Package nltk_lite :: Package contrib :: Package mit :: Package six863 :: Package semantics :: Class ParseI
[hide private]
[frames] | no frames]

Class ParseI

source code

object --+
         |
        ParseI
Known Subclasses:
AbstractParse

A processing class for deriving trees that represent possible structures for a sequence of tokens. These tree structures are known as parses. Typically, parsers are used to derive syntax trees for sentences. But parsers can also be used to derive other kinds of tree structure, such as morphological trees and discourse structures.

Instance Methods [hide private]
 
parse(self, sent)
Derive a parse tree that represents the structure of the given sentences words, and return a Tree.
source code
Tree
get_parse(self, sent)
Returns: A parse tree that represents the structure of the sentence.
source code
list of Tree
get_parse_list(self, sent)
Returns: A list of the parse trees for the sentence.
source code
ProbDistI
get_parse_probs(self, sent)
Returns: A probability distribution over the parse trees for the sentence.
source code
dict
get_parse_dict(self, sent)
Returns: A dictionary mapping from the parse trees for the sentence to numeric scores.
source code

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

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

parse(self, sent)

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.

Parameters:
  • sent (list of string) - The sentence to be parsed

get_parse(self, sent)

source code 
Parameters:
  • sent (list of string) - The sentence to be parsed
Returns: Tree
A parse tree that represents the structure of the sentence. If no parse is found, then return None.

get_parse_list(self, sent)

source code 
Parameters:
  • sent (list of string) - The sentence to be parsed
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.

get_parse_probs(self, sent)

source code 
Parameters:
  • sent (list of string) - The sentence to be parsed
Returns: ProbDistI
A probability distribution over the parse trees for the sentence.

get_parse_dict(self, sent)

source code 
Parameters:
  • sent (list of string) - The sentence to be parsed
Returns: dict
A dictionary mapping from the parse trees for the sentence to numeric scores.