热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用NER_sklearn.ipynbCRF实现,出现的问题

Traceback(mostrecentcalllast):FileD:\software\Anaconda3\envs\NER\lib\site-packages\IPytho



Traceback (most recent call last):
File "D:\software\Anaconda3\envs\NER\lib\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py', wdir='D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner')
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py", line 342, in
rs.fit(X_train, y_train)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn\utils\validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn\model_selection\_search.py", line 765, in fit
base_estimator = clone(self.estimator)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn\utils\validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn\base.py", line 74, in clone
new_object_params = estimator.get_params(deep=False)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn\base.py", line 195, in get_params
value = getattr(self, key)
AttributeError: 'CRF' object has no attribute 'keep_tempfiles'

好像是python 3.7不支持,尝试改成3.6.4

Please note and check the following:
* The Python version is: Python3.6 from "D:\software\Anaconda3\envs\NER\python.exe"
* The NumPy version is: "1.19.4"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'

然后又要改numpy为 1.16.0

Traceback (most recent call last):
File "D:\software\Anaconda3\envs\NER\lib\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py', wdir='D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner')
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py", line 6, in
import pandas as pd
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\pandas\__init__.py", line 38, in
) from e
ImportError: C extension: No module named 'pandas._libs.interval' not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inp

然后又要重装pandas

File "C:\Users\lee\AppData\Roaming\Python\Python36\site-packages\sklearn\base.py", line 21, in
from .utils import _IS_32BIT
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "C:\Users\lee\AppData\Roaming\Python\Python36\site-packages\sklearn\utils\__init__.py", line 20, in
from scipy.sparse import issparse
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\scipy\__init__.py", line 151, in
from scipy._lib._ccallback import LowLevelCallable
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\scipy\_lib\_ccallback.py", line 1, in
from . import _ccallback_c
ImportError: cannot import name '_ccallback_c'

然后又要重装scipy
pip uninstall scipy
pip install scipy

Traceback (most recent call last):
File "D:\software\Anaconda3\envs\NER\lib\site-packages\IPython\core\interactiveshell.py", line 3418, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in
runfile('D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py', wdir='D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner')
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "D:/Users/lee/Downloads/Compressed/ailearning-master/ailearning-master/ner/test.py", line 164, in
import sklearn_crfsuite
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn_crfsuite\__init__.py", line 2, in
from .estimator import CRF
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\sklearn_crfsuite\estimator.py", line 6, in
import pycrfsuite
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
File "D:\software\Anaconda3\envs\NER\lib\site-packages\pycrfsuite\__init__.py", line 2, in
from ._pycrfsuite import *
File "D:\software\PyCharm Community Edition 2019.1.1\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
module = self._system_import(name, *args, **kwargs)
ModuleNotFoundError: No module named 'pycrfsuite._pycrfsuite'

然后又要重装
pip uninstall python-crfsuite
pip install python-crfsuite

Top negative:
-1.003934 O word.lower():democrats
-1.014938 O +1:word.lower():military
-1.016890 O -1:word.lower():emirates
-1.038674 B-gpe +1:postag:NN
-1.123186 O -1:word.lower():extremist
-1.128056 O +1:word.lower():was
-1.143572 B-geo -1:word.lower():with
-1.177887 B-geo word[-2:]:ma
-1.181155 I-per +1:postag[:2]:NN
-1.186787 B-gpe word[-3:]:can
-1.201166 I-tim word.istitle()
-1.257182 I-per bias
-1.273856 O word.isupper()
-1.285654 O word[-2:]:sh
-1.294274 O postag:NNPS
-1.301724 B-art -1:word.istitle()
-1.361519 O word[-3:]:ish
-1.374149 B-org -1:postag:NNP
-1.447830 B-gpe -1:word.istitle()
-1.568004 O postag[:2]:NN
-1.660512 O word[-2:]:an
-1.685406 B-gpe word[-3:]:ean
-1.899461 B-gpe -1:word.lower():from
-1.909397 B-geo -1:postag[:2]:NN
-1.954756 B-per -1:postag:NNP
-2.099129 B-gpe word.lower():european
-2.361597 B-gpe -1:word.lower():in
-3.268760 O word.isdigit()
-4.204295 O word.istitle()
-5.503867 O postag:NNP

成功运行!



推荐阅读
  • 使用Ubuntu中的Python获取浏览器历史记录原文: ... [详细]
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • YOLOv7基于自己的数据集从零构建模型完整训练、推理计算超详细教程
    本文介绍了关于人工智能、神经网络和深度学习的知识点,并提供了YOLOv7基于自己的数据集从零构建模型完整训练、推理计算的详细教程。文章还提到了郑州最低生活保障的话题。对于从事目标检测任务的人来说,YOLO是一个熟悉的模型。文章还提到了yolov4和yolov6的相关内容,以及选择模型的优化思路。 ... [详细]
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Commit1ced2a7433ea8937a1b260ea65d708f32ca7c95eintroduceda+Clonetraitboundtom ... [详细]
  • 开发笔记:加密&json&StringIO模块&BytesIO模块
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了加密&json&StringIO模块&BytesIO模块相关的知识,希望对你有一定的参考价值。一、加密加密 ... [详细]
  • 目录实现效果:实现环境实现方法一:基本思路主要代码JavaScript代码总结方法二主要代码总结方法三基本思路主要代码JavaScriptHTML总结实 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • ZSI.generate.Wsdl2PythonError: unsupported local simpleType restriction ... [详细]
  • 计算机存储系统的层次结构及其优势
    本文介绍了计算机存储系统的层次结构,包括高速缓存、主存储器和辅助存储器三个层次。通过分层存储数据可以提高程序的执行效率。计算机存储系统的层次结构将各种不同存储容量、存取速度和价格的存储器有机组合成整体,形成可寻址存储空间比主存储器空间大得多的存储整体。由于辅助存储器容量大、价格低,使得整体存储系统的平均价格降低。同时,高速缓存的存取速度可以和CPU的工作速度相匹配,进一步提高程序执行效率。 ... [详细]
  • 本文详细介绍了Spring的JdbcTemplate的使用方法,包括执行存储过程、存储函数的call()方法,执行任何SQL语句的execute()方法,单个更新和批量更新的update()和batchUpdate()方法,以及单查和列表查询的query()和queryForXXX()方法。提供了经过测试的API供使用。 ... [详细]
  • 本文介绍了在使用Python中的aiohttp模块模拟服务器时出现的连接失败问题,并提供了相应的解决方法。文章中详细说明了出错的代码以及相关的软件版本和环境信息,同时也提到了相关的警告信息和函数的替代方案。通过阅读本文,读者可以了解到如何解决Python连接服务器失败的问题,并对aiohttp模块有更深入的了解。 ... [详细]
  • imx6ull开发板驱动MT7601U无线网卡的方法和步骤详解
    本文详细介绍了在imx6ull开发板上驱动MT7601U无线网卡的方法和步骤。首先介绍了开发环境和硬件平台,然后说明了MT7601U驱动已经集成在linux内核的linux-4.x.x/drivers/net/wireless/mediatek/mt7601u文件中。接着介绍了移植mt7601u驱动的过程,包括编译内核和配置设备驱动。最后,列举了关键词和相关信息供读者参考。 ... [详细]
  • 本文介绍了Android 7的学习笔记总结,包括最新的移动架构视频、大厂安卓面试真题和项目实战源码讲义。同时还分享了开源的完整内容,并提醒读者在使用FileProvider适配时要注意不同模块的AndroidManfiest.xml中配置的xml文件名必须不同,否则会出现问题。 ... [详细]
author-avatar
林白LS
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有