Giter Club home page Giter Club logo

coconlp's Introduction

This is a Chinese nlp package, which can extract information from texts.

pypiv Thanks

It is developed for a public welfare program, a weibo robot @寻人微博.

installation

It works well on macOS Mojave with python=3.6.

pip install cocoNLP

Directly from the repository

git clone https://github.com/fighting41love/cocoNLP.git
cd cocoNLP
python setup.py install

Quick start

Extract basic information from texts

>>> from cocoNLP.extractor import extractor

>>> ex = extractor()

>>> text = '急寻特朗普,男孩,于2018年11月27号11时在陕西省安康市汉滨区走失。丢失发型短发,...如有线索,请迅速与警方联系:18100065143,132-6156-2938,[email protected] 和yangyangfuture at gmail dot com'

# 抽取邮箱
>>> emails = ex.extract_email(text)
>>> print(emails)

['[email protected]', '[email protected]']
# 抽取手机号
>>> cellphones = ex.extract_cellphone(text,nation='CHN')
>>> print(cellphones)

['18100065143', '13261562938']
# 抽取身份证号
>>> ids = ex.extract_ids(text)
>>> print(ids)

['410105196904010537']
# 抽取手机归属地、运营商
>>> cell_locs = [ex.extract_cellphone_location(cell,'CHN') for cell in cellphones]
>>> print(cell_locs)

cellphone_location [{'phone': '18100065143', 'province': '上海', 'city': '上海', 'zip_code': '200000', 'area_code': '021', 'phone_type': '电信'}]
# 抽取地址信息
>>> locations = ex.extract_locations(text)
>>> print(locations)
['陕西省安康市汉滨区', '安康市汉滨区', '汉滨区']
# 抽取时间点
>>> times = ex.extract_time(text)
>>> print(times)
time {"type": "timestamp", "timestamp": "2018-11-27 11:00:00"}
# 抽取人名
>>> name = ex.extract_name(text)
>>> print(name)
特朗普

Extract phrases from texts

>>> from cocoNLP.config.phrase import rake

>>> r = rake.Rake()

