抱歉,暂不支持 Python 3.9 及以上版本。

hanlp segment
下载 https://file.hankcs.com/hanlp/hanlp-1.8.3-release.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/hanlp-1.8.3-release.zip

这又是什么操作呢?

下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip

这个呢?这是准备数据集吗?

2022-06-19-163240_639x108_scrot

这是假死了吗?

^C下载失败 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 由于 KeyboardInterrupt()
请参考 https://od.hankcs.com/book/intro_nlp/ 执行手动安装.
或手动下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip
是否前往 https://od.hankcs.com/book/intro_nlp/ ?(y/n)

2022-06-19-163958_386x81_scrot

看版本号,1.7的,不会删除了吧.这叫一个转啊.

安装pyhanlp
pip install pyhanlp
1
安装后在第一次使用时,当运行from pyhanlp import *时,会下载hanlp的数据文件,这个文件比较大,一般都会下载失败,推荐手动下载并放到要求的路径下。

data文件下载地址:Releases · hankcs/HanLP · GitHub

在页面中下载data-for-1.7.2.zip

然后把下载的文件放到C:\Anaconda3\Lib\site-packages\pyhanlp\static 目录下

再执行from pyhanlp import *,完成自动解压。
————————————————
版权声明:本文为CSDN博主「Ezrealmore」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:【NLP】pyhanlp的安装与使用_Ezrealmore的博客-CSDN博客_python 安装pyhanlp

v1.8.3 常规维护

Latest

  • 修复动态自定义词典与CustomDictionaryForcing的搭配问题 fix #1712
  • 调整莎=sha1,suo1 fix #1670
  • 根据总词频动态决定未登录词的默认词频
  • DoubleArrayTrie里的LongestSearcher的next支持null作为值 by @tiandiweizun in #1674
  • Update DoubleArrayTrie.java的注释 by @TITC in #1699
  • 数据包兼容data-for-1.7.5.zip md5=1d9e1be4378b2dbc635858d9c3517aaa
  • Portable版同步升级到v1.8.3

com.hankcs hanlp portable-1.8.3

Full Changelog: v1.8.2…v1.8.3

啊哦,你来晚了,分享的文件已经被取消了,下次要早点哟。

这是龟速啊,为啥不用其他分流服务呢?这都是啥啊。。。。。。

会员加速都无济于事啊!

https://file.hankcs.com/hanlp/data-for-1.7.5.zip 这个网站虽然时不时被DDoS,但也不至于这么慢。请贴一下你的宽带运营商,我们再想想办法。

你也可以试试镜像站:https://od.hankcs.com/hanlp/data/data-for-1.7.5.zip

最后还是求助迅雷多线程,几个小时下载下来了。

653M,必须给同学们预警下。

ls /home/pi/.local/lib/python3.7
site-packages
pi@raspberrypi:~ $ ls /home/pi/.local/lib/python3.7/site-packages

hanlp_downloader                   _jpype.cpython-37m-arm-linux-gnueabihf.so
hanlp_downloader-0.0.25.dist-info  pyhanlp
jpype                              pyhanlp-0.1.84.dist-info
JPype1-0.7.0.dist-info

pi@raspberrypi:~ ls /home/pi/.local/lib/python3.7/site-packages/pyhanlp/ `__init__.py main.py __pycache__ server.py static util.py` pi@raspberrypi:~ ls /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static

hanlp-1.8.3.jar   hanlp.properties.in  __init__.py
hanlp.properties  index.html           __pycache__

pi@raspberrypi:~ $ cp /home/pi/Downloads/data-for-1.7.5.zip /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static

ls /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static
data-for-1.7.5.zip

hanlp segment

下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip
^C下载失败 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 由于 KeyboardInterrupt()
请参考 https://od.hankcs.com/book/intro_nlp/ 执行手动安装.
或手动下载 https://file.hankcs.com/hanlp/data-for-1.7.5.zip 到 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip
是否前往 https://od.hankcs.com/book/intro_nlp/ ?(y/n)n

mv data-for-1.7.5.zip data-for-1.8.3.zip

hanlp segment

使用本地 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip, 忽略 https://file.hankcs.com/hanlp/data-for-1.7.5.zip
                                                                                       解压 data.zip...

image

挤压也是个漫长的等待,注视着CPU占用率的变化的进度条,好过一点儿。

hanlp segment

使用本地 /home/pi/.local/lib/python3.7/site-packages/pyhanlp/static/data-for-1.8.3.zip, 忽略 https://file.hankcs.com/hanlp/data-for-1.7.5.zip
                                                                                       解压 data.zip...
Invalid maximum heap size: -Xmx8g
The specified size exceeds the maximum representable size.
Traceback (most recent call last):
  File "/home/pi/.local/bin/hanlp", line 6, in <module>
    from pyhanlp.main import main
  File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/__init__.py", line 149, in <module>
    _start_jvm_for_hanlp()
  File "/home/pi/.local/lib/python3.7/site-packages/pyhanlp/__init__.py", line 136, in _start_jvm_for_hanlp
    HANLP_JVM_XMX, convertStrings=True)
  File "/home/pi/.local/lib/python3.7/site-packages/jpype/_core.py", line 219, in startJVM
    _jpype.startup(jvmpath, tuple(args), ignoreUnrecognized, convertStrings)
RuntimeError: Unable to start JVM
        at loadJVM(native/common/jp_env.cpp:169)
        at loadJVM(native/common/jp_env.cpp:179)
        at startup(native/python/pyjp_module.cpp:159)

JVM 又出事儿啦。