tsroten / pynlpir

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

ctypes.ArgumentError: and Init can't work #131

Open balcony021 opened 4 years ago

balcony021 commented 4 years ago

.

import pynlpir pynlpir.nlpir.Init(nlpir.PACKAGE_DIR, nlpir.UTF8_CODE, None) Traceback (most recent call last): File "<pyshell#1>", line 1, in pynlpir.nlpir.Init(nlpir.PACKAGE_DIR, nlpir.UTF8_CODE, None) NameError: name 'nlpir' is not defined from pynlpir import nlpir pynlpir.nlpir.Init(nlpir.PACKAGE_DIR, nlpir.UTF8_CODE, None) Traceback (most recent call last): File "<pyshell#3>", line 1, in pynlpir.nlpir.Init(nlpir.PACKAGE_DIR, nlpir.UTF8_CODE, None) ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type

sometimes in insert a "b" before "str", it works. Like this:

pynlpir.nlpir.FileProcess(b"D://result.txt",b"D://result_out.txt",False) 2842.843614972174 but ,sometimes, it failed, just like these:

pynlpir.nlpir.GetFileKeyWords(b"D://result.txt",50, False) b'\xe5\xae\xb6\xe9\x95\xbf#\xe5\xad\xa9\xe5\xad\x90#\xe6\x95\x99\xe8\x82\xb2#\xe6\x95\x99\xe5\xb8\x88#\xe5\xb0\x8f\xe5\xad\xa6#\xe5\x84\xbf\xe7\xab\xa5#\xe6\x88\x90\xe9\x95\xbf#\xe8\x80\x81\xe5\xb8\x88#\xe5\xad\xa6\xe4\xb9\xa0#\xe4\xba\xb2\xe5\xad\x90#\xe5\xae\xb6\xe5\xba\xad\xe6\x95\x99\xe8\x82\xb2#\xe6\x8c\x87\xe5\xaf\xbc#\xe5\xae\xb6\xe9\x95\xbf\xe5\xad\xa6\xe6\xa0\xa1#\xe5\xb9\xbc\xe5\x84\xbf#\xe5\xbf\x83\xe7\x90\x86#\xe7\x88\xb6\xe6\xaf\x8d#\xe5\xb9\xbc\xe5\x84\xbf\xe5\x9b\xad#\xe5\xad\xa6\xe7\x94\x9f#\xe7\xb3\xbb\xe5\x88\x97#\xe5\xad\xa6\xe7\x94\x9f\xe5\xae\xb6\xe9\x95\xbf#\xe5\xad\xa6\xe6\xa0\xa1#\xe5\xae\xb6\xe9\x95\xbf\xe6\x8c\x87\xe5\xaf\xbc#\xe6\x95\x85\xe4\xba\x8b#\xe6\xb2\x9f\xe9\x80\x9a#\xe5\xae\xb6\xe5\xba\xad#\xe6\x95\xb0\xe5\xad\xa6#\xe6\x95\x99\xe6\x9d\x90#\xe5\x9f\xb9\xe5\x85\xbb#\xe5\xae\xb6\xe9\x95\xbf\xe6\x89\x8b\xe5\x86\x8c#\xe9\x9d\x92\xe6\x98\xa5\xe6\x9c\x9f#\xe4\xb8\xad\xe5\x9b\xbd\xe5\xae\xb6\xe9\x95\xbf#\xe8\xaf\xad\xe6\x96\x87#\xe6\x89\x8b\xe5\x86\x8c#\xe5\xae\xb6\xe6\x95\x99#\xe5\x88\x9d\xe4\xb8\xad\xe7\x94\x9f\xe5\xae\xb6\xe9\x95\xbf#\xe6\x95\x99\xe5\xad\x90#\xe5\xae\xb6\xe9\x95\xbf\xe5\xbf\x85\xe8\xaf\xbb#\xe5\xae\x9d\xe5\xae\x9d#\xe6\x8c\x87\xe5\x8d\x97#\xe9\xab\x98\xe4\xb8\xad\xe7\x94\x9f\xe5\xae\xb6\xe9\x95\xbf#\xe4\xb8\x9b\xe4\xb9\xa6#\xe9\x98\x85\xe8\xaf\xbb#\xe8\xbe\x85\xe5\xaf\xbc#\xe5\xae\xb6\xe9\x95\xbf\xe8\xbe\x85\xe5\xaf\xbc#\xe9\x97\xae\xe9\xa2\x98#\xe5\xb9\xb4\xe7\xba\xa7#\xe5\xb9\xbc\xe5\x84\xbf\xe5\x9b\xad\xe5\xae\xb6\xe9\x95\xbf\xe5\xb7\xa5\xe4\xbd\x9c#\xe4\xb8\xad\xe5\x9b\xbd#\xe5\x8d\xa1\xe5\xa7\x86#\xe8\x82\xb2\xe5\x84\xbf#'

when i try nlpir.*, it will appear. but Ini (just like above), failed. python 3.75, pip install, win10 OS, or win7, the same result.