smoothnlp / SmoothNLP

专注于可解释的NLP技术 An NLP Toolset With A Focus on Explainable Inference
GNU General Public License v3.0
622 stars 113 forks source link

Questions on training and using corenlp-chinese-smoothnlp-0.1-with-dependencies.jar #3

Closed zegzag closed 5 years ago

zegzag commented 5 years ago

I've trained the corenlp-chinese-smoothnlp-0.1-with-dependencies.jar on a new corps ./sentiment_output_train_combined.txt, which sentiment category is 6. (terminal): java -mx8g -cp corenlp-chinese-smoothnlp-0.1-with-dependencies.jar edu.stanford.nlp.sentiment.SentimentTraining -numHid 20 -trainPath sentimen_output_train_combined.txt -train -model model.ser.gz -numClasses 6 -classNames "Very negative,Negative,Neutral,Positive,Very positive,Unknown" And I got the training model ./model.ser.gz But when I used it, it seemed that the result came from the original inner model but not the updated model, with means that the updated model didn't work. (terminal):java -jar corenlp-chinese-smoothnlp-0.1-with-dependencies.jar sentiment.model model.ser.gz When I use it in python notebook, the result seemed to be unchanged screenshot_20190304_135505 The sentimentDistribution of the test text on the new model is totally the same with "NLP_Utils/demo.ipynb, and its sentiment category is 5, but not 6.

zegzag commented 5 years ago

The model can be found in /nlp.creditx/ZhangZe

victorzhrn commented 5 years ago

Did you try:

wget --post-data '今天天气不错' 'localhost:9000/?properties={"annotators": "tokenize,sentiment", 
"sentiment.model":"/nlp.creditx/ZhangZe.model.ser.gz","outputFormat": "json","pipelineLanguage":"zh"}' -O -

I would most likely to recommend this way of specifying the model addr. The reason why the model file is not properly loaded might be: When I was making the maven project, I made changes to fileIO.class to specify the reading input streams from "resource" of the maven project, so that, unlikely official CoreNLP project, you do not need to download the main skeleton and the model files separately.

Please keep an eye on the maven project which I will hopefully update it in the next few days. It would show more details on how the jar is compiled and how you may adjust different file IO.

Thx

zegzag commented 5 years ago

Nice! It works with wget.