[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 706
  • Last Modified:

Top 10 most used words in a text document

How do I get the top 10 most used words in a text document ?
Any examples out their ?
0
u2envy1
Asked:
u2envy1
  • 2
2 Solutions
 
angus_young_acdcCommented:
One way would be to read each word in the document, and add it to a list.  Then do a count of how many times each word appears.
0
 
u2envy1Author Commented:
How will I do the count ? Then do a count of how many times each word appears.
If I have a list List<string> myList = new List<String>();
How do I count ?
myList.Add("The");
myList.Add("lazy");
myList.Add("Brown");
myList.Add("Fox");
myList.Add("was");
myList.Add("too");
myList.Add("lazy");
myList.Add("to");
myList.Add("jump");
myList.Add("over");
myList.Add("the");
myList.Add("brown");
myList.Add("dog");

0
 
Gautham JanardhanCommented:
u can use the grioup by function available for the list to group by the words and then check the count
0
 
u2envy1Author Commented:
Thx
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now