parsing - Stanford Parser: how to extract dependencies? -
My job may be to find a query in a sentence (maybe Example: You get the typed dependencies: It may seem easy, but by now, I have not found any method to remove the dependence of a specific type, and I want to end my work. A really need it. Any You can get dependency by the following code: noun + verb ), Then remove the object.
"Coding is sometimes difficult task." My query will be:
"coding is" .
nsubj (task-6, coding -1) police (task-6, two-two) advmod (task-6 , Sometimes -3) My program should remove the NSUbase Dependency, identify
"coding" as as a query and
"work" To save it
tree tree = sentence.seat (tree annotation.class); // Obtain Dependency Tree TreeBangLanguageTLP = New PennTreebankLanguagePack (); Grammatical structure Edit GSF = TLP. GrammaticalStructureFactory (); Grammatical Structure GS = GSF Negmatic structure (tree); Collections & lt; TypedDependency & gt; Td = gs.typedDependenciesCollapsed (); Println (TD); Object [] list = td.toArray (); Println (list.length); Dependency typed dependency typed; (Object object: list) {typedDependency = (TypedDependency) object; System.out.println ("Deppency name" typedDependency.dep (). NodeString () + "::" + "node" + typed dependency .reln ()); ("Some")) {// your code} .
Comments
Post a Comment