首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >AllenNLP语义角色标签器-参数注释

AllenNLP语义角色标签器-参数注释
EN

Stack Overflow用户
提问于 2020-12-21 21:49:58
回答 1查看 268关注 0票数 0

对于AllenNLP语义角色标记实现,如何像演示中所示那样应用参数注释?当我从我的本地实现运行代码时,我看到了动词和描述,但没有看到注释?我肯定遗漏了一个额外的步骤或逻辑,需要应用这些步骤或逻辑来支持输出的该部分。

演示应用程序中显示的内容

代码语言:javascript
复制
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] .

我的代码:

代码语言:javascript
复制
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

同样的句子,我的代码输出如下:

代码语言:javascript
复制
'{"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", "."]}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-12-27 01:17:08

在github上发帖后,从AllenNLP的人那里发现这是一个版本问题。我需要使用allennlp=1.3.0和最新的型号。现在它可以正常工作了。

代码语言:javascript
复制
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.

https://github.com/allenai/allennlp/issues/4876

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65393947

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档