在nltk中调用stanfordparser处理中文

出现unicode decode error

解决办法是修改nltk包internals.py的java()下增加cmd的参数,cmd = ["-Dfile.encoding=UTF-8"] + cmd,(https://github.com/nltk/nltk/issues/929)

另外需要注意unicode和str的区别。

原文地址:https://www.cnblogs.com/gui0901/p/4660633.html