From ea5639b85f215defb159c35591eed668e0f8011f Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 9 Dec 2005 16:28:45 +0000 Subject: [PATCH] multimodal for Swedish --- examples/{tram => tram0}/README | 0 examples/{tram => tram0}/Tram.gf | 0 examples/{tram => tram0}/TramEng.gf | 0 examples/{tram => tram0}/TramFre.gf | 0 examples/{tram => tram0}/TramI.gf | 0 examples/{tram => tram0}/TramSwe.gf | 0 lib/resource-1.0/abstract/Math.gf | 25 +++++++++++++++++ lib/resource-1.0/common/ParamX.gf | 8 +++--- lib/resource-1.0/english/MathEng.gf | 26 ++++++++++++++++++ lib/resource-1.0/multimodal/DemonstrativeI.gf | 17 +++++++----- .../multimodal/DemonstrativeSwe.gf | 4 +++ lib/resource-1.0/multimodal/MultimodalSwe.gf | 19 +++++++++++++ lib/resource-1.0/scandinavian/DiffScand.gf | 1 + lib/resource-1.0/scandinavian/MathScand.gf | 27 +++++++++++++++++++ lib/resource-1.0/scandinavian/VerbScand.gf | 2 +- lib/resource-1.0/swedish/DiffSwe.gf | 1 + lib/resource-1.0/swedish/MathSwe.gf | 2 ++ 17 files changed, 120 insertions(+), 12 deletions(-) rename examples/{tram => tram0}/README (100%) rename examples/{tram => tram0}/Tram.gf (100%) rename examples/{tram => tram0}/TramEng.gf (100%) rename examples/{tram => tram0}/TramFre.gf (100%) rename examples/{tram => tram0}/TramI.gf (100%) rename examples/{tram => tram0}/TramSwe.gf (100%) create mode 100644 lib/resource-1.0/abstract/Math.gf create mode 100644 lib/resource-1.0/english/MathEng.gf create mode 100644 lib/resource-1.0/multimodal/DemonstrativeSwe.gf create mode 100644 lib/resource-1.0/multimodal/MultimodalSwe.gf create mode 100644 lib/resource-1.0/scandinavian/MathScand.gf create mode 100644 lib/resource-1.0/swedish/MathSwe.gf diff --git a/examples/tram/README b/examples/tram0/README similarity index 100% rename from examples/tram/README rename to examples/tram0/README diff --git a/examples/tram/Tram.gf b/examples/tram0/Tram.gf similarity index 100% rename from examples/tram/Tram.gf rename to examples/tram0/Tram.gf diff --git a/examples/tram/TramEng.gf b/examples/tram0/TramEng.gf similarity index 100% rename from examples/tram/TramEng.gf rename to examples/tram0/TramEng.gf diff --git a/examples/tram/TramFre.gf b/examples/tram0/TramFre.gf similarity index 100% rename from examples/tram/TramFre.gf rename to examples/tram0/TramFre.gf diff --git a/examples/tram/TramI.gf b/examples/tram0/TramI.gf similarity index 100% rename from examples/tram/TramI.gf rename to examples/tram0/TramI.gf diff --git a/examples/tram/TramSwe.gf b/examples/tram0/TramSwe.gf similarity index 100% rename from examples/tram/TramSwe.gf rename to examples/tram0/TramSwe.gf diff --git a/lib/resource-1.0/abstract/Math.gf b/lib/resource-1.0/abstract/Math.gf new file mode 100644 index 000000000..367116767 --- /dev/null +++ b/lib/resource-1.0/abstract/Math.gf @@ -0,0 +1,25 @@ +abstract Math = Cat ** { + +--3 Noun phrases with symbols + +fun + + SymbPN : Symb -> PN ; -- "x" + IntPN : Int -> PN ; -- "27" + CNIntNP : CN -> Int -> NP ; -- "level 53" + CNSymbNP : Det -> CN -> [Symb] -> NP ; -- "(the) (2) numbers x and y" + +--3 Symbol lists + +-- A symbol list has at least two elements. The last two are separated +-- by a conjunction ("and" in English), the others by commas. +-- This produces "x, y and z", in English. + +cat + Symb ; + [Symb]{2} ; + +fun + MkSymb : String -> Symb ; + +} diff --git a/lib/resource-1.0/common/ParamX.gf b/lib/resource-1.0/common/ParamX.gf index f8ecb373b..560079343 100644 --- a/lib/resource-1.0/common/ParamX.gf +++ b/lib/resource-1.0/common/ParamX.gf @@ -1,4 +1,4 @@ -resource ParamX = { +resource ParamX = open Prelude in { param Number = Sg | Pl ; @@ -26,10 +26,10 @@ resource ParamX = { -- To construct a record with a polarity-dependent table. - polCases : Str -> Str -> {s : Polarity => Str} = \true,false -> { + polCases : SS -> SS -> {s : Polarity => Str} = \true,false -> { s = table { - Pos => true ; - Neg => false + Pos => true.s ; + Neg => false.s } } ; diff --git a/lib/resource-1.0/english/MathEng.gf b/lib/resource-1.0/english/MathEng.gf new file mode 100644 index 000000000..8bfaee695 --- /dev/null +++ b/lib/resource-1.0/english/MathEng.gf @@ -0,0 +1,26 @@ +concrete MathEng of Math = CatEng ** open Prelude, ResEng in { + +lin + SymbPN i = {s = \\c => i.s ; a = agrP3 Sg} ; --- c + IntPN i = {s = \\c => i.s ; a = agrP3 Sg} ; --- c + CNIntNP cn i = { + s = \\c => (cn.s ! Sg ! Nom ++ i.s) ; + a = agrP3 Sg + } ; + CNSymbNP det cn xs = { + s = \\c => det.s ++ cn.s ! det.n ! c ++ xs.s ; + a = agrP3 det.n + } ; + +lincat + + Symb, SymbList = SS ; + +lin + + MkSymb s = s ; + + BaseSymb = infixSS "and" ; + ConsSymb = infixSS "," ; + +} diff --git a/lib/resource-1.0/multimodal/DemonstrativeI.gf b/lib/resource-1.0/multimodal/DemonstrativeI.gf index 6b86230d7..8bac85b34 100644 --- a/lib/resource-1.0/multimodal/DemonstrativeI.gf +++ b/lib/resource-1.0/multimodal/DemonstrativeI.gf @@ -23,7 +23,10 @@ incomplete concrete DemonstrativeI of Demonstrative = Cat, TenseX ** in mkDem {s : Polarity => Str} - (polCases (PosCl cl).s (NegCl cl).s) (concatPoint np vp) ; + (polCases + (UttS (PosCl cl)) + (UttS (NegCl cl))) + (concatPoint np vp) ; MQPredVP np vp = let cl = QuestCl (PredVP np vp) @@ -31,8 +34,8 @@ incomplete concrete DemonstrativeI of Demonstrative = Cat, TenseX ** mkDem {s : Polarity => Str} (polCases - ((PosQCl cl).s ! QDir) - ((NegQCl cl).s ! QDir)) + (UttQS (PosQCl cl)) + (UttQS (NegQCl cl))) (concatPoint np vp) ; MQuestVP np vp = @@ -41,8 +44,8 @@ incomplete concrete DemonstrativeI of Demonstrative = Cat, TenseX ** mkDem {s : Polarity => Str} (polCases - ((PosQCl cl).s ! QDir) - ((NegQCl cl).s ! QDir)) + (UttQS (PosQCl cl)) + (UttQS (NegQCl cl))) vp ; MImpVP vp = @@ -51,8 +54,8 @@ incomplete concrete DemonstrativeI of Demonstrative = Cat, TenseX ** mkDem {s : Polarity => Str} (polCases - ((UttImpSg PPos imp).s) - ((UttImpSg PNeg imp).s)) + ((UttImpSg PPos imp)) + ((UttImpSg PNeg imp))) vp ; diff --git a/lib/resource-1.0/multimodal/DemonstrativeSwe.gf b/lib/resource-1.0/multimodal/DemonstrativeSwe.gf new file mode 100644 index 000000000..3967c5c9a --- /dev/null +++ b/lib/resource-1.0/multimodal/DemonstrativeSwe.gf @@ -0,0 +1,4 @@ +concrete DemonstrativeSwe of Demonstrative = CatSwe, TenseX ** DemonstrativeI with + (Test = TestSwe), + (Structural = StructuralSwe) ; + diff --git a/lib/resource-1.0/multimodal/MultimodalSwe.gf b/lib/resource-1.0/multimodal/MultimodalSwe.gf new file mode 100644 index 000000000..4d153d7d4 --- /dev/null +++ b/lib/resource-1.0/multimodal/MultimodalSwe.gf @@ -0,0 +1,19 @@ +--# -path=.:../swedish/:../scandinavian:../abstract:../common:prelude + +concrete MultimodalSwe of Multimodal = + NounSwe, +-- Verb, + AdjectiveSwe, + AdverbSwe, + NumeralSwe, +-- Sentence, +-- Question, +-- Relative, +-- Conjunction, +-- Phrase, +-- Tensed, + StructuralSwe, + DemonstrativeSwe, + BasicSwe + ** {} ; + diff --git a/lib/resource-1.0/scandinavian/DiffScand.gf b/lib/resource-1.0/scandinavian/DiffScand.gf index 5ce2d8153..0a4528ef7 100644 --- a/lib/resource-1.0/scandinavian/DiffScand.gf +++ b/lib/resource-1.0/scandinavian/DiffScand.gf @@ -18,6 +18,7 @@ interface DiffScand = open ResScand, Prelude in { conjThat : Str ; conjThan : Str ; + conjAnd : Str ; infMark : Str ; subjIf : Str ; diff --git a/lib/resource-1.0/scandinavian/MathScand.gf b/lib/resource-1.0/scandinavian/MathScand.gf new file mode 100644 index 000000000..9a65a79c2 --- /dev/null +++ b/lib/resource-1.0/scandinavian/MathScand.gf @@ -0,0 +1,27 @@ +incomplete concrete MathScand of Math = + CatScand ** open Prelude, ResScand, DiffScand in { + +lin + SymbPN i = {s = \\c => i.s ; g = Neutr} ; --- c + IntPN i = {s = \\c => i.s ; g = Neutr} ; --- c + CNIntNP cn i = { + s = \\c => (cn.s ! Sg ! DIndef ! Nom ++ i.s) ; + a = agrP3 cn.g Sg + } ; + CNSymbNP det cn xs = let g = cn.g in { + s = \\c => det.s ! g ++ cn.s ! det.n ! det.det ! caseNP c ++ xs.s ; + a = agrP3 g det.n + } ; + +lincat + + Symb, SymbList = SS ; + +lin + + MkSymb s = s ; + + BaseSymb = infixSS conjAnd ; + ConsSymb = infixSS "," ; + +} diff --git a/lib/resource-1.0/scandinavian/VerbScand.gf b/lib/resource-1.0/scandinavian/VerbScand.gf index c122bb837..b175de29f 100644 --- a/lib/resource-1.0/scandinavian/VerbScand.gf +++ b/lib/resource-1.0/scandinavian/VerbScand.gf @@ -26,7 +26,7 @@ incomplete concrete VerbScand of Verb = CatScand ** open DiffScand, ResScand in CompAdv a = {s = \\_ => a.s} ; --- these give parser overflow ---- AdvVP vp adv = insertAdv adv.s vp ; + AdvVP vp adv = insertAdv adv.s vp ; --- AdVVP adv vp = insertAdV adv.s vp ; {- diff --git a/lib/resource-1.0/swedish/DiffSwe.gf b/lib/resource-1.0/swedish/DiffSwe.gf index e1a77d462..3356649fe 100644 --- a/lib/resource-1.0/swedish/DiffSwe.gf +++ b/lib/resource-1.0/swedish/DiffSwe.gf @@ -22,6 +22,7 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in { conjThat = "att" ; conjThan = "än" ; + conjAnd = "och" ; infMark = "att" ; subjIf = "om" ; diff --git a/lib/resource-1.0/swedish/MathSwe.gf b/lib/resource-1.0/swedish/MathSwe.gf new file mode 100644 index 000000000..f32947a47 --- /dev/null +++ b/lib/resource-1.0/swedish/MathSwe.gf @@ -0,0 +1,2 @@ +concrete MathSwe of Math = CatSwe ** MathScand with + (DiffScand = DiffSwe) ;