MCPcopy
hub / github.com/ddbourgin/numpy-ml / most_common

Method most_common

numpy_ml/preprocessing/nlp.py:1097–1099  ·  view source on GitHub ↗

Return the top `n` most common tokens in the corpus

(self, n=5)

Source from the content-addressed store, hash-verified

1095 return self._tokens.shape
1096
1097 def most_common(self, n=5):
1098 """Return the top `n` most common tokens in the corpus"""
1099 return self.counts.most_common()[:n]
1100
1101 def words_with_count(self, k):
1102 """Return all tokens that occur `k` times in the corpus"""

Callers 1

predictMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected