class NonprojectiveDependencyParser(object): (source)
Constructor: NonprojectiveDependencyParser(dependency_grammar)
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.
Method | __init__ |
Creates a new NonprojectiveDependencyParser. |
Method | parse |
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... |
Instance Variable | _grammar |
Undocumented |
Instance Variable | _graph |
Undocumented |
Creates a new NonprojectiveDependencyParser.
Parameters | |
dependency | a grammar of word-to-word relations. |
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: list(str) return: An iterator of non-projective parses. rtype: iter(DependencyGraph)