github:https://github.com/stephen-v/zh-NER-keras
运行步骤:
1.首先要安装GIT
2.安装 keras-contrib:pip install git+https://www.github.com/keras-team/keras-contrib.git
3.运行,报错行:import bilsm_crf_model 错误类型:ImportError: cannot import name normalize_data_format
4.运行又报错:错误类型:AttributeError: ‘CRF’ object has no attribute ‘_inbound_nodes’
方法:将keras版本改至2.1.4
5.继续报错:'Tensor' object has no attribute 'assign'
方法:把process_data.py文件中的
if platform.system() == 'Windows':
split_text = '\r\n'
else:
split_text = '\n'
改为
if platform.system() == 'Windows':
split_text = '\n'
else:
split_text = '\r\n'
成功运行!
代码详解:
代码错误:(配置问题,配置好了不会错)
word_counts = Counter(row[0].lower() for sample in train for row in sample)
改为
train = train[0][0]
word_counts = Counter(train)