diff --git a/examples/dialogue/Agenda.gf b/examples/dialogue/Agenda.gf new file mode 100644 index 000000000..970f7bc55 --- /dev/null +++ b/examples/dialogue/Agenda.gf @@ -0,0 +1,12 @@ +abstract Agenda = Dialogue, Weekday ** { + + fun + Day : Kind ; + Meeting : Kind ; + Add : Oper2 Meeting Day ; + Remove : Oper1 Meeting ; + Interrupt : Oper0 ; + + day : WDay -> Object Day ; + +} diff --git a/examples/dialogue/AgendaEng.gf b/examples/dialogue/AgendaEng.gf new file mode 100644 index 000000000..5686e704e --- /dev/null +++ b/examples/dialogue/AgendaEng.gf @@ -0,0 +1,15 @@ +--# -path=.:present:prelude + +concrete AgendaEng of Agenda = + DialogueEng, WeekdayEng ** open LangEng, ParadigmsEng in { + + lin + Day = UseN (regN "day") ; + Meeting = UseN (regN "meeting") ; + Add = dirV3 (regV "add") (mkPreposition "on") ; + Remove = dirV2 (regV "remove") ; + Interrupt = regV "interrupt" ; + + day = UsePN ; + +} diff --git a/examples/dialogue/AgendaFre.gf b/examples/dialogue/AgendaFre.gf new file mode 100644 index 000000000..02871f928 --- /dev/null +++ b/examples/dialogue/AgendaFre.gf @@ -0,0 +1,16 @@ +--# -path=.:present:prelude + +concrete AgendaFre of Agenda = + DialogueFre, WeekdayFre ** open LangFre, ParadigmsFre, IrregFre in { + + lin + Day = UseN (regN "jour") ; + Meeting = UseN (regN "réunion") ; + Add = dirdirV3 (regV "ajouter") ; + Remove = dirV2 (regV "ôter") ; + Interrupt = interrompre_V2 ; + + day = UsePN ; + +} + diff --git a/examples/dialogue/AgendaGodis.gf b/examples/dialogue/AgendaGodis.gf new file mode 100644 index 000000000..16acad73a --- /dev/null +++ b/examples/dialogue/AgendaGodis.gf @@ -0,0 +1,15 @@ +--# -path=.:prelude + +concrete AgendaGodis of Agenda = + DialogueGodis, WeekdayGodis ** open ResGodis, Prelude in { + + lin + Day = ss "day" ; + Meeting = ss "meeting" ; + Add = ss "add" ; + Remove = ss "remove" ; + Interrupt = ss "interrupt" ; + + day = apps "weekday" ; + +} diff --git a/examples/dialogue/AgendaSwe.gf b/examples/dialogue/AgendaSwe.gf new file mode 100644 index 000000000..53d616c4f --- /dev/null +++ b/examples/dialogue/AgendaSwe.gf @@ -0,0 +1,16 @@ +--# -path=.:present:prelude + +concrete AgendaSwe of Agenda = + DialogueSwe, WeekdaySwe ** open LangSwe, ParadigmsSwe, IrregSwe in { + + lin + Day = UseN (regN "dag") ; + Meeting = UseN (regGenN "möte" neutrum) ; + Add = dirV3 (partV lägga_V "till") (mkPreposition "på") ; + Remove = dirV2 (partV taga_V "bort") ; + Interrupt = avbryta_V ; + + day = UsePN ; + +} + diff --git a/examples/dialogue/Dialogue.gf b/examples/dialogue/Dialogue.gf new file mode 100644 index 000000000..ccb410d15 --- /dev/null +++ b/examples/dialogue/Dialogue.gf @@ -0,0 +1,27 @@ +abstract Dialogue = { + + cat + Move ; + Action ; + Kind ; + Object Kind ; + Oper0 ; + Oper1 Kind ; + Oper2 Kind Kind ; + + fun + MRequest : Action -> Move ; + MAnswer : Action -> Move ; + + MQuery : Kind -> Move ; + + AOper0 : Oper0 -> Action ; + AOper1 : (k : Kind) -> Oper1 k -> Object k -> Action ; + AOper2 : (k,m : Kind) -> Oper2 k m -> Object k -> Object m -> Action ; + + OAll : (k : Kind) -> Object k ; + OIndef : (k : Kind) -> Object k ; + ODef : (k : Kind) -> Object k ; + + +} diff --git a/examples/dialogue/DialogueEng.gf b/examples/dialogue/DialogueEng.gf new file mode 100644 index 000000000..b30f30bcb --- /dev/null +++ b/examples/dialogue/DialogueEng.gf @@ -0,0 +1,4 @@ +--# -path=.:present:prelude + +concrete DialogueEng of Dialogue = DialogueI with + (Lang = LangEng) ; diff --git a/examples/dialogue/DialogueFre.gf b/examples/dialogue/DialogueFre.gf new file mode 100644 index 000000000..fcd755a78 --- /dev/null +++ b/examples/dialogue/DialogueFre.gf @@ -0,0 +1,4 @@ +--# -path=.:present:prelude + +concrete DialogueFre of Dialogue = DialogueI with + (Lang = LangFre) ; diff --git a/examples/dialogue/DialogueGodis.gf b/examples/dialogue/DialogueGodis.gf new file mode 100644 index 000000000..fd39b5cc3 --- /dev/null +++ b/examples/dialogue/DialogueGodis.gf @@ -0,0 +1,34 @@ +--# -path=.:prelude + +concrete DialogueGodis of Dialogue = open ResGodis, Prelude in { + + flags lexer=codelit ; unlexer=code ; + + lincat + Move = SS ; + Action = SS ; + Kind = SS ; + Object = SS ; + Oper0 = SS ; + Oper1 = SS ; + Oper2 = SS ; + + lin + MRequest a = a ; + MAnswer a = a ; --- ?? + + MQuery k = ss (bracket (app1 "query" k.s)) ; --- + + AOper0 op = ss (bracket (request op.s)) ; + AOper1 k op x = ss (req_ans op.s k.s x.s) ; + AOper2 k m op x y = + ss (bracket (request op.s ++ "," ++ + answer (app1 k.s x.s) ++ "," ++ answer (app1 m.s y.s))) ; + + OAll = apps "all" ; + OIndef = apps "indef" ; + ODef = apps "def" ; + + +} + diff --git a/examples/dialogue/DialogueI.gf b/examples/dialogue/DialogueI.gf new file mode 100644 index 000000000..7a00e67db --- /dev/null +++ b/examples/dialogue/DialogueI.gf @@ -0,0 +1,68 @@ +incomplete concrete DialogueI of Dialogue = open Lang, Prelude in { + + lincat + Move = Phr ; + Action = {s : ActType => Str} ; + Kind = CN ; + Object = NP ; + Oper0 = V ; + Oper1 = V2 ; + Oper2 = V3 ; + + lin + MRequest a = ss (a.s ! ARequest) ; + MAnswer a = ss (a.s ! AAnswer) ; + + MQuery k = + PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos + (ExistIP (IDetCN whichPl_IDet NoNum NoOrd k)))) NoVoc ; + + AOper0 op = mkAction (UseV op) ; + AOper1 _ op x = mkAction (ComplV2 op x) ; + AOper2 _ _ op x y = mkAction (ComplV3 op x y) ; + + OAll k = PredetNP all_Predet (DetCN (DetPl (PlQuant IndefArt) NoNum NoOrd) k) ; + OIndef k = DetCN (DetSg (SgQuant IndefArt) NoOrd) k ; + ODef k = DetCN (DetSg (SgQuant DefArt) NoOrd) k ; + + param + ActType = ARequest | AAnswer ; -- and some others + + oper + + -- this should perhaps be language dependent - but at least these + -- variants seem to make sense in all languages + + mkAction : VP -> {s : ActType => Str} = \vp -> { + s = table { + ARequest => variants { + aImp vp ; + aImpPlease vp ; + aWant vp ; + aCanYou vp + } ; + AAnswer => variants { + aInf vp + } + } + } ; + + aImp : VP -> Str = \vp -> + (PhrUtt NoPConj (UttImpPl PPos (ImpVP vp)) NoVoc).s ; + + aImpPlease : VP -> Str = \vp -> + (PhrUtt NoPConj (UttImpPl PPos (ImpVP vp)) please_Voc).s ; + + aWant : VP -> Str = \vp -> + (PhrUtt NoPConj (UttS (UseCl TPres ASimul PPos (PredVP (UsePron i_Pron) + (ComplVV want_VV vp)))) NoVoc).s ; + + aCanYou : VP -> Str = \vp -> + (PhrUtt NoPConj (UttQS (UseQCl TPres ASimul PPos (QuestCl (PredVP + (UsePron youSg_Pron) (ComplVV can_VV vp))))) NoVoc).s ; + + aInf : VP -> Str = \vp -> + (PhrUtt NoPConj (UttVP vp) NoVoc).s ; + +} + diff --git a/examples/dialogue/DialogueSwe.gf b/examples/dialogue/DialogueSwe.gf new file mode 100644 index 000000000..28a81cd69 --- /dev/null +++ b/examples/dialogue/DialogueSwe.gf @@ -0,0 +1,4 @@ +--# -path=.:present:prelude + +concrete DialogueSwe of Dialogue = DialogueI with + (Lang = LangSwe) ; diff --git a/examples/dialogue/README b/examples/dialogue/README new file mode 100644 index 000000000..f075b2f4f --- /dev/null +++ b/examples/dialogue/README @@ -0,0 +1,23 @@ +Dialogue system grammar examples. + +Files (for X = Eng, Fre, Godis, Swe): + + Dialogue.gf -- base dialogue grammar + DialogueX.gf -- implementation instance + DialogueI.gf -- implementation functor + + ResGodis.gf -- help constructs for Prolog terms + + Weekday.gf -- untility grammar with weekdays + WeekdayX.gf + + Agenda.gf -- application grammar for agenda + AgendaX.gf + +To build a new application for domain Dom, you need + + Dom.gf -- introduce fun's in Kind, Object, Oper0, Oper1, Oper2 + DomX.gf -- concrete syntax of the new fun's for language X + + + diff --git a/examples/dialogue/ResGodis.gf b/examples/dialogue/ResGodis.gf new file mode 100644 index 000000000..f6d998d1b --- /dev/null +++ b/examples/dialogue/ResGodis.gf @@ -0,0 +1,18 @@ +resource ResGodis = open Prelude in { + + oper + bracket : Str -> Str = \s -> "[" ++ s ++ "]" ; + + app1 : Str -> Str -> Str = \f,x -> f ++ paren x ; + + apps : Str -> SS -> SS = \f,x -> ss (app1 f x.s) ; + + request : Str -> Str = app1 "request" ; + answer : Str -> Str = app1 "answer" ; + + req_ans : Str -> Str -> Str -> Str = \f,t,k -> + bracket (request f ++ "," ++ answer (app1 t k)) ; + +} + +-- [request(add_event), answer(event_to_store(meeting))] diff --git a/examples/dialogue/Weekday.gf b/examples/dialogue/Weekday.gf new file mode 100644 index 000000000..8ef2e8c99 --- /dev/null +++ b/examples/dialogue/Weekday.gf @@ -0,0 +1,8 @@ +abstract Weekday = { + cat + WDay ; + + fun + Mon, Tue : WDay ; + +} diff --git a/examples/dialogue/WeekdayEng.gf b/examples/dialogue/WeekdayEng.gf new file mode 100644 index 000000000..16c2e6125 --- /dev/null +++ b/examples/dialogue/WeekdayEng.gf @@ -0,0 +1,10 @@ +concrete WeekdayEng of Weekday = open LangEng, ParadigmsEng in { + + lincat + WDay = PN ; + + lin + Mon = regPN "Monday" nonhuman ; + Tue = regPN "Tuesday" nonhuman ; + +} diff --git a/examples/dialogue/WeekdayFre.gf b/examples/dialogue/WeekdayFre.gf new file mode 100644 index 000000000..d0c6e141a --- /dev/null +++ b/examples/dialogue/WeekdayFre.gf @@ -0,0 +1,10 @@ +concrete WeekdayFre of Weekday = open LangFre, ParadigmsFre in { + + lincat + WDay = PN ; + + lin + Mon = mkPN "lundi" masculine ; + Tue = mkPN "mardi" masculine ; + +} diff --git a/examples/dialogue/WeekdayGodis.gf b/examples/dialogue/WeekdayGodis.gf new file mode 100644 index 000000000..48d07b99c --- /dev/null +++ b/examples/dialogue/WeekdayGodis.gf @@ -0,0 +1,10 @@ +concrete WeekdayGodis of Weekday = open ResGodis, Prelude in { + + lincat + WDay = SS ; + + lin + Mon = ss "monday" ; + Tue = ss "tuesday" ; + +} diff --git a/examples/dialogue/WeekdaySwe.gf b/examples/dialogue/WeekdaySwe.gf new file mode 100644 index 000000000..9097f19d3 --- /dev/null +++ b/examples/dialogue/WeekdaySwe.gf @@ -0,0 +1,10 @@ +concrete WeekdaySwe of Weekday = open LangSwe, ParadigmsSwe in { + + lincat + WDay = PN ; + + lin + Mon = regPN "mÃ¥ndag" utrum ; + Tue = regPN "tisdag" utrum ; + +}