class documentation
class BigramCollocationFinder(AbstractCollocationFinder): (source)
Constructor: BigramCollocationFinder(word_fd, bigram_fd, window_size)
A tool for the finding and ranking of bigram collocations or other association measures. It is often useful to use from_words() rather than constructing an instance directly.
Class Method | from |
Construct a BigramCollocationFinder for all bigrams in the given sequence. When window_size > 2, count non-contiguous bigrams, in the style of Church and Hanks's (1990) association ratio. |
Method | __init__ |
Construct a BigramCollocationFinder, given FreqDists for appearances of words and (possibly non-contiguous) bigrams. |
Method | score |
Returns the score for a given bigram using the given scoring function. Following Church and Hanks (1990), counts are scaled by a factor of 1/(window_size - 1). |
Class Variable | default |
Undocumented |
Instance Variable | window |
Undocumented |
Inherited from AbstractCollocationFinder
:
Class Method | from |
Constructs a collocation finder given a collection of documents, each of which is a list (or iterable) of tokens. |
Method | above |
Returns a sequence of ngrams, ordered by decreasing score, whose scores each exceed the given minimum score. |
Method | apply |
Removes candidate ngrams which have frequency less than min_freq. |
Method | apply |
Removes candidate ngrams (w1, w2, ...) where fn(w1, w2, ...) evaluates to True. |
Method | apply |
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 |
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 |
Undocumented |
Instance Variable | word |
Undocumented |
Class Method | _build |
Pad the document with the place holder according to the window_size |
Static Method | _ngram |
Undocumented |
Method | _apply |
Generic filter removes ngrams from the frequency distribution if the function returns True when passed an ngram tuple. |
Method | _score |
Generates of (ngram, score) pairs as determined by the scoring function provided. |
Construct a BigramCollocationFinder for all bigrams in the given sequence. When window_size > 2, count non-contiguous bigrams, in the style of Church and Hanks's (1990) association ratio.
Construct a BigramCollocationFinder, given FreqDists for appearances of words and (possibly non-contiguous) bigrams.