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

Class 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)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__load(self) source code
 
__getattr__(self, attr) source code
 
__repr__(self)
repr(x)
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

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

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)