[Attempto] Misleading error message in command

Kaarel Kaljurand kaljurand at gmail.com
Fri Apr 1 11:24:21 CEST 2011


Hi,

On Thu, Mar 31, 2011 at 21:41, Joshua TAYLOR <tayloj at cs.rpi.edu> wrote:
> When I ask the webclient to parse the text:
>
> John, initiate a fluent!
>
> I get the errors:
>
> error   sentence        1       John, initiate a fluent <>!     Commas must be followed
> by 'and' or 'or', or must occur at specified positions in lists, sets
> and commands.

yes, this error message is wrong in the sense that an error message
should point out the smallest modification to a text to make it
syntactically correct. In the above sentence the smallest modification
is to change the word "fluent", and the comma should stay where it is.

The module parser/sentence_failure.pl that generates some of the error
messages has limitations, e.g. it is not aware of the syntax tree and
therefore some types of checks for possible sources of errors are not
performed. For example, the predicate that checks for the incorrect
use of commas looks like this:

% check for illegal use of commas
get_sentence_error_text(SentenceTokens, 'Commas must be followed by
\'and\' or \'or\', or must occur at specified positions in lists, sets
and commands.') :-
        append(Front, [',', NextToken | Tail], SentenceTokens),
        % comma not followed by 'or'
        NextToken \= and,
        % comma not followed by 'and'
        NextToken \= or,
        % comma not within list; not absolutely fool-proof check since
illegal comma in "[...] ... , ... [...]" will not be found
        \+ (member('[', Front), member(']', Tail)),
        % comma not within set; not absolutely fool-proof check since
illegal comma in "{...} ... , ... {...}" will not be found
        \+ (member('{', Front), member('}', Tail)).

--
kaarel


More information about the attempto mailing list