[developers] ISSUE WITH SENTENCE GENERATION
Michael Wayne Goodman
goodmami at u.washington.edu
Fri Nov 11 01:32:40 CET 2016
Jacy sometimes returns parses with ill-formed MRSs. This particular bug is
already noted (https://github.com/delph-in/jacy/issues/1), but
unfortunately hasn't been fixed yet.
PyDelphin only throws a warning because it can still work with the MRS in
some ways, but, as Guy noted, DMRS conversion is not guaranteed for all
MRSs. Generally, well-formed MRSs are convertible, but there is a subset of
"well-formed" MRSs that are not. We have discussed updating the
well-formedness criteria, but have not fully done so. For more information,
see the following:
http://moin.delph-in.net/RmrsWellformedness
And the following are minutes of discussions with more information and
examples, but it may be hard to follow:
http://moin.delph-in.net/TomarMrsWellformedness
http://moin.delph-in.net/SingaporeMrsWellformedness
How are you using PyDelphin for the conversion? If you are using it as a
library (rather than converting at the command line), it may be possible to
capture the warning you've seen so you can skip the item altogether, rather
than potentially dealing with errors downstream. E.g.:
>>> from delphin.mrs import dmrx
>>> from delphin.interfaces import ace
>>> from delphin.exceptions import XmrsWarning
>>> import warnings
>>>
>>> def get_dmrs(sentence, grm):
... with warnings.catch_warnings():
... warnings.filterwarnings('error')
... try:
... return dmrx.dumps_one(ace.parse(grm,
sentence).result(0).mrs())
... except XmrsWarning:
... return None
...
>>> grm = '/home/goodmami/grammars/jacy/jacy.dat'
>>> print(get_dmrs('その 部屋 は あまり 静か じゃ ない です 。', grm))
Exception ignored in: <_io.FileIO name=5 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.TextIOWrapper name=5 encoding='UTF-8'>
None
>>> print(get_dmrs('その 部屋 は あまり 静か です 。', grm))
Exception ignored in: <_io.FileIO name=5 mode='rb' closefd=True>
ResourceWarning: unclosed file <_io.TextIOWrapper name=5 encoding='UTF-8'>
<dmrs-list><dmrs cfrom="-1" cto="-1">[...]
(You can ignore the Exception and ResourceWarning in the last two commands.)
Note that the first one (that has causes the XmrsWarning you noticed)
returns None, while the second (without the negation causing the problem)
returns the DMRS as expected.
On Thu, Nov 10, 2016, 06:27 Guy Emerson <gete2 at cam.ac.uk> wrote:
I cannot comment on Jacy, but you should be aware that not all MRSs can be
converted to DMRS. If you would like to generate from an MRS that is not
DMRS-compatible, then you should not try to convert the MRS to DMRS and
back.
An important constraint for an MRS to be DMRS-compatible is that each
variable can only be the intrinsic variable of a single EP.
2016-11-10 12:22 GMT+00:00 Naman Deep Singh <nmndeep at gmail.com>:
Sir,
The segmentation issue was resolved
But,
Whilst running this particular sentence:
その部屋はあまり静かじゃないです。
The ACE generated MRS has "ARG0: e2" for two different attributes as in
(inp.mrs)
When we try to generate DMRS from ACE generated MRS of this sentence a
warning error is shown :
/home/naman/.local/lib/python2.7/site-packages/delphin/mrs/simplemrs.py:244:
XmrsWarning: e2 is the intrinsic variable for more than one EP.
warn(str(ex), XmrsWarning)
Now on reverse generation of the sentence via the MRS generated from the
DMRS the same error prompts up and sentence generation is failed.
Please look into the problem.
With Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.delph-in.net/archives/developers/attachments/20161111/ce35b9c6/attachment.html>
More information about the developers
mailing list