# For each word in a corpus, find how many senses it has according to WordNet [closed]

I've come across this exercise in my studies and I do not know how to challenge, I've tried to follow examples though I can never find anything online that truly is symmetrical to what I'm trying to achieve.

`For each word occurring in the Reuters corpus, write code to find how many senses it has according to WordNet. Print a list of the 10 most frequently occurring words with 2 senses.`

If anyone could point me in the right direction of where to start!

I just hate even flipping the page if I haven't fully understood the entirety of it.

## closed as too broad by curiousdannii, lemontree♦Dec 7 '18 at 19:11

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• This question is too broad: we can't answer without knowing what it is that you don't understand. Your use of the words challenge and symmetrical doesn't make any sense to me (I can guess what you mean, but only from the context) so I wonder if you're having difficult understanding some of the basic words in the specification of the exercise. – Colin Fine Dec 6 '18 at 17:18
• Wordnet has interfaces in many programming languages. Find the library for your chosen programming language, and for each word, just find out how many meanings it has in Wordnet. – prash Dec 6 '18 at 22:05

Given your tags, I assume you're using the `nltk` library?

First you'll want the Reuters and Wordnet corpora:

``````from nltk.corpus import reuters, wordnet
``````

Then, get your words from the Reuters corpus however you like: you probably don't want the entirety of `reuters.words()`, so you should narrow it down by field, file, dataset, etc.

Then, find how many senses each one has.

``````def count_senses(word):
return len(wordnet.synsets(word))
``````