im having trouble displaying the 10 most common word pairs. im sure it is just a matter of sorting and taking the data but i am unsure on how to do this?
private static void generateOutput()
{
for(Entry e : result.entrySet())
{
System.out.println("Symbol: " + e.getKey());
Map<String, Integer> count = new HashMap<String,Integer>();
List<String> words = (List)e.getValue();
for(String s : words)
{
if(!count.containsKey(s))
{
count.put(s, 1);
}
else
{
count.put(s, count.get(s)+1);
}
}
for (Entry f : count.entrySet())
{
System.out.println("\tfollowing symbol: " + f.getKey() + " : " + f.getValue());
}
}
System.out.println();
}
this is my output, but it displays everything. how do just sort this and display the top 10 most commonly used word pairs?