Attempto / APE

Parser for Attempto Controlled English (ACE)
http://attempto.ifi.uzh.ch/ape/
Other
188 stars 28 forks source link

Apposition or tests failing? #39

Closed labriola closed 1 year ago

labriola commented 1 year ago

In the test file, test number 6 seems to be a simple apposition test:

text_drs_eval(0, 6, 'a man Kaarel works hard.', drs([], []), [[specification, [s, [np, [det, [a]], [nbar, [n, [man]], [appos_coord, [appos, [var, ['Kaarel']]]]]], [vp, [vbar, [vbar, [v, [works]]], [adv, [hard]]]]], ['.']]], '2006-08-12-18-09-32', amadeus, '').

However, trying a man Kaarel works hard. in either a locally built APE executable or from the webclient, seems to generate an error. In an effort to understand more, I tried running the tests which provides the result:

000006 [0000] 'a man Kaarel works hard.'

Which, if I am not mistaken, indicates that it Correctly generated an empty DRS. However, the test itself clearly shows a populated DRS, not an empty one.

Would anyone have any insight on this possible contradiction?

Kaljurand commented 1 year ago

ACE only allows single capital letters with optionally trailing integers in apposition: see http://attempto.ifi.uzh.ch/site/docs/ace_constructionrules.html (and search for apposition). If I remember correctly then an earlier version of ACE also allowed proper names in apposition, so there are some tests for that, whose behaviour then changed at some point. The predicate text_drs_eval that you quote actually has an empty DRS (drs([], [])), but for some reason a non-empty syntax tree. I guess it's a left-over from an earlier time, and perhaps only some of the syntax trees in the test file reflect the latest state. We are not actively testing the syntax trees, because these are not considered part of the stable API. So, while technically a bug (i.e. all syntax trees in this file should be updated), I'd consider it low priority.

The current behaviour of APE for this input is to return an empty DRS and syntax tree, and provide an error message.

http://attempto.ifi.uzh.ch/ws/ape/apews.perl?text=a+man+Kaarel+works+hard.&solo=&cdrs=on&cdrspp=on&csyntax=on&csyntaxpp=on&csyntaxd=on&csyntaxdpp=on

<apeResult>
<duration tokenizer="0.000" parser="0.001" refres="0.000"/>
<drs>drs([],[])</drs>
<syntax>[]</syntax>
<syntaxpp/>
<syntaxd>[]</syntaxd>
<syntaxdpp/>
<drspp>No conditions [] </drspp>
<messages>
<message importance="error" type="sentence" sentence="1" token="4" value="a man Kaarel <> works hard."
    repair="This is the first sentence that was not ACE. The sign <> indicates the position where parsing failed."/>
</messages>
</apeResult>
labriola commented 1 year ago

Thank you for the response; I appreciate it.

I believe that is the source of my confusion. I have been trying to get some of the example found here: http://attempto.ifi.uzh.ch/site/pubs/papers/ace3manual.pdf

To work, but it would appear this is an older document and these constructs are no longer supported.

e.g. "The customer Mr Miller inserts a card A." If the customer pushes the key ‘Terminate’ then SimpleMat displays the message ‘Amount is being prepared. Retract Card.’.

It does beg the question of how to further attach strings to nouns (such as the key example above) but I will see if I can find another approach.

Thanks again, I do appreciate your time

Kaljurand commented 1 year ago

The latest version of ACE is 6.7, and the ACE parser APE only supports that version. The long PDF manual that exists for v3 was split into 4 shorter documents at some point:

I'd attach strings to nouns using transitive verbs and possibly use proper names instead of strings, e.g.

Mr-Miller is a customer and inserts a card.
There is a key that is labelled by "Terminate".
If the customer pushes the key then SimpleMat displays "Amount is being prepared. Retract Card.".

This even compiles to OWL (with DL-Safe rules):

   DLSafeRule(
      Body(
         ObjectPropertyAtom(
            :push
            _:334552875917958970
            _:687215219289786240
         )
      )
      Head(
         DataPropertyAtom(
            :display
            :SimpleMat
            "Amount is being prepared. Retract Card."^^<http://www.w3.org/2001/XMLSchema#string>
         )
      )
   )
   ClassAssertion(
      :key
      _:687215219289786240
   )
   SameIndividual(
      :Mr-Miller
      _:334552875917958970
   )
   ClassAssertion(
      :customer
      _:334552875917958970
   )
   ClassAssertion(
      ObjectSomeValuesFrom(
         :insert
         :card
      )
      :Mr-Miller
   )

(Although now I notice that the bit about "Terminate" is dropped, which seems to be a bug, see #40)