decomp.semantics.predpatt

Module for converting PredPatt objects to networkx digraphs

class decomp.semantics.predpatt.PredPattCorpus(graphs_raw)

Container for predpatt graphs

classmethod from_conll(corpus, name='ewt', options=None)

Load a CoNLL dependency corpus and apply predpatt

Parameters
  • corpus (Union[str, TextIO]) – (path to) a .conllu file

  • name (str) – the name of the corpus; used in constructing treeids

  • options (Optional[PredPattOpts]) – options for predpatt extraction

Return type

PredPattCorpus

class decomp.semantics.predpatt.PredPattGraphBuilder

A predpatt graph builder

classmethod from_predpatt(predpatt, depgraph, graphid='')

Build a DiGraph from a PredPatt object and another DiGraph

Parameters
  • predpatt (PredPatt) – the predpatt extraction for the dependency parse

  • depgraph (DiGraph) – the dependency graph

  • graphid (str) – the tree indentifier; will be a prefix of all node identifiers

Return type

DiGraph