问题描述
我正在尝试使用 nltk Hunpos Tagger 运行 lambda 函数。从 https://code.google.com/archive/p/hunpos/downloads 下载了 Hunpos 库 但它一直说“[Errno 2] 没有这样的文件或目录:'/opt/python/trained_pos_taggers_/hunpos-1.0-linux/hunpos-tag'”
有什么方法可以将 hunpos-tag.exe 文件从 32 位转换为 64 位,或者我们可以在 lambda 上运行 32 位库吗?另外,我也通过“qemu-i386-static”进行了尝试。但同样的错误。
import json
import os
import sys
import subprocess
def lambda_handler(event,context):
from nltk.tag.hunpos import HunposTagger
from nltk import word_tokenize
subprocess.call(['/opt/python/qemu-file/qemu-i386-static','/opt/python/trained_pos_taggers_/hunpos-1.0-linux/hunpos-tag',''])
sentence = "Please turn off the computer and unplug the AC adaptor"
tokens = word_tokenize(sentence)
try:
tagger = HunposTagger(path_to_model= '/opt/python/trained_pos_taggers_/en_wsj.model',path_to_bin='/opt/python/trained_pos_taggers_/hunpos-1.0-linux/hunpos-tag')
print(tagger.tag(tokens))
except Exception as e:
print(e)
# Todo implement
return {
'statusCode': 200,'body': json.dumps('Hello from Lambda!')
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)