2

I've trained a POS tagger and neural dependency parser with Stanford corenlp. I can get them to work via command line, and now would like to access them via a server.

However, the documentation for the server doesn't say anything about using custom models. I checked the code and didn't find any obvious way of supplying a configuration file.

Any idea how to do this? I don't need all annotators, just the ones I trained.

erickrf
  • 2,069
  • 5
  • 21
  • 44

1 Answers1

3

Yes, the server should (in theory) support all the functionality of the regular pipeline. The properties GET parameter is translated into the Properties object you would normally pass into StanfordCoreNLP. Therefore, if you'd like the server to load a custom model, you can just call it via, e.g.:

wget \
  --post-data 'the quick brown fox jumped over the lazy dog' \
  'localhost:9000/?properties={"parse.model": "/path/to/model/on/server/computer", "annotators": "tokenize,ssplit,pos", "outputFormat": "json"}' -O -

Note that the server won't garbage-collect this model afterwards though, so if you load too many models there's a good chance you'll run into out-of-memory errors...

Gabor Angeli
  • 5,729
  • 1
  • 18
  • 29
  • Thanks! I got it to work. I noticed the first request you make to the server will load each annotator's model and you can't change that later without restarting the server. – erickrf Jan 15 '16 at 01:58
  • The server certainly loads the models the first time it's called, but it should also re-load new models if the properties ask for them... If it doesn't then this is a bug. – Gabor Angeli Jan 15 '16 at 02:03
  • I am newbie on Stanford NER. I have couple of questions. What is difference between Stanford NER and Stanford Core NLP. If i trained one model using Stanford NER, how can i run that classifier with Stanford Core NLP? – yasirnazir Aug 11 '16 at 17:22
  • How to circumvent the Garbage 'No' Collection ? – Suvarna Pattayil Sep 17 '18 at 14:06