stanfordnlp / python-stanford-corenlp

Python interface to CoreNLP using a bidirectional server-client interface.
MIT License
516 stars 105 forks source link

Dear,sir I need some help to deal with how to use Chinese model #11

Closed AmazingDD closed 5 years ago

AmazingDD commented 6 years ago

Dear,sir I need some help to deal with how to use Chinese model. I just change client.py

star_cmd a="java -Xmx{memory}g -cp "{javanlp}/*" edu.stanford.nlp.pipeline.StanfordCoreNLPServer -serverProperties StanfordCoreNLP-chinese.properties -port {port} -timeout {timeout}".

But I found it unwork when I run it on a Chinse word. It still use English Parser. I might need some help.

AmazingDD commented 6 years ago

By a way,it get a perfect result in English model.

tigerninjaman commented 6 years ago

Hi, did you ever figure this out? I am also interested.

arunchaganty commented 5 years ago

Apologies this comes in so late, but you can use a Chinese model by specifying the language in the properties, see https://stanfordnlp.github.io/CoreNLP/human-languages.html for more documentation. Here's a possible example:

CHINESE_PROPERTIES = {
"tokenize.language": "zh",
"segment.model": "edu/stanford/nlp/models/segmenter/chinese/ctb.gz",
"segment.sighanCorporaDict": "edu/stanford/nlp/models/segmenter/chinese",
"segment.serDictionary": "edu/stanford/nlp/models/segmenter/chinese/dict-chris6.ser.gz",
"segment.sighanPostProcessing": "true",
"ssplit.boundaryTokenRegex": "[.。]|[!?!?]+",
"pos.model": "edu/stanford/nlp/models/pos-tagger/chinese-distsim/chinese-distsim.tagger"
}

client = CoreNLPClient(default_properties=CHINESE_PROPERTIES)