The first and most straightforward solution to obtain only un-ambiguous utterances during generation could be described as a `brute force' solution. The generator derives possible utterances for a given logical form. For each of these utterances it is easy to check whether it is ambiguous or not, by counting the results the parser delivers for that utterance.
In a Prolog implementation this simple solution can be defined as follows. Note that we assume for simplicity that linguistic signs are represented with terms sign(LF,Str,Syn,Der) where LF represents the semantic information, Str represents the string and Syn represents syntactic information. The fourth argument position will be used later in this paper to represent derivation trees.
monitor(sign(LF,Str,Syn,Der)):- generate(sign(LF,Str,Syn,Der)), unambiguous(Str). unambiguous(Str) :- setof(LF,D^S^parse(sign(LF,Str,S,D), [El]).The predicates parse/1 and generate/1 call respectively the underlying parser and generator. The setof predicate is used to obtain the set of solutions of the parse predicate, where
^indicates that D and S are existentially quantified. By instantiating the resulting set as a set with exactly one element, we implement the idea that the utterance should be un-ambiguous (in that case there is only one parse result). Given Prolog's search strategy this definition implies that the generator generates solutions until an un-ambiguous utterance is generated.
The problem with this `generate and test' approach is that the search of the generator is not directed by the goal to produce an un-ambiguous result. We will now present a more involved monitoring strategy which is oriented towards the goal of producing an un-ambiguous utterance.