0

I need to create and add a new annotator for analysing text in Stanford CoreNLP. There are solution to add a new annotator. I can't find how to create a new annotator?

I need to create a neww annotator for Newsfeed source names in Stanford CoreNLP annotator list.

Any help is appreciated.

Tariq
  • 2,274
  • 4
  • 24
  • 40

1 Answers1

0

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.

Gabor Angeli
  • 5,729
  • 1
  • 18
  • 29