class documentation

Undocumented

Method __init__ Initialize this mapping based on keyword arguments, as follows:
Method decode_tag Undocumented
Method paras Undocumented
Method raw Undocumented
Method sents Undocumented
Method tagged_paras Undocumented
Method tagged_sents Undocumented
Method tagged_words Undocumented
Method textids In the pl196x corpus each category is stored in single file and thus both methods provide identical functionality. In order to accommodate finer granularity, a non-standard textids() method was implemented...
Method words Returns all of the words and punctuation symbols in the specified file that were in text nodes -- ie, tags are ignored. Like the xml() method, fileid can only specify one file.
Method xml Undocumented
Class Variable head_len Undocumented
Method _add_textids Undocumented
Method _init_textids Undocumented
Method _resolve Undocumented
Instance Variable _f2t Undocumented
Instance Variable _t2f Undocumented
Instance Variable _textids Undocumented

Inherited from CategorizedCorpusReader:

Method categories Return a list of the categories that are defined for this corpus, or for the file(s) if it is given.
Method fileids Return a list of file identifiers for the files that make up this corpus, or that make up the given category(s) if specified.
Method _add Undocumented
Method _init Undocumented
Instance Variable _c2f Undocumented
Instance Variable _delimiter Undocumented
Instance Variable _f2c Undocumented
Instance Variable _file Undocumented
Instance Variable _map Undocumented
Instance Variable _pattern Undocumented

Inherited from XMLCorpusReader (via CategorizedCorpusReader):

Instance Variable _wrap_etree Undocumented

Inherited from CorpusReader (via CategorizedCorpusReader, XMLCorpusReader):

Method __repr__ Undocumented
Method abspath Return the absolute path for the given file.
Method abspaths Return a list of the absolute paths for all fileids in this corpus; or for the given list of fileids, if specified.
Method citation Return the contents of the corpus citation.bib file, if it exists.
Method encoding Return the unicode encoding for the given corpus file, if known. If the encoding is unknown, or if the given file should be processed using byte strings (str), then return None.
Method ensure_loaded Load this corpus (if it has not already been loaded). This is used by LazyCorpusLoader as a simple method that can be used to make sure a corpus is loaded -- e.g., in case a user wants to do help(some_corpus).
Method license Return the contents of the corpus LICENSE file, if it exists.
Method open Return an open stream that can be used to read the given file. If the file's encoding is not None, then the stream will automatically decode the file's contents into unicode.
Method readme Return the contents of the corpus README file, if it exists.
Class Variable root Undocumented
Method _get_root Undocumented
Instance Variable _encoding The default unicode encoding for the fileids that make up this corpus. If encoding is None, then the file contents are processed using byte strings.
Instance Variable _fileids A list of the relative paths for the fileids that make up this corpus.
Instance Variable _root The root directory for this corpus.
Instance Variable _tagset Undocumented
def __init__(self, *args, **kwargs): (source)

Initialize this mapping based on keyword arguments, as follows:

  • cat_pattern: A regular expression pattern used to find the category for each file identifier. The pattern will be applied to each file identifier, and the first matching group will be used as the category label for that file.
  • cat_map: A dictionary, mapping from file identifiers to category labels.
  • cat_file: The name of a file that contains the mapping from file identifiers to categories. The argument cat_delimiter can be used to specify a delimiter.

The corresponding argument will be deleted from kwargs. If more than one argument is specified, an exception will be raised.

def decode_tag(self, tag): (source)

Undocumented

def paras(self, fileids=None, categories=None, textids=None): (source)

Undocumented

def raw(self, fileids=None, categories=None): (source)
def sents(self, fileids=None, categories=None, textids=None): (source)

Undocumented

def tagged_paras(self, fileids=None, categories=None, textids=None): (source)

Undocumented

def tagged_sents(self, fileids=None, categories=None, textids=None): (source)

Undocumented

def tagged_words(self, fileids=None, categories=None, textids=None): (source)

Undocumented

def textids(self, fileids=None, categories=None): (source)

In the pl196x corpus each category is stored in single file and thus both methods provide identical functionality. In order to accommodate finer granularity, a non-standard textids() method was implemented. All the main functions can be supplied with a list of required chunks---giving much more control to the user.

def words(self, fileids=None, categories=None, textids=None): (source)

Returns all of the words and punctuation symbols in the specified file that were in text nodes -- ie, tags are ignored. Like the xml() method, fileid can only specify one file.

Returns
list(str)the given file's text nodes as a list of words and punctuation symbols
def xml(self, fileids=None, categories=None): (source)
head_len: int = (source)

Undocumented

def _add_textids(self, file_id, text_id): (source)

Undocumented

def _init_textids(self): (source)

Undocumented

def _resolve(self, fileids, categories, textids=None): (source)

Undocumented

Undocumented

Undocumented

_textids = (source)

Undocumented