The crucial point during the process of generation of paraphrases is that one not only has to guarantee that an ambiguous utterance is restated differently but also that only relevant paraphrases are to be produced that appropriately resolve structural ambiguities.
In order to be able to take into account the source of ambiguity obtained
during parsing the basic idea of the proposed approach is to generate
paraphrases along `parsed' structures. Suppose that parsing of an
utterance has yielded two interpretations LF' and LF''
with corresponding derivations trees d and d
.
It is now possible to generate a new utterance for each logical
form LF
by means of the monitored generation algorithm described
in the previous section. In this case, the corresponding
derivation tree d
of LF
is marked by means of the others. The so
marked tree is then used to `guide' the generation step as already known.
Because most of the functions to use are already defined in section 5.5 we can directly specify the top-level function interactive_parsing as follows:
interactive_parsing(Str, Sign):- find_all_parse(sign(_,Str,_,_), SignSet, TreeSet), ( SignSet = [Sign] -> true ; generate_paraphrases(SignSet, TreeSet, Paraphrases), ask_best_answer(SignSet, Paraphrases, Sign) ).
interactive_parsing(goal): TreeSet := find_all_parses(string(goal)) if card(TreeSet) = 1 then return semantics(root_node(first(TreeSet))) else Paraphrases := generate_paraphrases(TreeSet); ask_best_answer(TreeSet,Paraphrases). generate_paraphrases(TreeSet): for each Tree in TreeSet do collect generate_paraphrase(Tree, TreeSet/{Tree}) in Paraphrases finally return Paraphrases. generate_paraphrase(Tree,TreeSet): Guide := mark(Tree,TreeSet); revision(Guide).
The predicate FIND_ALL_PARSE computes all possible parses TREESET of a given string (note, that this function also deletes spurious ambiguities). If the parser obtains multiple interpretations (i.e., the cardinality of TreeSet is greater than one) then for each element of TreeSet a paraphrase has to be generated. This is done by means of the predicate GENERATE_PARAPHRASES, whose explanation will be given below. All computed Paraphrases are then given to the user who has to choose the appropriate paraphrase. The corresponding logical form of the chosen reading determines the result of the paraphrasing process.
For each parsed sign of the form a paraphrase is generated in the following way: First its derivation tree TREE is marked by means of the set of derivations trees contained in TreeSet/Tree. The resulting marked derivation tree Guide is then used in order to guide the generation of the sign's logical form LF using the predicate mgen. Note, that this directly reflects the definition of the predicate revision, which definition was given in the previous section.