Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use eds.loads to obtain a EDS from the result of eds.dumps #203

Closed
Aria-K-Alethia opened this issue Jan 23, 2019 · 2 comments
Closed
Milestone

Comments

@Aria-K-Alethia
Copy link

Aria-K-Alethia commented Jan 23, 2019

Hi,

I use HTTP request to parse a sentence to EDS. And I use eds.dumps() to dump it to raw string. But when I use eds.loads() to recover it, I found no output result.

Below is my code:

 >>>text = Successful American business owners do the same thing.
 >>>res = rest.parse(exs[1].text, params={'eds':'json'})
 >>>res = res.result(0).eds()
 >>>raw = eds.dumps(res, properties = 1, single = 1)
 >>>raw
'{e3:\n _1:udef_q<0:35>[BV x6]\n e9:_successful_a_1<0:10>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE untensed}[ARG1 x6]\n e10:_american_a_1<11:19>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE untensed}[ARG1 x6]\n e12:compound<20:35>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE untensed}[ARG1 x6, ARG2 x11]\n _2:udef_q<20:28>[BV x11]\n x11:_business_n_1<20:28>{x }[]\n x6:_owner_n_of<29:35>{x IND +, NUM pl, PERS 3}[]\n e3:_do_v_1<36:38>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE pres}[ARG1 x6, ARG2 x18]\n _3:_the_q<39:42>[BV x18]\n e23:_same_a_as<43:47>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE untensed}[ARG1 x18]\n e25:comp_equal<43:47>{e MOOD indicative, PERF -, PROG -, SF prop, TENSE untensed}[ARG1 e23]\n x18:_thing_n_of-about<48:54>{x IND +, NUM sg, PERS 3}[]\n}'
>>>list(eds.loads(raw))
[]

Why?

@goodmami
Copy link
Member

There are a number of issues with the code as posted, but I'll assume those were just accidentally made when posting the issue. I can reproduce the problem with the following MWE:

>>> from delphin.mrs import eds
>>> from delphin.interfaces import rest
>>> text = 'Successful American business owners do the same thing.'
>>> res = rest.parse(text, params={'eds':'json'})
>>> x = res.result(0).eds()
>>> raw = eds.dumps(x, properties=True, single=True)
>>> list(eds.loads(raw))
[]

I suspect that the EDS parser is failing to parse the raw representation and giving up (the empty list just means that no EDS representations were found in the input string, but clearly that's not the case here). Perhaps due to the empty property list on _business_n_1 or maybe the hyphen in the predicate name in _thing_n_of-about, neither of which are invalid. I'll take a look.

In the meantime, what is it you want to accomplish? It seems the JSON parser of EDS is working fine, so you could work with that representation, or maybe the PENMAN one, if it's easier?

@Aria-K-Alethia
Copy link
Author

There are a number of issues with the code as posted, but I'll assume those were just accidentally made when posting the issue. I can reproduce the problem with the following MWE:

>>> from delphin.mrs import eds
>>> from delphin.interfaces import rest
>>> text = 'Successful American business owners do the same thing.'
>>> res = rest.parse(text, params={'eds':'json'})
>>> x = res.result(0).eds()
>>> raw = eds.dumps(x, properties=True, single=True)
>>> list(eds.loads(raw))
[]

I suspect that the EDS parser is failing to parse the raw representation and giving up (the empty list just means that no EDS representations were found in the input string, but clearly that's not the case here). Perhaps due to the empty property list on _business_n_1 or maybe the hyphen in the predicate name in _thing_n_of-about, neither of which are invalid. I'll take a look.

In the meantime, what is it you want to accomplish? It seems the JSON parser of EDS is working fine, so you could work with that representation, or maybe the PENMAN one, if it's easier?

Thank you for your help.

What I need here is a EDS parser for raw text representation, since I have many such kind of things(from deepbank). However, before parsing them I found this problem.

@goodmami goodmami added this to the v0.9.2 milestone Apr 1, 2019
goodmami added a commit that referenced this issue Apr 1, 2019
resolves #180
resolves #181
resolves #186
fixes #200
fixes #203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants