[Attempto] Can't unparse expressions (from DRSXML) using atom_to_term/3, Single quotes lost

Joshua TAYLOR tayloj at cs.rpi.edu
Tue Jun 2 18:26:37 CEST 2009


Thanks for the quick response. I usually access APE via the
webservice, but I downloaded the 6.5 distribution and applied those
patches, and can parse sentences that gave me problems yesterday.

With regard to the quoting of strings, I don't think that /all/
strings need to be quoted---just matching the prolog output would be
fine.  It seems that the Prolog convention is to only quote those
strings that contain special characters. E.g, in

CL-USER 47 > (invoke-ape-webservice :text "\"ab\" is shorter than \"ab
c\"." :solo "drs")
"drs([A, B], [property(A, short, comp_than, string('ab c'))-1/5,
predicate(B, be, string(ab), A)-1/4])"

there are both string(ab) and string('ab c'). I'm not as familiar with
Prolog as with Lisp, but Lisp has a printing function which prints
Lisp-readable output. If Prolog has a similar printer, it's output
would probably suffice (modulo whatever XML entity encoding is
required).

Regards,
Joshua

On Tue, Jun 2, 2009 at 11:38 AM, Tobias Kuhn <t.kuhn at gmx.ch> wrote:
> Hi Joshua,
>
> I agree. Strings should be quoted in the XML representation of the DRS. It's
> no my todo list now and I will fix it as soon as possible.
>
> By the way, new versions of the files parser/grammar.fit and
> utils/drs_to_xml.pl are attached that should solve the problem with the XML
> output for sentences like "John likes Mary". (However, it's not yet
> systematically tested.)
>
>
> Tobias
>
>
> Joshua TAYLOR wrote:
>>
>> Hello,
>>
>> I'm having a bit of trouble unparsing expressions using
>> atom_to_term/3.  It seems that single quotes that are present in
>> Prolog output are lost in DRSXML output. For instance:
>>
>> === DRS output
>>
>> CL-USER 28 > (invoke-ape-webservice :text "\"a)b\" is good." :solo "drs")
>> "drs([A, B], [property(A, good, pos)-1/5, predicate(B, be,
>> string('a)b'), A)-1/4])"
>>
>> ?- atom_to_term("string('a)b')",X,Y).
>> X = string('a)b'),
>> Y = [].
>>
>> === DRSXML output
>>
>> <DRS domain=\"A B\">
>>  <property ref=\"A\" adj=\"good\" degree=\"pos\" sentid=\"1\"
>> tokid=\"5\"/>
>>  <predicate ref=\"B\" verb=\"be\" subj=\"string(a)b)\"
>>      obj=\"A\" sentid=\"1\" tokid=\"4\"/>
>> </DRS>"
>>
>> ?- atom_to_term("string(a)b)",X,Y).
>> ERROR: Syntax error: Operator expected
>> ERROR: string(a)
>> ERROR: ** here **
>> ERROR: b) .
>>
>> Now, I couldn't find anything that explicitly affirmed that the DRSXML
>> attribute values would be string representations of Prolog atoms, but
>> the representations seemed close enough that it was probably the case.
>>  If string contents aren't quoted, the expressions can easily become
>> ambiguous.  E.g., (a contrived example):
>>
>> CL-USER 33 > (invoke-ape-webservice :text "John dictates \"Every )
>> must be preceded by a (.\"." :solo "drsxml")
>> "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
>>
>> <DRS domain=\"A\">
>>  <predicate
>>      ref=\"A\"
>>      verb=\"dictate\"
>>      subj=\"named(John)\"
>>      obj=\"string(Every ) must be preceded by a (.)\"
>>      sentid=\"1\"
>>      tokid=\"2\"/>
>> </DRS>"
>>
>> Regards,
>> Joshua
>> _______________________________________________
>> attempto mailing list
>> attempto at lists.ifi.uzh.ch
>> https://lists.ifi.uzh.ch/listinfo/attempto
>>


-- 
=====================
Joshua Taylor
tayloj at cs.rpi.edu, jtaylor at alum.rpi.edu

"A lot of good things went down one time,
  back in the goodle days."
    John Hartford


More information about the attempto mailing list