|
Methods defined here:
- __init__(self, n=2)
- Constructor.
- addNgram(self, ngram)
- Adds an ngram to the collection.
- deSerialize(self, filename='ngrams')
- Read ngram model from filename.
- frequencyProfile(self, increasing=True)
- Returns the frequency profile of the ngram items. If increasing is
set to True, the returned frequency profile will be increasing,
if it is set to False, the returned frequency profile is
decreasing.
- getLeastFrequent(self, ngram)
- Returns the least frequent ngram.
- getMostFrequent(self, ngram)
- Returns the most frequent ngram.
- getNgramFrequency(self, ngram)
- Returns the absolute frequency of an ngram.
- getNgramRelativeFrequency(self, ngram)
- Returns the relative frequency of an ngram.
- getNumberTokens(self)
- Return number of tokens.
- getNumberTypes(self)
- return number of types.
- relativeFrequencyProfile(self, increasing=True)
- Returns the relative frequency profile of the ngram items. If increasing
is set to True, the returned profile will be increasing, if it is set to
False, it is decreasing.
- removeNgram(self, ngram)
- Removes one occurrence of an ngram from the collection by decreasing
its counter. If the counter equals 0 after decreasing, the ngram is
removed from the collection.
- serialize(self, filename='ngrams')
- Dump the ngram model to a file.
|