python - Mosestokenizer 问题:[WinError 2] 系统找不到指定的文件
问题描述
无法弄清楚为什么会出现这个问题。
from mosestokenizer import MosesDetokenizer
with MosesDetokenizer('en') as detokenize:
print(detokenize(["hi", 'my', 'name', 'is', 'artem']))
这就是我得到的:
stdbuf was not found; communication with perl may hang due to stdio buffering.
Traceback (most recent call last):
File "C:\Users\ArtemLaptiev\Documents\GitHub\temp\foo.py", line 3, in <module>
with MosesDetokenizer('en') as detokenize:
File "C:\ProgramFiles\Anaconda\lib\site-packages\mosestokenizer\detokenizer.py", line 47, in __init__
super().__init__(argv)
File "C:\ProgramFiles\Anaconda\lib\site-packages\toolwrapper.py", line 52, in __init__
self.start()
File "C:\ProgramFiles\Anaconda\lib\site-packages\toolwrapper.py", line 92, in start
cwd=self.cwd
File "C:\ProgramFiles\Anaconda\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\ProgramFiles\Anaconda\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
谢谢你的帮助!
解决方案
使用sacremoses
而不是moses
.
pip install -U sacremoses
和
from sacremoses import MosesTokenizer, MosesDetokenizer
with MosesDetokenizer() as detokenize:
print(detokenize(["hi", 'my', 'name', 'is', 'artem']))
完整的细节
推荐阅读
- c# - AdobeSign:获取签名 URL 正在返回 NOT_FOUND 响应
- postgresql - Docker 在错误的数据库中构建模式
- javascript - Cucumber-js 未定义步骤参考使用 IntelliJ IDEA - Ultimate Edition
- uwp - 如何调整 ContentDialog 的大小以使用活动窗口中的大部分空间
- bioinformatics - 转换为 BCF 之前的 vcf 文件修改
- cmake - 无法构建仅针对 compile-rt(无 libgcc)链接的带有内存清理工具的 libc++?
- javascript - 开玩笑的覆盖以一种奇怪的方式仅缺少 if 条件行 - 为什么以及如何修复
- javascript - 寻找有关将 Parceljs 与 Backbone.js 一起使用的建议
- python-3.x - Python asyncio sleep 没有唤醒
- c++ - 如何使自定义 C++ 类成为 QML 类型?