Generating stanford semantic graph with nodes storing lemma -
i trying generate semanticgraph , use semgrex find specific node. use lemma 1 of node attribute in semgrex. saw relevant question , answer here:
corenlp semanticgraph - search edges specific lemmas
it mentioned that
make sure nodes storing lemmas -- see lemma annotator of corenlp (currently available english, only).
i current can use pipeline generate desired annotation generate semantic graph.
properties props = new properties(); props.put("annotators", "tokenize, ssplit, pos, lemma, parse"); stanfordcorenlp pipeline = new stanfordcorenlp(props);
however, after searching relevant information, find deprecated function @ here:
public static semanticgraph generatedependencies(tree tree, boolean collapse, boolean ccprocess, boolean includeextras, boolean lemmatize, boolean threadsafe) { semanticgraph deps = semanticgraphfactory.makefromtree(tree, collapse, ccprocess, includeextras, lemmatize, threadsafe); return deps; }
which seemed removed newest corenlp.
could give hint on how generate semantic graph nodes storing lemmas?
the function have should work. lemmas stored in semanticgraph
produced parse
annotator. can retrieve graph after running text through pipeline.annotate(annotation)
with:
sentence.get(semanticgraphcoreannotations.basicdependenciesannotation.class)
or, equivalent collapsed , collapsedccprocessed dependencies. see http://www-nlp.stanford.edu/nlp/javadoc/javanlp/edu/stanford/nlp/semgraph/semanticgraphcoreannotations.html. note these attached sentence (coremap), not document (annotation).
you can run semgrex on graph usual; e.g., {lemma:/foo/} >arctype {lemma:/bar/}
.
Comments
Post a Comment