Package nltk :: Package corpus :: Module util :: Class LazyCorpusLoader
[hide private]
[frames] | no frames]

type LazyCorpusLoader

source code

object --+
         |
        LazyCorpusLoader

A proxy object which is used to stand in for a corpus object before the corpus is loaded. This allows NLTK to create an object for each corpus, but defer the costs associated with loading those corpora until the first time that they're actually accessed.

The first time this object is accessed in any way, it will load the corresponding corpus, and transform itself into that corpus (by modifying its own __class__ and __dict__ attributes).

If the corpus can not be found, then accessing this object will raise an exception, displaying installation instructions for the NLTK data package. Once they've properly installed the data package (or modified nltk.data.path to point to its location), they can then use the corpus object without restarting python.

Instance Methods [hide private]
 
__init__(self, name, reader_cls, *args, **kwargs) source code
 
__load(self) source code
 
__getattr__(self, attr) source code
 
__repr__(self) source code
Method Details [hide private]

__init__(self, name, reader_cls, *args, **kwargs)
(Constructor)

source code 
Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 
Overrides: object.__repr__
(inherited documentation)