Running Stanford corenlp server with French models

我的未来我决定 提交于 2019-12-05 09:59:40

Ok, after a lot of readings and unsuccessful tries, I found a way to make it work (for v3.6.0). Here are the details, if they can be of any interest to someone else:

  1. Dowload the code and french models from http://stanfordnlp.github.io/CoreNLP/index.html#download. Unzip the code .zip and copy the french model .jar to that directory (do not remove the english models, they have different names anyway)

  2. cd to that directory and then run the server with:

    java -mx4g -cp "*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer
    

(it's a pity that the -prop flag doesn't help here)

  1. Call the API repeating the properties listed in the StanfordCoreNLP-french.properties:

    wget --header="Content-Type: text/plain; charset=UTF-8"
         --post-data 'Bonjour le monde.' 
         'localhost:9000/?properties={
           "annotators": "tokenize,ssplit,pos,parse", 
           "parse.model":"edu/stanford/nlp/models/lexparser/frenchFactored.ser.gz", 
           "pos.model":"edu/stanford/nlp/models/pos-tagger/french/french.tagger", 
           "tokenize.language":"fr", 
           "outputFormat": "json"}' 
      -O -
    

    which finally gives a 200 response using the French models!

(NB: don't know how to make it work with the UI (same for utf-8 support))

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!