nltk.data.
load
(resource_url, format='auto', cache=True, verbose=False, logic_parser=None, fstruct_reader=None, encoding=None)[source]¶Load a given resource from the NLTK data package. The following resource formats are currently supported:
pickle
json
yaml
cfg
(context free grammars)pcfg
(probabilistic CFGs)fcfg
(feature-based CFGs)fol
(formulas of First Order Logic)logic
(Logical formulas to be parsed by the given logic_parser)val
(valuation of First Order Logic model)text
(the file contents as a unicode string)raw
(the raw file contents as a byte string)
If no format is specified, load()
will attempt to determine a
format based on the resource name’s file extension. If that
fails, load()
will raise a ValueError
exception.
For all text formats (everything except pickle
, json
, yaml
and raw
),
it tries to decode the raw contents using UTF-8, and if that doesn’t
work, it tries with ISO-8859-1 (Latin-1), unless the encoding
is specified.
Parameters: |
|
---|