DependencyTrees.jl is a Julia package for working with dependency structures in natural language sentences. It provides a representation of dependency parse trees (DependencyTree
), a treebank reader, and transition-based parsing algorithms.
The DependencyTree
type represents a dependency parse of a natural language sentence.
julia> using DependencyTrees
julia> treebank = Treebank("test/data/english.conllu")
julia> for tree in treebank
# ...
end
julia> tree = first(treebank)
┌──────────────────── ROOT
│ ┌─► Pierre
│ ┌─►┌──┌──┌──└── Vinken
│ │ │ │ └────► ,
│ │ │ │ ┌─► 61
│ │ │ │ ┌─►└── years
│ │ │ └─►└───── old
│ │ └──────────► ,
└─►┌──└───────────┌── will
│ ┌─────┌──┌──└─► join
│ │ │ │ ┌─► the
│ │ │ └─►└── board
│ │ ┌──└───────► as
│ │ │ ┌────► a
│ │ │ │ ┌─► nonexecutive
│ │ └────►└──└── director
│ └──────────►┌── Nov.
│ └─► 29
└────────────────► .
A number of transition systems and oracles are implemented in the TransitionParsing
submodule.
julia> using DependencyTrees
julia> using DependencyTrees.TransitionParsing
julia> treebank = Treebank("test/data/english.conll")
julia> oracle = Oracle(ArcHybrid(), dymanic_oracle)
julia> for tree in treebank, (config, gold ts) in oracle(tree)
# ...
end
Transition systems:
ArcStandard
(static oracle)ArcEager
[1],[2] (static and dynamic oracles)ArcHybrid
[3],[4] (static and dynamic oracles)ArcSwift
[5] (static oracle)ListBasedNonProjective
[2] (static oracle)
See the documentation for details.
]add DependencyTrees
Open an issue! Bug reports, feature requests, etc. are all welcome.
[1]: Nivre 2003: An efficient algorithm for projective dependency parsing. http://stp.lingfil.uu.se/~nivre/docs/iwpt03.pdf
[2]: Nivre 2008: Algorithms for Deterministic Incremental Dependency Parsing. https://www.aclweb.org/anthology/J/J08/J08-4003.pdf
[3]: Kuhlmann et all 2011: Dynamic programming algorithms for transition-based dependency parsers. https://www.aclweb.org/anthology/P/P11/P11-1068.pdf
[4]: Goldberg & Nivre 2013: Training deterministic parsers with non-deterministic oracles. https://aclweb.org/anthology/Q/Q13/Q13-1033.pdf
[5]: Qi & Manning 2016: Arc-swift: a novel transition system for dependency parsing. https://nlp.stanford.edu/pubs/qi2017arcswift.pdf