class AlpinoCorpusReader(BracketParseCorpusReader): (source)
Constructor: AlpinoCorpusReader(root, encoding, tagset)
Reader for the Alpino Dutch Treebank. This corpus has a lexical breakdown structure embedded, as read by _parse Unfortunately this puts punctuation and some other words out of the sentence order in the xml element tree. This is no good for tag_ and word_ _tag and _word will be overridden to use a non-default new parameter 'ordered' to the overridden _normalize function. The _parse function can then remain untouched.
Method | __init__ |
No summary |
Method | _normalize |
Normalize the xml sentence element in t. The sentence elements <alpino_ds>, although embedded in a few overall xml elements, are seperated by blank lines. That's how the reader can deliver them one at a time... |
Method | _tag |
Undocumented |
Method | _word |
Return a correctly ordered list if words |
Inherited from BracketParseCorpusReader
:
Method | _parse |
Undocumented |
Method | _read |
Undocumented |
Instance Variable | _comment |
Undocumented |
Instance Variable | _detect |
Undocumented |
Instance Variable | _tagset |
Undocumented |
Inherited from SyntaxCorpusReader
(via BracketParseCorpusReader
):
Method | parsed |
Undocumented |
Method | raw |
Undocumented |
Method | sents |
Undocumented |
Method | tagged |
Undocumented |
Method | tagged |
Undocumented |
Method | words |
Undocumented |
Method | _read |
Undocumented |
Method | _read |
Undocumented |
Method | _read |
Undocumented |
Method | _read |
Undocumented |
Method | _read |
Undocumented |
Inherited from CorpusReader
(via BracketParseCorpusReader
, SyntaxCorpusReader
):
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 |
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 |
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. |
Parameters | |
root | The root directory for this corpus. |
encoding | Undocumented |
tagset | The name of the tagset used by this corpus, to be used for normalizing or converting the POS tags returned by the tagged_...() methods. |
fileids | A list or regexp specifying the fileids in this corpus. |
comment | The character which can appear at the start of a line to indicate that the rest of the line is a comment. |
detect | The method that is used to find blocks in the corpus; can be 'unindented_paren' (every unindented parenthesis starts a new parse) or 'sexpr' (brackets are matched). |
Normalize the xml sentence element in t. The sentence elements <alpino_ds>, although embedded in a few overall xml elements, are seperated by blank lines. That's how the reader can deliver them one at a time. Each sentence has a few category subnodes that are of no use to us. The remaining word nodes may or may not appear in the proper order. Each word node has attributes, among which: - begin : the position of the word in the sentence - pos : Part of Speech: the Tag - word : the actual word The return value is a string with all xml elementes replaced by clauses: either a cat clause with nested clauses, or a word clause. The order of the bracket clauses closely follows the xml. If ordered == True, the word clauses include an order sequence number. If ordered == False, the word clauses only have pos and word parts.