tsroten / pynlpir

A Python wrapper around the NLPIR/ICTCLAS Chinese segmentation software.
MIT License
566 stars 135 forks source link

An INIT Error in PyNLPIR #5

Closed aRe00t closed 10 years ago

aRe00t commented 10 years ago

It will throw an exception from init.py when import pynlpir. Line 76: raise RuntimeError("NLPIR function 'NLPIR_Init' failed.")

The problem seems due to the NLPIR library which the package wraps. I have viewed the offical notice of nlpir, the author said the license of version 20140324 is expired, the new version will soon release, and non-commercial user could get a temporary license of three months before the new release. (the author's mail: kevinzhang@bit.edu.cn)

The notice is in the 8th floor of this thread: http://www.bigdatabbs.com/forum.php?mod=redirect&goto=findpost&ptid=5331&pid=13882

tsroten commented 10 years ago

@GeiliCode is correct. Until a new NLPIR release is published, users will have to obtain license keys on their own. Kevin Zhang, NLPIR's maintainer, says that non-commercial users can email him and ask for a 3-month temporary license.

Once you have a license, you will need to use PyNLPIR's ctypesinterface. Call the function pynlpir.nlpir.Init to initialize NLPIR with your license code.

I won't be packaging a license code with PyNLPIR, so this issue won't be fixed. However, I'll leave this issue open until a new NLPIR release is packaged with PyNLPIR.

tsroten commented 10 years ago

The pynlpir.open function will be getting a license code argument for situations like this. See #6.

aRe00t commented 10 years ago

I have found an temporary solution. Change the current library to the version 20131219, license of this version has not yet expired. url: https://github.com/haobibo/ICTCLAS_Python_Warpper/blob/master/Patch_20131219.zip

tsroten commented 10 years ago

@GeiliCode I've run the tests using the 20131919 version. It works fine with one exception: NLPIR's GetKeyWordsfunction doesn't seem to work. I can't get it to return anything but an empty string.

I'll still push this update, as it at least fixes the essential segmenting functions. But, I'll add a release note warning about NLPIR's GetKeyWords (and, by relation, PyNLPIR's get_key_words function). I'll release it later tonight.

tsroten commented 10 years ago

This commit was just published in v0.1.3 on PyPi. Thanks @GeiliCode for your help!

aRe00t commented 10 years ago

: ) You are welcome, it's my pleasure.

tsroten commented 9 years ago

The new version of NLPIR fixes the problems with PyNLPIR's get_key_words function. This fix has been pushed to the develop branch and will be released on PyPI later this weekend.