crownpku / Information-Extraction-Chinese

Chinese Named Entity Recognition with IDCNN/biLSTM+CRF, and Relation Extraction with biGRU+2ATT 中文实体识别与关系提取
2.22k stars 814 forks source link

'ascii' codec error #12

Open wangyingshuai opened 6 years ago

wangyingshuai commented 6 years ago

when I run python3 main.py --train=True --clean=True --model_type=idcnn in my GPU,the error is: Traceback (most recent call last): File "main.py", line 10, in from model import Model File "/root/wangys/NLP/Information-Extraction-Chinese-master/NER_IDCNN_CRF/model.py", line 8, in from NER_IDCNN_CRF.utils import result_to_json ImportError: No module named 'NER_IDCNN_CRF'

wangyingshuai commented 6 years ago

when I run main.py ,the error is :+1: Traceback (most recent call last): File "main.py", line 228, in tf.app.run(main) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 222, in main train() File "main.py", line 188, in train best = evaluate(sess, model, "dev", dev_manager, id_to_tag, logger) File "main.py", line 88, in evaluate eval_lines = test_ner(ner_results, FLAGS.result_path) File "/root/wangys/NLP/Information-Extraction-Chinese-master/NER_IDCNN_CRF/utils.py", line 65, in test_ner f.writelines(to_write) UnicodeEncodeError: 'ascii' codec can't encode character '\uff08' in position 0: ordinal not in range(128)

wangyingshuai commented 6 years ago

I solved this problem,when open file ,add encoding="utf8" ,in order to ensure open and write file are all use utf8 encoding.

jinxianxian commented 5 years ago

I solved this problem,when open file ,add encoding="utf8" ,in order to ensure open and write file are all use utf8 encoding.

why not work again