def wordsplit(s): '返回一个由 分割开的自符' str='' #print s ictclas.import_dict('./user.txt') ictclas.ict_init("./") li = ictclas.process_str_ret_list(s) for i in li: #print i.start, i.length, i.word_id, s[i.start:(i.start+i.length)] # print s[i.start:(i.start+i.length)],hash(s[i.start:(i.start+i.length)]) str=str+s[i.start:(i.start+i.length)]+' ' ictclas.ict_exit() return str
def filesplit(f,n,tag): ictclas.import_dict('./user.txt') ictclas.ict_init("./") li=ictclas.process_file(f,n,tag) ictclas.ict_exit()