Ram*_*Sah 3 nlp nltk google-cloud-platform nltk-trainer
我试图在 Google 协作笔记本中导入 NLTK 语言建模模块 ( nltk.lm ),但没有成功。我尝试从 nltk 安装所有内容,但仍然没有成功。
我可能犯了什么错误或遗漏?
提前致谢。
Google Colab 已nltk v3.2.5安装,但nltk.lm(语言建模包)已添加到v3.4.
在您的 Google Colab 中运行:
!pip install -U nltk
Run Code Online (Sandbox Code Playgroud)
在输出中,您将看到它下载新版本,并卸载旧版本:
...
Downloading nltk-3.6.5-py3-none-any.whl (1.5 MB)
...
Successfully uninstalled nltk-3.2.5
...
You must restart the runtime in order to use newly installed versions.
Run Code Online (Sandbox Code Playgroud)
单击Restart runtime输出末尾显示的按钮。
现在应该可以了!
nltk您可以使用以下代码仔细检查版本:
import nltk
print('The nltk version is {}.'.format(nltk.__version__))
Run Code Online (Sandbox Code Playgroud)
您需要v3.4或稍后使用nltk.lm。
| 归档时间: |
|
| 查看次数: |
1515 次 |
| 最近记录: |