python - AllenNLP 语义角色标注器 - 参数注释
问题描述
对于 AllenNLP 语义角色标签实现,如何像演示中所示那样应用参数注释?当我从本地实现运行代码时,我看到动词和描述,但看不到注释?我一定遗漏了需要应用以支持该部分输出的额外步骤或逻辑。
演示应用程序中显示的内容
Sentence: At noon, a man exited the park on the N side.
exited: [ARGM-TMP: At noon] , [ARG0: a man] [V: exited] [ARG1: the park] [ARGM-DIR: on the N side] .
我的代码:
from allennlp.predictors.predictor import Predictor
download = "https://storage.googleapis.com/allennlp-public-models/bert-base-srl-2020.09.03.tar.gz"
# predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/bert-base-srl-2020.11.19.tar.gz")
predictor = Predictor.from_path(download)
text = "At noon, a man exited the park on the N side. "
tree = predictor.predict(sentence=text)
value = predictor.dump_line(tree)
value
我的代码对同一句话的输出:
'{"verbs": [{"verb": "exited", "description": "At noon , a man exited the park on the N side .", "tags": ["O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O"]}], "words": ["At", "noon", ",", "a", "man", "exited", "the", "park", "on", "the", "N", "side", "."]}
解决方案
在 github 上发布后,从 AllenNLP 的人那里得知这是一个版本问题。我需要使用 allennlp=1.3.0 和最新型号。现在它按预期工作。
This should be fixed in the latest allennlp 1.3 release. Also, the latest archive file is structured-prediction-srl-bert.2020.12.15.tar.gz.
推荐阅读
- java - java或xml中的Log4j2配置?
- wordpress - Woocommerce - 购物车页面上的验证
- kotlin - 当字段具有不同的序列化机制时,如何为类构建 SerialDescriptor?
- kubernetes - ansible给出错误,而在k8s命令在服务器上运行良好
- html - 我如何使这个标题居中?
- php - Mikrotik 配置文件激活失败,PHP 中没有此类命令错误
- javascript - 如何检查对象内的数组是否为空 JavaScript
- sapui5 - 两个系统(7.51 和 7.52)之间 OData 的差异
- python - 如何在视图函数上运行 Django APScheduler
- mongodb - 从 docker 容器获取 mongodb 备份时出错