class ProjectiveDependencyParser(object): (source)
Constructor: ProjectiveDependencyParser(dependency_grammar)
A projective, rule-based, dependency parser. A ProjectiveDependencyParser is created with a DependencyGrammar, a set of productions specifying word-to-word dependency relations. The parse() method will then return the set of all parses, in tree representation, for a given input sequence of tokens. Each parse must meet the requirements of the both the grammar and the projectivity constraint which specifies that the branches of the dependency tree are not allowed to cross. Alternatively, this can be understood as stating that each parent node and its children in the parse tree form a continuous substring of the input sequence.
Method | __init__ |
Create a new ProjectiveDependencyParser, from a word-to-word dependency grammar DependencyGrammar. |
Method | concatenate |
Concatenates the two spans in whichever way possible. This includes rightward concatenation (from the leftmost word of the leftmost span to the rightmost word of the rightmost span) and leftward concatenation (vice-versa) between adjacent spans... |
Method | parse |
Performs a projective dependency parse on the list of tokens using a chart-based, span-concatenation algorithm similar to Eisner (1996). |
Instance Variable | _grammar |
Undocumented |
Instance Variable | _tokens |
Undocumented |
Create a new ProjectiveDependencyParser, from a word-to-word dependency grammar DependencyGrammar.
Parameters | |
dependency | A word-to-word relation dependencygrammar. |
Concatenates the two spans in whichever way possible. This includes rightward concatenation (from the leftmost word of the leftmost span to the rightmost word of the rightmost span) and leftward concatenation (vice-versa) between adjacent spans. Unlike Eisner's presentation of span concatenation, these spans do not share or pivot on a particular word/word-index.
Returns | |
list(DependencySpan) | A list of new spans formed through concatenation. |