问题
I'm using Stanford CoreNLP's dependency parser, and wondering how to make a generic search for SemanticEdge(s) with specific head lemma, dependent lemma, and lexical relationship. For example, if I have an actual dependency like this:
- dobj(discover-4, insights-6)
How do I search for it using lemmas instead of the literal word and the index? Basically I want to be able to pattern match the parts of the dependency graph using generic rules...
回答1:
You could do this with semgrex
. See http://nlp.stanford.edu/software/tregex.shtml. Though you could also do it manually. Make sure that the nodes are storing lemmas -- see the lemma
annotator of CoreNLP (currently available for English, only).
来源:https://stackoverflow.com/questions/25326451/corenlp-semanticgraph-search-for-edges-with-specific-lemmas