Package nltk :: Package parse :: Module dependencygraph
[hide private]
[frames] | no frames]

Module dependencygraph

source code

Tools for reading and writing dependency trees. The input is assumed to be in Malt-TAB format.

Currently only reads the first tree in a file.

Classes [hide private]
DependencyGraph
A container for the nodes and labelled edges of a dependency structure.
Functions [hide private]
XDigraph
nx_graph(self)
Convert the data in a nodelist into a networkx labeled directed graph.
source code
 
demo() source code
 
malt_demo(nx=False)
A demonstration of the result of reading a dependency version of the first sentence of the Penn Treebank.
source code
 
conll_demo()
A demonstration of how to read a string representation of a CoNLL format dependency tree.
source code
 
conll_file_demo() source code
 
cycle_finding_demo() source code
Variables [hide private]
  treebank_data = 'Pierre NNP 2 NMOD\nVinken NNP ...
  conll_data1 = '\n1 Ze ze Pron ...
  conll_data2 = '1 Cathy Cathy N N...
Variables Details [hide private]

treebank_data

Value:
'''Pierre  NNP     2       NMOD
Vinken  NNP     8       SUB
,       ,       2       P
61      CD      5       NMOD
years   NNS     6       AMOD
old     JJ      2       NMOD
,       ,       2       P
will    MD      0       ROOT
...

conll_data1

Value:
'''
1   Ze                ze                Pron  Pron  per|3|evofmv|nom  \
               2   su      _  _
2   had               heb               V     V     trans|ovt|1of2of3|\
ev             0   ROOT    _  _
3   met               met               Prep  Prep  voor              \
               8   mod     _  _
4   haar              haar              Pron  Pron  bez|3|ev|neut|attr\
...

conll_data2

Value:
'''1   Cathy             Cathy             N     N     eigen|ev|neut  \
                  2   su      _  _
2   zag               zie               V     V     trans|ovt|1of2of3|\
ev             0   ROOT    _  _
3   hen               hen               Pron  Pron  per|3|mv|datofacc \
               2   obj1    _  _
4   wild              wild              Adj   Adj   attr|stell|onverv \
               5   mod     _  _
...