AllenNLP 语义角色标注器 - 参数注释
AllenNLP Semantic Role Labeler - Argument Annotations
对于 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.
对于 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.