Search code examples
stanford-nlp

CoreNLP SemanticGraph - search for edges with specific lemmas


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...


Solution

  • 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).