I have been trying to use Stanford Parser in my Java program to parse some sentences in Chinese. Since I am quite new at both Java and Stanford Parser, I used the \'ParseDem
The problem is that the GrammaticalStructureFactory is constructed from a PennTreebankLanguagePack
, which is for the English Penn Treebank. You need to use (in two places)
TreebankLanguagePack tlp = new ChineseTreebankLanguagePack();
and to import this appropriately
import edu.stanford.nlp.trees.international.pennchinese.ChineseTreebankLanguagePack;
But we also generally recommend using the factored parser for Chinese (since it works considerably better, unlike for English, although at the cost of more memory and time usage)
LexicalizedParser lp = LexicalizedParser.loadModel("edu/stanford/nlp/models/lexparser/chineseFactored.ser.gz");