class documentation

A tool for the finding and ranking of trigram collocations or other association measures. It is often useful to use from_words() rather than constructing an instance directly.

Class Method from_words Construct a TrigramCollocationFinder for all trigrams in the given sequence.
Method __init__ Construct a TrigramCollocationFinder, given FreqDists for appearances of words, bigrams, two words with any word between them, and trigrams.
Method bigram_finder Constructs a bigram collocation finder with the bigram and unigram data from this finder. Note that this does not include any filtering applied to this finder.
Method score_ngram Returns the score for a given trigram using the given scoring function.
Class Variable default_ws Undocumented
Instance Variable bigram_fd Undocumented
Instance Variable wildcard_fd Undocumented

Inherited from AbstractCollocationFinder:

Class Method from_documents Constructs a collocation finder given a collection of documents, each of which is a list (or iterable) of tokens.
Method above_score Returns a sequence of ngrams, ordered by decreasing score, whose scores each exceed the given minimum score.
Method apply_freq_filter Removes candidate ngrams which have frequency less than min_freq.
Method apply_ngram_filter Removes candidate ngrams (w1, w2, ...) where fn(w1, w2, ...) evaluates to True.
Method apply_word_filter Removes candidate ngrams (w1, w2, ...) where any of (fn(w1), fn(w2), ...) evaluates to True.
Method nbest Returns the top n ngrams when scored by the given function.
Method score_ngrams Returns a sequence of (ngram, score) pairs ordered from highest to lowest score, as determined by the scoring function provided.
Instance Variable N Undocumented
Instance Variable ngram_fd Undocumented
Instance Variable word_fd Undocumented
Class Method _build_new_documents Pad the document with the place holder according to the window_size
Static Method _ngram_freqdist Undocumented
Method _apply_filter Generic filter removes ngrams from the frequency distribution if the function returns True when passed an ngram tuple.
Method _score_ngrams Generates of (ngram, score) pairs as determined by the scoring function provided.
@classmethod
def from_words(cls, words, window_size=3): (source)

Construct a TrigramCollocationFinder for all trigrams in the given sequence.

def __init__(self, word_fd, bigram_fd, wildcard_fd, trigram_fd): (source)

Construct a TrigramCollocationFinder, given FreqDists for appearances of words, bigrams, two words with any word between them, and trigrams.

def bigram_finder(self): (source)

Constructs a bigram collocation finder with the bigram and unigram data from this finder. Note that this does not include any filtering applied to this finder.

def score_ngram(self, score_fn, w1, w2, w3): (source)

Returns the score for a given trigram using the given scoring function.

default_ws: int = (source)

Undocumented

bigram_fd = (source)

Undocumented

wildcard_fd = (source)

Undocumented