From fc70965de3ad8d0986673ccd77b0cb7009b675d6 Mon Sep 17 00:00:00 2001 From: aarne Date: Mon, 30 May 2005 15:22:42 +0000 Subject: [PATCH] a dialogue resource started --- lib/dialogue/Dialogue.gf | 41 +++++++++++++++++++++++++++++++ lib/dialogue/DialogueEng.gf | 6 +++++ lib/dialogue/DialogueI.gf | 42 ++++++++++++++++++++++++++++++++ lib/dialogue/DialogueParam.gf | 24 ++++++++++++++++++ lib/dialogue/DialogueParamEng.gf | 3 +++ src/GF/Source/PrintGF.hs | 1 - 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 lib/dialogue/Dialogue.gf create mode 100644 lib/dialogue/DialogueEng.gf create mode 100644 lib/dialogue/DialogueI.gf create mode 100644 lib/dialogue/DialogueParam.gf create mode 100644 lib/dialogue/DialogueParamEng.gf diff --git a/lib/dialogue/Dialogue.gf b/lib/dialogue/Dialogue.gf new file mode 100644 index 000000000..143f9cd12 --- /dev/null +++ b/lib/dialogue/Dialogue.gf @@ -0,0 +1,41 @@ +abstract Dialogue = { + + cat + Phrase ; + Sentence ; + Command ; + + NP ; V ; V2 ; VV ; A ; PP ; IP ; + + fun + PhrasePos : Sentence -> Phrase ; + PhraseNeg : Sentence -> Phrase ; + PhraseQuest : Sentence -> Phrase ; + + SentV : V -> NP -> Sentence ; + SentV2 : V2 -> NP -> NP -> Sentence ; + SentA : A -> NP -> Sentence ; + SentPP : PP -> NP -> Sentence ; + + ModSentV : VV -> V -> NP -> Sentence ; + ModSentV2 : VV -> V2 -> NP -> NP -> Sentence ; + ModSentA : VV -> A -> NP -> Sentence ; + ModSentPP : VV -> PP -> NP -> Sentence ; + + WhQuestV : V -> IP -> Phrase ; + WhQuestSubjV2 : V2 -> IP -> NP -> Phrase ; + WhQuestObjV2 : V2 -> NP -> IP -> Phrase ; + WhQuestA : A -> IP -> Phrase ; + WhQuestPP : PP -> IP -> Phrase ; + + CommV : V -> Phrase ; + CommV2 : V2 -> NP -> Phrase ; + CommA : A -> Phrase ; + CommPP : PP -> Phrase ; + +-- to test + + testNP : NP ; testV : V ; testV2 : V2 ; testVV : VV ; testA : A ; + testPP : PP ; testIP : IP ; + +} diff --git a/lib/dialogue/DialogueEng.gf b/lib/dialogue/DialogueEng.gf new file mode 100644 index 000000000..6a64c186f --- /dev/null +++ b/lib/dialogue/DialogueEng.gf @@ -0,0 +1,6 @@ +--# -path=dialogue:resource/*:prelude + +concrete DialogueEng of Dialogue = DialogueI with + (Resource = ResourceEng), + (Basic = BasicEng), + (DialogueParam = DialogueParamEng) ; diff --git a/lib/dialogue/DialogueI.gf b/lib/dialogue/DialogueI.gf new file mode 100644 index 000000000..4d56212b0 --- /dev/null +++ b/lib/dialogue/DialogueI.gf @@ -0,0 +1,42 @@ +incomplete concrete DialogueI of Dialogue = open Prelude, Resource, Basic, DialogueParam in { + + lincat + Phrase = {s : Str} ; + Sentence = {s : PhraseForm => Str} ; + Command = {s : Str} ; + + NP = NP ; V = V ; V2 = V2 ; VV = VV ; A = A ; PP = PP ; IP = IP ; + + lin + PhrasePos s = ss (s.s ! PPos) ; + PhraseNeg s = ss (s.s ! PNeg) ; + PhraseQuest s = ss (s.s ! PQuest) ; + + SentV v np = mkPhrase (SPredV np v) ; + SentV2 v np obj = mkPhrase (SPredV2 np v obj) ; + SentA v np = mkPhrase (SPredAP np (UseA v)) ; + SentPP pp np = mkPhrase (SPredAdv np (AdvPP pp)) ; + + ModSentV m v np = mkPhrase (SPredVV np m (IPredV ASimul v)) ; + ModSentV2 m v np obj = mkPhrase (SPredVV np m (IPredV2 ASimul v obj)) ; + + CommV v = ImperOne (PosImpVP (IPredV ASimul v)) ; + CommV2 v obj = ImperOne (PosImpVP (IPredV2 ASimul v obj)) ; + + WhQuestV v ip = mkQuestion (QPredV ip v) ; + WhQuestSubjV2 v ip np = mkQuestion (QPredV2 ip v np) ; + WhQuestObjV2 v np ip = mkQuestion (IntSlash ip (SlashV2 np v)) ; + WhQuestA v ip = mkQuestion (QPredAP ip (UseA v)) ; + WhQuestPP pp ip = mkQuestion (QPredAdv ip (AdvPP pp)) ; + + +-- test + + testNP = she_NP ; testV = walk_V ; testV2 = love_V2 ; testVV = + want_VV ; + --- testA = PositADeg blue_A ; + testPP = PrepNP in_Prep (DefOneNP (UseN city_N)) ; + testIP = who8one_IP ; + + +} diff --git a/lib/dialogue/DialogueParam.gf b/lib/dialogue/DialogueParam.gf new file mode 100644 index 000000000..10574dcb6 --- /dev/null +++ b/lib/dialogue/DialogueParam.gf @@ -0,0 +1,24 @@ +interface DialogueParam = open Resource, Predef, Prelude in { + + param + PhraseForm = PPos | PNeg | PQuest ; + + oper + mkPhraseStr : (p,n,q : Str) -> {s : PhraseForm => Str} = \p,n,q -> + {s = table { + PPos => p ; + PNeg => n ; + PQuest => q + } + } ; + + mkPhrase : Cl -> {s : PhraseForm => Str} = \p -> + mkPhraseStr + ((IndicPhrase (UseCl (PosTP TPresent ASimul) p)).s) + ((IndicPhrase (UseCl (NegTP TPresent ASimul) p)).s) + ((QuestPhrase (UseQCl (PosTP TPresent ASimul) (QuestCl p))).s) ; + + mkQuestion : QCl -> {s : Str} = \q -> + (QuestPhrase (UseQCl (PosTP TPresent ASimul) q)) ; + +} diff --git a/lib/dialogue/DialogueParamEng.gf b/lib/dialogue/DialogueParamEng.gf new file mode 100644 index 000000000..3a105b8cf --- /dev/null +++ b/lib/dialogue/DialogueParamEng.gf @@ -0,0 +1,3 @@ +instance DialogueParamEng of DialogueParam = open ResourceEng, Predef, Prelude in { + +} ; diff --git a/src/GF/Source/PrintGF.hs b/src/GF/Source/PrintGF.hs index a0bc469ae..e793e7d94 100644 --- a/src/GF/Source/PrintGF.hs +++ b/src/GF/Source/PrintGF.hs @@ -347,7 +347,6 @@ instance Print Exp where EProj exp label -> prPrec i 3 (concatD [prt 3 exp , doc (showString ".") , prt 0 label]) EQConstr id0 id -> prPrec i 3 (concatD [doc (showString "{0") , prt 0 id0 , doc (showString ".") , prt 0 id , doc (showString "}0")]) -- H EQCons id0 id -> prPrec i 3 (concatD [doc (showString "%") , prt 0 id0 , doc (showString ".") , prt 0 id]) - EQCons id0 id -> prPrec i 3 (concatD [doc (showString "%") , prt 0 id0 , doc (showString ".") , prt 0 id , doc (showString "%")]) EApp exp0 exp -> prPrec i 2 (concatD [prt 2 exp0 , prt 3 exp]) ETable cases -> prPrec i 2 (concatD [doc (showString "table") , doc (showString "{") , prt 0 cases , doc (showString "}")]) ETTable exp cases -> prPrec i 2 (concatD [doc (showString "table") , prt 4 exp , doc (showString "{") , prt 0 cases , doc (showString "}")])