nltk study

  • 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):

    • """A tool for the findingand ranking of bigram collocations or other association measures. It is oftenuseful to use from_words() rather than constructing an instance directly."""

  • class TrigramCollocationFinder(AbstractCollocationFinder):

    • """A tool for the findingand ranking of trigram collocations or other association measures. It is oftenuseful to use from_words() rather than constructing an instance directly."""

  • 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):

      • """General purpose decorator factory: takes acaller function as input and returns a decorator with the same attributes.A caller function is any function likethis::

    • 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)

(0)

相关推荐