As described in the documentation, you need to implement the Annotator interface, with a constructor taking parameters MyAnnotator(String, java.util.Properties)
, and then in the properties file you pass into CoreNLP, set a parameter
customAnnotatorClass.NAME=CLASS
For example:
customAnnotatorClass.myann=com.domain.package.MyAnnotator
Then, you can pass properties into the annotator by defining properties:
myann.myprop=myvalue
myann.otherprop=othervalue
These will show up in the Properties
object passed into the constructor of the Annotator you created.
A good example of a small Annotator that can be used as a template for what a custom annotator should look like could be the Gender annotator.