.tokens
list of a DiscourseDocumentGraph (or any of its subclasses)
In [1]:
%matplotlib inline
# install the gvmagic extension by uncommenting/running it once:
# %install_ext https://raw.github.com/cjdrake/ipython-magic/master/gvmagic.py
%load_ext gvmagic
import os
import discoursegraphs as dg
In [2]:
CORPUS_DIR = os.path.expanduser('~/corpora/potsdam-commentary-corpus-2.0.0/')
In [3]:
rstgraph = dg.read_rs3(os.path.join(CORPUS_DIR, 'rst', 'maz-1423.rs3'))
rstgraph_untokenized = dg.read_rs3(os.path.join(CORPUS_DIR, 'rst', 'maz-1423.rs3'), tokenize=False)
In [4]:
%dotstr dg.print_dot(rstgraph_untokenized)
In [5]:
dg.info(rstgraph_untokenized)
In [17]:
dg.util.plot_attribute_distribution(rstgraph, rstgraph.edges(), 'rst:rel_name')
In [9]:
cdg = dg.read_conano(os.path.join(CORPUS_DIR, 'connectors', 'maz-1423.xml'))
cdg_untokenized = dg.read_conano(os.path.join(CORPUS_DIR, 'connectors', 'maz-1423.xml'), tokenize=False)
In [10]:
%dotstr dg.print_dot(cdg_untokenized)
In [11]:
%dotstr dg.print_dot(cdg)
In [12]:
mdg = dg.read_mmax2(os.path.join(CORPUS_DIR, 'coreference', 'maz-1423.mmax'))
In [13]:
%dotstr dg.print_dot(mdg)
In [14]:
tdg = dg.read_tiger(os.path.join(CORPUS_DIR, 'syntax', 'maz-1423.xml'))
%dotstr dg.print_dot(tdg)
In [15]:
merged_graph = dg.DiscourseDocumentGraph()
merged_graph.merge_graphs(rstgraph)
merged_graph.merge_graphs(cdg)
merged_graph.merge_graphs(mdg)
merged_graph.merge_graphs(tdg)
In [16]:
%dotstr dg.print_dot(merged_graph)
Beautiful, isn't it?
In [ ]: