在使用pynlpir和用户自定义词典进行分词时,如果报出如下错误:

    [2017-12-09 18:05:51] Cannot Save user dictionary
Cannot write log file /usr/local/lib/python2.7/dist-packages/pynlpir/Data/20171209.err!
[2017-12-09 18:05:51] /usr/local/lib/python2.7/dist-packages/pynlpir/Data/FieldDict.pos
Cannot write log file /usr/local/lib/python2.7/dist-packages/pynlpir/Data/20171209.err!
...

一般是因为权限不够高,需要到pynlpir的相应目录下对相关文件进行提权限操作,如:

    d0main@d0main-dell:/usr/local/lib/python2.7/dist-packages/pynlpir/Data$ sudo chmod 777 FieldDict.pdat
d0main@d0main-dell:/usr/local/lib/python2.7/dist-packages/pynlpir/Data$ sudo chmod 777 UserDefinedDict.lst
d0main@d0main-dell:/usr/local/lib/python2.7/dist-packages/pynlpir/Data$ sudo chmod 777 FieldDict.pos
04-16 03:36