Search code examples
stanford-nlp

How to create custom relations using KBPAnnotator?


Is it possible to somehow define and use custom rule patterns for KBPAnnotator? If I not wrong the annotator reads rules from files located by the following path edu/stanford/nlp/models/kbp/tokensregex and these rule types are hardcoded in the RelationType interface.


Solution

  • Unfortunately, this is not as easy as it is with many of the other CoreNLP components. The KBP relation annotator evolved primarily as a way to share Stanford's system for the TAC-KBP slot filling shared task, and is therefore very much tuned to that task.

    You can likely adapt the Tokensregex part of the classifier to use your own pattern definitions, but this is not yet supported out-of-the-box.