(*########################################################################*)
(*                                                                        *)
(*                 ACG development toolkit                                *)
(*                                                                        *)
(*                  Copyright 2008-2024 INRIA                             *)
(*                                                                        *)
(*  More information on "https://acg.loria.fr/"                           *)
(*  License: CeCILL, see the LICENSE file or "http://www.cecill.info"     *)
(*  Authors: see the AUTHORS file                                         *)
(*                                                                        *)
(*                                                                        *)
(*                                                                        *)
(*                                                                        *)
(*                                                                        *)
(*########################################################################*)

(*  First print the help message that describes the commands *)
help;

(* Require a user interaction (press return) to continue between
commands by using the "-s" option of `acg` *)

(*  First load an acg. It requires having first compiled tag.acg *)
(*  with the acgc.opt compiler with: *)
(*  acgc tag.acg *)
load "tag.acgo";

(*  Alternatively, you can just load the data with the command *)
(* load "tag.acg"; *)


(*  List the available data *)
list;

(*  Ok. We are ready to try to realize some abstract terms. *)
(*  We require to realize in the context of 3 lexicons (tag_syntax, *)
(*  tag_yields and tag_semantics) a term *)
(*  build on the *SHARED* abstract vocabulary of the 3 lexicons *)
realize lexicons=tag_syntax, tag_yields, tag_semantics < "C_sleeps I_s I_vp (C_dog C_a (C_black (C_big (C_new I_n)))) : S";

(*  Look at the result. Can we parse the string generated by this term? *)
(*  Yes. Just run: *)
parse lexicon=tag_yields type=S < "a + new + big + black + dog + sleeps  : string";

(*  Ok, now we're ready to do the same for another term *)
realize lexicons=tag_syntax, tag_yields, tag_semantics < "C_chases I_s I_vp (C_dog C_every I_n) (C_cat C_a I_n) : S";

(*  And now let's see if we can get long distance dependencies *)
realize lexicons=tag_syntax, tag_yields, tag_semantics < "C_loves (C_claims I_s I_vp C_paul) I_vp C_john C_mary : S";

realize lexicons=tag_syntax, tag_yields, tag_semantics < "C_to_love (C_claims I_s I_vp C_paul) (C_seems I_vp) C_john C_mary : S";

realize lexicons=tag_syntax, tag_yields, tag_semantics < "C_liked ( C_said (C_does_think I_s I_vp C_paul) I_vp C_john) I_vp C_who C_bill : S";

(*  And we can recover this term from its semantic realization: *)
parse lexicon=tag_semantics type=S < "WHO (lambda y. think p (say j (like b y)))  : t";

parse lexicon=tag_semantics type=S < "All x. (dog x) > (Ex x'. (cat x') & (chase x x'))  : t";

