How to use Python to use stanford parser dealing with chinese sentence

814 Views Asked by At

I wanna use the interface of python to deal with some chinese sentences,as I haven't had any accuantance witn Java. Here's the problem.It seems that the interface given by the offical website can just be used on English sentences.I try to modify the code in parser.py but I meet lots of difficults. So,I wanna know if any of you had met such problem as I do and can give me some ideas about how to cope with it ? Thanks alot .

1

There are 1 best solutions below

0
On

You should be able to use NLTK's StanfordParser interface. See an intro to using the parser from NLTK in this other SO answer.

Just provide the Chinese model instead to the StanfordParser init method:

# ... set up parser JAR paths here ...
parser = stanford.StanfordParser(model_path="edu/stanford/nlp/models/lexparser/chinesePCFG.ser.gz")
# ... parse things ...