Package nltk :: Package parse :: Module nonprojectivedependencyparser :: Class NonprojectiveDependencyParser
[hide private]
[frames] | no frames]

type NonprojectiveDependencyParser

source code

object --+
         |
        NonprojectiveDependencyParser

A non-projective, rule-based, dependency parser. This parser will return the set of all possible non-projective parses based on the word-to-word relations defined in the parser's dependency grammar, and will allow the branches of the parse tree to cross in order to capture a variety of linguistic phenomena that a projective parser will not.

Instance Methods [hide private]
 
__init__(self, dependency_grammar)
Creates a new NonprojectiveDependencyParser.
source code
 
parse(self, tokens)
Parses the input tokens with respect to the parser's grammar.
source code
Method Details [hide private]

__init__(self, dependency_grammar)
(Constructor)

source code 

Creates a new NonprojectiveDependencyParser.

Parameters:
  • dependency_grammar - a grammar of word-to-word relations.
  • depenedncy_grammar (DependencyGrammar)
Overrides: object.__init__

parse(self, tokens)

source code 

Parses the input tokens with respect to the parser's grammar. Parsing is accomplished by representing the search-space of possible parses as a fully-connected directed graph. Arcs that would lead to ungrammatical parses are removed and a lattice is constructed of length n, where n is the number of input tokens, to represent all possible grammatical traversals. All possible paths through the lattice are then enumerated to produce the set of non-projective parses.

param tokens: A list of tokens to parse. type tokens: A list of String. return: A set of non-projective parses. rtype: A list of DependencyGraph