Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
public List<Dependency> GetDependency(Tree tree)
var tlp = new PennTreebankLanguagePack();
var gsf = tlp.grammaticalStructureFactory();
var gs = gsf.newGrammaticalStructure(tree);
var dependencies = gs.typedDependenciesCollapsedTree();
return (from TypedDependency dependency in dependencies.toArray()
select new Dependency
Dependent = dependency.dep().value().Replace("\\/", "/"),
Governor ="\\/", "/"),
Name = dependency.reln().getShortName()
public struct Dependency
public string Governor;
public string Dependent;
public string Name;
Copy link

hi sergey-tihon..I want help from you to regarding above code. I want to extract governor and dependent from perticular tag. for ex. nsubj(good-4, phone-5). then extract what is at the position governor and what is at dependent i can do this? n I am taking this list of dependency from text file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment