Reader for chunked (and optionally tagged) corpora. Paragraphs are
split using a block reader. They are then tokenized into sentences using
a sentence tokenizer. Finally, these sentences are parsed into chunk
trees using a string-to-chunktree conversion function. Each of these
steps can be performed using a default function or a custom function. By
default, paragraphs are split on blank lines; sentences are listed one
per line; and sentences are parsed into chunk trees using nltk.chunk.tagstr2tree.
|
|
__init__(self,
root,
fileids,
extension='',
str2chunktree=<function tagstr2tree at 0x18a6530>,
sent_tokenizer=RegexpTokenizer(pattern='\n', gaps=True, discard_empty=True, f...,
para_block_reader=<function read_blankline_block at 0x132be70>,
encoding=None) |
source code
|
|
str
|
raw(self,
fileids=None)
Returns:
the given file(s) as a single string. |
source code
|
|
list of str
|
words(self,
fileids=None)
Returns:
the given file(s) as a list of words and punctuation symbols. |
source code
|
|
list of (list of str)
|
sents(self,
fileids=None)
Returns:
the given file(s) as a list of sentences or utterances, each encoded
as a list of word strings. |
source code
|
|
list of (list of (list of
str))
|
paras(self,
fileids=None)
Returns:
the given file(s) as a list of paragraphs, each encoded as a list of
sentences, which are in turn encoded as lists of word strings. |
source code
|
|
list of (str,str)
|
tagged_words(self,
fileids=None)
Returns:
the given file(s) as a list of tagged words and punctuation symbols,
encoded as tuples (word,tag). |
source code
|
|
list of (list of (str,str))
|
tagged_sents(self,
fileids=None)
Returns:
the given file(s) as a list of sentences, each encoded as a list of
(word,tag) tuples. |
source code
|
|
list of (list of (list of
(str,str)))
|
tagged_paras(self,
fileids=None)
Returns:
the given file(s) as a list of paragraphs, each encoded as a list of
sentences, which are in turn encoded as lists of
(word,tag) tuples. |
source code
|
|
list of ((str,str) and Tree)
|
|
list of Tree
|
chunked_sents(self,
fileids=None)
Returns:
the given file(s) as a list of sentences, each encoded as a shallow
Tree. |
source code
|
|
list of (list of Tree)
|
chunked_paras(self,
fileids=None)
Returns:
the given file(s) as a list of paragraphs, each encoded as a list of
sentences, which are in turn encoded as a shallow Tree. |
source code
|
|
|
|
|
|
Inherited from api.CorpusReader:
__repr__,
abspath,
abspaths,
encoding,
fileids,
open,
readme
|
|
Inherited from api.CorpusReader:
files
|
|
Inherited from api.CorpusReader:
items
|