>>> # Extraction given the list of strings where each string is a sentence.
>>> r.extract_keywords_from_sentences(['2015年5月11日,“奶茶妹妹”章泽天分别起诉北京搜狐互联网信息服务有限公司、华某(25岁)名誉权纠纷及成某(38岁)名誉权纠纷二案,要求被诉人公开赔礼道歉、恢复名誉、删除相关视频、断开转载该视频的链接,赔偿经济损失、精神损害抚慰金共计170万元。北京市海淀法院已经受理了这两起案件。原告章泽天诉称,她被许多网友称为“奶茶妹妹”,在网络上获得相当的关注度。2014年4月18日,北京搜狐互联网信息服务有限公司的“搜狐视频娱乐播报调查”节目制作并发布了名为“奶茶妹妹恋情或为炒作,百万炒作团队浮出水面”的视频,该段视频捏造包括“奶茶妹妹走红,实为幕后商业策划”、“100万,奶茶妹妹花巨资,请人策划走红”、“奶茶妹妹在清华大学挂科、作弊、想方设法地转学院”等等。华某在上述节目中捏造了大量的对原告的虚假言论,包括声称其就是原告聘请的“幕后推手和炒作专家”,原告曾花100万聘请其为之宣传策划,原告与刘强东的恋情系两者合作的结果等等。
'],2,4)

>>> # To get keyword phrases ranked highest to lowest.
>>> ranked_words = r.get_ranked_phrases()

>>> # To get keyword phrases ranked highest to lowest with scores.
>>> ranked_words_score = r.get_ranked_phrases_with_scores()

>>> for ele in ranked_words_score:
>>>     print(ele)

(16.0, '要求 被诉人 公开 赔礼道歉')
(15.0, '上述 节目 中 捏造')
(14.5, '该段 视频 捏造 包括')
(14.0, '实为 幕后 商业 策划')
(14.0, '奶茶 妹妹 花 巨资')
(9.5, '删除 相关 视频')
(9.0, '请人 策划 走红')
(9.0, '网络 上 获得')
(9.0, '想方设法 地转 学院')
(9.0, '奶茶 妹妹 走红')
(9.0, '名誉权 纠纷 及成')
(9.0, '名誉权 纠纷 二案')
(8.5, '奶茶 妹妹 恋情')
(8.5, '原告 章泽天 诉称')
(6.0, '奶茶 妹妹')
(5.0, '节目 制作')
(5.0, '幕后 推手')
(5.0, '宣传 策划')

References

This is a python implementation of the algorithm as mentioned in paper Automatic keyword extraction from individual documents by Stuart Rose, Dave Engel, Nick Cramer and Wendy Cowley

coconlp's People

Contributors

fighting41love avatar hanabi1224 avatar rxy007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

coconlp's Issues

r = rake.Rake()


UnicodeDecodeError Traceback (most recent call last)
c:\Users\37633\Desktop\zhifa_nlp\punish_nlp.py in
----> 1 r = rake.Rake()

D:\anaconda\envs\py37\lib\site-packages\cocoNLP\config\phrase\rake.py in init(self, punctuations, ranking_metric, max_length, min_length)
53
54 # If stopwords not provided we use language stopwords by default.
---> 55 self.stopwords = self.load_stopwords()
56
57 # If punctuations are not provided we ignore all punctuation symbols.

D:\anaconda\envs\py37\lib\site-packages\cocoNLP\config\phrase\rake.py in load_stopwords(self, path)
81 """
82 with open(path) as f:
---> 83 stopwords = f.readlines()
84 stopwords_list = []
85 for word in stopwords:

UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 4: illegal multibyte sequence

错误

ex.extract_time("1993-02-08 11:58")
'{"type": "timestamp", "timestamp": "2019-10-30 23:58:00"}'

This is a chinese nlp extractor.

This is a Chinese nlp extractor. At present, this python package has only one function 'key phrase extraction'. We try to develop more functions to help NLPer and other developers to extract information from texts. The package is in development now. We will provide a formal version before June 2019.

安装成功,使用时提示hanlp-1.7.4-release.zip下载失败

Downloading https://github.com/hankcs/HanLP/releases/download/v1.7.4/hanlp-1.7.4-release.zip to C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp\static\hanlp-1.7.4-release.zip

0.45%, 0 MB, 3 KB/s, ETA 7 min 31 s
0.89%, 0 MB, 7 KB/s, ETA 3 min 51 s
1.34%, 0 MB, 6 KB/s, ETA 4 min 53 s
1.79%, 0 MB, 7 KB/s, ETA 3 min 41 s
2.23%, 0 MB, 5 KB/s, ETA 5 min 22 s
2.68%, 0 MB, 6 KB/s, ETA 4 min 33 s
3.13%, 0 MB, 5 KB/s, ETA 4 min 59 s
3.57%, 0 MB, 6 KB/s, ETA 4 min 25 s
4.02%, 0 MB, 4 KB/s, ETA 6 min 16 s
4.47%, 0 MB, 4 KB/s, ETA 5 min 46 sFailed to download https://github.com/hankcs/HanLP/releases/download/v1.7.4/hanlp-1.7.4-release.zip
Please refer to https://github.com/hankcs/pyhanlp for manually installation.
Traceback (most recent call last):
File "C:\Users\admin\Desktop\text-classification-cnn-rnn-master\predict.py", line 22, in
from cocoNLP.extractor import extractor
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\cocoNLP\extractor.py", line 6, in
from pyhanlp import *
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp_init_.py", line 122, in
start_jvm_for_hanlp()
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp_init
.py", line 39, in start_jvm_for_hanlp
from pyhanlp.static import STATIC_ROOT, hanlp_installed_data_version, HANLP_DATA_PATH
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp\static_init
.py", line 310, in
install_hanlp_jar()
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp\static_init_.py", line 200, in install_hanlp_jar
with zipfile.ZipFile(jar_zip, "r") as archive:
File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\zipfile.py", line 1113, in init
self.fp = io.open(file, filemode)
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\pyhanlp\static\hanlp-1.7.4-release.zip'

Could not reserve enough space for 2097152KB object heap

执行安装之后,开始运行
开始测试程序
第一句from cocoNLP.extractor import extractor
报错下面的错误
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap
全局设置java内存也没有,到底哪里错误了呢

提取语义式的时间会出错,貌似是与arrows兼容性的问题

时间只有在明确的时间不会出错,类似于“上周”这种表达就会触发错误

我调试了位于“cocoNLP\Lib\site-packages\cocoNLP\config\basic\time_nlp”下的TimeUnit.py,先是把arrows降级到0.15.0,然后把.replace替换成.replace``.shift,之后给getTime方法修改(分别加上s)
image

最后还是有错误
image
不知用的是哪一版本的arrows呢

pip install cocoNLP安装失败

我实在anaconda上安装的,windows和linux都试了,均失败
Collecting cocoNLP
Downloading https://files.pythonhosted.org/packages/6e/63/c4799852e34cc66a2f81e7604a14839de7a165403c3855d3b4edc191f558/cocoNLP-0.0.10.tar.gz (74kB)
100% |████████████████████████████████| 81kB 19kB/s

Complete output from command python setup.py egg_info:

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/arrow-0.13.0-py3.7.egg
Searching for regex
Reading https://pypi.org/simple/regex/
Downloading https://files.pythonhosted.org/packages/16/07/ee3e02770ed456a088b90da7c9b1e9aa227e3c956d37b845cef2aab93764/regex-2018.11.22.tar.gz#sha256=79a6a60ed1ee3b12eb0e828c01d75e3b743af6616d69add6c2fde1d425a4ba3f
Best match: regex 2018.11.22
Processing regex-2018.11.22.tar.gz
Writing /tmp/easy_install-h6r8nxmh/regex-2018.11.22/setup.cfg
Running regex-2018.11.22/setup.py -q bdist_egg --dist-dir /tmp/easy_install-h6r8nxmh/regex-2018.11.22/egg-dist-tmp-qpx_gk9a
regex_3/_regex.c: In function ‘fuzzy_match_group_fld’:
regex_3/_regex.c:11062:22: warning: ‘data.new_text_pos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!record_fuzzy(safe_state, data.fuzzy_type, data.new_text_pos -
                      ^
regex_3/_regex.c: In function ‘fuzzy_match_string_fld’:
regex_3/_regex.c:10852:22: warning: ‘data.new_text_pos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!record_fuzzy(safe_state, data.fuzzy_type, data.new_text_pos -
                      ^
In file included from /data/anaconda3/include/python3.7m/pytime.h:6:0,
                 from /data/anaconda3/include/python3.7m/Python.h:68,
                 from regex_3/_regex.c:46:
regex_3/_regex.c: In function ‘re_compile’:
/data/anaconda3/include/python3.7m/object.h:800:12: warning: ‘packed_code_list’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (_Py_DEC_REFTOTAL  _Py_REF_DEBUG_COMMA       \
            ^
regex_3/_regex.c:25175:15: note: ‘packed_code_list’ was declared here
     PyObject* packed_code_list;
               ^
regex_3/_regex.c: In function ‘basic_match’:
regex_3/_regex.c:11140:22: warning: ‘data.new_text_pos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!record_fuzzy(safe_state, data.fuzzy_type, data.new_text_pos -
                      ^
regex_3/_regex.c:11092:18: note: ‘data.new_text_pos’ was declared here
     RE_FuzzyData data;
                  ^
regex_3/_regex.c:10933:22: warning: ‘data.new_text_pos’ may be used uninitialized in this function [-Wmaybe-uninitialized]
     if (!record_fuzzy(safe_state, data.fuzzy_type, data.new_text_pos -
                      ^
regex_3/_regex.c:10880:18: note: ‘data.new_text_pos’ was declared here
     RE_FuzzyData data;
                  ^
zip_safe flag not set; analyzing archive contents...
__pycache__._regex.cpython-37: module references __file__
creating /tmp/pip-install-v9kles9o/cocoNLP/.eggs/regex-2018.11.22-py3.7-linux-x86_64.egg
Extracting regex-2018.11.22-py3.7-linux-x86_64.egg to /tmp/pip-install-v9kles9o/cocoNLP/.eggs

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/regex-2018.11.22-py3.7-linux-x86_64.egg
Searching for phonenumbers
Reading https://pypi.org/simple/phonenumbers/
Downloading https://files.pythonhosted.org/packages/d9/62/a176cfaf6edb90b68ae3426cf4fb8fd98189df550e2143cafc66bb2c1b82/phonenumbers-8.10.2-py2.py3-none-any.whl#sha256=e8e5cec198d7aad477867c23aa897525a4c112971d4b378cc8c49bb57b975d7a
Best match: phonenumbers 8.10.2
Processing phonenumbers-8.10.2-py2.py3-none-any.whl
Installing phonenumbers-8.10.2-py2.py3-none-any.whl to /tmp/pip-install-v9kles9o/cocoNLP/.eggs

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/phonenumbers-8.10.2-py3.7.egg
Searching for phone
Reading https://pypi.org/simple/phone/
Downloading https://files.pythonhosted.org/packages/bd/8f/0209b160730490c22c050a9ea7adbcace4a046327ba0845b329749765d0a/phone-0.4.2.tar.gz#sha256=47b66e3ffe655be8f41ec6e2b63a040cfbc6dcb111b9f8c7c1f604a47af7edee
Best match: phone 0.4.2
Processing phone-0.4.2.tar.gz
Writing /tmp/easy_install-405bt72v/phone-0.4.2/setup.cfg
Running phone-0.4.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-405bt72v/phone-0.4.2/egg-dist-tmp-dsior2xg
creating /tmp/pip-install-v9kles9o/cocoNLP/.eggs/phone-0.4.2-py3.7.egg
Extracting phone-0.4.2-py3.7.egg to /tmp/pip-install-v9kles9o/cocoNLP/.eggs

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/phone-0.4.2-py3.7.egg
Searching for pyhanlp
Reading https://pypi.org/simple/pyhanlp/
Downloading https://files.pythonhosted.org/packages/e9/a6/489ce6a74965bd7b170499d9f25947dd1887ef45e519ea5218382c5ab9d5/pyhanlp-0.1.44.tar.gz#sha256=42319069afd791fb41f84cff5402ee644fa6953b6697e01934ccf9f9ea69199f
Best match: pyhanlp 0.1.44
Processing pyhanlp-0.1.44.tar.gz
Writing /tmp/easy_install-pj_eufy6/pyhanlp-0.1.44/setup.cfg
Running pyhanlp-0.1.44/setup.py -q bdist_egg --dist-dir /tmp/easy_install-pj_eufy6/pyhanlp-0.1.44/egg-dist-tmp-5kivclqo
zip_safe flag not set; analyzing archive contents...
pyhanlp.__pycache__.__init__.cpython-37: module references __file__
pyhanlp.__pycache__.util.cpython-37: module references __file__
pyhanlp.static.__pycache__.__init__.cpython-37: module references __file__
creating /tmp/pip-install-v9kles9o/cocoNLP/.eggs/pyhanlp-0.1.44-py3.7.egg
Extracting pyhanlp-0.1.44-py3.7.egg to /tmp/pip-install-v9kles9o/cocoNLP/.eggs

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/pyhanlp-0.1.44-py3.7.egg
Searching for jieba
Reading https://pypi.org/simple/jieba/
Downloading https://files.pythonhosted.org/packages/71/46/c6f9179f73b818d5827202ad1c4a94e371a29473b7f043b736b4dab6b8cd/jieba-0.39.zip#sha256=de385e48582a4862e55a9167334d0fbe91d479026e5dac40e59e22c08b8e883e
Best match: jieba 0.39
Processing jieba-0.39.zip
Writing /tmp/easy_install-ot_p4fga/jieba-0.39/setup.cfg
Running jieba-0.39/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ot_p4fga/jieba-0.39/egg-dist-tmp-cn9zspze
zip_safe flag not set; analyzing archive contents...
jieba.__pycache__._compat.cpython-37: module references __file__
jieba.analyse.__pycache__.tfidf.cpython-37: module references __file__
creating /tmp/pip-install-v9kles9o/cocoNLP/.eggs/jieba-0.39-py3.7.egg
Extracting jieba-0.39-py3.7.egg to /tmp/pip-install-v9kles9o/cocoNLP/.eggs

Installed /tmp/pip-install-v9kles9o/cocoNLP/.eggs/jieba-0.39-py3.7.egg
Searching for jpype1
Reading https://pypi.org/simple/jpype1/
Downloading https://files.pythonhosted.org/packages/c4/4b/60a3e63d51714d4d7ef1b1efdf84315d118a0a80a5b085bb52a7e2428cdc/JPype1-0.6.3.tar.gz#sha256=6841523631874a731e1f94e1b1f130686ad3772030eaa3b6946256eeb1d10dd1
Best match: JPype1 0.6.3
Processing JPype1-0.6.3.tar.gz
Writing /tmp/easy_install-1_9moflx/JPype1-0.6.3/setup.cfg
Running JPype1-0.6.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-1_9moflx/JPype1-0.6.3/egg-dist-tmp-k3g99am3
warning: no previously-included files matching '*.pyc' found anywhere in distribution
no previously-included directories found matching 'test/classes'
gcc: error trying to exec 'cc1plus': execvp: No such file or directory
/tmp/easy_install-1_9moflx/JPype1-0.6.3/setup.py:173: FeatureNotice: Turned ON Numpy support for fast Java array access
  FeatureNotice)
Traceback (most recent call last):
  File "/data/anaconda3/lib/python3.7/distutils/unixccompiler.py", line 118, in _compile
    extra_postargs)
  File "/data/anaconda3/lib/python3.7/distutils/ccompiler.py", line 909, in spawn
    spawn(cmd, dry_run=self.dry_run)
  File "/data/anaconda3/lib/python3.7/distutils/spawn.py", line 36, in spawn
    _spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/data/anaconda3/lib/python3.7/distutils/spawn.py", line 159, in _spawn_posix
    % (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/data/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/data/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "/data/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/data/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/data/anaconda3/lib/python3.7/distutils/command/install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "/data/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/data/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 78, in run
    _build_ext.run(self)
  File "/data/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "/data/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/tmp/easy_install-1_9moflx/JPype1-0.6.3/setup.py", line 181, in build_extensions
  File "/data/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 199, in build_extension
    _build_ext.build_extension(self, ext)
  File "/data/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/data/anaconda3/lib/python3.7/distutils/ccompiler.py", line 574, in compile
    self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
  File "/data/anaconda3/lib/python3.7/distutils/unixccompiler.py", line 120, in _compile
    raise CompileError(msg)
distutils.errors.CompileError: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-1_9moflx/JPype1-0.6.3/setup.py", line 217, in <module>
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 140, in setup
    return distutils.core.setup(**attrs)
  File "/data/anaconda3/lib/python3.7/distutils/core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1141, in run_setup
    run_setup(setup_script, args)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 253, in run_setup
    raise
  File "/data/anaconda3/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/data/anaconda3/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/_vendor/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 154, in save_modules
    yield saved
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 195, in setup_context
    yield
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "/tmp/easy_install-1_9moflx/JPype1-0.6.3/setup.py", line 217, in <module>
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 140, in setup
    return distutils.core.setup(**attrs)
  File "/data/anaconda3/lib/python3.7/distutils/core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: command 'gcc' failed with exit status 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-v9kles9o/cocoNLP/setup.py", line 75, in <module>
    cmdclass={'install': MyInstall},
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 139, in setup
    _install_setup_requires(attrs)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 134, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/dist.py", line 514, in fetch_build_eggs
    replace_conflicting=True,
  File "/data/anaconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 777, in resolve
    replace_conflicting=replace_conflicting
  File "/data/anaconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1060, in best_match
    return self.obtain(req, installer)
  File "/data/anaconda3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1072, in obtain
    return installer(requirement)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/dist.py", line 581, in fetch_build_egg
    return cmd.easy_install(req)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 676, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 702, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 887, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1155, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "/data/anaconda3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 1143, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'gcc' failed with exit status 1
Found native jni.h at /opt/jdk1.8.0_191/include

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-v9kles9o/cocoNLP/
You are using pip version 10.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

提取时间'#2018-11-27 11:00:00#'失败

代码:
from cocoNLP.extractor import extractor

ex = extractor()

text = '#2018-11-27 11:00:00#'
times = ex.extract_time(text)
print(times)

输出:
{"error": "no time pattern could be extracted."}

。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

时间识别会添加未来或滞后时间的功能吗?

>>> txt = '二十日,下午三点表示,明天九点'
>>> times = ex.extract_time(txt)
>>> times
'{"type": "timespan", "timespan": ["2019-10-20 00:00:00", "2019-10-30 15:00:00"]
}'
>>> txt = '今天是九月十八号,在二十号,将举办'
>>> times = ex.extract_time(txt)
>>> times
'{"type": "timespan", "timespan": ["2019-10-30 00:00:00", "2019-09-18 00:00:00"]

希望能加上一个判定,如果出现今天,昨天等词,可以更改时间基准。。。
(如果有好办法能识别也希望大家告诉我一下([email protected])。。因为最近在做,被折磨疯了。)
再次感谢作者!!!!!

AttributeError: unknown attribute: "weeks"

ex.extract_time("下周三")
Traceback (most recent call last):
File "", line 1, in
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/extractor.py", line 240, in extract_time
res = tn.parse(target=tmp_text) # target为待分析语句,timeBase为基准时间默认是当前时间
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py", line 97, in parse
self.timeToken = self.__timeEx()
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py", line 176, in __timeEx
res.append(TimeUnit(temp[i], self, contextTp))
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 34, in init
self.time_normalization()
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 53, in time_normalization
self.norm_setCurRelated()
File "/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 888, in norm_setCurRelated
cur = cur.replace(weeks=1, days=span)
File "/anaconda3/lib/python3.7/site-packages/arrow/arrow.py", line 603, in replace
raise AttributeError('unknown attribute: "{}"'.format(key))
AttributeError: unknown attribute: "weeks"

匹配合法工商企业名称正则

(北京|上海|重庆|天津|东莞|广州|中山|深圳|惠州|江门|珠海|汕头|佛山|湛江|河源|肇庆|潮州|清远|韶关|揭阳|阳江|云浮|茂名|梅州|汕尾|济南|青岛|临沂|济宁|菏泽|烟台|泰安|淄博|潍坊|日照|威海|滨州|东营|聊城|德州|莱芜|枣庄|苏州|徐州|盐城|无锡|南京|南通|连云港|常州|扬州|镇江|淮安|泰州|宿迁|郑州|南阳|新乡|安阳|洛阳|信阳|平顶山|周口|商丘|开封|焦作|驻马店|濮阳|三门峡|漯河|许昌|鹤壁|济源|石家庄|唐山|保定|邯郸|邢台|沧州|秦皇岛|张家口|衡水|廊坊|承德|温州|宁波|杭州|台州|嘉兴|金华|湖州|绍兴|舟山|丽水|衢州|西安|咸阳|宝鸡|汉中|渭南|安康|榆林|商洛|延安|铜川|长沙|邵阳|常德|衡阳|株洲|湘潭|永州|岳阳|怀化|郴州|娄底|益阳|张家界|永川|合川|江津|南川|漳州|泉州|厦门|福州|莆田|宁德|三明|南平|龙岩|昆明|曲靖|昭通|保山|玉溪|成都|绵阳|广元|达州|南充|德阳|广安|巴中|遂宁|内江|攀枝花|乐山|自贡|泸州|雅安|宜宾|资阳|眉山|贵港|玉林|北海|南宁|柳州|桂林|梧州|钦州|来宾|河池|百色|贺州|崇左|防城港|芜湖|合肥|六安|宿州|阜阳|安庆|马鞍山|蚌埠|淮北|淮南|宣城|黄山|铜陵|亳州|池州|巢湖|滁州|三亚|海口|琼海|文昌|东方|五指山|万宁|儋州|南昌|赣州|上饶|吉安|九江|新余|抚州|宜春|景德镇|萍乡|鹰潭|武汉|宜昌|襄樊|荆州|孝感|黄冈|十堰|咸宁|黄石|仙桃|随州|天门|荆门|潜江|鄂州|太原|大同|运城|长治|晋城|忻州|临汾|吕梁|晋中|阳泉|朔州|大连|沈阳|丹东|辽阳|葫芦岛|锦州|朝阳|营口|鞍山|抚顺|阜新|本溪|盘锦|铁岭|台北|高雄|台中|新竹|基隆|台南|嘉义|齐齐哈尔|哈尔滨|大庆|佳木斯|双鸭山|牡丹江|鸡西|黑河|绥化|鹤岗|伊春|七台河|赤峰|包头|通辽|呼和浩特|乌海|鄂尔多斯|呼伦贝尔|贵阳|遵义|安顺|六盘水|兰州|天水|庆阳|武威|酒泉|张掖|白银|平凉|嘉峪关|金昌|西宁|乌鲁木齐|石河子|克拉玛依|阿拉尔|五家渠|图木舒克|拉萨|吉林|长春|白山|白城|松原|辽源|通化|四平|银川|吴忠|中卫|石嘴山|固原|广东|山东|江苏|河南|河北|浙江|陕西|湖南|福建|云南|四川|安徽|海南|江西|湖北|山西|辽宁|**|贵州|甘肃|青海|吉林)+[\u4e00-\u9fa5()]{5,15}(公司|厂|场|部|铺|中心|店|馆|商行|门市|工作室|大药房|蛋糕房|超市|经销处|设计室|销售处|汽修行|美容院)

提供匹配全国合法固定电话正则,希望加入支持提取固定电话号码。谢谢!

(010|021|022|023|0310|0311|0312|0313|0314|0315|0316|0317|0318|0319|0335|0570|0571|0572|0573|0574|0575|0576|0577|0578|0579|0580|024|0410|0411|0412|0413|0414|0415|0416|0417|0418|0419|0421|0427|0429|027|0710|0711|0712|0713|0714|0715|0716|0717|0718|0719|0722|0724|0728|025|0510|0511|0512|0513|0514|0515|0516|0517|0518|0519|0523|0470|0471|0472|0473|0474|0475|0476|0477|0478|0479|0482|0483|0790|0791|0792|0793|0794|0795|0796|0797|0798|0799|0701|0350|0351|0352|0353|0354|0355|0356|0357|0358|0359|0930|0931|0932|0933|0934|0935|0936|0937|0938|0941|0943|0530|0531|0532|0533|0534|0535|0536|0537|0538|0539|0450|0451|0452|0453|0454|0455|0456|0457|0458|0459|0591|0592|0593|0594|0595|0596|0597|0598|0599|020|0751|0752|0753|0754|0755|0756|0757|0758|0759|0760|0762|0763|0765|0766|0768|0769|0660|0661|0662|0663|028|0810|0811|0812|0813|0814|0816|0817|0818|0819|0825|0826|0827|0830|0831|0832|0833|0834|0835|0836|0837|0838|0839|0840|0730|0731|0732|0733|0734|0735|0736|0737|0738|0739|0743|0744|0745|0746|0370|0371|0372|0373|0374|0375|0376|0377|0378|0379|0391|0392|0393|0394|0395|0396|0398|0870|0871|0872|0873|0874|0875|0876|0877|0878|0879|0691|0692|0881|0883|0886|0887|0888|0550|0551|0552|0553|0554|0555|0556|0557|0558|0559|0561|0562|0563|0564|0565|0566|0951|0952|0953|0954|0431|0432|0433|0434|0435|0436|0437|0438|0439|0440|0770|0771|0772|0773|0774|0775|0776|0777|0778|0779|0851|0852|0853|0854|0855|0856|0857|0858|0859|029|0910|0911|0912|0913|0914|0915|0916|0917|0919|0971|0972|0973|0974|0975|0976|0977|0890|0898|0899|0891|0892|0893|0991|0990|0992|0995|0902|0994|0909|0996|0997|0908|0998|0903|0999|0901|0993|0906)[^\d]{0,3}[1-9]{1}[\d]{6,7}

配置错误

from cocoNLP.extractor import extractor...

ValueError Traceback (most recent call last)
c:\Users\37633\Desktop\zhifa_nlp\punish_nlp.py in
----> 1 from cocoNLP.extractor import extractor

D:\anaconda\envs\py37\lib\site-packages\cocoNLP\extractor.py in
4 from itertools import groupby
5 import phonenumbers
----> 6 from pyhanlp import *
7 from cocoNLP.config.basic.time_nlp.TimeNormalizer import *
8

D:\anaconda\envs\py37\lib\site-packages\pyhanlp_init_.py in
143
144
--> 145 _start_jvm_for_hanlp()
146
147

D:\anaconda\envs\py37\lib\site-packages\pyhanlp_init_.py in _start_jvm_for_hanlp()
75 raise ValueError(
76 "配置错误: 数据包 %s 不存在,请修改配置文件中的root" %
---> 77 HANLP_DATA_PATH)
78 elif not os.path.isfile(PATH_CONFIG):
79 raise ValueError(

ValueError: 配置错误: 数据包 D:/anaconda/envs/py37/lib/site-packages/pyhanlp/static\data 不存在,请修改配置文件中的root

怎么自定义人名库

怎么自定义人名库,然后从自定义人名库中抽取人名?希望得到解答,谢谢

执行错误

File "/var/hongsheng_xin/coconlp/cocoNLP/extractor.py", line 6, in
from pyhanlp import *
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/site-packages/pyhanlp/init.py", line 122, in
_start_jvm_for_hanlp()
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/site-packages/pyhanlp/init.py", line 39, in _start_jvm_for_hanlp
from pyhanlp.static import STATIC_ROOT, hanlp_installed_data_version, HANLP_DATA_PATH
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/site-packages/pyhanlp/static/init.py", line 313, in
install_hanlp_data(HANLP_JAR_VERSION)
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/site-packages/pyhanlp/static/init.py", line 244, in install_hanlp_data
with zipfile.ZipFile(data_zip, "r") as zip_ref:
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/zipfile.py", line 1131, in init
self._RealGetContents()
File "/var/anaconda2/envs/DemoEnv/lib/python3.6/zipfile.py", line 1198, in _RealGetContents
raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

提取人名,多个人名时只返回最后一个人名?

from cocoNLP.extractor import extractor
ex=extractor()
text1='急寻王龙,短发,王龙,男,丢失发型短发,...如有线索,请迅速与警方联系:19909156745'
name=ex.extract_name(text1)
print(name)

output:王龙
但是源码中说返回的是['王龙','王龙']

请问这是怎么回事?

extract_time的bug

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-16-182311dacec4> in <module>()
----> 1 model.predict(strs[1])

~/jupyter_projects/NERPredicter.py in predict(self, sentence, attrs)
     70         self.dic['ID'] = self.cocoExtractor.extract_ids(sentence)
     71         self.dic['PHONE_INFO'] = [self.cocoExtractor.extract_cellphone_location(cell,'CHN') for cell in self.dic['PHONE']]
---> 72         time = json.loads(self.cocoExtractor.extract_time(sentence))
     73         if time["type"] == "timestamp":
     74             self.dic['DATETIME'].append(time["timestamp"])

~/anaconda3/lib/python3.7/site-packages/cocoNLP/extractor.py in extract_time(self, text)
    238         tmp_text = self.replace_ids(tmp_text)
    239         tn = TimeNormalizer()
--> 240         res = tn.parse(target=tmp_text)  # target为待分析语句,timeBase为基准时间默认是当前时间
    241         return res
    242 

~/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py in parse(self, target, timeBase)
     87         self.invalidSpan = False
     88         self.timeSpan = ''
---> 89         self.target = self._filter(target)
     90         self.timeBase = arrow.get(timeBase).format('YYYY-M-D-H-m-s')
     91         self.nowTime = timeBase

~/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py in _filter(self, input_query)
     25     def _filter(self, input_query):
     26         # 这里对于下个周末这种做转化 把个给移除掉
---> 27         input_query = StringPreHandler.numberTranslator(input_query)
     28 
     29         rule = u"[0-9]月[0-9]"

~/anaconda3/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/StringPreHandler.py in numberTranslator(cls, target)
    134             s = filter(None, s)
    135             num = 0
--> 136             if len(s) == 1:
    137                 tenthousand = int(s[0])
    138                 num += tenthousand * 10000

TypeError: object of type 'filter' has no len()

输入测试的句子为:
1月24日,新华社对外发布了**对雄安新区的指导意见,洋洋洒洒2万字,17次提到北京,4次提到天津,信息量很大,其实也回答了人们关心的很多问题。
将 2万 修改为 数万 后程序正常, 查看了一下源码,认为可以去掉filter

添加了多人物名称识别

您好
起初代码只能识别单人名称
我为您的代码添加了多人物识别

如果您需要我可以马上把我的代码发给您😁
当然 您的代码写的真的好棒!

身份证后面有X不能识别

我发现识别身份证的时候有一个问题,就是对身份证最后一位有X的无法识别,这个怎么解决

pip install cocoNLP 有问题,在windows上安装,请问该怎么解决了

(D:\Programs\python) C:\Users\sunyh>pip install cocoNLP
Collecting cocoNLP
Using cached https://files.pythonhosted.org/packages/8f/c3/59aaa0fcaf7afb0853f0ce21570452f40048628f6b3cd68423ee3e798d05/cocoNLP-0.0.13.tar.gz
Complete output from command python setup.py egg_info:
Couldn't find index page for 'arrow' (maybe misspelled?)
No local packages or working download links found for arrow
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\sunyh\AppData\Local\Temp\pip-build-i5gkisqz\cocoNLP\setup.py", line 75, in
cmdclass={'install': MyInstall},
File "D:\Programs\python\lib\distutils\core.py", line 108, in setup
setup_distribution = dist = klass(attrs)
File "D:\Programs\python\lib\site-packages\setuptools\dist.py", line 335, in init
self.fetch_build_eggs(attrs['setup_requires'])
File "D:\Programs\python\lib\site-packages\setuptools\dist.py", line 456, in fetch_build_eggs
replace_conflicting=True,
File "D:\Programs\python\lib\site-packages\pkg_resources_init
.py", line 863, in resolve
replace_conflicting=replace_conflicting
File "D:\Programs\python\lib\site-packages\pkg_resources_init_.py", line 1141, in best_match
return self.obtain(req, installer)
File "D:\Programs\python\lib\site-packages\pkg_resources_init_.py", line 1153, in obtain
return installer(requirement)
File "D:\Programs\python\lib\site-packages\setuptools\dist.py", line 522, in fetch_build_egg
return cmd.easy_install(req)
File "D:\Programs\python\lib\site-packages\setuptools\command\easy_install.py", line 666, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('arrow')

AttributeError: unknown attribute: "weeks" 与“周”相关的日期不能正常解析

代码如下
安装后没有更改任何代码,其他日期格式可以正常解析。只是与周相关的不能正常解析。

text = '上周'
times = ex.extract_time(text)
print(times)

报错如下,请问如何解决,

Traceback (most recent call last):
  File "/Users/andersen/PycharmProjects/aminer/test.py", line 21, in <module>
    times = ex.extract_time(text)
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/extractor.py", line 240, in extract_time
    res = tn.parse(target=tmp_text)  # target为待分析语句,timeBase为基准时间默认是当前时间
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py", line 94, in parse
    self.timeToken = self.__timeEx()
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeNormalizer.py", line 169, in __timeEx
    res.append(TimeUnit(temp[i], self, contextTp))
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 34, in __init__
    self.time_normalization()
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 53, in time_normalization
    self.norm_setCurRelated()
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/cocoNLP/config/basic/time_nlp/TimeUnit.py", line 875, in norm_setCurRelated
    cur = cur.replace(weeks=-1, days=span)
  File "/Users/andersen/PycharmProjects/venv3.7.4/lib/python3.7/site-packages/arrow/arrow.py", line 612, in replace
    raise AttributeError('unknown attribute: "{}"'.format(key))
AttributeError: unknown attribute: "weeks"

pip and python setup.py failed to install

env is win10 and anaconda3. Hope you can help me, thank you! Below is the error report
Collecting cocoNLP
Downloading https://files.pythonhosted.org/packages/8f/c3/59aaa0fcaf7afb0853f0ce21570452f40048628f6b3cd68423ee3e798d05/cocoNLP-0.0.13.tar.gz (88kB)

Complete output from command python setup.py egg_info:

Installed c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs\phone-0.4.2-py3.7.egg
Searching for pyhanlp
Reading https://pypi.org/simple/pyhanlp/
Downloading https://files.pythonhosted.org/packages/db/78/5e20dadc4b0e63f0c0b8feb6b752e1d47ba8f02dba269e656cf186448fe1/pyhanlp-0.1.48.tar.gz#sha256=61c2358d2803d06da3d544664febf210590df662d4c10cc01aa6c6c2bb4456e4
Best match: pyhanlp 0.1.48
Processing pyhanlp-0.1.48.tar.gz
Writing C:\Users\user\AppData\Local\Temp\easy_install-nwl5yguy\pyhanlp-0.1.48\setup.cfg
Running pyhanlp-0.1.48\setup.py -q bdist_egg --dist-dir C:\Users\user\AppData\Local\Temp\easy_install-nwl5yguy\pyhanlp-0.1.48\egg-dist-tmp-32tui2lq
zip_safe flag not set; analyzing archive contents...
pyhanlp.__pycache__.__init__.cpython-37: module references __file__
pyhanlp.__pycache__.util.cpython-37: module references __file__
pyhanlp.static.__pycache__.__init__.cpython-37: module references __file__
creating c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs\pyhanlp-0.1.48-py3.7.egg
Extracting pyhanlp-0.1.48-py3.7.egg to c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs

Installed c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs\pyhanlp-0.1.48-py3.7.egg
Searching for jieba
Reading https://pypi.org/simple/jieba/
Downloading https://files.pythonhosted.org/packages/71/46/c6f9179f73b818d5827202ad1c4a94e371a29473b7f043b736b4dab6b8cd/jieba-0.39.zip#sha256=de385e48582a4862e55a9167334d0fbe91d479026e5dac40e59e22c08b8e883e
Best match: jieba 0.39
Processing jieba-0.39.zip
Writing C:\Users\user\AppData\Local\Temp\easy_install-ip56mpcu\jieba-0.39\setup.cfg
Running jieba-0.39\setup.py -q bdist_egg --dist-dir C:\Users\user\AppData\Local\Temp\easy_install-ip56mpcu\jieba-0.39\egg-dist-tmp-clndrtyv
zip_safe flag not set; analyzing archive contents...
jieba.__pycache__._compat.cpython-37: module references __file__
jieba.analyse.__pycache__.tfidf.cpython-37: module references __file__
creating c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs\jieba-0.39-py3.7.egg
Extracting jieba-0.39-py3.7.egg to c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs

Installed c:\users\user\appdata\local\temp\pip-install-0sqfyyq0\coconlp\.eggs\jieba-0.39-py3.7.egg
Searching for jpype1>=0.7.0
Reading https://pypi.org/simple/jpype1/
Downloading https://files.pythonhosted.org/packages/28/63/784834e8a24ec2e1ad7f703c3dc6c6fb372a77cc68a2fdff916e18a4449e/JPype1-0.7.0.tar.gz#sha256=1630439d5b0fb49e2878b43a1a1f074f9d4f46520f525569e14f1f0f9399f871
Best match: JPype1 0.7.0
Processing JPype1-0.7.0.tar.gz
Writing C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\setup.cfg
Running JPype1-0.7.0\setup.py -q bdist_egg --dist-dir C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\egg-dist-tmp-o5keaij5
D:\Anacanda\lib\distutils\dist.py:274: UserWarning: Unknown distribution option: 'use_scm_version'
  warnings.warn(msg)
C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\setupext\build_ext.py:85: FeatureNotice: Turned ON Numpy support for fast Java array access
  FeatureNotice)
Traceback (most recent call last):
  File "D:\Anacanda\lib\site-packages\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
    return self.find_available_vc_vers()[-1]
IndexError: list index out of range

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anacanda\lib\distutils\core.py", line 148, in setup
    dist.run_commands()
  File "D:\Anacanda\lib\distutils\dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "D:\Anacanda\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Anacanda\lib\site-packages\setuptools\command\bdist_egg.py", line 172, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "D:\Anacanda\lib\site-packages\setuptools\command\bdist_egg.py", line 158, in call_command
    self.run_command(cmdname)
  File "D:\Anacanda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anacanda\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Anacanda\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
    self.build()
  File "D:\Anacanda\lib\distutils\command\install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "D:\Anacanda\lib\distutils\cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "D:\Anacanda\lib\distutils\dist.py", line 985, in run_command
    cmd_obj.run()
  File "D:\Anacanda\lib\site-packages\setuptools\command\build_ext.py", line 78, in run
    _build_ext.run(self)
  File "D:\Anacanda\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
    _build_ext.build_ext.run(self)
  File "D:\Anacanda\lib\distutils\command\build_ext.py", line 339, in run
    self.build_extensions()
  File "C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\setupext\build_ext.py", line 95, in build_extensions
  File "D:\Anacanda\lib\site-packages\Cython\Distutils\old_build_ext.py", line 194, in build_extensions
    self.build_extension(ext)
  File "D:\Anacanda\lib\site-packages\setuptools\command\build_ext.py", line 199, in build_extension
    _build_ext.build_extension(self, ext)
  File "D:\Anacanda\lib\distutils\command\build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "D:\Anacanda\lib\distutils\_msvccompiler.py", line 345, in compile
    self.initialize()
  File "D:\Anacanda\lib\distutils\_msvccompiler.py", line 238, in initialize
    vc_env = _get_vc_env(plat_spec)
  File "D:\Anacanda\lib\site-packages\setuptools\msvc.py", line 185, in msvc14_get_vc_env
    return EnvironmentInfo(plat_spec, vc_min_ver=14.0).return_env()
  File "D:\Anacanda\lib\site-packages\setuptools\msvc.py", line 843, in __init__
    self.si = SystemInfo(self.ri, vc_ver)
  File "D:\Anacanda\lib\site-packages\setuptools\msvc.py", line 485, in __init__
    self.vc_ver = vc_ver or self._find_latest_available_vc_ver()
  File "D:\Anacanda\lib\site-packages\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
    raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\setup.py", line 54, in <module>
    classifiers=[
  File "D:\Anacanda\lib\site-packages\setuptools\__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "D:\Anacanda\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 1144, in run_setup
    run_setup(setup_script, args)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 253, in run_setup
    raise
  File "D:\Anacanda\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "D:\Anacanda\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 166, in save_modules
    saved_exc.resume()
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 141, in resume
    six.reraise(type, exc, self._tb)
  File "D:\Anacanda\lib\site-packages\setuptools\_vendor\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 154, in save_modules
    yield saved
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 195, in setup_context
    yield
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 250, in run_setup
    _execfile(setup_script, ns)
  File "D:\Anacanda\lib\site-packages\setuptools\sandbox.py", line 45, in _execfile
    exec(code, globals, locals)
  File "C:\Users\user\AppData\Local\Temp\easy_install-hky83igj\JPype1-0.7.0\setup.py", line 54, in <module>
    classifiers=[
  File "D:\Anacanda\lib\site-packages\setuptools\__init__.py", line 143, in setup
    return distutils.core.setup(**attrs)
  File "D:\Anacanda\lib\distutils\core.py", line 163, in setup
    raise SystemExit("error: " + str(msg))
SystemExit: error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\user\AppData\Local\Temp\pip-install-0sqfyyq0\cocoNLP\setup.py", line 75, in <module>
    cmdclass={'install': MyInstall},
  File "D:\Anacanda\lib\site-packages\setuptools\__init__.py", line 142, in setup
    _install_setup_requires(attrs)
  File "D:\Anacanda\lib\site-packages\setuptools\__init__.py", line 137, in _install_setup_requires
    dist.fetch_build_eggs(dist.setup_requires)
  File "D:\Anacanda\lib\site-packages\setuptools\dist.py", line 586, in fetch_build_eggs
    replace_conflicting=True,
  File "D:\Anacanda\lib\site-packages\pkg_resources\__init__.py", line 780, in resolve
    replace_conflicting=replace_conflicting
  File "D:\Anacanda\lib\site-packages\pkg_resources\__init__.py", line 1063, in best_match
    return self.obtain(req, installer)
  File "D:\Anacanda\lib\site-packages\pkg_resources\__init__.py", line 1075, in obtain
    return installer(requirement)
  File "D:\Anacanda\lib\site-packages\setuptools\dist.py", line 653, in fetch_build_egg
    return cmd.easy_install(req)
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 679, in easy_install
    return self.install_item(spec, dist.location, tmpdir, deps)
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 705, in install_item
    dists = self.install_eggs(spec, download, tmpdir)
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 890, in install_eggs
    return self.build_and_install(setup_script, setup_base)
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 1158, in build_and_install
    self.run_setup(setup_script, setup_base, args)
  File "D:\Anacanda\lib\site-packages\setuptools\command\easy_install.py", line 1146, in run_setup
    raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
  including thunk build\lib\org\jpype\classloader\JPypeClassLoader.class
  including thunk build\lib\org.jpype.jar

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-install-0sqfyyq0\cocoNLP\

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.