class documentation

Reader for corpora of word-aligned sentences. Tokens are assumed to be separated by whitespace. Sentences begin on separate lines.

Method __init__ Construct a new Aligned Corpus reader for a set of documents located at the given root directory. Example usage:
Method aligned_sents No summary
Method raw No summary
Method sents No summary
Method words No summary
Instance Variable _alignedsent_block_reader Undocumented
Instance Variable _sent_tokenizer Undocumented
Instance Variable _sep Undocumented
Instance Variable _word_tokenizer Undocumented

Inherited from CorpusReader:

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 fileids Return a list of file identifiers for the fileids that make up this 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, root, fileids, sep='/', word_tokenizer=WhitespaceTokenizer(), sent_tokenizer=RegexpTokenizer('\n', gaps=True), alignedsent_block_reader=read_alignedsent_block, encoding='latin1'): (source)

Construct a new Aligned Corpus reader for a set of documents located at the given root directory. Example usage:

>>> root = '/...path to corpus.../'
>>> reader = AlignedCorpusReader(root, '.*', '.txt') # doctest: +SKIP
Parameters
rootThe root directory for this corpus.
fileidsA list or regexp specifying the fileids in this corpus.
sepUndocumented
word_tokenizerUndocumented
sent_tokenizerUndocumented
alignedsent_block_readerUndocumented
encodingUndocumented
def aligned_sents(self, fileids=None): (source)
Returns
list(AlignedSent)the given file(s) as a list of AlignedSent objects.
def raw(self, fileids=None): (source)
Returns
strthe given file(s) as a single string.
def sents(self, fileids=None): (source)
Returns
list(list(str))the given file(s) as a list of sentences or utterances, each encoded as a list of word strings.
def words(self, fileids=None): (source)
Returns
list(str)the given file(s) as a list of words and punctuation symbols.
_alignedsent_block_reader = (source)

Undocumented

_sent_tokenizer = (source)

Undocumented

Undocumented

_word_tokenizer = (source)

Undocumented