Skip to content
This repository has been archived by the owner on Jan 20, 2023. It is now read-only.

Output related question #534

Open
jdjmoon opened this issue Sep 18, 2020 · 1 comment
Open

Output related question #534

jdjmoon opened this issue Sep 18, 2020 · 1 comment

Comments

@jdjmoon
Copy link

jdjmoon commented Sep 18, 2020

Hello,

I really like how the Demo has Open Information Extraction. I had quick question regarding output. For example if I run the command provided from the demo:

from allennlp.predictors.predictor import Predictor
import allennlp_models.structured_prediction
predictor = Predictor.from_path("https://storage.googleapis.com/allennlp-public-models/openie-model.2020.03.26.tar.gz")
predictor.predict(
  sentence="John decided to run for office next month."
)

Among few lines, I am getting something like this:

{'verbs': [{'description': '[ARG0: John] [V: decided] [ARG1: to run for office next month] .',
   'tags': ['B-ARG0',
    'B-V',
    'B-ARG1',
    'I-ARG1',
    'I-ARG1',
    'I-ARG1',
    'I-ARG1',
    'I-ARG1',
    'O'],
   'verb': 'decided'},

Is there anyway it can only print out [ARG0: John] [V: decided] [ARG1: to run for office next month] ?

Thank you

@dirkgr
Copy link
Member

dirkgr commented Nov 12, 2020

Sure, you can say

x = predictor.predict(...)
print(x['verbs'][0]['description'])

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants