How to get frequency of words in text depends of they part of speech?
<p>I can easy get most common words by:</p>

<pre><code>stopwords = set(nltk.corpus.stopwords.words('english'))    
tagged_words = nltk.word_tokenize(text)
tagged_words = nltk.pos_tag(tagged_words)

# Remove single-character tokens (mostly punctuation)
tagged_words = [tagged_word for tagged_word in tagged_words if len(tagged_word[0]) &gt; 1]

# Remove numbers
tagged_words = [tagged_word for tagged_word in tagged_words if not tagged_word[0].isnumeric()]

# Remove stopwords
if remove_stopwords:
    tagged_words = [tagged_word for tagged_word in tagged_words if tagged_word[0] not in stopwords]

# Dark magic
lemmatizer = nltk.stem.WordNetLemmatizer()
words = []
for tagged_word in tagged_words:
    pos = wordnet_pos_code(tagged_word[1])
    # Ignoring all words, except nouns, verbs, adjectives and adverbs
    if pos is not None:
        words.append({'word':lemmatizer.lemmatize(tagged_word[0], pos=pos), 'pos':tagged_word[1]})

# Calculate frequency distribution
fdist = nltk.FreqDist(words)

# Return top % words_count % words
res = []
for word, frequency in fdist.most_common(words_count):
    word_dict = {}
    word_dict['word'] = word
    word_dict['count'] = frequency
    res.append(word_dict)
return res
</code></pre>

<p>But i got some words like 'Brown' as person name and 'brown' as color and they are not same. Okay, i can check them by capital letter. But if i get something like:</p>

<blockquote>
  <p>Brown is not just a color. Brown is part of lifestyle. And Mr Brown should agree with me.</p>
</blockquote>

<p>So, nltk does part-of-speech analysis pretty good. But how can i get most common words depends on part-of-speech?</p>