From eb3d750459c5ab6fd0fa2266175e1ad4a4e3d33f Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 8 Nov 2006 15:08:09 +0000 Subject: [PATCH] godis tram grammars, augmented with Fin --- examples/godis-tram/Common/GodisLang.gf | 399 +++++++++++++++++++ examples/godis-tram/Common/GodisLangEng.gf | 134 +++++++ examples/godis-tram/Common/GodisLangFin.gf | 154 +++++++ examples/godis-tram/Common/GodisLangSwe.gf | 150 +++++++ examples/godis-tram/Common/GodisSystem.gf | 135 +++++++ examples/godis-tram/Common/GodisSystemEng.gf | 4 + examples/godis-tram/Common/GodisSystemFin.gf | 4 + examples/godis-tram/Common/GodisSystemI.gf | 152 +++++++ examples/godis-tram/Common/GodisSystemSem.gf | 134 +++++++ examples/godis-tram/Common/GodisSystemSwe.gf | 4 + examples/godis-tram/Common/GodisUser.gf | 33 ++ examples/godis-tram/Common/GodisUserEng.gf | 32 ++ examples/godis-tram/Common/GodisUserFin.gf | 5 + examples/godis-tram/Common/GodisUserI.gf | 34 ++ examples/godis-tram/Common/GodisUserSem.gf | 33 ++ examples/godis-tram/Common/GodisUserSwe.gf | 31 ++ examples/godis-tram/Common/Prolog.gf | 60 +++ examples/godis-tram/Tram/Lines.gf | 22 + examples/godis-tram/Tram/LinesEng.gf | 26 ++ examples/godis-tram/Tram/LinesFin.gf | 42 ++ examples/godis-tram/Tram/LinesSem.gf | 25 ++ examples/godis-tram/Tram/LinesSwe.gf | 26 ++ examples/godis-tram/Tram/Stops.gf | 66 +++ examples/godis-tram/Tram/StopsEng.gf | 66 +++ examples/godis-tram/Tram/StopsFin.gf | 71 ++++ examples/godis-tram/Tram/StopsSem.gf | 66 +++ examples/godis-tram/Tram/StopsSwe.gf | 68 ++++ examples/godis-tram/Tram/TramLexicon.gf | 41 ++ examples/godis-tram/Tram/TramLexiconEng.gf | 34 ++ examples/godis-tram/Tram/TramLexiconFin.gf | 34 ++ examples/godis-tram/Tram/TramLexiconSwe.gf | 40 ++ examples/godis-tram/Tram/TramSystem.gf | 64 +++ examples/godis-tram/Tram/TramSystemEng.gf | 5 + examples/godis-tram/Tram/TramSystemFin.gf | 5 + examples/godis-tram/Tram/TramSystemI.gf | 49 +++ examples/godis-tram/Tram/TramSystemSem.gf | 45 +++ examples/godis-tram/Tram/TramSystemSwe.gf | 4 + examples/godis-tram/Tram/TramUser.gf | 62 +++ examples/godis-tram/Tram/TramUserEng.gf | 59 +++ examples/godis-tram/Tram/TramUserFin.gf | 14 + examples/godis-tram/Tram/TramUserFin0.gf | 6 + examples/godis-tram/Tram/TramUserI.gf | 56 +++ examples/godis-tram/Tram/TramUserSem.gf | 39 ++ examples/godis-tram/Tram/TramUserSwe.gf | 57 +++ examples/godis-tram/log.txt | 36 ++ 45 files changed, 2626 insertions(+) create mode 100644 examples/godis-tram/Common/GodisLang.gf create mode 100644 examples/godis-tram/Common/GodisLangEng.gf create mode 100644 examples/godis-tram/Common/GodisLangFin.gf create mode 100644 examples/godis-tram/Common/GodisLangSwe.gf create mode 100644 examples/godis-tram/Common/GodisSystem.gf create mode 100644 examples/godis-tram/Common/GodisSystemEng.gf create mode 100644 examples/godis-tram/Common/GodisSystemFin.gf create mode 100644 examples/godis-tram/Common/GodisSystemI.gf create mode 100644 examples/godis-tram/Common/GodisSystemSem.gf create mode 100644 examples/godis-tram/Common/GodisSystemSwe.gf create mode 100644 examples/godis-tram/Common/GodisUser.gf create mode 100644 examples/godis-tram/Common/GodisUserEng.gf create mode 100644 examples/godis-tram/Common/GodisUserFin.gf create mode 100644 examples/godis-tram/Common/GodisUserI.gf create mode 100644 examples/godis-tram/Common/GodisUserSem.gf create mode 100644 examples/godis-tram/Common/GodisUserSwe.gf create mode 100644 examples/godis-tram/Common/Prolog.gf create mode 100644 examples/godis-tram/Tram/Lines.gf create mode 100644 examples/godis-tram/Tram/LinesEng.gf create mode 100644 examples/godis-tram/Tram/LinesFin.gf create mode 100644 examples/godis-tram/Tram/LinesSem.gf create mode 100644 examples/godis-tram/Tram/LinesSwe.gf create mode 100644 examples/godis-tram/Tram/Stops.gf create mode 100644 examples/godis-tram/Tram/StopsEng.gf create mode 100644 examples/godis-tram/Tram/StopsFin.gf create mode 100644 examples/godis-tram/Tram/StopsSem.gf create mode 100644 examples/godis-tram/Tram/StopsSwe.gf create mode 100644 examples/godis-tram/Tram/TramLexicon.gf create mode 100644 examples/godis-tram/Tram/TramLexiconEng.gf create mode 100644 examples/godis-tram/Tram/TramLexiconFin.gf create mode 100644 examples/godis-tram/Tram/TramLexiconSwe.gf create mode 100644 examples/godis-tram/Tram/TramSystem.gf create mode 100644 examples/godis-tram/Tram/TramSystemEng.gf create mode 100644 examples/godis-tram/Tram/TramSystemFin.gf create mode 100644 examples/godis-tram/Tram/TramSystemI.gf create mode 100644 examples/godis-tram/Tram/TramSystemSem.gf create mode 100644 examples/godis-tram/Tram/TramSystemSwe.gf create mode 100644 examples/godis-tram/Tram/TramUser.gf create mode 100644 examples/godis-tram/Tram/TramUserEng.gf create mode 100644 examples/godis-tram/Tram/TramUserFin.gf create mode 100644 examples/godis-tram/Tram/TramUserFin0.gf create mode 100644 examples/godis-tram/Tram/TramUserI.gf create mode 100644 examples/godis-tram/Tram/TramUserSem.gf create mode 100644 examples/godis-tram/Tram/TramUserSwe.gf create mode 100644 examples/godis-tram/log.txt diff --git a/examples/godis-tram/Common/GodisLang.gf b/examples/godis-tram/Common/GodisLang.gf new file mode 100644 index 000000000..4a88945e2 --- /dev/null +++ b/examples/godis-tram/Common/GodisLang.gf @@ -0,0 +1,399 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common + +interface GodisLang = open Grammar, Prelude, PredefAbs in { + +---------------------------------------------------------------------- +-- different clause forms + +param ClForm = HasDone | IsDoing; + +oper + +ClauseForm : Type; +clauseForm : ClauseForm -> ClauseForm; + +hasDone : ClauseForm; +isDoing : ClauseForm; + +anter : ClauseForm -> Ant; + +---------------------------------------------------------------------- +-- punctuation on system utterances + +param Punctn = FullStop | QuestMark; + +oper + +Punctuation : Type; +fullStop, +questMark : Punctuation; + +consText : Punctuation -> Utt -> Text -> Text; + +---------------------------------------------------------------------- +-- focus + +emphasize : NP -> NP; +embed_NP : Str -> Str -> NP -> NP; + +---------------------------------------------------------------------- +-- user utterances + +UserQuestion, +UserAction, +UserAnswer, +UserShortAns, +UserProposition : Type; + +askQS : QCl -> UserQuestion; +ansCl : Cl -> UserAnswer; +ansNP : NP -> UserShortAns; + +reqVP : VP -> UserAction; +req1 : Str -> UserAction; +req1x : Str -> Str -> UserAction; +req2x : Str -> Str -> Str -> UserAction; + +not_user_prop : UserProposition -> SS; +not_user_short : UserShortAns -> SS; + +userGreet, +userQuit, +userYes, +userNo, +userOkay : SS; + +userCoordinate : SS -> SS -> SS; + +thank_you_Str, +i_want_to_Str, +please_Str, +this_that_Str : Str; + +use_QCl : QCl -> SS; +use_Cl : Cl -> SS; +use_NP : NP -> SS; +use_VP : VP -> SS; +use_Adv : Adv -> SS; + +---------------------------------------------------------------------- +-- system utterances + +hello, +goodbye, +yes, +no, + +is_that_correct_Post, +returning_to_Pre, +returning_to_act_Pre, +returning_to_issue_Pre, +i_dont_understand, +cant_answer_que_Pre, +not_valid_Post, + +icm_acc_pos, +icm_con_neg, +icm_reraise, +icm_loadplan, +icm_accommodate : Utt; + +icm_per_pos : String -> Utt; + +cncUtt : Utt -> Utt -> Utt; + +---------------------------------------------------------------------- +-- interrogative phrases + +which_N_sg : N -> IP; +which_N_pl : N -> IP; + +---------------------------------------------------------------------- +-- noun phrases + +sing_NP, +plur_NP : Str -> NP; + +the_CN_sg : CN -> NP; + +the_N_sg, +the_N_pl, +indef_N_sg, +indef_N_pl, +this_N_sg, +these_N_pl, +no_N_sg, +no_N_pl, +all_N_pl : N -> NP; + +the_A_super_N_sg, +indef_A_posit_N_sg, +no_A_posit_N_sg : A -> N -> NP; + +NP_Adv : NP -> Adv -> NP; +NP_Prep_NP : Prep -> NP -> NP -> NP; +NP_in_NP, +NP_of_NP, +NPgen_NP : NP -> NP -> NP; +NP_Cl : NP -> Cl; + +prefix_N : N -> N -> N; + +---------------------------------------------------------------------- +-- questions, q-clauses + +useQCl : (QCl ** ClauseForm) -> QS; + +which_N_are_AP, +which_N_is_AP : N -> AP -> QCl; +what_is_NP : NP -> QCl; +who_VP : VP -> QCl; + +which_N_do_you_want_to_V2 : N -> V2 -> QCl; +which_N_has_NP_V2 : N -> NP -> V2 -> QCl; +which_N_are_AP_Adv : N -> AP -> Adv -> QCl; + +is_the_N_AP : N -> AP -> QCl; +is_the_N_AP_Adv : N -> AP -> Adv -> QCl; + +which_N_are_Adv : N -> Adv -> QCl; +which_N_are_Adv_Adv : N -> Adv -> Adv -> QCl; + +is_the_N_Adv : N -> Adv -> QCl; +is_the_N_Adv_Adv : N -> Adv -> Adv -> QCl; + +---------------------------------------------------------------------- +-- adverbials + +Prep_NP : Prep -> NP -> Adv; +in_NP : NP -> Adv; + +---------------------------------------------------------------------- +-- clauses, sentences, answers, propositions + +useCl : (Cl ** ClauseForm) -> S; + +--generic_VP, +you_want_to_VP, +you_are_VPing : VP -> Cl; +you_VV_to_VP : VV -> VP -> Cl; +it_is_NP_who_VP : NP -> (VP ** ClauseForm) -> Cl; +NP_is_AP : NP -> AP -> Cl; +NP_is_AP_Adv : NP -> AP -> Adv -> Cl; +NP_is_Adv : NP -> Adv -> Cl; + +---------------------------------------------------------------------- +-- relative clauses + +useRCl : (RCl ** ClauseForm) -> RS; + +---------------------------------------------------------------------- +-- verb phrases, actions + +use_V : V -> VP; +V2_NP : V2 -> NP -> VP; +V2_the_N : V2 -> N -> VP; +V2_a_N : V2 -> N -> VP; +VPing : (VP ** ClauseForm) -> VP; +vp2Utt : VP -> Utt; + +---------------------------------------------------------------------- +-- general syntactical operations + +disjunct_QCl : QCl -> QCl -> QCl; +negate_Cl : Cl -> Cl; + +---------------------------------------------------------------------- +-- verbs + +see_V : V; + +do_V2, +have_V2, +understand_V2 : V2; + +know_VQ, +wonder_VQ : VQ; + +say_VS : VS; + +fail_VV, +like_VV : VV; + +---------------------------------------------------------------------- +-- nouns, proper nouns, common nouns and noun phrases + +information_N : N; + +you_NP : NP; + +---------------------------------------------------------------------- +-- closed word categories + +of_på_Prep, +for_Prep : Prep; + +not_Predet : Predet; +no_Quant : Quant; +all_Quant : QuantPl; + + +---------------------------------------------------------------------- +-- language independent implementations +---------------------------------------------------------------------- + +oper + +---------------------------------------------------------------------- +-- different clause forms + +ClauseForm = {clform : ClForm}; +clauseForm c = c; + +hasDone = {clform = HasDone}; +isDoing = {clform = IsDoing}; + +anter c = case c.clform of {HasDone => AAnter; IsDoing => ASimul}; + +---------------------------------------------------------------------- +-- punctuation on system utterances + +Punctuation = {punctuation : Punctn}; +fullStop = {punctuation = FullStop}; +questMark = {punctuation = QuestMark}; + +consText punct utt = let txt = PhrUtt NoPConj utt NoVoc in + case punct.punctuation of + { FullStop => TFullStop txt; QuestMark => TQuestMark txt }; + +---------------------------------------------------------------------- +-- focus + +emphasize = embed_NP "" ""; + +---------------------------------------------------------------------- +-- user utterances + +UserAction, +UserQuestion, +UserAnswer, +UserShortAns, +UserProposition = SS; + +askQS q = UttQS (UseQCl TPres ASimul PPos q); +ansCl c = UttS (UseCl TPres ASimul PPos c); +ansNP a = UttNP a; + +reqVP vp = + PhrUtt NoPConj + (variants{ UttImpSg PPos (ImpVP vp); + UttS (UseCl TPres ASimul PPos + (PredVP (UsePron i_Pron) (ComplVV want_VV vp))); + UttS (UseCl TCond ASimul PPos + (PredVP (UsePron i_Pron) (ComplVV like_VV vp))) }) + (variants{ NoVoc; please_Voc }); +req1 act = req1x act []; +req1x act = req2x act act; +req2x imp inf extra = variants { + ss ( variants { imp; i_want_to_Str ++ inf } ++ extra ++ optStr please_Str); + ss ( variants { please_Str; userOkay.s } ++ imp ++ extra )}; + +use_QCl = askQS; +use_Cl = ansCl; +use_NP = ansNP; +use_VP = reqVP; +use_Adv = UttAdv; + +---------------------------------------------------------------------- +-- system utterances + +cncUtt x y = mkUtt (x.s ++ y.s); + +---------------------------------------------------------------------- +-- interrogative phrases + +which_N_sg n = IDetCN whichSg_IDet NoNum NoOrd (UseN n); +which_N_pl n = IDetCN whichPl_IDet NoNum NoOrd (UseN n); + +---------------------------------------------------------------------- +-- noun phrases + +the_CN_sg cn = DetCN (DetSg (SgQuant DefArt) NoOrd) cn; + +the_N_sg n = the_CN_sg (UseN n); +the_N_pl n = DetCN (DetPl (PlQuant DefArt) NoNum NoOrd) (UseN n); +indef_N_sg n = DetCN (DetSg (SgQuant IndefArt) NoOrd) (UseN n); +indef_N_pl n = DetCN (DetPl (PlQuant IndefArt) NoNum NoOrd) (UseN n); +this_N_sg n = DetCN (DetSg (SgQuant this_Quant) NoOrd) (UseN n); +these_N_pl n = DetCN (DetPl (PlQuant this_Quant) NoNum NoOrd) (UseN n); +no_N_sg n = DetCN (DetSg (SgQuant no_Quant) NoOrd) (UseN n); +no_N_pl n = DetCN (DetPl (PlQuant no_Quant) NoNum NoOrd) (UseN n); +all_N_pl n = DetCN (DetPl all_Quant NoNum NoOrd) (UseN n); + +the_A_super_N_sg a n = DetCN (DetSg (SgQuant DefArt) (OrdSuperl a)) (UseN n); +indef_A_posit_N_sg a n = DetCN (DetSg (SgQuant IndefArt) NoOrd) (AdjCN (PositA a) (UseN n)); +no_A_posit_N_sg a n = DetCN (DetSg (SgQuant no_Quant) NoOrd) (AdjCN (PositA a) (UseN n)); + +NP_Adv = AdvNP; +NP_Prep_NP prep np np' = AdvNP np (PrepNP prep np'); + +NP_in_NP = NP_Prep_NP in_Prep; +NP_of_NP = NP_Prep_NP of_på_Prep; + +---------------------------------------------------------------------- +-- questions + +useQCl q = UseQCl TPres (anter q) PPos q; + +which_N_are_AP n ap = QuestVP (which_N_pl n) (UseComp (CompAP ap)); +which_N_is_AP n ap = QuestVP (which_N_sg n) (UseComp (CompAP ap)); +what_is_NP np = QuestVP whatSg_IP (UseComp (CompNP np)); +who_VP vp = QuestVP whoSg_IP vp; + +which_N_do_you_want_to_V2 n v2 = QuestSlash (which_N_sg n) (SlashVVV2 you_NP want_VV v2); +which_N_has_NP_V2 n np v2 = QuestSlash (which_N_pl n) (SlashV2 np v2); +which_N_are_AP_Adv n ap adv= QuestVP (which_N_pl n) (AdvVP (UseComp (CompAP ap)) adv); + +is_the_N_AP n ap = QuestCl (NP_is_AP (the_N_sg n) ap); +is_the_N_AP_Adv n ap adv = QuestCl (NP_is_AP_Adv (the_N_sg n) ap adv); + +which_N_are_Adv n a = QuestVP (which_N_pl n) (UseComp (CompAdv a)); +which_N_are_Adv_Adv n a aa = QuestVP (which_N_pl n) (AdvVP (UseComp (CompAdv a)) aa); + +is_the_N_Adv n a = QuestCl (PredVP (the_N_sg n) (UseComp (CompAdv a))); +is_the_N_Adv_Adv n a aa = QuestCl (PredVP (the_N_sg n) (AdvVP (UseComp (CompAdv a)) aa)); + +---------------------------------------------------------------------- +-- adverbials + +Prep_NP = PrepNP; +in_NP = PrepNP in_Prep; + +---------------------------------------------------------------------- +-- clauses, sentences, answers, propositions + +useCl c = UseCl TPres (anter c) PPos c; + +--generic_VP = GenericCl; +you_want_to_VP vp = PredVP you_NP (ComplVV want_VV vp); +you_are_VPing vp = PredVP you_NP (VPing (isDoing ** vp)); +you_VV_to_VP vv vp = PredVP you_NP (ComplVV vv vp); +it_is_NP_who_VP np vp = CleftNP np (UseRCl TPres (anter vp) PPos (RelVP IdRP vp)); +NP_is_AP np ap = PredVP np (UseComp (CompAP ap)); +NP_is_AP_Adv np ap adv= PredVP np (AdvVP (UseComp (CompAP ap)) adv); +NP_is_Adv np adv= PredVP np (UseComp (CompAdv adv)); + +---------------------------------------------------------------------- +-- relative clauses + +useRCl r = UseRCl TPres (anter r) PPos r; + +---------------------------------------------------------------------- +-- verb phrases, actions + +use_V = UseV; +V2_NP = ComplV2; +V2_the_N v2 n = ComplV2 v2 (the_N_sg n); +V2_a_N v2 n = ComplV2 v2 (indef_N_sg n); + +} diff --git a/examples/godis-tram/Common/GodisLangEng.gf b/examples/godis-tram/Common/GodisLangEng.gf new file mode 100644 index 000000000..89ecdd585 --- /dev/null +++ b/examples/godis-tram/Common/GodisLangEng.gf @@ -0,0 +1,134 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +instance GodisLangEng of GodisLang = + open Prelude, PredefCnc, GrammarEng, ParadigmsEng, (ResEng=ResEng), ParamX, ConstructX, + (Lex=LangEng), (Irreg=IrregEng) in { + +oper + +---------------------------------------------------------------------- +-- focus + +embed_NP a b x = {s = \\c => a ++ (x.s ! c) ++ b; a = x.a; lock_NP = <>}; + + +---------------------------------------------------------------------- +-- user utterances + +userGreet = ss ["hello"]; +userQuit = ss (variants{ ["goodbye"]; ["quit"] }); +userNo = ss ["no"]; +userYes = ss ["yes"]; +userOkay = variants { ss ["okay"]; ss ["ok"] }; + +userCoordinate x y = ss (x.s ++ "and" ++ optStr "then" ++ y.s); + +thank_you_Str = variants {["thank you"]; "great"; ["thanks"]}; +i_want_to_Str = variants{"i" ++ variants{"want"; ["would like"]} ++ "to"; + ["can you"]}; +please_Str = "please"; +this_that_Str = variants{"this"; "that"}; + +not_user_prop p = ss ( not_Predet.s ++ p.s ); +not_user_short a = ss ( not_Predet.s ++ a.s ); + +---------------------------------------------------------------------- +-- system utterances + +hello = mkUtt ["The mp3 player is ready to use"]; +goodbye = mkUtt ["Goodbye"]; +yes = mkUtt ["Yes"]; +no = mkUtt ["No"]; + +is_that_correct_Post = mkUtt [", is that correct"]; +returning_to_Pre = mkUtt ["Returning to"]; +returning_to_act_Pre = mkUtt ["Returning to"]; +returning_to_issue_Pre = mkUtt ["Returning to the issue of"]; +what_did_you_say = mkUtt ["What did you say"]; +what_do_you_mean = mkUtt ["What do you mean"]; +i_dont_understand = mkUtt ["Sorry, I don't quite understand"]; +cant_answer_que_Pre = mkUtt ["Sorry, I can't answer questions about"]; +not_valid_Post = mkUtt ["is not a valid option"]; + +icm_acc_pos = variants { mkUtt ["Okay"]; mkUtt thank_you_Str }; +icm_con_neg = mkUtt ["Hello?"]; +icm_reraise = mkUtt ["So, "]; +icm_loadplan = mkUtt ["Let's see"]; +icm_accommodate = mkUtt ["Alright "]; + +icm_per_pos x = mkUtt (["I thought you said"] ++ x.s); + + +---------------------------------------------------------------------- +-- noun phrases + +sing_NP s = ResEng.regNP s Sg ** {lock_NP = <>}; +plur_NP s = ResEng.regNP s Pl ** {lock_NP = <>}; + +NPgen_NP = NP_of_NP; + +NP_Cl np = {s = \\t,a,b,o => np.s ! ResEng.Nom; lock_Cl = <>}; + +prefix_N n = compoundN (UttNP (DetCN (DetSg MassDet NoOrd) (UseN n))).s; + +---------------------------------------------------------------------- +-- verb phrases, actions + +VPing vp = case vp.clform of {HasDone => vp; IsDoing => ProgrVP vp}; +vp2Utt vp = mkUtt (ResEng.infVP True vp (ResEng.agrP3 Sg)); +-- vp2Utt vp = mkUtt (vp.s2 ! (ResEng.agrP3 Sg));i_want_to_Str ++ + + +---------------------------------------------------------------------- +-- general syntactical operations + +disjunct_QCl q q' = + {s = \\t,a,p,x => q.s!t!a!p!x ++ "or" ++ q'.s!t!a!p!x; + lock_QCl = <>}; + +negate_Cl c = + {s = \\t,a,p,o => c.s!t!a!(case p of {ResEng.CNeg _ => ResEng.CPos; ResEng.CPos => ResEng.CNeg Prelude.True})!o; + lock_Cl = <>}; + +---------------------------------------------------------------------- +-- verbs + +see_V = Irreg.see_V; + +do_V2 = Lex.do_V2; +have_V2 = Lex.have_V2; +understand_V2 = Lex.understand_V2; + +know_VQ = mkVQ Irreg.know_V; +wonder_VQ = Lex.wonder_VQ; + +say_VS = Lex.say_VS; + +fail_VV = mkVV (regV "fail"); +like_VV = mkVV (regV "like"); + +---------------------------------------------------------------------- +-- nouns, proper nouns, common nouns and noun phrases + +information_N = regN "information"; + +you_NP = UsePron Lex.youSg_Pron; + +---------------------------------------------------------------------- +-- closed word categories + +of_på_Prep = mkPrep "of"; +for_Prep = mkPrep "for"; + +not_Predet = ss "not" ** {lock_Predet = <>}; + +no_Quant = {s = \\_ => "no"; lock_Quant = <>}; +all_Quant = {s = "all"; lock_QuantPl = <>}; + + +------------------------------------------------------------------ + +i_dont_want_to = variants { ["i do not want to"]; + ["i don't want to"] }; + +} diff --git a/examples/godis-tram/Common/GodisLangFin.gf b/examples/godis-tram/Common/GodisLangFin.gf new file mode 100644 index 000000000..bc7f62652 --- /dev/null +++ b/examples/godis-tram/Common/GodisLangFin.gf @@ -0,0 +1,154 @@ +--# -path=.:prelude:alltenses + +instance GodisLangFin of GodisLang = + open Prelude, PredefCnc, GrammarFin, + ParadigmsFin, (ResFin=ResFin), ParamX, ConstructX, + (Lex=LangFin) in { + +--flags optimize = noexpand ; + +oper + +TODO : (a : Type) -> a = Predef.error "TODO" ; + +---------------------------------------------------------------------- +-- focus + +embed_NP a b x = TODO NP ; +----{s = \\c => a ++ (x.s ! c) ++ b; a = x.a; lock_NP = <>}; + + +---------------------------------------------------------------------- +-- user utterances + +userGreet = ss ["hei"]; +userQuit = ss (variants{ ["näkemiin"]; ["lopetetaan"] }); +userNo = ss ["ei"]; +userYes = ss ["kyllä"]; +userOkay = variants { ss ["okei"]; ss ["selvä"] }; + +userCoordinate x y = ss (x.s ++ "ja" ++ optStr "sitten" ++ y.s); + +thank_you_Str = variants {"kiitos"; "loistavaa"; "kiitti"}; +i_want_to_Str = variants {"haluan"; "haluaisin"} ; + +please_Str = ["ole hyvä"] ; +this_that_Str = variants{"tämä"; "tuo"}; + +not_user_prop p = ss ( Predef.toStr Predet not_Predet ++ p.s ); +not_user_short a = ss ( Predef.toStr Predet not_Predet ++ a.s ); + +---------------------------------------------------------------------- +-- system utterances + +hello = mkUtt ["Valmis"]; +goodbye = mkUtt ["Näkemiin"]; +yes = mkUtt ["Kyllä"]; +no = mkUtt ["Ei"]; + +is_that_correct_Post = mkUtt [", pitääkö paikkansa"]; +returning_to_Pre = mkUtt ["Takaisin kohtaan"]; +returning_to_act_Pre = mkUtt ["Takaisin kohtaan"]; +returning_to_issue_Pre = mkUtt ["Takaisin aiheeseen"]; +what_did_you_say = mkUtt ["Mitä sanoit"]; +what_do_you_mean = mkUtt ["Mitä tarkoitat"]; +i_dont_understand = mkUtt ["Anteeksi, en ymmärrä"]; +cant_answer_que_Pre = mkUtt ["Anteeksi, en tiedä mitään aiheesta"]; +not_valid_Post = mkUtt ["ei ole mahdollinen vaihtoehto"]; + +icm_acc_pos = variants { mkUtt ["Okei"]; mkUtt thank_you_Str }; +icm_con_neg = mkUtt ["No?"]; +icm_reraise = mkUtt ["No niin, "]; +icm_loadplan = mkUtt ["Katsotaan"]; +icm_accommodate = mkUtt ["Selvä"]; + +icm_per_pos x = mkUtt (["Luulin että sanoit että"] ++ x.s); + + +---------------------------------------------------------------------- +-- noun phrases + +sing_NP s = mkNP (nLinux s) singular ; ---- +plur_NP s = mkNP (nLinux s) plural ; + +NPgen_NP np1 np2 = AdvNP np2 (PrepNP possess_Prep np1) ; ---- + +NP_Cl np = TODO Cl ; + +prefix_N n1 n2 = n2 ; ---- + +---------------------------------------------------------------------- +-- verb phrases, actions + +VPing vp = case vp.clform of { + HasDone => vp; + IsDoing => ProgrVP vp + }; + +vp2Utt vp = UttVP vp ; + + +---------------------------------------------------------------------- +-- general syntactical operations + +disjunct_QCl q q' = + {s = \\t,a,p => q.s!t!a!p ++ "vai" ++ q'.s!t!a!p; + lock_QCl = <>}; + +negate_Cl c = + {s = \\t,a,p,o => c.s!t!a!(case p of { + Neg => Pos; + Pos => Neg + })!o; + lock_Cl = <>}; + +---------------------------------------------------------------------- +-- verbs + +see_V = Lex.see_V2 ** {lock_V = <>}; ---- + +do_V2 = Lex.do_V2; +have_V2 = Lex.have_V2; +understand_V2 = Lex.understand_V2; + +know_VQ = mkVQ (reg2V "tietää" "tiesi") ; +wonder_VQ = Lex.wonder_VQ; + +say_VS = Lex.say_VS; + +fail_VV = mkVV (regV "epäonnistua"); +like_VV = mkVV (regV "haluta"); ---- + +---------------------------------------------------------------------- +-- nouns, proper nouns, common nouns and noun phrases + +information_N = regN "informaatio"; + +you_NP = UsePron Lex.youSg_Pron; + +---------------------------------------------------------------------- +-- closed word categories + +of_på_Prep = casePrep genitive ; +for_Prep = casePrep allative ; + +not_Predet = {s = \\n,c => "ei" ; lock_Predet = <>} ; ---- + +no_Quant = TODO Quant ; +all_Quant = TODO QuantPl ; + + +------------------------------------------------------------------ + +i_dont_want_to = variants { ["en halua"]; + ["en tahdo"] }; + +-- Finnish-specific + +-- local cases in free variation + +in_Case : Case = variants {adessive ; inessive} ; +to_Case : Case = variants {allative ; illative} ; +from_Case : Case = variants {ablative ; elative} ; + +} diff --git a/examples/godis-tram/Common/GodisLangSwe.gf b/examples/godis-tram/Common/GodisLangSwe.gf new file mode 100644 index 000000000..6970f89c6 --- /dev/null +++ b/examples/godis-tram/Common/GodisLangSwe.gf @@ -0,0 +1,150 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +instance GodisLangSwe of GodisLang = + open Prelude, PredefCnc, GrammarSwe, ParadigmsSwe, ConstructX, + MorphoSwe, CommonScand, (Lex=LexiconSwe), (Irreg=IrregSwe) in { + +oper + +---------------------------------------------------------------------- +-- focus + +embed_NP a b x = {s = \\c => a ++ (x.s ! c) ++ b; a = x.a; lock_NP = <>}; + + +---------------------------------------------------------------------- +-- user utterances + +userGreet = ss ["hej"]; +userQuit = ss ["hejdå"]; +userNo = ss ["nej"]; +userYes = ss ["ja"]; +userOkay = variants { ss ["okej"]; ss ["ok"]; ss ["okay"] }; + +userCoordinate x y = ss (x.s ++ "och" ++ optStr "sedan" ++ y.s); + +thank_you_Str = variants{ "schysst"; "tack"; userOkay.s }; +i_want_to_Str = variants{ "jag" ++ variants{ "vill"; ["skulle vilja"] }; + ["kan du"] }; +please_Str = "tack"; +this_that_Str = variants{ variants{"den";"det"} ++ optStr "här"; + "denna"; "detta" }; + +not_user_prop p = ss ( "inte" ++ p.s ); +not_user_short a = ss ( "inte" ++ a.s ); + +---------------------------------------------------------------------- +-- system utterances + +hello = mkUtt ["MP3 spelaren är redo"]; +goodbye = mkUtt ["Hejdå"]; +yes = mkUtt ["Ja"]; +no = mkUtt ["Nej"]; + +is_that_correct_Post = mkUtt [", är det korrekt"]; +returning_to_Pre = mkUtt ["Återgår till"]; +returning_to_act_Pre = mkUtt ["Återgår till att"]; +returning_to_issue_Pre = mkUtt ["Återgår till frågan om"]; +what_did_you_say = mkUtt ["Vad sa du"]; +what_do_you_mean = mkUtt ["Vad menar du"]; +i_dont_understand = mkUtt ["Jag förstår inte riktigt"]; +cant_answer_que_Pre = mkUtt ["Ledsen , jag kan inte svara på frågor om"]; +not_valid_Post = mkUtt ["går inte att välja"]; + +icm_acc_pos = mkUtt thank_you_Str; +icm_con_neg = mkUtt ["Hallå?"]; +icm_reraise = mkUtt ["Så ,"]; +icm_loadplan = mkUtt ["Få se"]; +icm_accommodate = mkUtt ["Visst"]; + +icm_per_pos x = mkUtt (["Jag tyckte du sa"] ++ x.s); + + +---------------------------------------------------------------------- +-- noun phrases + +sing_NP s = regNP s (s+"s") SgUtr ** {lock_NP = <>}; +plur_NP s = regNP s (s+"s") Plg ** {lock_NP = <>}; + +NPgen_NP = NP_of_NP; + +NP_Cl np = {s = \\t,a,b,o => np.s ! nominative; lock_Cl = <>}; + +prefix_N n1 n2 = {s = \\n,s,c => n1.s!Sg!Indef!Gen ++ n2.s!n!s!c; + g = n2.g; + lock_N = <>}; + + +---------------------------------------------------------------------- +-- actions/verb phrases + +VPing act = act; +vp2Utt vp = mkUtt (infVP vp (agrP3 utrum Sg)); +-- UttVP vp; + + +---------------------------------------------------------------------- +-- general syntactical operations + +disjunct_QCl q q' = + {s = \\t,a,p,x => q.s!t!a!p!x ++ "eller" ++ q'.s!t!a!p!x; + lock_QCl = <>}; + +negate_Cl c = + {s = \\t,a,p,o => c.s!t!a!(case p of {Neg=>Pos; Pos=>Neg})!o; + lock_Cl = <>}; + +-- disjunct_Utt u u' = ss (u.s ++ "eller" ++ u'.s); +-- disjunct_VP vp vp' = +-- insertObj (\\agr => "eller" ++ (ImpVP vp').s!Pos!(agr.gn)) vp; + + +---------------------------------------------------------------------- +-- verbs + +see_V = Irreg.se_V; + +do_V2 = Lex.do_V2; +have_V2 = Lex.have_V2; +understand_V2 = Lex.understand_V2; + +know_VQ = mkVQ Irreg.veta_V; +wonder_VQ = Lex.wonder_VQ; + +say_VS = Lex.say_VS; + +fail_VV = mkVV (mkV "misslyckas" "misslyckas" "misslyckas" "misslyckades" "misslyckats" "misslyckad"); +like_VV = want_VV; + +---------------------------------------------------------------------- +-- nouns, proper nouns, common nouns and noun phrases + +information_N = mk2N "information" "informationer"; + +you_NP = UsePron youSg_Pron; + +---------------------------------------------------------------------- +-- closed word categories + +of_på_Prep = mkPrep "på"; +for_Prep = mkPrep "för"; + +not_Predet = {s = \\_ => "inte"; lock_Predet = <>}; + +no_Quant = {s = table {Sg => \\_ => table {Utr => "ingen"; + Neutr => "inget"}; + Pl => \\_,_ => "inga"}; + det = DIndef; + lock_Quant = <>}; + +all_Quant = {s = \\_,_ => "alla"; + det = DIndef; + lock_QuantPl = <>}; + + + +---------------------------------------------------------------------- + +i_dont_want_to = ["jag vill inte"]; + +} diff --git a/examples/godis-tram/Common/GodisSystem.gf b/examples/godis-tram/Common/GodisSystem.gf new file mode 100644 index 000000000..2569c1ec3 --- /dev/null +++ b/examples/godis-tram/Common/GodisSystem.gf @@ -0,0 +1,135 @@ +--# -path=.:prelude + +abstract GodisSystem = PredefAbs ** { + +cat + +-- Participant; + +Move; +[Move]{1}; +S; + +ShortAns; + +Proposition; + +-- NOTE: Question means only WhQ +-- this division is for Multimodality to work +Question; +YNQ; AltQ; +[Proposition]{2}; + +-- special kind of proposition best linearized as a VP, +-- only used in Y/N and Alt questions starting with "do you want to ..." +-- this is for VP aggregation to work +VPProposition; -- issue(X^p(X)) and action(a) +[VPProposition]{2}; + +Action; +Reason; + + +fun + +-- usr, sys : Participant; + +---------------------------------------------------------------------- +-- forming Questions + +action_Q, +issue_Q : Question; + +ynq : Proposition -> YNQ; +altq : [Proposition] -> AltQ; +-- BaseProposition : Proposition -> Proposition -> [Proposition]; +-- ConsProposition : Proposition -> [Proposition] -> [Proposition]; + +---------------------------------------------------------------------- +-- forming Propositions + +not : Proposition -> Proposition; +-- done : Action -> Proposition; +fail : Question -> Reason -> Proposition; +-- und : Participant -> Proposition -> Proposition; + +---------------------------------------------------------------------- +-- forming VPPropositions, and associated questions + +action : Action -> VPProposition; +issue : Question -> VPProposition; + +vp_ynq : VPProposition -> YNQ; +vp_altq : [VPProposition] -> AltQ; +-- BaseVPProposition : VPProposition -> VPProposition -> [VPProposition]; +-- ConsVPProposition : VPProposition -> [VPProposition] -> [VPProposition]; + +---------------------------------------------------------------------- +-- short answers + +notS : ShortAns -> ShortAns; + + +---------------------------------------------------------------------- +-- dialogue moves + +answer_yes, +answer_no : Move; + +greet, +quit : Move; +ask : Question -> Move; +askYNQ : YNQ -> Move; +askAltQ : AltQ -> Move; +answer : Proposition -> Move; +answerVP : VPProposition -> Move; +shortAns : ShortAns -> Move; + +request, +confirm : Action -> Move; +reportFailure : Action -> Reason -> Move; + +answerFailure : Question -> Reason -> Move; + +---------------------------------------------------------------------- +-- ICM + +icm_acc_pos, +icm_con_neg, +icm_per_neg, +icm_per_int, +icm_sem_neg, +icm_sem_int, +icm_und_neg, +icm_reraise, +icm_loadplan, +icm_accommodate : Move; + +icm_per_pos : String -> Move; +icm_und_int_prop, +icm_und_pos_prop, +icm_acc_neg_prop : Proposition -> Move; +icm_acc_neg_que : Question -> Move; +icm_sem_pos_move : Move -> Move; +icm_sem_pos_shortAns : ShortAns -> Move; +icm_und_pos_vp, +icm_und_int_vp : {- Participant -> -} VPProposition -> Move; +icm_reraise_act : Action -> Move; + +icm_reraise_whq, +icm_accommodate_whq, +icm_reaccommodate_whq : Question -> Move; +icm_reraise_ynq, +icm_accommodate_ynq, +icm_reaccommodate_ynq : YNQ -> Move; +icm_und_int_altq, +icm_reraise_altq, +icm_accommodate_altq, +icm_reaccommodate_altq: AltQ -> Move; + +-- BaseMove : Move -> [Move]; +-- ConsMove : Move -> [Move] -> [Move]; + +godis_utterance : [Move] -> S; + +} diff --git a/examples/godis-tram/Common/GodisSystemEng.gf b/examples/godis-tram/Common/GodisSystemEng.gf new file mode 100644 index 000000000..c30c3c579 --- /dev/null +++ b/examples/godis-tram/Common/GodisSystemEng.gf @@ -0,0 +1,4 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete GodisSystemEng of GodisSystem = GodisSystemI with + (Grammar=GrammarEng), (Extra=ExtraEng), (GodisLang=GodisLangEng); diff --git a/examples/godis-tram/Common/GodisSystemFin.gf b/examples/godis-tram/Common/GodisSystemFin.gf new file mode 100644 index 000000000..946cc9490 --- /dev/null +++ b/examples/godis-tram/Common/GodisSystemFin.gf @@ -0,0 +1,4 @@ +--# -path=.:prelude:alltenses + +concrete GodisSystemFin of GodisSystem = GodisSystemI with + (Grammar=GrammarFin), (Extra=ExtraFin), (GodisLang=GodisLangFin); diff --git a/examples/godis-tram/Common/GodisSystemI.gf b/examples/godis-tram/Common/GodisSystemI.gf new file mode 100644 index 000000000..d299dc8ff --- /dev/null +++ b/examples/godis-tram/Common/GodisSystemI.gf @@ -0,0 +1,152 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common + +incomplete concrete GodisSystemI of GodisSystem = PredefCnc ** + open Prelude, Grammar, Extra, GodisLang, ConstructX, ParamX in { + +lincat + +Move = Utt ** Punctuation; +[Move], +S = Text; + +ShortAns = NP; + +Proposition = Cl ** ClauseForm; +[Proposition], +Question, +YNQ, AltQ = QCl ** ClauseForm; + +VPProposition = VP; +[VPProposition] = [VPI]; + +Action = VP ** ClauseForm; + +Reason = S; + +lin + +---------------------------------------------------------------------- +-- questions + +action_Q = isDoing ** + QuestSlash whatSg_IP (AdvSlash (SlashVVV2 (UsePron i_Pron) can_VV do_V2) + (PrepNP for_Prep you_NP)); +issue_Q = isDoing ** + QuestCl (PredVP you_NP (ComplVV want_VV + (ComplV2 have_V2 (DetCN someSg_Det (UseN information_N))))); + +ynq p = clauseForm p ** QuestCl p; +altq qs = qs; +BaseProposition p q = clauseForm p ** disjunct_QCl (QuestCl p) (QuestCl q); +ConsProposition p qs = clauseForm p ** disjunct_QCl (QuestCl p) qs; + +---------------------------------------------------------------------- +-- propositions + +not p = p ** negate_Cl p; +-- done a = clauseForm a ** PredVP (UsePron i_Pron) (VPing a); +{- +fail q r = hasDone ** + negate_Cl (PredVP (UsePron i_Pron) + (AdvVP (ComplVQ know_VQ (UseQCl TPres (anter q) PPos q)) + (SubjS because_Subj r))); +-} +---------------------------------------------------------------------- +-- vp-propositions + +action a = a; +{- +issue q = ComplVQ know_VQ (useQCl q); +-} + +vp_ynq p = isDoing ** QuestCl (PredVP you_NP (ComplVV want_VV p)); +vp_altq qs = isDoing ** QuestCl (PredVP you_NP (ComplVPIVV want_VV (ConjVPI or_Conj qs))); + + +BaseVPProposition p q = BaseVPI (MkVPI p) (MkVPI q); +ConsVPProposition p qs = ConsVPI (MkVPI p) qs; + +---------------------------------------------------------------------- +-- short answers + +notS a = PredetNP not_Predet a; + +---------------------------------------------------------------------- +-- dialogue moves + +answer_yes = fullStop ** yes; +answer_no = fullStop ** no; + +greet = fullStop ** hello; +quit = fullStop ** goodbye; +shortAns a = fullStop ** UttNP a; +request a = fullStop ** UttImpSg PPos (ImpVP a); + +ask q = questMark ** UttQS (useQCl q); +askYNQ q = questMark ** UttQS (useQCl q); +askAltQ q = questMark ** UttQS (useQCl q); + +answer p = fullStop ** UttS (useCl p); +answerVP p = fullStop ** vp2Utt p; + +confirm a = fullStop ** UttS (useCl (clauseForm a ** PredVP (UsePron i_Pron) (VPing a))); + +reportFailure a r = fullStop ** + UttS (UseCl TPast ASimul PPos + (PredVP (UsePron i_Pron) + (AdvVP (ComplVV fail_VV a) (SubjS because_Subj r)))); + +answerFailure q r = fullStop ** UttS r; + +---------------------------------------------------------------------- +-- ICM + +icm_acc_pos = fullStop ** icm_acc_pos; +icm_con_neg = fullStop ** icm_con_neg; +icm_per_neg = fullStop ** + UttQS (UseQCl TPast ASimul PPos (QuestSlash whatSg_IP + (SlashV2 you_NP (UseVS say_VS)))); +icm_per_int = questMark ** what_did_you_say; +icm_sem_neg = fullStop ** i_dont_understand; +icm_sem_int = questMark ** what_do_you_mean; +icm_und_neg = fullStop ** i_dont_understand; + +icm_reraise = fullStop ** icm_reraise; +icm_loadplan = fullStop ** icm_loadplan; +icm_accommodate = fullStop ** icm_accommodate; + +icm_per_pos x = fullStop ** icm_per_pos x; +icm_und_int_prop p = questMark ** (UttS (useCl p)); +icm_und_pos_prop p = questMark ** (UttS (useCl p)); +icm_acc_neg_prop p = fullStop ** cncUtt (UttS (useCl p)) not_valid_Post; +icm_acc_neg_que q = fullStop ** + cncUtt cant_answer_que_Pre (UttAdv (AdvSC (EmbedQS (useQCl q)))); +icm_sem_pos_move m = fullStop ** m; +icm_sem_pos_shortAns a = fullStop ** UttNP a; +icm_und_pos_vp p = questMark ** (UttS (useCl (you_want_to_VP p ** isDoing))); +icm_und_int_vp p = questMark ** cncUtt (UttS (useCl (you_want_to_VP p ** isDoing))) is_that_correct_Post; +icm_reraise_act a = fullStop ** + cncUtt returning_to_act_Pre (vp2Utt a); -- (VPing a)); + +icm_und_int_altq q = questMark ** UttAdv (AdvSC (EmbedQS (useQCl q))); +icm_reraise_whq q = fullStop ** requestion q returning_to_Pre; +icm_reraise_ynq q = fullStop ** requestion q returning_to_Pre; +icm_reraise_altq q = fullStop ** requestion q returning_to_issue_Pre; +icm_accommodate_whq q = questMark ** icm_accommodate; +icm_accommodate_ynq q = questMark ** icm_accommodate; +icm_accommodate_altq q = questMark ** icm_accommodate; +icm_reaccommodate_whq q = questMark ** requestion q returning_to_issue_Pre; +icm_reaccommodate_ynq q = questMark ** requestion q returning_to_issue_Pre; +icm_reaccommodate_altq q = questMark ** requestion q returning_to_issue_Pre; + +oper requestion : (QCl ** ClauseForm) -> Utt -> Utt + = \q,s -> cncUtt s (UttAdv (AdvSC (EmbedQS (useQCl q)))); + +lin + +BaseMove m = consText m m TEmpty; +ConsMove m = consText m m; + +godis_utterance x = x; + +} diff --git a/examples/godis-tram/Common/GodisSystemSem.gf b/examples/godis-tram/Common/GodisSystemSem.gf new file mode 100644 index 000000000..b0c269351 --- /dev/null +++ b/examples/godis-tram/Common/GodisSystemSem.gf @@ -0,0 +1,134 @@ +--# -path=.:prelude + +concrete GodisSystemSem of GodisSystem = PredefCnc ** open Prolog in { + +lincat + +Move, +[Move], +S, +ShortAns, +Proposition, +Question, +YNQ, AltQ, +[Proposition], +VPProposition, +[VPProposition], +Action, +Reason = PStr; + + +lin + +-- usr = ss "usr"; +-- sys = ss "sys"; + +---------------------------------------------------------------------- +-- questions + +action_Q = pWhQ "action"; +issue_Q = pWhQ "issue"; + +ynq q = q; +altq qs = pp1 "set" (pBrackets qs); +BaseProposition = pSeq; +ConsProposition = pSeq; + +---------------------------------------------------------------------- +-- propositions + +not = pp1 "not"; +-- done = pp1 "done"; +fail = pp2 "fail"; +-- und = pp2 "und"; + +---------------------------------------------------------------------- +-- vp-propositions + +action = pp1 "action"; +issue = pp1 "issue"; + +vp_ynq p = p; +vp_altq qs = pp1 "set" (pBrackets qs); +BaseVPProposition = pSeq; +ConsVPProposition = pSeq; + +---------------------------------------------------------------------- +-- short answers + +notS = pp1 "not"; + +---------------------------------------------------------------------- +-- dialogue moves + +answer_yes = pp1 "answer" (pp0 "yes"); +answer_no = pp1 "answer" (pp0 "no"); + +greet = pp0 "greet"; +quit = pp0 "quit"; +ask = pp1 "ask"; +askYNQ = pp1 "ask"; +askAltQ = pp1 "ask"; +answer = pp1 "answer"; +answerVP = pp1 "answer"; +shortAns = pp1 "answer"; + +request = pp1 "request"; +confirm a = variants{ pp1 "confirm" a; + pp2 "report" a (pp0 "done") }; +reportFailure a r = pp2 "report" a (pp1 "failed" r); + +answerFailure q r = pp1 "answer" (pp2 "fail" q r); + +---------------------------------------------------------------------- +-- ICM + +icm_acc_pos = icmFeedback0 "acc" "pos"; +icm_con_neg = icmFeedback0 "con" "neg"; +icm_per_neg = icmFeedback0 "per" "neg"; +icm_per_int = icmFeedback0 "per" "int"; +icm_sem_neg = icmFeedback0 "sem" "neg"; +icm_sem_int = icmFeedback0 "sem" "int"; +icm_und_neg = icmFeedback0 "und" "neg"; +icm_reraise = icmSingle0 "reraise"; +icm_loadplan = icmSingle0 "loadplan"; +icm_accommodate = icmSingle0 "accomodate"; + +icm_per_pos = icmFeedback1 "per" "pos"; +icm_und_int_prop p = icmFeedback1 "und" "int" (pOper "*" (pp0 "usr") p); +icm_und_pos_prop p = icmFeedback1 "und" "pos" (pOper "*" (pp0 "usr") p); +icm_acc_neg_prop = icmFeedback1 "acc" "neg"; +icm_acc_neg_que q = icmFeedback1 "acc" "neg" (pp1 "issue" q); +icm_sem_pos_move = icmFeedback1 "sem" "pos"; +icm_sem_pos_shortAns = icmFeedback1 "sem" "pos"; +icm_und_pos_vp p = icmFeedback1 "und" "pos" (pOper "*" (pp0 "usr") p); +icm_und_int_vp p = icmFeedback1 "und" "int" (pOper "*" (pp0 "usr") p); +icm_reraise_act = icmSingle1 "reraise"; + +icm_und_int_altq q = icmFeedback1 "und" "int"(pOper "*" (pp0 "usr") q); +icm_reraise_whq = icmSingle1 "reraise"; +icm_reraise_ynq = icmSingle1 "reraise"; +icm_reraise_altq = icmSingle1 "reraise"; +icm_accommodate_whq = icmSingle1 "accomodate"; +icm_accommodate_ynq = icmSingle1 "accomodate"; +icm_accommodate_altq = icmSingle1 "accomodate"; +icm_reaccommodate_whq = icmSingle1 "reaccomodate"; +icm_reaccommodate_ynq = icmSingle1 "reaccomodate"; +icm_reaccommodate_altq = icmSingle1 "reaccomodate"; + +BaseMove m = m; +ConsMove m = pSeq m; + +godis_utterance = pBrackets; + + +oper + +icmSingle0 : Str -> PStr = \icm -> pStr ("icm" ++ ":" ++ icm); +icmSingle1 : Str -> PPStr = \icm -> pOper ":" (icmSingle0 icm); + +icmFeedback0 : Str -> Str -> PStr = \lvl,pol -> icmSingle0 (lvl ++ "*" ++ pol); +icmFeedback1 : Str -> Str -> PPStr = \lvl,pol -> icmSingle1 (lvl ++ "*" ++ pol); + + +} diff --git a/examples/godis-tram/Common/GodisSystemSwe.gf b/examples/godis-tram/Common/GodisSystemSwe.gf new file mode 100644 index 000000000..b45cb0b66 --- /dev/null +++ b/examples/godis-tram/Common/GodisSystemSwe.gf @@ -0,0 +1,4 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete GodisSystemSwe of GodisSystem = GodisSystemI with + (Grammar=GrammarSwe), (Extra=ExtraSwe), (GodisLang=GodisLangSwe); diff --git a/examples/godis-tram/Common/GodisUser.gf b/examples/godis-tram/Common/GodisUser.gf new file mode 100644 index 000000000..8db3eed7e --- /dev/null +++ b/examples/godis-tram/Common/GodisUser.gf @@ -0,0 +1,33 @@ +--# -path=.:prelude + +abstract GodisUser = { + +cat + +S; +Question; +Action; +Answer; +ShortAns; +Proposition; + + +fun + +greet_S, +quit_S : S; + +no_S, +yes_S : Answer; + +request_S : Action -> S; +answer_S : Answer -> S; +ask_S : Question -> S; + +shortans_S, +not_shortans_S : ShortAns -> S; +not_prop_S : Proposition -> S; + +request_request_S : Action -> Action -> S; + +} diff --git a/examples/godis-tram/Common/GodisUserEng.gf b/examples/godis-tram/Common/GodisUserEng.gf new file mode 100644 index 000000000..62e3b326c --- /dev/null +++ b/examples/godis-tram/Common/GodisUserEng.gf @@ -0,0 +1,32 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete GodisUserEng of GodisUser = + GodisUserI with (GodisLang = GodisLangEng); + + +-- open Prelude, GodisLangEng in { + +-- lincat + +-- S = SS; + +-- Question = UserQuestion; +-- Action = UserAction; +-- Answer = UserAnswer; +-- ShortAns = UserShortAns; + + +-- lin + +-- greet_S = ss ["hello"]; +-- quit_S = variants{ ss ["goodbye"]; ss ["quit"] }; + +-- no_S = ss ["no"]; +-- yes_S = ss ["yes"]; + +-- request_S x = x; +-- answer_S x = x; +-- ask_S x = x; +-- shortans_S x = x; + +-- } diff --git a/examples/godis-tram/Common/GodisUserFin.gf b/examples/godis-tram/Common/GodisUserFin.gf new file mode 100644 index 000000000..f5de2ef0a --- /dev/null +++ b/examples/godis-tram/Common/GodisUserFin.gf @@ -0,0 +1,5 @@ +--# -path=.:prelude:alltenses + +concrete GodisUserFin of GodisUser = + GodisUserI with (GodisLang = GodisLangFin); + diff --git a/examples/godis-tram/Common/GodisUserI.gf b/examples/godis-tram/Common/GodisUserI.gf new file mode 100644 index 000000000..b1e3befbd --- /dev/null +++ b/examples/godis-tram/Common/GodisUserI.gf @@ -0,0 +1,34 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common + +incomplete concrete GodisUserI of GodisUser = + open Prelude, GodisLang in { + +lincat + +S = SS; + +Question = UserQuestion; +Action = UserAction; +Answer = UserAnswer; +ShortAns = UserShortAns; +Proposition = UserProposition; + +lin + +greet_S = {s = "hei"} ; +quit_S = userQuit; + +no_S = userNo; +yes_S = userYes; + +request_S x = x; +answer_S x = x; +ask_S x = x; +shortans_S x = x; + +not_prop_S = not_user_prop; +not_shortans_S = not_user_short; + +request_request_S = userCoordinate; + +} diff --git a/examples/godis-tram/Common/GodisUserSem.gf b/examples/godis-tram/Common/GodisUserSem.gf new file mode 100644 index 000000000..b863d0983 --- /dev/null +++ b/examples/godis-tram/Common/GodisUserSem.gf @@ -0,0 +1,33 @@ +--# -path=.:prelude + +concrete GodisUserSem of GodisUser = + open Prolog, GodisSystemSem in { + +lincat + +S, +Question, +Answer, +ShortAns, +Action, +Proposition = PStr; + +lin + +greet_S = pList1 (pp0 "greet"); +quit_S = pList1 (pp0 "quit"); + +no_S = pm1 (answer (pp0 "no")); +yes_S = pm1 (answer (pp0 "yes")); + +answer_S = pBrackets; +ask_S = pBrackets; +request_S = pBrackets; +shortans_S = pBrackets; + +not_prop_S = \x -> pBrackets (pp1 "not" x); +not_shortans_S = \x -> pBrackets (pp1 "not" x); + +request_request_S = pList2; + +} diff --git a/examples/godis-tram/Common/GodisUserSwe.gf b/examples/godis-tram/Common/GodisUserSwe.gf new file mode 100644 index 000000000..19b0b3025 --- /dev/null +++ b/examples/godis-tram/Common/GodisUserSwe.gf @@ -0,0 +1,31 @@ +--# -path=.:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete GodisUserSwe of GodisUser = + GodisUserI with (GodisLang = GodisLangSwe); + + +-- open Prelude, GodisLangSwe in { + +-- lincat + +-- S = SS; + +-- Question = UserQuestion; +-- Answer = UserAnswer; +-- ShortAns = UserShortAns; +-- Action = UserAction; + +-- lin + +-- greet_S = ss ["hej"]; +-- quit_S = ss ["hejdå"]; + +-- no_S = ss ["nej"]; +-- yes_S = ss ["ja"]; + +-- answer_S x = x; +-- ask_S x = x; +-- shortans_S x = x; +-- request_S x = x; + +-- } diff --git a/examples/godis-tram/Common/Prolog.gf b/examples/godis-tram/Common/Prolog.gf new file mode 100644 index 000000000..461ed470e --- /dev/null +++ b/examples/godis-tram/Common/Prolog.gf @@ -0,0 +1,60 @@ +resource Prolog = { + +oper + +PStr : Type = {s : Str}; +PPStr : Type = PStr -> PStr; +PPPStr : Type = PStr -> PStr -> PStr; +PPPPStr : Type = PStr -> PStr -> PStr -> PStr; +PPPPPStr : Type = PStr -> PStr -> PStr -> PStr -> PStr; +PPPPPPStr : Type = PStr -> PStr -> PStr -> PStr -> PStr -> PStr; +PPPPPPPStr : Type = PStr -> PStr -> PStr -> PStr -> PStr -> PStr -> PStr; + +pStr : Str -> PStr = \str -> {s = str}; +pOper : Str -> PPPStr = \f,x,y -> pStr (x.s ++ f ++ y.s); +pPrefix : Str -> PPStr = \f,x -> pStr (f ++ x.s); +pPostfix : Str -> PPStr = \f,x -> pStr (x.s ++ f); +pEmbed : Str -> Str -> PPStr = \f,g,x -> pStr (f ++ x.s ++ g); +pParen : PPStr = pEmbed "(" ")"; +pBrackets: PPStr = pEmbed "[" "]"; + +pAtom : PPStr = \x -> pStr ("'" + x.s + "'"); +pQuote : PPStr = pEmbed "'" "'"; +pDQuote : PPStr = pEmbed "\"" "\""; + +pNil : PStr = pStr "''"; +pEmpty : PStr = pStr []; + +pp0 : Str -> PStr = pStr; +pp1 : Str -> PPStr = \pred,arg -> pPrefix pred (pParen arg); +pp2 : Str -> PPPStr = \pred,arg1,arg2 -> pp1 pred (pSeq arg1 arg2); +pp3 : Str -> PPPPStr = \pred,arg1,arg2 -> pp2 pred (pSeq arg1 arg2); +pp4 : Str -> PPPPPStr = \pred,arg1,arg2 -> pp3 pred (pSeq arg1 arg2); +pp5 : Str -> PPPPPPStr = \pred,arg1,arg2 -> pp4 pred (pSeq arg1 arg2); +pp6 : Str -> PPPPPPPStr = \pred,arg1,arg2 -> pp5 pred (pSeq arg1 arg2); + +pList0 : PStr = pBrackets pEmpty; +pList1 : PPStr = \x -> pBrackets x; +pList2 : PPPStr = \x,y -> pList1 (pSeq x y); +pList3 : PPPPStr = \x,y -> pList2 (pSeq x y); +pList4 : PPPPPStr = \x,y -> pList3 (pSeq x y); +pList5 : PPPPPPStr = \x,y -> pList4 (pSeq x y); +pList6 : PPPPPPPStr = \x,y -> pList5 (pSeq x y); + +pSeq : PPPStr = pOper ","; + +pConcat : PPPStr = \x,y -> pStr (x.s ++ y.s); + +-- the following operations are Godis-specific + +pWhQ : Str -> PStr = \pred -> pOper "^" pVar (pp1 pred pVar); +pVar : PStr = pStr "X"; + +pm1 : PPStr = \x -> x; +pm2 : PPPStr = \x,y -> pm1 (pSeq x y); +pm3 : PPPPStr = \x,y -> pm2 (pSeq x y); +pm4 : PPPPPStr = \x,y -> pm3 (pSeq x y); +pm5 : PPPPPPStr = \x,y -> pm4 (pSeq x y); +pm6 : PPPPPPPStr = \x,y -> pm5 (pSeq x y); + +} diff --git a/examples/godis-tram/Tram/Lines.gf b/examples/godis-tram/Tram/Lines.gf new file mode 100644 index 000000000..a0d0a6fdc --- /dev/null +++ b/examples/godis-tram/Tram/Lines.gf @@ -0,0 +1,22 @@ +abstract Lines = { +cat Line; +fun +Tram1 : Line ; +Tram2 : Line ; +Tram3 : Line ; +Tram4 : Line ; +Tram5 : Line ; +Tram6 : Line ; +Tram7 : Line ; +Tram8 : Line ; +Tram9 : Line ; + +Bus34 : Line ; +Bus40 : Line ; +Bus51 : Line ; +Bus60 : Line ; +Bus62 : Line ; + +Alvsnabben : Line ; + +} \ No newline at end of file diff --git a/examples/godis-tram/Tram/LinesEng.gf b/examples/godis-tram/Tram/LinesEng.gf new file mode 100644 index 000000000..fe25c69e2 --- /dev/null +++ b/examples/godis-tram/Tram/LinesEng.gf @@ -0,0 +1,26 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete LinesEng of Lines = open Prelude, CatEng, GodisLangEng in { + +lincat Line = NP; + +lin +Tram1 = sing_NP ["tram number 1"]; +Tram2 = sing_NP ["tram number 2"]; +Tram3 = sing_NP ["tram number 3"]; +Tram4 = sing_NP ["tram number 4"]; +Tram5 = sing_NP ["tram number 5"]; +Tram6 = sing_NP ["tram number 6"]; +Tram7 = sing_NP ["tram number 7"]; +Tram8 = sing_NP ["tram number 8"]; +Tram9 = sing_NP ["tram number 9"]; + +Bus34 = sing_NP ["bus number 34"]; +Bus40 = sing_NP ["bus number 40"]; +Bus51 = sing_NP ["bus number 51"]; +Bus60 = sing_NP ["bus number 60"]; +Bus62 = sing_NP ["bus number 62"]; + +Alvsnabben = sing_NP ["the alvsnabben ferry"]; + +} diff --git a/examples/godis-tram/Tram/LinesFin.gf b/examples/godis-tram/Tram/LinesFin.gf new file mode 100644 index 000000000..27268f5af --- /dev/null +++ b/examples/godis-tram/Tram/LinesFin.gf @@ -0,0 +1,42 @@ +--# -path=.:../Common:alltenses:mathematical + +concrete LinesFin of Lines = open Prelude, CatFin, GodisLangFin, ParadigmsFin, SymbolFin in { + +lincat Line = NP; + +lin +Tram1 = ratikka "1" ; +Tram2 = ratikka "2"; +Tram3 = ratikka "3"; +Tram4 = ratikka "4"; +Tram5 = ratikka "5"; +Tram6 = ratikka "6"; +Tram7 = ratikka "7"; +Tram8 = ratikka "8"; +Tram9 = ratikka "9"; + +Bus34 = bussi "34"; +Bus40 = bussi "40"; +Bus51 = bussi "51"; +Bus60 = bussi "60"; +Bus62 = bussi "62"; + +Alvsnabben = mkNP (regN "älvsnabben-lautta") singular ; + +oper + +ratikka : Str -> NP = \s -> CNIntNP (regN "ratikka") (int s) ; +bussi : Str -> NP = \s -> CNIntNP (regN "bussi") (int s) ; + +---- this shouldn't be needed +int : Str -> { + s : Str ; + last : % Predef.Ints 9 ; + size : % Predef.Ints 1 + } = \s -> { + s = s ; + last = 0 ; + size = 1 + } ; + +} diff --git a/examples/godis-tram/Tram/LinesSem.gf b/examples/godis-tram/Tram/LinesSem.gf new file mode 100644 index 000000000..8d00343d4 --- /dev/null +++ b/examples/godis-tram/Tram/LinesSem.gf @@ -0,0 +1,25 @@ +--# -path=.:../Common + +concrete LinesSem of Lines = open Prolog in { + +lincat Line = PStr; + +lin +Tram1 = pp0 ["tram_1"]; +Tram2 = pp0 ["tram_2"]; +Tram3 = pp0 ["tram_3"]; +Tram4 = pp0 ["tram_4"]; +Tram5 = pp0 ["tram_5"]; +Tram6 = pp0 ["tram_6"]; +Tram7 = pp0 ["tram_7"]; +Tram8 = pp0 ["tram_8"]; +Tram9 = pp0 ["tram_9"]; + +Bus34 = pp0 ["bus_34"]; +Bus40 = pp0 ["bus_40"]; +Bus51 = pp0 ["bus_51"]; +Bus60 = pp0 ["bus_60"]; +Bus62 = pp0 ["bus_62"]; + +Alvsnabben = pp0 ["alvsnabben"]; +} diff --git a/examples/godis-tram/Tram/LinesSwe.gf b/examples/godis-tram/Tram/LinesSwe.gf new file mode 100644 index 000000000..d7b94f994 --- /dev/null +++ b/examples/godis-tram/Tram/LinesSwe.gf @@ -0,0 +1,26 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete LinesSwe of Lines = open Prelude, CatSwe, GodisLangSwe in { + +lincat Line = NP; + +lin +Tram1 = sing_NP ["spårvagn nummer 1"]; +Tram2 = sing_NP ["spårvagn nummer 2"]; +Tram3 = sing_NP ["spårvagn nummer 3"]; +Tram4 = sing_NP ["spårvagn nummer 4"]; +Tram5 = sing_NP ["spårvagn nummer 5"]; +Tram6 = sing_NP ["spårvagn nummer 6"]; +Tram7 = sing_NP ["spårvagn nummer 7"]; +Tram8 = sing_NP ["spårvagn nummer 8"]; +Tram9 = sing_NP ["spårvagn nummer 9"]; + +Bus34 = sing_NP ["buss nummer 34"]; +Bus40 = sing_NP ["buss nummer 40"]; +Bus51 = sing_NP ["buss nummer 51"]; +Bus60 = sing_NP ["buss nummer 60"]; +Bus62 = sing_NP ["buss nummer 62"]; + +Alvsnabben = sing_NP ["Älvsnabben"]; +} + diff --git a/examples/godis-tram/Tram/Stops.gf b/examples/godis-tram/Tram/Stops.gf new file mode 100644 index 000000000..1e66c9e3f --- /dev/null +++ b/examples/godis-tram/Tram/Stops.gf @@ -0,0 +1,66 @@ +abstract Stops = { + +cat Stop; + +fun +Angered : Stop ; +AxelDahlstromsTorg : Stop ; +Bergsjon : Stop ; +Biskopsgarden : Stop ; +Botaniska : Stop ; +Broplatsen : Stop ; +Brunnsbotorget : Stop ; +Brunnsparken : Stop ; +Centralstationen : Stop ; +Chalmers : Stop ; +Eriksberg : Stop ; +Frihamnen : Stop ; +FrolundaTorg : Stop ; +Gamlestadstorget : Stop ; +Gronsakstorget : Stop ; +Guldheden : Stop ; +Hagakyrkan : Stop ; +Harlanda : Stop ; +Hinnebacksgatan : Stop ; +HjBrantingsplatsen : Stop ; +Jarntorget : Stop ; +Kalleback : Stop ; +Karralundsgatan : Stop ; +Klareberg : Stop ; +Klippan : Stop ; +Korkarlensgata : Stop ; +Korsvagen : Stop ; +Kortedala : Stop ; +Kungssten : Stop ; +Lansmansgarden : Stop ; +LillaBommen : Stop ; +Lindholmen : Stop ; +Linneplatsen : Stop ; +LundbyStrand : Stop ; +Mariaplan : Stop ; +Marklandsgatan : Stop ; +Nordstan : Stop ; +Olivedalsgatan : Stop ; +Olskrokstorget : Stop ; +OstraSjukhuset : Stop ; +Pilbagsgatan : Stop ; +Redbergsplatsen : Stop ; +Rosenlund : Stop ; +Sahlgrenska : Stop ; +Saltholmen : Stop ; +SanktSigfridsplan : Stop ; +Sannaplan : Stop ; +Skogome : Stop ; +Sorgardsskolan : Stop ; +Stigbergstorget : Stop ; +Tagene : Stop ; +Torp : Stop ; +Tynnered : Stop ; +Ullevi : Stop ; +Valand : Stop ; +VasaViktoriagatan : Stop ; +Vasaplatsen : Stop ; +WavrinskysPlats : Stop ; + + +} diff --git a/examples/godis-tram/Tram/StopsEng.gf b/examples/godis-tram/Tram/StopsEng.gf new file mode 100644 index 000000000..d7018ad57 --- /dev/null +++ b/examples/godis-tram/Tram/StopsEng.gf @@ -0,0 +1,66 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete StopsEng of Stops = open Prelude, CatEng, GodisLangEng in { + +lincat Stop = NP; + +lin +Angered = sing_NP ["angered"]; +AxelDahlstromsTorg = sing_NP ["axel dahlstroms torg"]; +Bergsjon = sing_NP ["bergsjon"]; +Biskopsgarden = sing_NP ["biskopsgarden"]; +Botaniska = sing_NP ["botaniska"]; +Broplatsen = sing_NP ["broplatsen"]; +Brunnsbotorget = sing_NP ["brunnsbotorget"]; +Brunnsparken = sing_NP ["brunnsparken"]; +Centralstationen = sing_NP ["centralstationen"]; +Chalmers = sing_NP ["chalmers"]; +Eriksberg = sing_NP ["eriksberg"]; +Frihamnen = sing_NP ["frihamnen"]; +FrolundaTorg = sing_NP ["frolunda torg"]; +Gamlestadstorget = sing_NP ["gamlestadstorget"]; +Gronsakstorget = sing_NP ["gronsakstorget"]; +Guldheden = sing_NP ["guldheden"]; +Hagakyrkan = sing_NP ["hagakyrkan"]; +Harlanda = sing_NP ["harlanda"]; +Hinnebacksgatan = sing_NP ["hinnebacksgatan"]; +HjBrantingsplatsen = sing_NP ["hjalmar brantingsplatsen"]; +Jarntorget = sing_NP ["jarntorget"]; +Kalleback = sing_NP ["kalleback"]; +Karralundsgatan = sing_NP ["karralundsgatan"]; +Klareberg = sing_NP ["klareberg"]; +Klippan = sing_NP ["klippan"]; +Korkarlensgata = sing_NP ["korkarlens gata"]; +Korsvagen = sing_NP ["korsvagen"]; +Kortedala = sing_NP ["kortedala"]; +Kungssten = sing_NP ["kungssten"]; +Lansmansgarden = sing_NP ["lansmansgarden"]; +LillaBommen = sing_NP ["lilla bommen"]; +Lindholmen = sing_NP ["lindholmen"]; +Linneplatsen = sing_NP ["linneplatsen"]; +LundbyStrand = sing_NP ["lundby strand"]; +Mariaplan = sing_NP ["mariaplan"]; +Marklandsgatan = sing_NP ["marklandsgatan"]; +Nordstan = sing_NP ["nordstan"]; +Olivedalsgatan = sing_NP ["olivedalsgatan"]; +Olskrokstorget = sing_NP ["olskrokstorget"]; +OstraSjukhuset = sing_NP ["ostra sjukhuset"]; +Pilbagsgatan = sing_NP ["pilbagsgatan"]; +Redbergsplatsen = sing_NP ["redbergsplatsen"]; +Rosenlund = sing_NP ["rosenlund"]; +Sahlgrenska = sing_NP ["sahlgrenska"]; +Saltholmen = sing_NP ["saltholmen"]; +SanktSigfridsplan = sing_NP ["sankt sigfrids plan"]; +Sannaplan = sing_NP ["sannaplan"]; +Skogome = sing_NP ["skogome"]; +Sorgardsskolan = sing_NP ["sorgardsskolan"]; +Stigbergstorget = sing_NP ["stigbergstorget"]; +Tagene = sing_NP ["tagene"]; +Torp = sing_NP ["torp"]; +Tynnered = sing_NP ["tynnered"]; +Ullevi = sing_NP ["ullevi"]; +Valand = sing_NP ["valand"]; +VasaViktoriagatan = sing_NP ["vasa viktoriagatan"]; +Vasaplatsen = sing_NP ["vasaplatsen"]; +WavrinskysPlats = sing_NP ["wavrinskys plats"]; +} diff --git a/examples/godis-tram/Tram/StopsFin.gf b/examples/godis-tram/Tram/StopsFin.gf new file mode 100644 index 000000000..939e9f4f7 --- /dev/null +++ b/examples/godis-tram/Tram/StopsFin.gf @@ -0,0 +1,71 @@ +--# -path=.:../Common:alltenses + +concrete StopsFin of Stops = open Prelude, CatFin, GodisLangFin, ParadigmsFin in { + +lincat Stop = NP; + +lin +Angered = sing_NP ["angeredia"]; +AxelDahlstromsTorg = sing_NP ["axel_dahlstroms_torgia"]; +Bergsjon = sing_NP ["bergsjönia"]; +Biskopsgarden = sing_NP ["biskopsgardenia"]; +Botaniska = singNP (nTalo ["botaniska"]); +Broplatsen = sing_NP ["broplatsenia"]; +Brunnsbotorget = sing_NP ["brunnsbotorgetia"]; +Brunnsparken = sing_NP ["brunnsparkenia"]; +Centralstationen = sing_NP ["centralstationenia"]; +Chalmers = sing_NP ["chalmersia"]; +Eriksberg = sing_NP ["eriksbergia"]; +Frihamnen = sing_NP ["frihamnenia"]; +FrolundaTorg = sing_NP ["frölunda_torgia"]; +Gamlestadstorget = sing_NP ["gamlestadstorgetia"]; +Gronsakstorget = sing_NP ["grönsakstorgetia"]; +Guldheden = sing_NP ["guldhedenia"]; +Hagakyrkan = sing_NP ["hagakyrkania"]; +Harlanda = singNP (nTalo ["härlanda"]); +Hinnebacksgatan = sing_NP ["hinnebäcksgatania"]; +HjBrantingsplatsen = sing_NP ["hjalmar_brantingsplatsenia"]; +Jarntorget = sing_NP ["järntorgetia"]; +Kalleback = sing_NP ["kallebäckia"]; +Karralundsgatan = sing_NP ["kärralundsgatania"]; +Klareberg = sing_NP ["klarebergia"]; --- ä +Klippan = sing_NP ["klippania"]; +Korkarlensgata = singNP (nTalo ["körkarlens_gata"]); +Korsvagen = sing_NP ["korsvägenia"]; +Kortedala = sing_NP ["kortedalaia"]; +Kungssten = sing_NP ["kungsstenia"]; +Lansmansgarden = sing_NP ["länsmansgardenia"]; +LillaBommen = sing_NP ["lilla_bommenia"]; +Lindholmen = sing_NP ["lindholmenia"]; +Linneplatsen = sing_NP ["linnéplatsenia"]; +LundbyStrand = sing_NP ["lundby_strandia"]; +Mariaplan = sing_NP ["mariaplania"]; +Marklandsgatan = sing_NP ["marklandsgatania"]; +Nordstan = sing_NP ["nordstania"]; +Olivedalsgatan = sing_NP ["olivedalsgatania"]; +Olskrokstorget = sing_NP ["olskrokstorgetia"]; +OstraSjukhuset = sing_NP ["östra_sjukhusetia"]; +Pilbagsgatan = sing_NP ["pilbågsgatania"]; +Redbergsplatsen = sing_NP ["redbergsplatsenia"]; +Rosenlund = sing_NP ["rosenlundia"]; +Sahlgrenska = singNP (nTalo ["sahlgrenska"]); +Saltholmen = sing_NP ["saltholmenia"]; +SanktSigfridsplan = sing_NP ["sankt_sigfrids_plania"]; +Sannaplan = sing_NP ["sannaplania"]; +Skogome = singNP (nTalo ["skogome"]); +Sorgardsskolan = sing_NP ["sorgardsskolania"]; +Stigbergstorget = sing_NP ["stigbergstorgetia"]; +Tagene = singNP (nTalo ["tagene"]); +Torp = sing_NP ["torpia"]; +Tynnered = sing_NP ["tynneredia"]; +Ullevi = singNP (nTalo ["ullevi"]); +Valand = sing_NP ["valandia"]; +VasaViktoriagatan = sing_NP ["vasa_viktoriagatania"]; +Vasaplatsen = sing_NP ["vasaplatsenia"]; +WavrinskysPlats = sing_NP ["wavrinskys_platsia"]; + +oper + +singNP : N -> NP = \n -> mkNP n singular ; + +} diff --git a/examples/godis-tram/Tram/StopsSem.gf b/examples/godis-tram/Tram/StopsSem.gf new file mode 100644 index 000000000..5ecd084dd --- /dev/null +++ b/examples/godis-tram/Tram/StopsSem.gf @@ -0,0 +1,66 @@ +--# -path=.:../Common + +concrete StopsSem of Stops = open Prolog in { + +lincat Stop = PStr; + +lin +Angered = pp0 ["Angered"]; +AxelDahlstromsTorg = pp0 ["AxelDahlstromsTorg"]; +Bergsjon = pp0 ["Bergsjon"]; +Biskopsgarden = pp0 ["Biskopsgarden"]; +Botaniska = pp0 ["Botaniska"]; +Broplatsen = pp0 ["Broplatsen"]; +Brunnsbotorget = pp0 ["Brunnsbotorget"]; +Brunnsparken = pp0 ["Brunnsparken"]; +Centralstationen = pp0 ["Centralstationen"]; +Chalmers = pp0 ["Chalmers"]; +Eriksberg = pp0 ["Criksberg"]; +Frihamnen = pp0 ["Frihamnen"]; +FrolundaTorg = pp0 ["FrolundaTorg"]; +Gamlestadstorget = pp0 ["Gamlestadstorget"]; +Gronsakstorget = pp0 ["Gronsakstorget"]; +Guldheden = pp0 ["Guldheden"]; +Hagakyrkan = pp0 ["Hagakyrkan"]; +Harlanda = pp0 ["Harlanda"]; +Hinnebacksgatan = pp0 ["Hinnebacksgatan"]; +HjBrantingsplatsen = pp0 ["HjBrantingsplatsen"]; +Jarntorget = pp0 ["Jarntorget"]; +Kalleback = pp0 ["Kalleback"]; +Karralundsgatan = pp0 ["Karralundsgatan"]; +Klareberg = pp0 ["Klareberg"]; +Klippan = pp0 ["Klippan"]; +Korkarlensgata = pp0 ["Korkarlensgata"]; +Korsvagen = pp0 ["Korsvagen"]; +Kortedala = pp0 ["Kortedala"]; +Kungssten = pp0 ["Kungssten"]; +Lansmansgarden = pp0 ["Lansmansgarden"]; +LillaBommen = pp0 ["LillaBommen"]; +Lindholmen = pp0 ["Lindholmen"]; +Linneplatsen = pp0 ["Linneplatsen"]; +LundbyStrand = pp0 ["LundbyStrand"]; +Mariaplan = pp0 ["Mariaplan"]; +Marklandsgatan = pp0 ["Marklandsgatan"]; +Nordstan = pp0 ["Nordstan"]; +Olivedalsgatan = pp0 ["Olivedalsgatan"]; +Olskrokstorget = pp0 ["Olskrokstorget"]; +OstraSjukhuset = pp0 ["OstraSjukhuset"]; +Pilbagsgatan = pp0 ["Pilbagsgatan"]; +Redbergsplatsen = pp0 ["Redbergsplatsen"]; +Rosenlund = pp0 ["Rosenlund"]; +Sahlgrenska = pp0 ["Sahlgrenska"]; +Saltholmen = pp0 ["Saltholmen"]; +SanktSigfridsplan = pp0 ["SanktSigfridsPlan"]; +Sannaplan = pp0 ["Sannaplan"]; +Skogome = pp0 ["Skogome"]; +Sorgardsskolan = pp0 ["Sorgardsskolan"]; +Stigbergstorget = pp0 ["Stigbergstorget"]; +Tagene = pp0 ["Tagene"]; +Torp = pp0 ["Torp"]; +Tynnered = pp0 ["Tynnered"]; +Ullevi = pp0 ["Ullevi"]; +Valand = pp0 ["Valand"]; +VasaViktoriagatan = pp0 ["VasaViktoriagatan"]; +Vasaplatsen = pp0 ["Vasaplatsen"]; +WavrinskysPlats = pp0 ["WavrinskysPlats"]; +} diff --git a/examples/godis-tram/Tram/StopsSwe.gf b/examples/godis-tram/Tram/StopsSwe.gf new file mode 100644 index 000000000..e20f98c01 --- /dev/null +++ b/examples/godis-tram/Tram/StopsSwe.gf @@ -0,0 +1,68 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete StopsSwe of Stops = open Prelude, CatSwe, GodisLangSwe in { + +lincat Stop = NP; + +lin + +Angered = sing_NP ["angered"]; +AxelDahlstromsTorg = sing_NP ["axel dahlströms torg"]; +Bergsjon = sing_NP ["bergsjön"]; +Biskopsgarden = sing_NP ["biskopsgården"]; +Botaniska = sing_NP ["botaniska"]; +Broplatsen = sing_NP ["broplatsen"]; +Brunnsbotorget = sing_NP ["brunnsbotorget"]; +Brunnsparken = sing_NP ["brunnsparken"]; +Centralstationen = sing_NP ["centralstationen"]; +Chalmers = sing_NP ["chalmers"]; +Eriksberg = sing_NP ["eriksberg"]; +Frihamnen = sing_NP ["frihamnen"]; +FrolundaTorg = sing_NP ["frölunda torg"]; +Gamlestadstorget = sing_NP ["gamlestadstorget"]; +Gronsakstorget = sing_NP ["grönsakstorget"]; +Guldheden = sing_NP ["guldheden"]; +Hagakyrkan = sing_NP ["hagakyrkan"]; +Harlanda = sing_NP ["härlanda"]; +Hinnebacksgatan = sing_NP ["hinnebäcksgatan"]; +HjBrantingsplatsen = sing_NP ["hjalmar brantingsplatsen"]; +Jarntorget = sing_NP ["järntorget"]; +Kalleback = sing_NP ["kallebäck"]; +Karralundsgatan = sing_NP ["kärralundsgatan"]; +Klareberg = sing_NP ["klareberg"]; +Klippan = sing_NP ["klippan"]; +Korkarlensgata = sing_NP ["körkarlens gata"]; +Korsvagen = sing_NP ["korsvägen"]; +Kortedala = sing_NP ["kortedala"]; +Kungssten = sing_NP ["kungssten"]; +Lansmansgarden = sing_NP ["länsmansgården"]; +LillaBommen = sing_NP ["lilla bommen"]; +Lindholmen = sing_NP ["lindholmen"]; +Linneplatsen = sing_NP ["linneplatsen"]; +LundbyStrand = sing_NP ["lundby strand"]; +Mariaplan = sing_NP ["mariaplan"]; +Marklandsgatan = sing_NP ["marklandsgatan"]; +Nordstan = sing_NP ["nordstan"]; +Olivedalsgatan = sing_NP ["olivedalsgatan"]; +Olskrokstorget = sing_NP ["olskrokstorget"]; +OstraSjukhuset = sing_NP ["östra sjukhuset"]; +Pilbagsgatan = sing_NP ["pilbågsgatan"]; +Redbergsplatsen = sing_NP ["redbergsplatsen"]; +Rosenlund = sing_NP ["rosenlund"]; +Sahlgrenska = sing_NP ["sahlgrenska"]; +Saltholmen = sing_NP ["saltholmen"]; +SanktSigfridsplan = sing_NP ["sankt sigfrids plan"]; +Sannaplan = sing_NP ["sannaplan"]; +Skogome = sing_NP ["skogome"]; +Sorgardsskolan = sing_NP ["sorgårdsskolan"]; +Stigbergstorget = sing_NP ["stigbergstorget"]; +Tagene = sing_NP ["tagene"]; +Torp = sing_NP ["torp"]; +Tynnered = sing_NP ["tynnered"]; +Ullevi = sing_NP ["ullevi"]; +Valand = sing_NP ["valand"]; +VasaViktoriagatan = sing_NP ["vasa viktoriagatan"]; +Vasaplatsen = sing_NP ["vasaplatsen"]; +WavrinskysPlats = sing_NP ["wavrinskys plats"]; +} + diff --git a/examples/godis-tram/Tram/TramLexicon.gf b/examples/godis-tram/Tram/TramLexicon.gf new file mode 100644 index 000000000..b4e9f3a7f --- /dev/null +++ b/examples/godis-tram/Tram/TramLexicon.gf @@ -0,0 +1,41 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common + +abstract TramLexicon = Cat ** { + +fun + +-- The functions should be in alphabetical order +-- within each category + +-- Adjectives +short_A : A; + +-- Conjunctions +and_then_Conj : Conj; + +-- Nouns +route_N, +stop_N, +way_N : N; + +-- Prepositiona +from_Prep, +to_Prep : Prep; + +-- Verbs-1 +help_V, +restart_V : V; + +-- Verbs-2 +go_from_V2, +go_to_V2, +find_V2, +findout_V2, +take_V2 : V2; + +} + + + + + diff --git a/examples/godis-tram/Tram/TramLexiconEng.gf b/examples/godis-tram/Tram/TramLexiconEng.gf new file mode 100644 index 000000000..955baac30 --- /dev/null +++ b/examples/godis-tram/Tram/TramLexiconEng.gf @@ -0,0 +1,34 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete TramLexiconEng of TramLexicon = CatEng ** + open Prelude, ParadigmsEng, ParamX, (Lex=LexiconEng), (Irr=IrregEng), GodisLangEng in { + +lin + +-- Adjectives +short_A = Lex.short_A; + +-- Conjunctions +and_then_Conj = {s = ["and then"]; n = Pl; lock_Conj = <>}; + +-- Nouns +route_N = regN "route"; +stop_N = regN "stop"; +way_N = regN "way"; + +-- Prepositions +from_Prep = ss "from"; +to_Prep = ss "to"; + +-- Verb-1 +help_V = regV "help"; +restart_V = regV "restart"; + +-- Verb-2 +go_from_V2 = dirV2 (partV (regV "go") "from"); --- ?? +go_to_V2 = dirV2 (partV (regV "go") "to"); --- ?? +find_V2 = Lex.find_V2; +findout_V2 = dirV2 (regV "findout"); --- ?? +take_V2 = dirV2 Irr.take_V; + +} diff --git a/examples/godis-tram/Tram/TramLexiconFin.gf b/examples/godis-tram/Tram/TramLexiconFin.gf new file mode 100644 index 000000000..556706fe8 --- /dev/null +++ b/examples/godis-tram/Tram/TramLexiconFin.gf @@ -0,0 +1,34 @@ +--# -path=.:../Common:alltenses + +concrete TramLexiconFin of TramLexicon = CatFin ** + open Prelude, ParadigmsFin, ParamX, (Lex=LexiconFin), GodisLangFin in { + +lin + +-- Adjectives +short_A = Lex.short_A; + +-- Conjunctions +and_then_Conj = {s = ["ja sitten"]; n = Pl; lock_Conj = <>}; + +-- Nouns +route_N = regN "reitti"; +stop_N = regN "pysäkki"; +way_N = regN "tie"; + +-- Prepositions +from_Prep = casePrep from_Case ; ---- +to_Prep = casePrep to_Case ; ---- + +-- Verb-1 +help_V = regV "auttaa"; +restart_V = regV "uudelleenaloittaa"; ---- alusta + +-- Verb-2 +go_from_V2 = caseV2 Lex.go_V from_Case ; +go_to_V2 = caseV2 Lex.go_V to_Case ; +find_V2 = Lex.find_V2; +findout_V2 = dirV2 (regV "selvittää"); +take_V2 = dirV2 (regV "ottaa") ; + +} diff --git a/examples/godis-tram/Tram/TramLexiconSwe.gf b/examples/godis-tram/Tram/TramLexiconSwe.gf new file mode 100644 index 000000000..e0928e3b3 --- /dev/null +++ b/examples/godis-tram/Tram/TramLexiconSwe.gf @@ -0,0 +1,40 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete TramLexiconSwe of TramLexicon = CatSwe ** + open Prelude, ParadigmsSwe, ParamX, (Lex=LexiconSwe), (Irr=IrregSwe), GodisLangSwe in { + +lin + +-- Adjectives +short_A = Lex.short_A; + +-- Conjunctions +and_then_Conj = {s = ["och sedan"]; n = Pl; lock_Conj = <>}; + +-- Nouns +route_N = regGenN "rutt" utrum; +stop_N = regGenN "hållplats" utrum; +way_N = regGenN "väg" utrum; + +-- Prepositions +from_Prep = ss "från"; +to_Prep = ss "till"; + +-- Verb-1 +help_V = regV "hjälpa"; +restart_V = partV (regV "starta") "om"; + +-- Verb-2 +go_from_V2 = dirV2 (partV åka_V "från"); +go_to_V2 = dirV2 (partV åka_V "till"); +find_V2 = dirV2 (regV "hittar"); +findout_V2 = dirV2 (Irr.finna_V); +take_V2 = dirV2 (ta_V); + + +oper +åka_V : V = irregV "åka" "åkte" "åkt"; +ta_V : V = mkV "ta" "tar" "ta" "tog" "tagit" "tagen"; + + +} diff --git a/examples/godis-tram/Tram/TramSystem.gf b/examples/godis-tram/Tram/TramSystem.gf new file mode 100644 index 000000000..a304e1203 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystem.gf @@ -0,0 +1,64 @@ +--# -path=.:../Common:prelude + +abstract TramSystem = GodisSystem, Stops, Lines ** { + +cat +Route; -- route descripiption. +Leg; +[Leg]{2}; -- route segments on a line +-- the following are derived from declaring [Leg]{2}: +-- BaseLeg : Leg -> Leg -> [Leg]; +-- ConsLeg : Leg -> [Leg] -> [Leg]; + + +fun + +----------------------------------------------------------------- +-- Functions for creating routes + +lineLeg : Line -> Stop -> Stop -> Leg; + +oneLeg : Leg -> Route; +mkRoute : [Leg] -> Route; + +------------------------------------------------------------------- +-- Predicates +-- Questions and Propositions as they are intended to be used +-- by either System or User + +-- U: what is the shortest route? +shortest_route_Q : Question; + +-- S: Take Tram Z from X to Y. Take... +shortest_route_P : Route -> Proposition; + +-- S: Where do you want to go to? +dest_stop_Q : Question; + +-- U: I want to go to Stop +dest_stop_P : Stop -> Proposition; + +-- S: Where do you want to go from? +dept_stop_Q : Question; + +-- U: I want to go from Stop +dept_stop_P : Stop -> Proposition; + + +----------------------------------------------------------------- +-- Short answers + +-- U: "klippan" +stop : Stop -> ShortAns; + + +------------------------------------------------------------------ +-- Actions + +-- S: GoTGoDiS is a tram information system +help: Action; + +-- S: restarting +top: Action; + +} diff --git a/examples/godis-tram/Tram/TramSystemEng.gf b/examples/godis-tram/Tram/TramSystemEng.gf new file mode 100644 index 000000000..a5a539d50 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystemEng.gf @@ -0,0 +1,5 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete TramSystemEng of TramSystem = GodisSystemEng, StopsEng, LinesEng ** TramSystemI with + (Grammar=GrammarEng), (GodisLang=GodisLangEng), (TramLexicon=TramLexiconEng); + diff --git a/examples/godis-tram/Tram/TramSystemFin.gf b/examples/godis-tram/Tram/TramSystemFin.gf new file mode 100644 index 000000000..dfa228cd5 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystemFin.gf @@ -0,0 +1,5 @@ +--# -path=.:../Common:prelude:alltenses:mathematical + +concrete TramSystemFin of TramSystem = GodisSystemFin, StopsFin, LinesFin ** TramSystemI with + (Grammar=GrammarFin), (GodisLang=GodisLangFin), (TramLexicon=TramLexiconFin); + diff --git a/examples/godis-tram/Tram/TramSystemI.gf b/examples/godis-tram/Tram/TramSystemI.gf new file mode 100644 index 000000000..b94720836 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystemI.gf @@ -0,0 +1,49 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common + +incomplete concrete TramSystemI of TramSystem = + GodisSystemI ** open Grammar, GodisLang, TramLexicon in { + +lincat +Route = NP; +Leg = NP; +[Leg] = [NP]; + + +lin + +----------------------------------------------------------------------------- +-- Route + +lineLeg line from to = AdvNP (AdvNP line (PrepNP from_Prep from)) (PrepNP to_Prep to); + +oneLeg leg = leg; +mkRoute legs = ConjNP and_then_Conj legs; +BaseLeg = BaseNP; +ConsLeg = ConsNP; + +------------------------------------------------------------------------------- +-- Predicates and Questions + +shortest_route_Q = isDoing ** what_is_NP (the_A_super_N_sg short_A route_N); +shortest_route_P x = isDoing ** GenericCl (ComplV2 take_V2 x); + +dest_stop_Q = isDoing ** which_N_do_you_want_to_V2 stop_N go_to_V2; +dest_stop_P x = isDoing ** you_want_to_VP (ComplV2 go_to_V2 x); + +dept_stop_Q = isDoing ** which_N_do_you_want_to_V2 stop_N go_from_V2; +dept_stop_P x = isDoing ** you_want_to_VP (ComplV2 go_from_V2 x); + + +--------------------------------------------------------------------------- +-- Short Answers + +stop x = x; + +----------------------------------------------------------------------- +-- Actions + +top = isDoing ** UseV restart_V; + +help = isDoing ** UseV help_V; + +} diff --git a/examples/godis-tram/Tram/TramSystemSem.gf b/examples/godis-tram/Tram/TramSystemSem.gf new file mode 100644 index 000000000..8d08eeb40 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystemSem.gf @@ -0,0 +1,45 @@ +--# -path=.:../Common:prelude + +concrete TramSystemSem of TramSystem = GodisSystemSem, StopsSem, LinesSem ** open Prolog in { + +lincat +Route, +Leg, +[Leg] = PStr; + +lin + +----------------------------------------------------------- +-- Route + +lineLeg line s1 s2 = pp3 "leg" line s1 s2; + +oneLeg leg = pList1 leg; +mkRoute legs = pBrackets legs; +BaseLeg leg leg' = pSeq leg leg'; +ConsLeg leg legs = pSeq leg legs; + +----------------------------------------------------------- +-- Predicates and questions + +shortest_route_Q = pWhQ "shortest_path"; +shortest_route_P route = pp1 "shortest_path" route; + +dest_stop_Q = pWhQ "dest_stop"; +dest_stop_P = pp1 "dest_stop"; + +dept_stop_Q = pWhQ "dept_stop"; +dept_stop_P = pp1 "dept_stop"; + +------------------------------------------------------------ +-- Short answers + +stop = pp1 "stop"; + +------------------------------------------------------------- +-- Actions + +top = pp0 "top"; +help = pp0 "help"; + +} diff --git a/examples/godis-tram/Tram/TramSystemSwe.gf b/examples/godis-tram/Tram/TramSystemSwe.gf new file mode 100644 index 000000000..131595e11 --- /dev/null +++ b/examples/godis-tram/Tram/TramSystemSwe.gf @@ -0,0 +1,4 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete TramSystemSwe of TramSystem = GodisSystemSwe, StopsSwe, LinesSwe ** TramSystemI with + (Grammar=GrammarSwe), (GodisLang=GodisLangSwe), (TramLexicon=TramLexiconSwe); diff --git a/examples/godis-tram/Tram/TramUser.gf b/examples/godis-tram/Tram/TramUser.gf new file mode 100644 index 000000000..49de2219b --- /dev/null +++ b/examples/godis-tram/Tram/TramUser.gf @@ -0,0 +1,62 @@ +--# -path=.:../Common:prelude + +abstract TramUser = GodisUser, Stops ** { + +fun + +------------------------------------------------------------------------ +-- Predicates +-- Questions used by the User + +-- "find a route" +shortest_route : Question; + +-- "I want to go from chalmers" +shortest_route__dept : Stop -> Question; + +-- "I want to go to chalmers" +shortest_route__dest : Stop -> Question; + +-- "I want to go from chalmers to valand" +shortest_route__dept_dest : Stop -> Stop -> Question; + + +------------------------------------------------------------------------ +-- Answers + +-- "from chalmers" +dept_stop : Stop -> Answer; + +-- "to chalmers" +dest_stop : Stop -> Answer; + +-- "from valand to chalmers" +dept_dest_stop : Stop -> Stop -> Answer; + +----------------------------------------------------------------------- +-- Short answers + +-- "chalmers" +stop : Stop -> ShortAns; + +-- "valand to chalmers" +stop_dest_stop: Stop -> Stop -> ShortAns; + +-- "valand from chalmers" +stop_dept_stop: Stop -> Stop -> ShortAns; + +------------------------------------------------------------------------- +-- Actions + +-- U: restart +top : Action; + +-- U: help +help : Action; + +-- print_info, +-- download_info, +-- read_info : Action; + + +} diff --git a/examples/godis-tram/Tram/TramUserEng.gf b/examples/godis-tram/Tram/TramUserEng.gf new file mode 100644 index 000000000..142aba4f6 --- /dev/null +++ b/examples/godis-tram/Tram/TramUserEng.gf @@ -0,0 +1,59 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/english + +concrete TramUserEng of TramUser = GodisUserEng, StopsEng ** TramUserI + with (Grammar=GrammarEng), (GodisLang=GodisLangEng), + (TramSystemI=TramSystemEng), (TramLexicon=TramLexiconEng); + +-- concrete TramUserEng of TramUser = GodisUserEng, StopsEng ** +-- open Prelude, GodisLangEng, TramSystemEng, ResEng, TramLexiconEng in { + +-- ---------------------------------------------------------------------- +-- -- Predicates and questions + +-- lin + +-- shortest_route +-- = variants{ askQS shortest_route_Q; +-- ss (variants{["find"]; ["find out"]; ["get"]; ["ask for"]} ++ +-- variants{["a route"]; ["shortest route"];["a way"];["a itinerary"]})}; + +-- shortest_route__dept x +-- = ss ( ["i want to go from"] ++ x.s!Nom); + + +-- shortest_route__dest x +-- = ss ( ["i want to go to"] ++ x.s!Nom); + + +-- shortest_route__dept_dest x y +-- = ss ( variants{["i want to go from"] ++ x.s!Nom ++ "to" ++ y.s!Nom; +-- ["i want to go to"] ++ y.s!Nom ++ "from" ++ x.s!Nom} ); + + +-- dest_stop x = ss( "to" ++ x.s!Nom); +-- dept_stop x = ss( "from" ++ x.s!Nom); + +-- dept_dest_stop x y = ss(variants{"to" ++ y.s!Nom ++ "from" ++ x.s!Nom; +-- "from" ++ x.s!Nom ++ "to" ++ y.s!Nom} ); + +-- stop_dest_stop x y = ss(x.s!Nom ++ "to" ++ y.s!Nom); +-- stop_dept_stop x y = ss(x.s!Nom ++ "from" ++ y.s!Nom); + + +-- ---------------------------------------------------------------------- +-- -- short answers +-- lin + +-- stop x = ansNP x; + + +-- ---------------------------------------------------------------------- +-- -- Actions +-- lin + +-- top = reqVP top; + +-- help = reqVP help; + +-- } + diff --git a/examples/godis-tram/Tram/TramUserFin.gf b/examples/godis-tram/Tram/TramUserFin.gf new file mode 100644 index 000000000..eff07ec22 --- /dev/null +++ b/examples/godis-tram/Tram/TramUserFin.gf @@ -0,0 +1,14 @@ +--# -path=.:../Common:prelude:alltenses:mathematical + +concrete TramUserFin of TramUser = TramUserFin0-[stop_dest_stop, stop_dept_stop] ** + open GrammarFin, GodisLangFin, TramLexiconFin in { + +lin + stop_dest_stop x y = + UttAdv (mkAdv ( + fromStr Adv (PrepNP (casePrep from_Case) x) ++ + fromStr Adv (PrepNP (casePrep to_Case) y) + ) + ) ; +} + diff --git a/examples/godis-tram/Tram/TramUserFin0.gf b/examples/godis-tram/Tram/TramUserFin0.gf new file mode 100644 index 000000000..5861fa7a7 --- /dev/null +++ b/examples/godis-tram/Tram/TramUserFin0.gf @@ -0,0 +1,6 @@ +--# -path=.:../Common:prelude:alltenses:mathematical + +concrete TramUserFin0 of TramUser = GodisUserFin, StopsFin ** TramUserI + with (Grammar=GrammarFin), (GodisLang=GodisLangFin), + (TramSystemI=TramSystemFin), (TramLexicon=TramLexiconFin); + diff --git a/examples/godis-tram/Tram/TramUserI.gf b/examples/godis-tram/Tram/TramUserI.gf new file mode 100644 index 000000000..7570d1f59 --- /dev/null +++ b/examples/godis-tram/Tram/TramUserI.gf @@ -0,0 +1,56 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common + +incomplete concrete TramUserI of TramUser = GodisUserI ** + open Prelude, Grammar, GodisLang, TramSystemI, TramLexicon in { + +---------------------------------------------------------------------- +-- Predicates and questions + +lin + +shortest_route + = variants{ askQS shortest_route_Q; + reqVP (ComplV2 (variants{find_V2;findout_V2}) + (variants {indef_N_sg (variants{way_N;route_N}); + (the_A_super_N_sg short_A (variants{way_N;route_N}))})) }; + +shortest_route__dept x + = reqVP (ComplV2 go_from_V2 x); + +shortest_route__dest x + = reqVP (ComplV2 go_to_V2 x); + +shortest_route__dept_dest x y + = variants{ reqVP (AdvVP (ComplV2 go_from_V2 x) (Prep_NP to_Prep y)); + reqVP (AdvVP (ComplV2 go_to_V2 y) (Prep_NP from_Prep y)) }; + + +dest_stop x = UttAdv (Prep_NP to_Prep x); +dept_stop x = UttAdv (Prep_NP from_Prep x); + +dept_dest_stop x y + = variants{ UttAdv (Prep_NP to_Prep (NP_Prep_NP from_Prep x y)); + UttAdv (Prep_NP from_Prep (NP_Prep_NP to_Prep x y)) }; + + +---------------------------------------------------------------------- +-- short answers +lin + +stop x = ansNP x; + +stop_dest_stop x y = ansNP (NP_Prep_NP to_Prep x y); +stop_dept_stop x y = ansNP (NP_Prep_NP from_Prep x y); + + + +---------------------------------------------------------------------- +-- Actions +lin + +top = reqVP top; + +help = reqVP help; + +} + diff --git a/examples/godis-tram/Tram/TramUserSem.gf b/examples/godis-tram/Tram/TramUserSem.gf new file mode 100644 index 000000000..c2ea38a3f --- /dev/null +++ b/examples/godis-tram/Tram/TramUserSem.gf @@ -0,0 +1,39 @@ +--# -path=.:../Common:prelude + +concrete TramUserSem of TramUser = GodisUserSem, StopsSem ** + open Prolog, TramSystemSem in { + +lin + +------------------------------------------------------------- +-- Predicates and questions + +shortest_route = pm1 (ask shortest_route_Q); + +shortest_route__dept x = pm2 (ask shortest_route_Q) (answer (dept_stop_P x)); +shortest_route__dest x = pm2 (ask shortest_route_Q) (answer (dest_stop_P x)); + +shortest_route__dept_dest x y = pm3 (ask shortest_route_Q) (answer (dept_stop_P x)) (answer (dest_stop_P y)); + +dest_stop x = pm1 (answer (dest_stop_P x)); +dept_stop x = pm1 (answer (dept_stop_P x)); + +dept_dest_stop x y = pm2 (answer (dept_stop_P x)) (answer (dest_stop_P y)); + + +-------------------------------------------------- +-- Short answers + +stop x = pm1 (shortAns (stop x)); + +stop_dest_stop x y = pm2 (shortAns(stop x)) (answer(dest_stop_P y)); +stop_dept_stop x y = pm2 (shortAns(stop x)) (answer(dept_stop_P y)); + + +------------------------------------------------------ +-- Actions +top = pm1 (request top); +help = pm1 (request help); + +} + diff --git a/examples/godis-tram/Tram/TramUserSwe.gf b/examples/godis-tram/Tram/TramUserSwe.gf new file mode 100644 index 000000000..41372a43c --- /dev/null +++ b/examples/godis-tram/Tram/TramUserSwe.gf @@ -0,0 +1,57 @@ +--# -path=.:../Common:prelude:resource-1.0/abstract:resource-1.0/common:resource-1.0/scandinavian:resource-1.0/swedish + +concrete TramUserSwe of TramUser = GodisUserSwe, StopsSwe ** TramUserI + with (Grammar=GrammarSwe), (GodisLang=GodisLangSwe), + (TramSystemI=TramSystemSwe), (TramLexicon=TramLexiconSwe); + +-- concrete TramUserSwe of TramUser = GodisUserSwe, StopsSwe ** +-- open Prelude, GrammarSwe, GodisLangSwe, TramLexiconSwe, TramSystemSwe, CommonScand in { + +-- ------------------------------------------------------------------------ +-- -- Predicates + +-- lin + +-- shortest_route +-- = variants{ askQS shortest_route_Q; +-- ss (variants{["hitta"]; ["ge mig"]; ["fråga efter"]} ++ +-- variants{["en rutt"]; ["kortaste vägen"]; ["en resväg"]})}; + +-- shortest_route__dept x +-- = ss ( ["jag vill åka från"] ++ x.s!NPNom); + +-- shortest_route__dest x +-- = ss ( ["jag vill åka till"] ++ x.s!NPNom); + +-- shortest_route__dept_dest x y +-- = ss ( variants{["jag vill åka från"] ++ x.s!NPNom ++ "till" ++ y.s!NPNom ; +-- ["jag vill åka till"] ++ y.s!NPNom ++ "från" ++ x.s!NPNom} ); + +-- dest_stop x = ss( "till" ++ x.s!NPNom); +-- dept_stop x = ss( "från" ++ x.s!NPNom); + +-- dept_dest_stop x y = ss(variants{"till" ++ y.s!NPNom ++ "från" ++ x.s!NPNom; +-- "från" ++ x.s!NPNom ++ "till" ++ y.s!NPNom} ); + +-- stop_dest_stop x y = ss(x.s!NPNom ++ "till" ++ y.s!NPNom); +-- stop_dept_stop x y = ss(x.s!NPNom ++ "från" ++ y.s!NPNom); + +-- ---------------------------------------------------------------------- +-- -- Short answers +-- lin +-- stop x = ansNP x; + + +-- ---------------------------------------------------------------------- +-- -- Actions + +-- lin +-- top = reqVP top; + +-- help = variants{ reqVP help; +-- ss ["hur gör jag nu"] }; + + + +-- } + diff --git a/examples/godis-tram/log.txt b/examples/godis-tram/log.txt new file mode 100644 index 000000000..ce08b51ba --- /dev/null +++ b/examples/godis-tram/log.txt @@ -0,0 +1,36 @@ +8/11/2006 + +10.15 installed Swe and Eng from package, tried them. + +10.25 started Fin. + +11.15 Finnish modules completed from Eng modules, start testing. + optimize=noexpand necessary in GodisLangEng. + Some decisions feel wrong: it seems the parametrized implementation + cannot be fully used. Find some probable bugs in Eng as well. + +11.45 Have to add VPI to ExtraFin. + +12.00 TramSystemFin compiles. And compiles. And compiles. Going to lunch and a + talk. + +14.30 Back from lunch and talk. TramSystemFin has compiled in 15 minutes. + Running with random examples, mostly OK Finnish. Thus a "baseline" was + accomplished in 2 hours. + + +15.00 Change the inflection of stop names that end with a vowel. Convers + all Finnish files to iso-latin-1 to conform with the resource library. + After some forking, comment out the linearization of issue and fail in + GodisSystemFin - the two functions that took the most time to compile. + Now TramSystemFin compiles in 2.5 minutes. + +15.50 TramUserFin also compiles, and even the parser works very well + here. But errors in the grammar get evident. Fixed some by renaming + the Finnish instance of TramUserI to TramUserFin0, and defining + TramUserFin by subtracting from this. + + + + +