Package nltk_lite :: Package contrib :: Package mit :: Package six863 :: Package parse :: Class AbstractParse
[hide private]
[frames] | no frames]

Class AbstractParse

source code

object --+    
         |    
    ParseI --+
             |
            AbstractParse

An abstract base class for parsers. AbstractParse provides a default implementation for:

Note that subclasses must override either get_parse or get_parse_list (or both), to avoid infinite recursion.

Instance Methods [hide private]
 
__init__(self)
Construct a new parser.
source code
 
parse(self, sentence)
Derive a parse tree that represents the structure of the given sentences words, and return a Tree.
source code
 
grammar(self) source code
Tree
get_parse(self, tokens)
Returns: A parse tree that represents the structure of the sentence.
source code
list of Tree
get_parse_list(self, tokens)
Returns: A list of the parse trees for the sentence.
source code
 
batch_test(self, filename) source code

Inherited from ParseI: get_parse_dict, get_parse_probs

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Construct a new parser.

Overrides: object.__init__

parse(self, sentence)

source code 

Derive a parse tree that represents the structure of the given sentences words, and return a Tree. If no parse is found, then output None. If multiple parses are found, then output the best parse.

The parsed trees derive a structure for the subtokens, but do not modify them. In particular, the leaves of the subtree should be equal to the list of subtokens.

Overrides: ParseI.parse
(inherited documentation)

get_parse(self, tokens)

source code 
Returns: Tree
A parse tree that represents the structure of the sentence. If no parse is found, then return None.
Overrides: ParseI.get_parse
(inherited documentation)

get_parse_list(self, tokens)

source code 
Returns: list of Tree
A list of the parse trees for the sentence. When possible, this list should be sorted from most likely to least likely.
Overrides: ParseI.get_parse_list
(inherited documentation)