class AbstractCollocationFinder(object): """An abstract base class for collocationfinders whose purpose is to collect collocation candidate frequencies, filterand rank them. As a minimum, collocation finders requirethe frequencies of each word in a corpus, and the joint frequency of word tuples.This data should be provided through nltk.probability.FreqDist objects or an identicalinterface."""
class BigramCollocationFinder(AbstractCollocationFinder): class TrigramCollocationFinder(AbstractCollocationFinder): class QuadgramCollocationFinder(AbstractCollocationFinder): """A tool for the findingand ranking of quadgram collocations or other association measures. It is oftenuseful to use from_words() rather than constructing an instance directly.""" def decorator(caller): def new_wrapper(wrapper, model): """An improvement overfunctools.update_wrapper. The wrapper is a generic callable object. It works bygenerating a copy of the wrapper with the right signature and by updating thecopy, not the original. Moreovoer, 'model' can be a dictionary withkeys 'name', 'doc', 'module', 'dict', 'defaults'."""
def getinfo(func): """Returns an info dictionary containing: - name (the name of the function : str) - argnames (the names of the arguments :list) - defaults (the values of the defaultarguments : tuple) - signature (the signature : str) - fullsignature (the full signature :Signature) - doc (the docstring : str) - module (the module name : str) - dict (the function __dict__ : str)
|