mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Add Grammatical Framework
This commit is contained in:
@@ -529,6 +529,16 @@ Gosu:
|
||||
color: "#82937f"
|
||||
primary_extension: .gs
|
||||
|
||||
Grammatical Framework:
|
||||
type: programming
|
||||
lexer: haskell
|
||||
aliases:
|
||||
- gf
|
||||
wrap: false
|
||||
primary_extension: .gf
|
||||
searchable: true
|
||||
color: "#ff0000"
|
||||
|
||||
Groff:
|
||||
primary_extension: .man
|
||||
extensions:
|
||||
|
||||
12
samples/Grammatical Framework/CharactersGla.gf
Normal file
12
samples/Grammatical Framework/CharactersGla.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
resource CharactersGla = {
|
||||
|
||||
--Character classes
|
||||
oper
|
||||
vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"<22>"|"<22>"|"<22>"|"<22>"|"<22>") ;
|
||||
vowelCap : pattern Str = #("A"|"E"|"I"|"O"|"U"|"<22>"|"<22>"|"<22>"|"<22>"|"<22>") ;
|
||||
consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ;
|
||||
consonantCap : pattern Str = #("B"|"C"|"D"|"F"|"G"|"H"|"J"|"K"|"L"|"M"|"N"|"P"|"Q"|"R"|"S"|"T"|"V"|"W"|"X"|"Z") ;
|
||||
broadVowel : pattern Str = #("a"|"o"|"u"|"<22>"|"<22>"|"<22>") ;
|
||||
slenderVowel : pattern Str = #("e"|"i"|"<22>"|"<22>") ;
|
||||
|
||||
}
|
||||
12
samples/Grammatical Framework/CharactersGle.gf
Normal file
12
samples/Grammatical Framework/CharactersGle.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
resource CharactersGle = {
|
||||
|
||||
--Character classes
|
||||
oper
|
||||
vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"<22>"|"<22>"|"<22>"|"<22>"|"<22>") ;
|
||||
vowelCap : pattern Str = #("A"|"E"|"I"|"O"|"U"|"<22>"|"<22>"|"<22>"|"<22>"|"<22>") ;
|
||||
consonant : pattern Str = #("b"|"c"|"d"|"f"|"g"|"h"|"j"|"k"|"l"|"m"|"n"|"p"|"q"|"r"|"s"|"t"|"v"|"w"|"x"|"z") ;
|
||||
consonantCap : pattern Str = #("B"|"C"|"D"|"F"|"G"|"H"|"J"|"K"|"L"|"M"|"N"|"P"|"Q"|"R"|"S"|"T"|"V"|"W"|"X"|"Z") ;
|
||||
broadVowel : pattern Str = #("a"|"o"|"u"|"<22>"|"<22>"|"<22>") ;
|
||||
slenderVowel : pattern Str = #("e"|"i"|"<22>"|"<22>") ;
|
||||
|
||||
}
|
||||
15
samples/Grammatical Framework/Foods.gf
Normal file
15
samples/Grammatical Framework/Foods.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
abstract Foods = {
|
||||
flags startcat = Comment ;
|
||||
cat
|
||||
Comment ; Item ; Kind ; Quality ;
|
||||
fun
|
||||
Pred : Item -> Quality -> Comment ;
|
||||
This, That, These, Those : Kind -> Item ;
|
||||
Mod : Quality -> Kind -> Kind ;
|
||||
Wine, Cheese, Fish, Pizza : Kind ;
|
||||
Very : Quality -> Quality ;
|
||||
Fresh, Warm, Italian,
|
||||
Expensive, Delicious, Boring : Quality ;
|
||||
}
|
||||
76
samples/Grammatical Framework/FoodsAfr.gf
Normal file
76
samples/Grammatical Framework/FoodsAfr.gf
Normal file
@@ -0,0 +1,76 @@
|
||||
-- (c) 2009 Laurette Pretorius Sr & Jr and Ansu Berg under LGPL
|
||||
|
||||
concrete FoodsAfr of Foods = open Prelude, Predef in{
|
||||
lincat
|
||||
Comment = {s: Str} ;
|
||||
Kind = {s: Number => Str} ;
|
||||
Item = {s: Str ; n: Number} ;
|
||||
Quality = {s: AdjAP => Str} ;
|
||||
|
||||
lin
|
||||
Pred item quality = {s = item.s ++ "is" ++ (quality.s ! Predic)};
|
||||
This kind = {s = "hierdie" ++ (kind.s ! Sg); n = Sg};
|
||||
That kind = {s = "daardie" ++ (kind.s ! Sg); n = Sg};
|
||||
These kind = {s = "hierdie" ++ (kind.s ! Pl); n = Pl};
|
||||
Those kind = {s = "daardie" ++ (kind.s ! Pl); n = Pl};
|
||||
Mod quality kind = {s = table{n => (quality.s ! Attr) ++ (kind.s!n)}};
|
||||
|
||||
Wine = declNoun_e "wyn";
|
||||
Cheese = declNoun_aa "kaas";
|
||||
Fish = declNoun_ss "vis";
|
||||
Pizza = declNoun_s "pizza";
|
||||
|
||||
Very quality = veryAdj quality;
|
||||
|
||||
Fresh = regAdj "vars";
|
||||
Warm = regAdj "warm";
|
||||
Italian = smartAdj_e "Italiaans";
|
||||
Expensive = regAdj "duur";
|
||||
Delicious = smartAdj_e "heerlik";
|
||||
Boring = smartAdj_e "vervelig";
|
||||
|
||||
param
|
||||
AdjAP = Attr | Predic ;
|
||||
Number = Sg | Pl ;
|
||||
|
||||
oper
|
||||
--Noun operations (wyn, kaas, vis, pizza)
|
||||
|
||||
declNoun_aa: Str -> {s: Number => Str} = \x ->
|
||||
let v = tk 2 x
|
||||
in
|
||||
{s = table{Sg => x ; Pl => v + (last x) +"e"}};
|
||||
|
||||
declNoun_e: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + "e"}} ;
|
||||
declNoun_s: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + "s"}} ;
|
||||
|
||||
declNoun_ss: Str -> {s: Number => Str} = \x -> {s = table{Sg => x ; Pl => x + (last x) + "e"}} ;
|
||||
|
||||
|
||||
--Adjective operations
|
||||
|
||||
mkAdj : Str -> Str -> {s: AdjAP => Str} = \x,y -> {s = table{Attr => x; Predic => y}};
|
||||
|
||||
declAdj_e : Str -> {s : AdjAP=> Str} = \x -> mkAdj (x + "e") x;
|
||||
declAdj_g : Str -> {s : AdjAP=> Str} = \w ->
|
||||
let v = init w
|
||||
in mkAdj (v + "<22>") w ;
|
||||
|
||||
declAdj_oog : Str -> {s : AdjAP=> Str} = \w ->
|
||||
let v = init w
|
||||
in
|
||||
let i = init v
|
||||
in mkAdj (i + "<22>") w ;
|
||||
|
||||
regAdj : Str -> {s : AdjAP=> Str} = \x -> mkAdj x x;
|
||||
|
||||
veryAdj : {s: AdjAP => Str} -> {s : AdjAP=> Str} = \x -> {s = table{a => "baie" ++ (x.s!a)}};
|
||||
|
||||
|
||||
smartAdj_e : Str -> {s : AdjAP=> Str} = \a -> case a of
|
||||
{
|
||||
_ + "oog" => declAdj_oog a ;
|
||||
_ + ("e" | "ie" | "o" | "oe") + "g" => declAdj_g a ;
|
||||
_ => declAdj_e a
|
||||
};
|
||||
}
|
||||
21
samples/Grammatical Framework/FoodsAmh.gf
Normal file
21
samples/Grammatical Framework/FoodsAmh.gf
Normal file
@@ -0,0 +1,21 @@
|
||||
concrete FoodsAmh of Foods ={
|
||||
flags coding = utf8;
|
||||
lincat
|
||||
Comment,Item,Kind,Quality = Str;
|
||||
lin
|
||||
Pred item quality = item ++ quality++ "ነው::" ;
|
||||
This kind = "ይህ" ++ kind;
|
||||
That kind = "ያ" ++ kind;
|
||||
Mod quality kind = quality ++ kind;
|
||||
Wine = "ወይን";
|
||||
Cheese = "አይብ";
|
||||
Fish = "ዓሳ";
|
||||
Very quality = "በጣም" ++ quality;
|
||||
Fresh = "አዲስ";
|
||||
Warm = "ትኩስ";
|
||||
Italian = "የጥልያን";
|
||||
Expensive = "ውድ";
|
||||
Delicious = "ጣፋጭ";
|
||||
Boring = "አስቀያሚ";
|
||||
|
||||
}
|
||||
43
samples/Grammatical Framework/FoodsBul.gf
Normal file
43
samples/Grammatical Framework/FoodsBul.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
-- (c) 2009 Krasimir Angelov under LGPL
|
||||
|
||||
concrete FoodsBul of Foods = {
|
||||
|
||||
flags
|
||||
coding = utf8;
|
||||
|
||||
param
|
||||
Gender = Masc | Fem | Neutr;
|
||||
Number = Sg | Pl;
|
||||
Agr = ASg Gender | APl ;
|
||||
|
||||
lincat
|
||||
Comment = Str ;
|
||||
Quality = {s : Agr => Str} ;
|
||||
Item = {s : Str; a : Agr} ;
|
||||
Kind = {s : Number => Str; g : Gender} ;
|
||||
|
||||
lin
|
||||
Pred item qual = item.s ++ case item.a of {ASg _ => "е"; APl => "са"} ++ qual.s ! item.a ;
|
||||
|
||||
This kind = {s=case kind.g of {Masc=>"този"; Fem=>"тази"; Neutr=>"това" } ++ kind.s ! Sg; a=ASg kind.g} ;
|
||||
That kind = {s=case kind.g of {Masc=>"онзи"; Fem=>"онази"; Neutr=>"онова"} ++ kind.s ! Sg; a=ASg kind.g} ;
|
||||
These kind = {s="тези" ++ kind.s ! Pl; a=APl} ;
|
||||
Those kind = {s="онези" ++ kind.s ! Pl; a=APl} ;
|
||||
|
||||
Mod qual kind = {s=\\n => qual.s ! (case n of {Sg => ASg kind.g; Pl => APl}) ++ kind.s ! n; g=kind.g} ;
|
||||
|
||||
Wine = {s = table {Sg => "вино"; Pl => "вина"}; g = Neutr};
|
||||
Cheese = {s = table {Sg => "сирене"; Pl => "сирена"}; g = Neutr};
|
||||
Fish = {s = table {Sg => "риба"; Pl => "риби"}; g = Fem};
|
||||
Pizza = {s = table {Sg => "пица"; Pl => "пици"}; g = Fem};
|
||||
|
||||
Very qual = {s = \\g => "много" ++ qual.s ! g};
|
||||
|
||||
Fresh = {s = table {ASg Masc => "свеж"; ASg Fem => "свежа"; ASg Neutr => "свежо"; APl => "свежи"}};
|
||||
Warm = {s = table {ASg Masc => "горещ"; ASg Fem => "гореща"; ASg Neutr => "горещо"; APl => "горещи"}};
|
||||
Italian = {s = table {ASg Masc => "италиански"; ASg Fem => "италианска"; ASg Neutr => "италианско"; APl => "италиански"}};
|
||||
Expensive = {s = table {ASg Masc => "скъп"; ASg Fem => "скъпа"; ASg Neutr => "скъпо"; APl => "скъпи"}};
|
||||
Delicious = {s = table {ASg Masc => "превъзходен"; ASg Fem => "превъзходна"; ASg Neutr => "превъзходно"; APl => "превъзходни"}};
|
||||
Boring = {s = table {ASg Masc => "еднообразен"; ASg Fem => "еднообразна"; ASg Neutr => "еднообразно"; APl => "еднообразни"}};
|
||||
|
||||
}
|
||||
7
samples/Grammatical Framework/FoodsCat.gf
Normal file
7
samples/Grammatical Framework/FoodsCat.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:present
|
||||
|
||||
-- (c) 2009 Jordi Saludes under LGPL
|
||||
|
||||
concrete FoodsCat of Foods = FoodsI with
|
||||
(Syntax = SyntaxCat),
|
||||
(LexFoods = LexFoodsCat) ;
|
||||
35
samples/Grammatical Framework/FoodsChi.gf
Normal file
35
samples/Grammatical Framework/FoodsChi.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
concrete FoodsChi of Foods = {
|
||||
flags coding = utf8 ;
|
||||
lincat
|
||||
Comment, Item = Str ;
|
||||
Kind = {s,c : Str} ;
|
||||
Quality = {s,p : Str} ;
|
||||
lin
|
||||
Pred item quality = item ++ "是" ++ quality.s ++ quality.p ;
|
||||
This kind = "这" ++ kind.c ++ kind.s ;
|
||||
That kind = "那" ++ kind.c ++ kind.s ;
|
||||
These kind = "这" ++ "些" ++ kind.s ;
|
||||
Those kind = "那" ++ "些" ++ kind.s ;
|
||||
Mod quality kind = {
|
||||
s = quality.s ++ quality.p ++ kind.s ;
|
||||
c = kind.c
|
||||
} ;
|
||||
Wine = geKind "酒" ;
|
||||
Pizza = geKind "比 萨 饼" ;
|
||||
Cheese = geKind "奶 酪" ;
|
||||
Fish = geKind "鱼" ;
|
||||
Very quality = longQuality ("非 常" ++ quality.s) ;
|
||||
Fresh = longQuality "新 鲜" ;
|
||||
Warm = longQuality "温 热" ;
|
||||
Italian = longQuality "意 大 利 式" ;
|
||||
Expensive = longQuality "昂 贵" ;
|
||||
Delicious = longQuality "美 味" ;
|
||||
Boring = longQuality "难 吃" ;
|
||||
oper
|
||||
mkKind : Str -> Str -> {s,c : Str} = \s,c ->
|
||||
{s = s ; c = c} ;
|
||||
geKind : Str -> {s,c : Str} = \s ->
|
||||
mkKind s "个" ;
|
||||
longQuality : Str -> {s,p : Str} = \s ->
|
||||
{s = s ; p = "的"} ;
|
||||
}
|
||||
35
samples/Grammatical Framework/FoodsCze.gf
Normal file
35
samples/Grammatical Framework/FoodsCze.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
-- (c) 2011 Katerina Bohmova under LGPL
|
||||
|
||||
concrete FoodsCze of Foods = open ResCze in {
|
||||
flags
|
||||
coding = utf8 ;
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Quality = Adjective ;
|
||||
Kind = Noun ;
|
||||
Item = NounPhrase ;
|
||||
lin
|
||||
Pred item quality =
|
||||
{s = item.s ++ copula ! item.n ++
|
||||
quality.s ! item.g ! item.n} ;
|
||||
This = det Sg "tento" "tato" "toto" ;
|
||||
That = det Sg "tamten" "tamta" "tamto" ;
|
||||
These = det Pl "tyto" "tyto" "tato" ;
|
||||
Those = det Pl "tamty" "tamty" "tamta" ;
|
||||
Mod quality kind = {
|
||||
s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ;
|
||||
g = kind.g
|
||||
} ;
|
||||
Wine = noun "víno" "vína" Neutr ;
|
||||
Cheese = noun "sýr" "sýry" Masc ;
|
||||
Fish = noun "ryba" "ryby" Fem ;
|
||||
Pizza = noun "pizza" "pizzy" Fem ;
|
||||
Very qual = {s = \\g,n => "velmi" ++ qual.s ! g ! n} ;
|
||||
Fresh = regAdj "čerstv" ;
|
||||
Warm = regAdj "tepl" ;
|
||||
Italian = regAdj "italsk" ;
|
||||
Expensive = regAdj "drah" ;
|
||||
Delicious = regnfAdj "vynikající" ;
|
||||
Boring = regAdj "nudn" ;
|
||||
}
|
||||
|
||||
58
samples/Grammatical Framework/FoodsDut.gf
Normal file
58
samples/Grammatical Framework/FoodsDut.gf
Normal file
@@ -0,0 +1,58 @@
|
||||
-- (c) 2009 Femke Johansson under LGPL
|
||||
|
||||
concrete FoodsDut of Foods = {
|
||||
|
||||
lincat
|
||||
Comment = {s : Str};
|
||||
Quality = {s : AForm => Str};
|
||||
Kind = { s : Number => Str};
|
||||
Item = {s : Str ; n : Number};
|
||||
|
||||
lin
|
||||
Pred item quality =
|
||||
{s = item.s ++ copula ! item.n ++ quality.s ! APred};
|
||||
This = det Sg "deze";
|
||||
These = det Pl "deze";
|
||||
That = det Sg "die";
|
||||
Those = det Pl "die";
|
||||
|
||||
Mod quality kind =
|
||||
{s = \\n => quality.s ! AAttr ++ kind.s ! n};
|
||||
Wine = regNoun "wijn";
|
||||
Cheese = noun "kaas" "kazen";
|
||||
Fish = noun "vis" "vissen";
|
||||
Pizza = noun "pizza" "pizza's";
|
||||
|
||||
Very a = {s = \\f => "erg" ++ a.s ! f};
|
||||
|
||||
Fresh = regadj "vers";
|
||||
Warm = regadj "warm";
|
||||
Italian = regadj "Italiaans";
|
||||
Expensive = adj "duur" "dure";
|
||||
Delicious = regadj "lekker";
|
||||
Boring = regadj "saai";
|
||||
|
||||
param
|
||||
Number = Sg | Pl;
|
||||
AForm = APred | AAttr;
|
||||
|
||||
oper
|
||||
det : Number -> Str ->
|
||||
{s : Number => Str} -> {s : Str ; n: Number} =
|
||||
\n,det,noun -> {s = det ++ noun.s ! n ; n=n};
|
||||
|
||||
noun : Str -> Str -> {s : Number => Str} =
|
||||
\man,men -> {s = table {Sg => man; Pl => men}};
|
||||
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\wijn -> noun wijn (wijn + "en");
|
||||
|
||||
regadj : Str -> {s : AForm => Str} =
|
||||
\koud -> adj koud (koud+"e");
|
||||
|
||||
adj : Str -> Str -> {s : AForm => Str} =
|
||||
\duur, dure -> {s = table {APred => duur; AAttr => dure}};
|
||||
|
||||
copula : Number => Str =
|
||||
table {Sg => "is" ; Pl => "zijn"};
|
||||
}
|
||||
43
samples/Grammatical Framework/FoodsEng.gf
Normal file
43
samples/Grammatical Framework/FoodsEng.gf
Normal file
@@ -0,0 +1,43 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsEng of Foods = {
|
||||
flags language = en_US;
|
||||
lincat
|
||||
Comment, Quality = {s : Str} ;
|
||||
Kind = {s : Number => Str} ;
|
||||
Item = {s : Str ; n : Number} ;
|
||||
lin
|
||||
Pred item quality =
|
||||
{s = item.s ++ copula ! item.n ++ quality.s} ;
|
||||
This = det Sg "this" ;
|
||||
That = det Sg "that" ;
|
||||
These = det Pl "these" ;
|
||||
Those = det Pl "those" ;
|
||||
Mod quality kind =
|
||||
{s = \\n => quality.s ++ kind.s ! n} ;
|
||||
Wine = regNoun "wine" ;
|
||||
Cheese = regNoun "cheese" ;
|
||||
Fish = noun "fish" "fish" ;
|
||||
Pizza = regNoun "pizza" ;
|
||||
Very a = {s = "very" ++ a.s} ;
|
||||
Fresh = adj "fresh" ;
|
||||
Warm = adj "warm" ;
|
||||
Italian = adj "Italian" ;
|
||||
Expensive = adj "expensive" ;
|
||||
Delicious = adj "delicious" ;
|
||||
Boring = adj "boring" ;
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
oper
|
||||
det : Number -> Str ->
|
||||
{s : Number => Str} -> {s : Str ; n : Number} =
|
||||
\n,det,noun -> {s = det ++ noun.s ! n ; n = n} ;
|
||||
noun : Str -> Str -> {s : Number => Str} =
|
||||
\man,men -> {s = table {Sg => man ; Pl => men}} ;
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\car -> noun car (car + "s") ;
|
||||
adj : Str -> {s : Str} =
|
||||
\cold -> {s = cold} ;
|
||||
copula : Number => Str =
|
||||
table {Sg => "is" ; Pl => "are"} ;
|
||||
}
|
||||
48
samples/Grammatical Framework/FoodsEpo.gf
Normal file
48
samples/Grammatical Framework/FoodsEpo.gf
Normal file
@@ -0,0 +1,48 @@
|
||||
-- (c) 2009 Julia Hammar under LGPL
|
||||
|
||||
concrete FoodsEpo of Foods = open Prelude in {
|
||||
|
||||
flags coding =utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = SS ;
|
||||
Kind, Quality = {s : Number => Str} ;
|
||||
Item = {s : Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
Pred item quality = ss (item.s ++ copula ! item.n ++ quality.s ! item.n) ;
|
||||
This = det Sg "ĉi tiu" ;
|
||||
That = det Sg "tiu" ;
|
||||
These = det Pl "ĉi tiuj" ;
|
||||
Those = det Pl "tiuj" ;
|
||||
Mod quality kind = {s = \\n => quality.s ! n ++ kind.s ! n} ;
|
||||
Wine = regNoun "vino" ;
|
||||
Cheese = regNoun "fromaĝo" ;
|
||||
Fish = regNoun "fiŝo" ;
|
||||
Pizza = regNoun "pico" ;
|
||||
Very quality = {s = \\n => "tre" ++ quality.s ! n} ;
|
||||
Fresh = regAdj "freŝa" ;
|
||||
Warm = regAdj "varma" ;
|
||||
Italian = regAdj "itala" ;
|
||||
Expensive = regAdj "altekosta" ;
|
||||
Delicious = regAdj "bongusta" ;
|
||||
Boring = regAdj "enuiga" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
oper
|
||||
det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} =
|
||||
\n,d,cn -> {
|
||||
s = d ++ cn.s ! n ;
|
||||
n = n
|
||||
} ;
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\vino -> {s = table {Sg => vino ; Pl => vino + "j"}
|
||||
} ;
|
||||
regAdj : Str -> {s : Number => Str} =
|
||||
\nova -> {s = table {Sg => nova ; Pl => nova + "j"}
|
||||
} ;
|
||||
copula : Number => Str = \\_ => "estas" ;
|
||||
}
|
||||
|
||||
7
samples/Grammatical Framework/FoodsFin.gf
Normal file
7
samples/Grammatical Framework/FoodsFin.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:present
|
||||
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsFin of Foods = FoodsI with
|
||||
(Syntax = SyntaxFin),
|
||||
(LexFoods = LexFoodsFin) ;
|
||||
32
samples/Grammatical Framework/FoodsFre.gf
Normal file
32
samples/Grammatical Framework/FoodsFre.gf
Normal file
@@ -0,0 +1,32 @@
|
||||
--# -path=.:../foods:present
|
||||
|
||||
concrete FoodsFre of Foods = open SyntaxFre, ParadigmsFre in {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = Utt ;
|
||||
Item = NP ;
|
||||
Kind = CN ;
|
||||
Quality = AP ;
|
||||
|
||||
lin
|
||||
Pred item quality = mkUtt (mkCl item quality) ;
|
||||
This kind = mkNP this_QuantSg kind ;
|
||||
That kind = mkNP that_QuantSg kind ;
|
||||
These kind = mkNP these_QuantPl kind ;
|
||||
Those kind = mkNP those_QuantPl kind ;
|
||||
Mod quality kind = mkCN quality kind ;
|
||||
Very quality = mkAP very_AdA quality ;
|
||||
|
||||
Wine = mkCN (mkN "vin" masculine) ;
|
||||
Pizza = mkCN (mkN "pizza" feminine) ;
|
||||
Cheese = mkCN (mkN "fromage" masculine) ;
|
||||
Fish = mkCN (mkN "poisson" masculine) ;
|
||||
Fresh = mkAP (mkA "frais" "fraîche" "frais" "fraîchement") ;
|
||||
Warm = mkAP (mkA "chaud") ;
|
||||
Italian = mkAP (mkA "italien") ;
|
||||
Expensive = mkAP (mkA "cher") ;
|
||||
Delicious = mkAP (mkA "délicieux") ;
|
||||
Boring = mkAP (mkA "ennuyeux") ;
|
||||
}
|
||||
7
samples/Grammatical Framework/FoodsGer.gf
Normal file
7
samples/Grammatical Framework/FoodsGer.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:present
|
||||
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsGer of Foods = FoodsI with
|
||||
(Syntax = SyntaxGer),
|
||||
(LexFoods = LexFoodsGer) ;
|
||||
66
samples/Grammatical Framework/FoodsGla.gf
Normal file
66
samples/Grammatical Framework/FoodsGla.gf
Normal file
@@ -0,0 +1,66 @@
|
||||
concrete FoodsGla of Foods = open MutationsGla, CharactersGla, Prelude in {
|
||||
param Gender = Masc|Fem ;
|
||||
param Number = Sg|Pl ;
|
||||
param Breadth = Broad|Slender|NoBreadth ;
|
||||
param Beginning = Bcgmp|Other ;
|
||||
|
||||
lincat Comment = Str;
|
||||
lin Pred item quality = "tha" ++ item ++ quality.s!Sg!Unmutated ;
|
||||
|
||||
lincat Item = Str;
|
||||
lin
|
||||
This kind = (addArticleSg kind) ++ "seo" ;
|
||||
That kind = (addArticleSg kind) ++ "sin";
|
||||
These kind = (addArticlePl kind) ++ "seo" ;
|
||||
Those kind = (addArticlePl kind) ++ "sin" ;
|
||||
oper addArticleSg : {s : Number => Mutation => Str; g : Gender} -> Str =
|
||||
\kind -> case kind.g of { Masc => "an" ++ kind.s!Sg!PrefixT; Fem => "a'" ++ kind.s!Sg!Lenition1DNTLS } ;
|
||||
oper addArticlePl : {s : Number => Mutation => Str; g : Gender} -> Str =
|
||||
\kind -> "na" ++ kind.s!Pl!PrefixH ;
|
||||
|
||||
oper Noun : Type = {s : Number => Mutation => Str; g : Gender; pe : Breadth; beginning: Beginning; };
|
||||
lincat Kind = Noun;
|
||||
lin
|
||||
Mod quality kind = {
|
||||
s = table{
|
||||
Sg => table{mutation => kind.s!Sg!mutation ++ case kind.g of {Masc => quality.s!Sg!Unmutated; Fem => quality.s!Sg!Lenition1} };
|
||||
Pl => table{mutation => kind.s!Pl!mutation ++ case kind.pe of {Slender => quality.s!Pl!Lenition1; _ => quality.s!Pl!Unmutated} }
|
||||
};
|
||||
g = kind.g;
|
||||
pe = kind.pe;
|
||||
beginning = kind.beginning
|
||||
} ;
|
||||
Wine = makeNoun "f<>on" "f<>ontan" Masc ;
|
||||
Cheese = makeNoun "c<>ise" "c<>isean" Masc ;
|
||||
Fish = makeNoun "iasg" "<22>isg" Masc ;
|
||||
Pizza = makeNoun "pizza" "pizzathan" Masc ;
|
||||
oper makeNoun : Str -> Str -> Gender -> Noun = \sg,pl,g -> {
|
||||
s = table{Sg => (mutate sg); Pl => (mutate pl)};
|
||||
g = g;
|
||||
pe = pe;
|
||||
beginning = Bcgmp
|
||||
}
|
||||
where {
|
||||
pe : Breadth = case pl of {
|
||||
_ + v@(#broadVowel) + c@(#consonant*) + #consonant => Broad;
|
||||
_ + v@(#slenderVowel) + c@(#consonant*) + #consonant => Slender;
|
||||
_ => NoBreadth
|
||||
}
|
||||
};
|
||||
|
||||
oper Adjective : Type = {s : Number => Mutation => Str; sVery : Number => Str};
|
||||
lincat Quality = Adjective;
|
||||
lin
|
||||
Very quality = {s=table{number => table{_ => quality.sVery!number}}; sVery=quality.sVery } ;
|
||||
Fresh = makeAdjective "<22>r" "<22>ra" ;
|
||||
Warm = makeAdjective "bl<62>th" "bl<62>tha" ;
|
||||
Italian = makeAdjective "Eadailteach" "Eadailteach" ;
|
||||
Expensive = makeAdjective "daor" "daora" ;
|
||||
Delicious = makeAdjective "blasta" "blasta" ;
|
||||
Boring = makeAdjective "leamh" "leamha" ;
|
||||
oper makeAdjective : Str -> Str -> Adjective =
|
||||
\sg,pl -> {
|
||||
s=table{Sg => (mutate sg); Pl => (mutate pl)};
|
||||
sVery=table{Sg => "gl<67>"++(lenition1dntls sg); Pl => "gl<67>"++(lenition1dntls pl)}
|
||||
} ;
|
||||
}
|
||||
59
samples/Grammatical Framework/FoodsGle.gf
Normal file
59
samples/Grammatical Framework/FoodsGle.gf
Normal file
@@ -0,0 +1,59 @@
|
||||
concrete FoodsGle of Foods = open MutationsGle, CharactersGle in {
|
||||
param Gender = Masc|Fem ;
|
||||
param Number = Sg|Pl ;
|
||||
param Breadth = Broad|Slender|NoBreadth ;
|
||||
|
||||
lincat Comment = Str;
|
||||
lin Pred item quality = "t<>" ++ item ++ quality.s!Sg!Unmutated ;
|
||||
|
||||
lincat Item = Str;
|
||||
lin
|
||||
This kind = (addArticleSg kind) ++ "seo" ;
|
||||
That kind = (addArticleSg kind) ++ "sin";
|
||||
These kind = (addArticlePl kind) ++ "seo" ;
|
||||
Those kind = (addArticlePl kind) ++ "sin" ;
|
||||
oper addArticleSg : {s : Number => Mutation => Str; g : Gender} -> Str =
|
||||
\kind -> "an" ++ case kind.g of { Masc => kind.s!Sg!PrefixT; Fem => kind.s!Sg!Lenition1DNTLS } ;
|
||||
oper addArticlePl : {s : Number => Mutation => Str; g : Gender} -> Str =
|
||||
\kind -> "na" ++ kind.s!Pl!PrefixH ;
|
||||
|
||||
lincat Kind = {s : Number => Mutation => Str; g : Gender; pe : Breadth} ;
|
||||
lin
|
||||
Mod quality kind = {
|
||||
s = table{
|
||||
Sg => table{mutation => kind.s!Sg!mutation ++ case kind.g of {Masc => quality.s!Sg!Unmutated; Fem => quality.s!Sg!Lenition1} };
|
||||
Pl => table{mutation => kind.s!Pl!mutation ++ case kind.pe of {Slender => quality.s!Pl!Lenition1; _ => quality.s!Pl!Unmutated} }
|
||||
};
|
||||
g = kind.g;
|
||||
pe = kind.pe
|
||||
} ;
|
||||
Wine = makeNoun "f<>on" "f<>onta" Masc ;
|
||||
Cheese = makeNoun "c<>is" "c<>iseanna" Fem ;
|
||||
Fish = makeNoun "iasc" "<22>isc" Masc ;
|
||||
Pizza = makeNoun "p<>otsa" "p<>otsa<73>" Masc ;
|
||||
oper makeNoun : Str -> Str -> Gender -> {s : Number => Mutation => Str; g : Gender; pe : Breadth} =
|
||||
\sg,pl,g -> {
|
||||
s = table{Sg => (mutate sg); Pl => (mutate pl)};
|
||||
g = g;
|
||||
pe = case pl of {
|
||||
_ + v@(#broadVowel) + c@(#consonant*) + #consonant => Broad;
|
||||
_ + v@(#slenderVowel) + c@(#consonant*) + #consonant => Slender;
|
||||
_ => NoBreadth
|
||||
}
|
||||
} ;
|
||||
|
||||
lincat Quality = {s : Number => Mutation => Str; sVery : Number => Str} ;
|
||||
lin
|
||||
Very quality = {s=table{number => table{_ => quality.sVery!number}}; sVery=quality.sVery } ;
|
||||
Fresh = makeAdjective "<22>r" "<22>ra" ;
|
||||
Warm = makeAdjective "te" "te" ;
|
||||
Italian = makeAdjective "Iod<6F>lach" "Iod<6F>lacha" ;
|
||||
Expensive = makeAdjective "daor" "daora" ;
|
||||
Delicious = makeAdjective "blasta" "blasta" ;
|
||||
Boring = makeAdjective "leamh" "leamha" ;
|
||||
oper makeAdjective : Str -> Str -> {s : Number => Mutation => Str; sVery : Number => Str} =
|
||||
\sg,pl -> {
|
||||
s=table{Sg => (mutate sg); Pl => (mutate pl)};
|
||||
sVery=table{Sg => "an-"+(lenition1dntls sg); Pl => "an-"+(lenition1dntls pl)}
|
||||
} ;
|
||||
}
|
||||
108
samples/Grammatical Framework/FoodsHeb.gf
Normal file
108
samples/Grammatical Framework/FoodsHeb.gf
Normal file
@@ -0,0 +1,108 @@
|
||||
--# -path=alltenses
|
||||
|
||||
--(c) 2009 Dana Dannells
|
||||
-- Licensed under LGPL
|
||||
|
||||
concrete FoodsHeb of Foods = open Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = SS ;
|
||||
Quality = {s: Number => Species => Gender => Str} ;
|
||||
Kind = {s : Number => Species => Str ; g : Gender ; mod : Modified} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number ; sp : Species ; mod : Modified} ;
|
||||
|
||||
|
||||
lin
|
||||
Pred item quality = ss (item.s ++ quality.s ! item.n ! Indef ! item.g ) ;
|
||||
This = det Sg Def "הזה" "הזאת";
|
||||
That = det Sg Def "ההוא" "ההיא" ;
|
||||
These = det Pl Def "האלה" "האלה" ;
|
||||
Those = det Pl Def "ההם" "ההן" ;
|
||||
Mod quality kind = {
|
||||
s = \\n,sp => kind.s ! n ! sp ++ quality.s ! n ! sp ! kind.g;
|
||||
g = kind.g ;
|
||||
mod = T
|
||||
} ;
|
||||
Wine = regNoun "יין" "יינות" Masc ;
|
||||
Cheese = regNoun "גבינה" "גבינות" Fem ;
|
||||
Fish = regNoun "דג" "דגים" Masc ;
|
||||
Pizza = regNoun "פיצה" "פיצות" Fem ;
|
||||
Very qual = {s = \\g,n,sp => "מאוד" ++ qual.s ! g ! n ! sp} ;
|
||||
Fresh = regAdj "טרי" ;
|
||||
Warm = regAdj "חם" ;
|
||||
Italian = regAdj2 "איטלקי" ;
|
||||
Expensive = regAdj "יקר" ;
|
||||
Delicious = regAdj "טעים" ;
|
||||
Boring = regAdj2 "משעמם";
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem ;
|
||||
Species = Def | Indef ;
|
||||
Modified = T | F ;
|
||||
|
||||
oper
|
||||
Noun : Type = {s : Number => Species => Str ; g : Gender ; mod : Modified } ;
|
||||
Adj : Type = {s : Number => Species => Gender => Str} ;
|
||||
|
||||
det : Number -> Species -> Str -> Str -> Noun ->
|
||||
{s : Str ; g :Gender ; n : Number ; sp : Species ; mod : Modified} =
|
||||
\n,sp,m,f,cn -> {
|
||||
s = case cn.mod of { _ => cn.s ! n ! sp ++ case cn.g of {Masc => m ; Fem => f} };
|
||||
g = cn.g ;
|
||||
n = n ;
|
||||
sp = sp ;
|
||||
mod = cn.mod
|
||||
} ;
|
||||
|
||||
noun : (gvina,hagvina,gvinot,hagvinot : Str) -> Gender -> Noun =
|
||||
\gvina,hagvina,gvinot,hagvinot,g -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
Indef => gvina ;
|
||||
Def => hagvina
|
||||
} ;
|
||||
Pl => table {
|
||||
Indef => gvinot ;
|
||||
Def => hagvinot
|
||||
}
|
||||
} ;
|
||||
g = g ;
|
||||
mod = F
|
||||
} ;
|
||||
|
||||
regNoun : Str -> Str -> Gender -> Noun =
|
||||
\gvina,gvinot, g ->
|
||||
noun gvina (defH gvina) gvinot (defH gvinot) g ;
|
||||
|
||||
defH : Str -> Str = \cn ->
|
||||
case cn of {_ => "ה" + cn};
|
||||
|
||||
replaceLastLetter : Str -> Str = \c ->
|
||||
case c of {"ף" => "פ" ; "ם" => "מ" ; "ן" => "נ" ; "ץ" => "צ" ; "ך" => "כ"; _ => c} ;
|
||||
|
||||
adjective : (_,_,_,_ : Str) -> Adj =
|
||||
\tov,tova,tovim,tovot -> {
|
||||
s = table {
|
||||
Sg => table {
|
||||
Indef => table { Masc => tov ; Fem => tova } ;
|
||||
Def => table { Masc => defH tov ; Fem => defH tova }
|
||||
} ;
|
||||
Pl => table {
|
||||
Indef => table {Masc => tovim ; Fem => tovot } ;
|
||||
Def => table { Masc => defH tovim ; Fem => defH tovot }
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
regAdj : Str -> Adj = \tov ->
|
||||
case tov of { to + c@? =>
|
||||
adjective tov (to + replaceLastLetter (c) + "ה" ) (to + replaceLastLetter (c) +"ים" ) (to + replaceLastLetter (c) + "ות" )};
|
||||
|
||||
regAdj2 : Str -> Adj = \italki ->
|
||||
case italki of { italk+ c@? =>
|
||||
adjective italki (italk + replaceLastLetter (c) +"ת" ) (italk + replaceLastLetter (c)+ "ים" ) (italk + replaceLastLetter (c) + "ות" )};
|
||||
|
||||
} -- FoodsHeb
|
||||
75
samples/Grammatical Framework/FoodsHin.gf
Normal file
75
samples/Grammatical Framework/FoodsHin.gf
Normal file
@@ -0,0 +1,75 @@
|
||||
-- (c) 2010 Vikash Rauniyar under LGPL
|
||||
|
||||
concrete FoodsHin of Foods = {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
param
|
||||
Gender = Masc | Fem ;
|
||||
Number = Sg | Pl ;
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number} ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Quality = {s : Gender => Number => Str} ;
|
||||
lin
|
||||
Pred item quality = {
|
||||
s = item.s ++ quality.s ! item.g ! item.n ++ copula item.n
|
||||
} ;
|
||||
This kind = {s = "यह" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ;
|
||||
That kind = {s = "वह" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ;
|
||||
These kind = {s = "ये" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ;
|
||||
Those kind = {s = "वे" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ;
|
||||
Mod quality kind = {
|
||||
s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ;
|
||||
g = kind.g
|
||||
} ;
|
||||
Wine = regN "मदिरा" ;
|
||||
Cheese = regN "पनीर" ;
|
||||
Fish = regN "मछली" ;
|
||||
Pizza = regN "पिज़्ज़ा" ;
|
||||
Very quality = {s = \\g,n => "अति" ++ quality.s ! g ! n} ;
|
||||
Fresh = regAdj "ताज़ा" ;
|
||||
Warm = regAdj "गरम" ;
|
||||
Italian = regAdj "इटली" ;
|
||||
Expensive = regAdj "बहुमूल्य" ;
|
||||
Delicious = regAdj "स्वादिष्ट" ;
|
||||
Boring = regAdj "अरुचिकर" ;
|
||||
|
||||
oper
|
||||
mkN : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} =
|
||||
\s,p,g -> {
|
||||
s = table {
|
||||
Sg => s ;
|
||||
Pl => p
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
regN : Str -> {s : Number => Str ; g : Gender} = \s -> case s of {
|
||||
lark + "ा" => mkN s (lark + "े") Masc ;
|
||||
lark + "ी" => mkN s (lark + "ीयँा") Fem ;
|
||||
_ => mkN s s Masc
|
||||
} ;
|
||||
|
||||
mkAdj : Str -> Str -> Str -> {s : Gender => Number => Str} = \ms,mp,f -> {
|
||||
s = table {
|
||||
Masc => table {
|
||||
Sg => ms ;
|
||||
Pl => mp
|
||||
} ;
|
||||
Fem => \\_ => f
|
||||
}
|
||||
} ;
|
||||
|
||||
regAdj : Str -> {s : Gender => Number => Str} = \a -> case a of {
|
||||
acch + "ा" => mkAdj a (acch + "े") (acch + "ी") ;
|
||||
_ => mkAdj a a a
|
||||
} ;
|
||||
|
||||
copula : Number -> Str = \n -> case n of {
|
||||
Sg => "है" ;
|
||||
Pl => "हैं"
|
||||
} ;
|
||||
|
||||
}
|
||||
29
samples/Grammatical Framework/FoodsI.gf
Normal file
29
samples/Grammatical Framework/FoodsI.gf
Normal file
@@ -0,0 +1,29 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
incomplete concrete FoodsI of Foods =
|
||||
open Syntax, LexFoods in {
|
||||
lincat
|
||||
Comment = Utt ;
|
||||
Item = NP ;
|
||||
Kind = CN ;
|
||||
Quality = AP ;
|
||||
lin
|
||||
Pred item quality = mkUtt (mkCl item quality) ;
|
||||
This kind = mkNP this_Det kind ;
|
||||
That kind = mkNP that_Det kind ;
|
||||
These kind = mkNP these_Det kind ;
|
||||
Those kind = mkNP those_Det kind ;
|
||||
Mod quality kind = mkCN quality kind ;
|
||||
Very quality = mkAP very_AdA quality ;
|
||||
|
||||
Wine = mkCN wine_N ;
|
||||
Pizza = mkCN pizza_N ;
|
||||
Cheese = mkCN cheese_N ;
|
||||
Fish = mkCN fish_N ;
|
||||
Fresh = mkAP fresh_A ;
|
||||
Warm = mkAP warm_A ;
|
||||
Italian = mkAP italian_A ;
|
||||
Expensive = mkAP expensive_A ;
|
||||
Delicious = mkAP delicious_A ;
|
||||
Boring = mkAP boring_A ;
|
||||
}
|
||||
84
samples/Grammatical Framework/FoodsIce.gf
Normal file
84
samples/Grammatical Framework/FoodsIce.gf
Normal file
@@ -0,0 +1,84 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
-- (c) 2009 Martha Dis Brandt under LGPL
|
||||
|
||||
concrete FoodsIce of Foods = open Prelude in {
|
||||
|
||||
--flags coding=utf8;
|
||||
|
||||
lincat
|
||||
Comment = SS ;
|
||||
Quality = {s : Gender => Number => Defin => Str} ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number} ;
|
||||
|
||||
lin
|
||||
Pred item quality = ss (item.s ++ copula item.n ++ quality.s ! item.g ! item.n ! Ind) ;
|
||||
This, That = det Sg "<22>essi" "<22>essi" "<22>etta" ;
|
||||
These, Those = det Pl "<22>essir" "<22>essar" "<22>essi" ;
|
||||
Mod quality kind = { s = \\n => quality.s ! kind.g ! n ! Def ++ kind.s ! n ; g = kind.g } ;
|
||||
Wine = noun "v<>n" "v<>n" Neutr ;
|
||||
Cheese = noun "ostur" "ostar" Masc ;
|
||||
Fish = noun "fiskur" "fiskar" Masc ;
|
||||
-- the word "pizza" is more commonly used in Iceland, but "flatbaka" is the Icelandic word for it
|
||||
Pizza = noun "flatbaka" "flatb<74>kur" Fem ;
|
||||
Very qual = {s = \\g,n,defOrInd => "mj<6D>g" ++ qual.s ! g ! n ! defOrInd } ;
|
||||
Fresh = regAdj "ferskur" ;
|
||||
Warm = regAdj "heitur" ;
|
||||
Boring = regAdj "lei<65>inlegur" ;
|
||||
-- the order of the given adj forms is: mSg fSg nSg mPl fPl nPl mSgDef f/nSgDef _PlDef
|
||||
Italian = adjective "<22>talskur" "<22>t<EFBFBD>lsk" "<22>talskt" "<22>talskir" "<22>talskar" "<22>t<EFBFBD>lsk" "<22>talski" "<22>talska" "<22>talsku" ;
|
||||
Expensive = adjective "d<>r" "d<>r" "d<>rt" "d<>rir" "d<>rar" "d<>r" "d<>ri" "d<>ra" "d<>ru" ;
|
||||
Delicious = adjective "lj<6C>ffengur" "lj<6C>ffeng" "lj<6C>ffengt" "lj<6C>ffengir" "lj<6C>ffengar" "lj<6C>ffeng" "lj<6C>ffengi" "lj<6C>ffenga" "lj<6C>ffengu" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem | Neutr ;
|
||||
Defin = Ind | Def ;
|
||||
|
||||
oper
|
||||
det : Number -> Str -> Str -> Str -> {s : Number => Str ; g : Gender} ->
|
||||
{s : Str ; g : Gender ; n : Number} =
|
||||
\n,masc,fem,neutr,cn -> {
|
||||
s = case cn.g of {Masc => masc ; Fem => fem; Neutr => neutr } ++ cn.s ! n ;
|
||||
g = cn.g ;
|
||||
n = n
|
||||
} ;
|
||||
|
||||
noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} =
|
||||
\man,men,g -> {
|
||||
s = table {
|
||||
Sg => man ;
|
||||
Pl => men
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
adjective : (x1,_,_,_,_,_,_,_,x9 : Str) -> {s : Gender => Number => Defin => Str} =
|
||||
\ferskur,fersk,ferskt,ferskir,ferskar,fersk_pl,ferski,ferska,fersku -> {
|
||||
s = \\g,n,t => case <g,n,t> of {
|
||||
< Masc, Sg, Ind > => ferskur ;
|
||||
< Masc, Pl, Ind > => ferskir ;
|
||||
< Fem, Sg, Ind > => fersk ;
|
||||
< Fem, Pl, Ind > => ferskar ;
|
||||
< Neutr, Sg, Ind > => ferskt ;
|
||||
< Neutr, Pl, Ind > => fersk_pl;
|
||||
< Masc, Sg, Def > => ferski ;
|
||||
< Fem, Sg, Def > | < Neutr, Sg, Def > => ferska ;
|
||||
< _ , Pl, Def > => fersku
|
||||
}
|
||||
} ;
|
||||
|
||||
regAdj : Str -> {s : Gender => Number => Defin => Str} = \ferskur ->
|
||||
let fersk = Predef.tk 2 ferskur
|
||||
in adjective
|
||||
ferskur fersk (fersk + "t")
|
||||
(fersk + "ir") (fersk + "ar") fersk
|
||||
(fersk + "i") (fersk + "a") (fersk + "u") ;
|
||||
|
||||
copula : Number -> Str =
|
||||
\n -> case n of {
|
||||
Sg => "er" ;
|
||||
Pl => "eru"
|
||||
} ;
|
||||
}
|
||||
8
samples/Grammatical Framework/FoodsIta.gf
Normal file
8
samples/Grammatical Framework/FoodsIta.gf
Normal file
@@ -0,0 +1,8 @@
|
||||
--# -path=.:present
|
||||
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsIta of Foods = FoodsI with
|
||||
(Syntax = SyntaxIta),
|
||||
(LexFoods = LexFoodsIta) ;
|
||||
|
||||
72
samples/Grammatical Framework/FoodsJpn.gf
Normal file
72
samples/Grammatical Framework/FoodsJpn.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
--# -path=.:../lib/src/prelude
|
||||
|
||||
-- (c) 2009 Zofia Stankiewicz under LGPL
|
||||
|
||||
concrete FoodsJpn of Foods = open Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = {s: Style => Str};
|
||||
Quality = {s: AdjUse => Str ; t: AdjType} ;
|
||||
Kind = {s : Number => Str} ;
|
||||
Item = {s : Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
Pred item quality = {s = case quality.t of {
|
||||
IAdj => table {Plain => item.s ++ quality.s ! APred ; Polite => item.s ++ quality.s ! APred ++ copula ! Polite ! item.n } ;
|
||||
NaAdj => \\p => item.s ++ quality.s ! APred ++ copula ! p ! item.n }
|
||||
} ;
|
||||
This = det Sg "この" ;
|
||||
That = det Sg "その" ;
|
||||
These = det Pl "この" ;
|
||||
Those = det Pl "その" ;
|
||||
Mod quality kind = {s = \\n => quality.s ! Attr ++ kind.s ! n} ;
|
||||
Wine = regNoun "ワインは" ;
|
||||
Cheese = regNoun "チーズは" ;
|
||||
Fish = regNoun "魚は" ;
|
||||
Pizza = regNoun "ピザは" ;
|
||||
Very quality = {s = \\a => "とても" ++ quality.s ! a ; t = quality.t } ;
|
||||
Fresh = adj "新鮮な" "新鮮";
|
||||
Warm = regAdj "あたたかい" ;
|
||||
Italian = adj "イタリアの" "イタリアのもの";
|
||||
Expensive = regAdj "たかい" ;
|
||||
Delicious = regAdj "おいしい" ;
|
||||
Boring = regAdj "つまらない" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
AdjUse = Attr | APred ; -- na-adjectives have different forms as noun attributes and predicates
|
||||
Style = Plain | Polite ; -- for phrase types
|
||||
AdjType = IAdj | NaAdj ; -- IAdj can form predicates without the copula, NaAdj cannot
|
||||
|
||||
oper
|
||||
det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} =
|
||||
\n,d,cn -> {
|
||||
s = d ++ cn.s ! n ;
|
||||
n = n
|
||||
} ;
|
||||
noun : Str -> Str -> {s : Number => Str} =
|
||||
\sakana,sakana -> {s = \\_ => sakana } ;
|
||||
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\sakana -> noun sakana sakana ;
|
||||
|
||||
adj : Str -> Str -> {s : AdjUse => Str ; t : AdjType} =
|
||||
\chosenna, chosen -> {
|
||||
s = table {
|
||||
Attr => chosenna ;
|
||||
APred => chosen
|
||||
} ;
|
||||
t = NaAdj
|
||||
} ;
|
||||
|
||||
regAdj : Str -> {s: AdjUse => Str ; t : AdjType} =\akai -> {
|
||||
s = \\_ => akai ; t = IAdj} ;
|
||||
|
||||
copula : Style => Number => Str =
|
||||
table {
|
||||
Plain => \\_ => "だ" ;
|
||||
Polite => \\_ => "です" } ;
|
||||
|
||||
}
|
||||
91
samples/Grammatical Framework/FoodsLav.gf
Normal file
91
samples/Grammatical Framework/FoodsLav.gf
Normal file
@@ -0,0 +1,91 @@
|
||||
--# -path=.:prelude
|
||||
|
||||
-- (c) 2009 Inese Bernsone under LGPL
|
||||
|
||||
concrete FoodsLav of Foods = open Prelude in {
|
||||
|
||||
flags
|
||||
coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = SS ;
|
||||
Quality = {s : Q => Gender => Number => Defin => Str } ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number } ;
|
||||
|
||||
lin
|
||||
Pred item quality = ss (item.s ++ {- copula item.n -} "ir" ++ quality.s ! Q1 ! item.g ! item.n ! Ind ) ;
|
||||
This = det Sg "šis" "šī" ;
|
||||
That = det Sg "tas" "tā" ;
|
||||
These = det Pl "šie" "šīs" ;
|
||||
Those = det Pl "tie" "tās" ;
|
||||
Mod quality kind = {s = \\n => quality.s ! Q1 ! kind.g ! n ! Def ++ kind.s ! n ; g = kind.g } ;
|
||||
Wine = noun "vīns" "vīni" Masc ;
|
||||
Cheese = noun "siers" "sieri" Masc ;
|
||||
Fish = noun "zivs" "zivis" Fem ;
|
||||
Pizza = noun "pica" "picas" Fem ;
|
||||
Very qual = {s = \\q,g,n,spec => "ļoti" ++ qual.s ! Q2 ! g ! n ! spec };
|
||||
|
||||
Fresh = adjective "svaigs" "svaiga" "svaigi" "svaigas" "svaigais" "svaigā" "svaigie" "svaigās" ;
|
||||
Warm = regAdj "silts" ;
|
||||
Italian = specAdj "itāļu" (regAdj "itālisks") ;
|
||||
Expensive = regAdj "dārgs" ;
|
||||
Delicious = regAdj "garšīgs" ;
|
||||
Boring = regAdj "garlaicīgs" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem ;
|
||||
Defin = Ind | Def ;
|
||||
Q = Q1 | Q2 ;
|
||||
|
||||
oper
|
||||
det : Number -> Str -> Str -> {s : Number => Str ; g : Gender} ->
|
||||
{s : Str ; g : Gender ; n : Number} =
|
||||
\n,m,f,cn -> {
|
||||
s = case cn.g of {Masc => m ; Fem => f} ++ cn.s ! n ;
|
||||
g = cn.g ;
|
||||
n = n
|
||||
} ;
|
||||
noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} =
|
||||
\man,men,g -> {
|
||||
s = table {
|
||||
Sg => man ;
|
||||
Pl => men
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
adjective : (_,_,_,_,_,_,_,_ : Str) -> {s : Q => Gender => Number => Defin => Str} =
|
||||
\skaists,skaista,skaisti,skaistas,skaistais,skaistaa,skaistie,skaistaas -> {
|
||||
s = table {
|
||||
_ => table {
|
||||
Masc => table {
|
||||
Sg => table {Ind => skaists ; Def => skaistais} ;
|
||||
Pl => table {Ind => skaisti ; Def => skaistie}
|
||||
} ;
|
||||
Fem => table {
|
||||
Sg => table {Ind => skaista ; Def => skaistaa} ;
|
||||
Pl => table {Ind => skaistas ; Def => skaistaas}
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
{- irregAdj : Str -> {s : Gender => Number => Defin => Str} = \itaalju ->
|
||||
let itaalju = itaalju
|
||||
in adjective itaalju (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) (itaalju) ; -}
|
||||
|
||||
regAdj : Str -> {s : Q => Gender => Number => Defin => Str} = \skaists ->
|
||||
let skaist = init skaists
|
||||
in adjective skaists (skaist + "a") (skaist + "i") (skaist + "as") (skaist + "ais") (skaist + "ā") (skaist + "ie") (skaist + "ās");
|
||||
|
||||
Adjective : Type = {s : Q => Gender => Number => Defin => Str} ;
|
||||
|
||||
specAdj : Str -> Adjective -> Adjective = \s,a -> {
|
||||
s = table {
|
||||
Q2 => a.s ! Q1 ;
|
||||
Q1 => \\_,_,_ => s
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
105
samples/Grammatical Framework/FoodsMlt.gf
Normal file
105
samples/Grammatical Framework/FoodsMlt.gf
Normal file
@@ -0,0 +1,105 @@
|
||||
-- (c) 2013 John J. Camilleri under LGPL
|
||||
|
||||
concrete FoodsMlt of Foods = open Prelude in {
|
||||
flags coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = SS ;
|
||||
Quality = {s : Gender => Number => Str} ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number} ;
|
||||
|
||||
lin
|
||||
-- Pred item quality = ss (item.s ++ copula item.n item.g ++ quality.s ! item.g ! item.n) ;
|
||||
Pred item quality = ss (item.s ++ quality.s ! item.g ! item.n) ;
|
||||
|
||||
This kind = det Sg "dan" "din" kind ;
|
||||
That kind = det Sg "dak" "dik" kind ;
|
||||
These kind = det Pl "dawn" "" kind ;
|
||||
Those kind = det Pl "dawk" "" kind ;
|
||||
|
||||
Mod quality kind = {
|
||||
s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ;
|
||||
g = kind.g
|
||||
} ;
|
||||
|
||||
Wine = noun "inbid" "inbejjed" Masc ;
|
||||
Cheese = noun "ġobon" "ġobniet" Masc ;
|
||||
Fish = noun "ħuta" "ħut" Fem ;
|
||||
Pizza = noun "pizza" "pizzez" Fem ;
|
||||
|
||||
Very qual = {s = \\g,n => qual.s ! g ! n ++ "ħafna"} ;
|
||||
|
||||
Warm = adjective "sħun" "sħuna" "sħan" ;
|
||||
Expensive = adjective "għali" "għalja" "għaljin" ;
|
||||
Delicious = adjective "tajjeb" "tajba" "tajbin" ;
|
||||
Boring = uniAdj "tad-dwejjaq" ;
|
||||
Fresh = regAdj "frisk" ;
|
||||
Italian = regAdj "Taljan" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem ;
|
||||
|
||||
oper
|
||||
--Create an adjective (full function)
|
||||
--Params: Sing Masc, Sing Fem, Plural
|
||||
adjective : (_,_,_ : Str) -> {s : Gender => Number => Str} = \iswed,sewda,suwed -> {
|
||||
s = table {
|
||||
Masc => table {
|
||||
Sg => iswed ;
|
||||
Pl => suwed
|
||||
} ;
|
||||
Fem => table {
|
||||
Sg => sewda ;
|
||||
Pl => suwed
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
--Create a regular adjective
|
||||
--Param: Sing Masc
|
||||
regAdj : Str -> {s : Gender => Number => Str} = \frisk ->
|
||||
adjective frisk (frisk + "a") (frisk + "i") ;
|
||||
|
||||
--Create a "uni-adjective" eg tal-buzz
|
||||
--Param: Sing Masc
|
||||
uniAdj : Str -> {s : Gender => Number => Str} = \uni ->
|
||||
adjective uni uni uni ;
|
||||
|
||||
--Create a noun
|
||||
--Params: Singular, Plural, Gender (inherent)
|
||||
noun : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} = \ktieb,kotba,g -> {
|
||||
s = table {
|
||||
Sg => ktieb ;
|
||||
Pl => kotba
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
--Copula is a linking verb
|
||||
--Params: Number, Gender
|
||||
-- copula : Number -> Gender -> Str = \n,g -> case n of {
|
||||
-- Sg => case g of { Masc => "huwa" ; Fem => "hija" } ;
|
||||
-- Pl => "huma"
|
||||
-- } ;
|
||||
|
||||
--Create an article, taking into account first letter of next word
|
||||
article = pre {
|
||||
"a"|"e"|"i"|"o"|"u" => "l-" ;
|
||||
--cons@("ċ"|"d"|"n"|"r"|"s"|"t"|"x"|"ż") => "i" + cons + "-" ;
|
||||
_ => "il-"
|
||||
} ;
|
||||
|
||||
--Create a determinant
|
||||
--Params: Sg/Pl, Masc, Fem
|
||||
det : Number -> Str -> Str -> {s : Number => Str ; g : Gender} -> {s : Str ; g : Gender ; n : Number} = \n,m,f,cn -> {
|
||||
s = case n of {
|
||||
Sg => case cn.g of {Masc => m ; Fem => f}; --string
|
||||
Pl => m --default to masc
|
||||
} ++ article ++ cn.s ! n ;
|
||||
g = cn.g ; --gender
|
||||
n = n --number
|
||||
} ;
|
||||
|
||||
}
|
||||
49
samples/Grammatical Framework/FoodsMon.gf
Normal file
49
samples/Grammatical Framework/FoodsMon.gf
Normal file
@@ -0,0 +1,49 @@
|
||||
--# -path=.:/GF/lib/src/prelude
|
||||
|
||||
-- (c) 2009 Nyamsuren Erdenebadrakh under LGPL
|
||||
|
||||
concrete FoodsMon of Foods = open Prelude in {
|
||||
flags coding=utf8;
|
||||
|
||||
lincat
|
||||
Comment, Quality = SS ;
|
||||
Kind = {s : Number => Str} ;
|
||||
Item = {s : Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
Pred item quality = ss (item.s ++ "бол" ++ quality.s) ;
|
||||
This = det Sg "энэ" ;
|
||||
That = det Sg "тэр" ;
|
||||
These = det Pl "эдгээр" ;
|
||||
Those = det Pl "тэдгээр" ;
|
||||
Mod quality kind = {s = \\n => quality.s ++ kind.s ! n} ;
|
||||
Wine = regNoun "дарс" ;
|
||||
Cheese = regNoun "бяслаг" ;
|
||||
Fish = regNoun "загас" ;
|
||||
Pizza = regNoun "пицца" ;
|
||||
Very = prefixSS "маш" ;
|
||||
Fresh = ss "шинэ" ;
|
||||
Warm = ss "халуун" ;
|
||||
Italian = ss "итали" ;
|
||||
Expensive = ss "үнэтэй" ;
|
||||
Delicious = ss "амттай" ;
|
||||
Boring = ss "амтгүй" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
oper
|
||||
det : Number -> Str -> {s : Number => Str} -> {s : Str ; n : Number} =
|
||||
\n,d,cn -> {
|
||||
s = d ++ cn.s ! n ;
|
||||
n = n
|
||||
} ;
|
||||
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\x -> {s = table {
|
||||
Sg => x ;
|
||||
Pl => x + "нууд"}
|
||||
} ;
|
||||
}
|
||||
|
||||
|
||||
60
samples/Grammatical Framework/FoodsNep.gf
Normal file
60
samples/Grammatical Framework/FoodsNep.gf
Normal file
@@ -0,0 +1,60 @@
|
||||
-- (c) 2011 Dinesh Simkhada under LGPL
|
||||
|
||||
concrete FoodsNep of Foods = {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
lincat
|
||||
Comment, Quality = {s : Str} ;
|
||||
Kind = {s : Number => Str} ;
|
||||
Item = {s : Str ; n : Number} ;
|
||||
|
||||
lin
|
||||
Pred item quality =
|
||||
{s = item.s ++ quality.s ++ copula ! item.n} ;
|
||||
|
||||
This = det Sg "यो" ;
|
||||
That = det Sg "त्यो" ;
|
||||
These = det Pl "यी" ;
|
||||
Those = det Pl "ती" ;
|
||||
Mod quality kind =
|
||||
{s = \\n => quality.s ++ kind.s ! n} ;
|
||||
|
||||
Wine = regNoun "रक्सी" ;
|
||||
Cheese = regNoun "चिज" ;
|
||||
Fish = regNoun "माछा" ;
|
||||
Pizza = regNoun "पिज्जा" ;
|
||||
Very a = {s = "धेरै" ++ a.s} ;
|
||||
Fresh = adj "ताजा" ;
|
||||
Warm = adj "तातो" ;
|
||||
Italian = adj "इटालियन" ;
|
||||
Expensive = adj "महँगो" | adj "बहुमूल्य" ;
|
||||
Delicious = adj "स्वादिष्ट" | adj "मीठो" ;
|
||||
Boring = adjPl "नमिठो" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
|
||||
oper
|
||||
det : Number -> Str ->
|
||||
{s : Number => Str} -> {s : Str ; n : Number} =
|
||||
\n,det,noun -> {s = det ++ noun.s ! n ; n = n} ;
|
||||
|
||||
noun : Str -> Str -> {s : Number => Str} =
|
||||
\man,men -> {s = table {Sg => man ; Pl => men}} ;
|
||||
|
||||
regNoun : Str -> {s : Number => Str} =
|
||||
\car -> noun car (car + "हरु") ;
|
||||
|
||||
adjPl : Str -> {s : Str} = \a -> case a of {
|
||||
bor + "ठो" => adj (bor + "ठा") ;
|
||||
_ => adj a
|
||||
} ;
|
||||
|
||||
adj : Str -> {s : Str} =
|
||||
\cold -> {s = cold} ;
|
||||
|
||||
copula : Number => Str =
|
||||
table {Sg => "छ" ; Pl => "छन्"} ;
|
||||
}
|
||||
|
||||
30
samples/Grammatical Framework/FoodsOri.gf
Normal file
30
samples/Grammatical Framework/FoodsOri.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
concrete FoodsOri of Foods = {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = Str;
|
||||
Item = Str;
|
||||
Kind = Str;
|
||||
Quality = Str;
|
||||
|
||||
lin
|
||||
Pred item quality = item ++ quality ++ "ଅଟେ";
|
||||
This kind = "ଏଇ" ++ kind;
|
||||
That kind = "ସେଇ" ++ kind;
|
||||
These kind = "ଏଇ" ++ kind ++ "ଗୁଡିକ" ;
|
||||
Those kind = "ସେଇ" ++ kind ++ "ଗୁଡିକ" ;
|
||||
Mod quality kind = quality ++ kind;
|
||||
Wine = "ମଦ";
|
||||
Cheese = "ଛେନା";
|
||||
Fish = "ମାଛ";
|
||||
Pizza = "ପିଜଜ଼ା" ;
|
||||
Very quality = "ଅତି" ++ quality;
|
||||
Fresh = "ତାଜା";
|
||||
Warm = "ଗରମ";
|
||||
Italian = "ଇଟାଲି";
|
||||
Expensive = "ମୁଲ୍ୟବାନ୍";
|
||||
Delicious = "ସ୍ଵାଦିସ୍ଟ ";
|
||||
Boring = "ଅରୁଚିକର";
|
||||
|
||||
}
|
||||
65
samples/Grammatical Framework/FoodsPes.gf
Normal file
65
samples/Grammatical Framework/FoodsPes.gf
Normal file
@@ -0,0 +1,65 @@
|
||||
concrete FoodsPes of Foods = {
|
||||
|
||||
flags optimize=noexpand ; coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Quality = {s : Add => Str; prep : Str} ;
|
||||
Kind = {s : Add => Number => Str ; prep : Str};
|
||||
Item = {s : Str ; n : Number};
|
||||
lin
|
||||
Pred item quality = {s = item.s ++ quality.s ! Indep ++ copula ! item.n} ;
|
||||
This = det Sg "این" ;
|
||||
That = det Sg "آن" ;
|
||||
These = det Pl "این" ;
|
||||
Those = det Pl "آن" ;
|
||||
|
||||
Mod quality kind = {s = \\a,n => kind.s ! Attr ! n ++ kind.prep ++ quality.s ! a ;
|
||||
prep = quality.prep
|
||||
};
|
||||
Wine = regN "شراب" ;
|
||||
Cheese = regN "پنیر" ;
|
||||
Fish = regN "ماهى" ;
|
||||
Pizza = regN "پیتزا" ;
|
||||
Very a = {s = \\at => "خیلی" ++ a.s ! at ; prep = a.prep} ;
|
||||
Fresh = adj "تازه" ;
|
||||
Warm = adj "گرم" ;
|
||||
Italian = adj "ایتالیایی" ;
|
||||
Expensive = adj "گران" ;
|
||||
Delicious = adj "لذىذ" ;
|
||||
Boring = adj "ملال آور" ; -- it must be written as ملال آور.
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Add = Indep | Attr ;
|
||||
oper
|
||||
det : Number -> Str -> {s: Add => Number => Str ; prep : Str} -> {s : Str ; n: Number} =
|
||||
\n,det,noun -> {s = det ++ noun.s ! Indep ! n ; n = n };
|
||||
|
||||
noun : (x1,_,_,x4 : Str) -> {s : Add => Number => Str ; prep : Str} = \pytzA, pytzAy, pytzAhA,pr ->
|
||||
{s = \\a,n => case <a,n> of
|
||||
{<Indep,Sg> => pytzA ; <Indep,Pl> => pytzAhA ;
|
||||
<Attr,Sg> =>pytzA ; <Attr,Pl> => pytzAhA + "ى" };
|
||||
prep = pr
|
||||
};
|
||||
|
||||
regN : Str -> {s: Add => Number => Str ; prep : Str} = \mrd ->
|
||||
case mrd of
|
||||
{ _ + ("ا"|"ه"|"ى"|"و"|"") => noun mrd (mrd+"ى") (mrd + "ها") "";
|
||||
_ => noun mrd mrd (mrd + "ها") "e"
|
||||
};
|
||||
|
||||
adj : Str -> {s : Add => Str; prep : Str} = \tAzh ->
|
||||
case tAzh of
|
||||
{ _ + ("ا"|"ه"|"ى"|"و"|"") => mkAdj tAzh (tAzh ++ "ى") "" ;
|
||||
_ => mkAdj tAzh tAzh "ه"
|
||||
};
|
||||
|
||||
mkAdj : Str -> Str -> Str -> {s : Add => Str; prep : Str} = \tAzh, tAzhy, pr ->
|
||||
{s = table {Indep => tAzh;
|
||||
Attr => tAzhy};
|
||||
prep = pr
|
||||
};
|
||||
copula : Number => Str = table {Sg => "است"; Pl => "هستند"};
|
||||
|
||||
}
|
||||
77
samples/Grammatical Framework/FoodsPor.gf
Normal file
77
samples/Grammatical Framework/FoodsPor.gf
Normal file
@@ -0,0 +1,77 @@
|
||||
-- (c) 2009 Rami Shashati under LGPL
|
||||
|
||||
concrete FoodsPor of Foods = open Prelude in {
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Quality = {s : Gender => Number => Str} ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Item = {s : Str ; n : Number ; g : Gender } ;
|
||||
|
||||
lin
|
||||
Pred item quality =
|
||||
{s = item.s ++ copula ! item.n ++ quality.s ! item.g ! item.n } ;
|
||||
This = det Sg (table {Masc => "este" ; Fem => "esta"}) ;
|
||||
That = det Sg (table {Masc => "esse" ; Fem => "essa"}) ;
|
||||
These = det Pl (table {Masc => "estes" ; Fem => "estas"}) ;
|
||||
Those = det Pl (table {Masc => "esses" ; Fem => "essas"}) ;
|
||||
|
||||
Mod quality kind = { s = \\n => kind.s ! n ++ quality.s ! kind.g ! n ; g = kind.g } ;
|
||||
|
||||
Wine = regNoun "vinho" Masc ;
|
||||
Cheese = regNoun "queijo" Masc ;
|
||||
Fish = regNoun "peixe" Masc ;
|
||||
Pizza = regNoun "pizza" Fem ;
|
||||
|
||||
Very a = { s = \\g,n => "muito" ++ a.s ! g ! n } ;
|
||||
|
||||
Fresh = mkAdjReg "fresco" ;
|
||||
Warm = mkAdjReg "quente" ;
|
||||
Italian = mkAdjReg "Italiano" ;
|
||||
Expensive = mkAdjReg "caro" ;
|
||||
Delicious = mkAdjReg "delicioso" ;
|
||||
Boring = mkAdjReg "chato" ;
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem ;
|
||||
|
||||
oper
|
||||
QualityT : Type = {s : Gender => Number => Str} ;
|
||||
|
||||
mkAdj : (_,_,_,_ : Str) -> QualityT = \bonito,bonita,bonitos,bonitas -> {
|
||||
s = table {
|
||||
Masc => table { Sg => bonito ; Pl => bonitos } ;
|
||||
Fem => table { Sg => bonita ; Pl => bonitas }
|
||||
} ;
|
||||
} ;
|
||||
|
||||
-- regular pattern
|
||||
adjSozinho : Str -> QualityT = \sozinho ->
|
||||
let sozinh = Predef.tk 1 sozinho
|
||||
in mkAdj sozinho (sozinh + "a") (sozinh + "os") (sozinh + "as") ;
|
||||
|
||||
-- for gender-independent adjectives
|
||||
adjUtil : Str -> Str -> QualityT = \util,uteis ->
|
||||
mkAdj util util uteis uteis ;
|
||||
|
||||
-- smart paradigm for adjcetives
|
||||
mkAdjReg : Str -> QualityT = \a -> case last a of {
|
||||
"o" => adjSozinho a ;
|
||||
"e" => adjUtil a (a + "s")
|
||||
} ;
|
||||
|
||||
ItemT : Type = {s : Str ; n : Number ; g : Gender } ;
|
||||
|
||||
det : Number -> (Gender => Str) -> KindT -> ItemT =
|
||||
\num,det,noun -> {s = det ! noun.g ++ noun.s ! num ; n = num ; g = noun.g } ;
|
||||
|
||||
KindT : Type = {s : Number => Str ; g : Gender} ;
|
||||
|
||||
noun : Str -> Str -> Gender -> KindT =
|
||||
\animal,animais,gen -> {s = table {Sg => animal ; Pl => animais} ; g = gen } ;
|
||||
|
||||
regNoun : Str -> Gender -> KindT =
|
||||
\carro,gen -> noun carro (carro + "s") gen ;
|
||||
|
||||
copula : Number => Str = table {Sg => "<22>" ; Pl => "s<>o"} ;
|
||||
}
|
||||
72
samples/Grammatical Framework/FoodsRon.gf
Normal file
72
samples/Grammatical Framework/FoodsRon.gf
Normal file
@@ -0,0 +1,72 @@
|
||||
-- (c) 2009 Ramona Enache under LGPL
|
||||
|
||||
concrete FoodsRon of Foods =
|
||||
{
|
||||
flags coding=utf8 ;
|
||||
|
||||
param Number = Sg | Pl ;
|
||||
Gender = Masc | Fem ;
|
||||
NGender = NMasc | NFem | NNeut ;
|
||||
lincat
|
||||
Comment = {s : Str};
|
||||
Quality = {s : Number => Gender => Str};
|
||||
Kind = {s : Number => Str; g : NGender};
|
||||
Item = {s : Str ; n : Number; g : Gender};
|
||||
|
||||
lin
|
||||
|
||||
This = det Sg (mkTab "acest" "această");
|
||||
That = det Sg (mkTab "acel" "acea");
|
||||
These = det Pl (mkTab "acești" "aceste");
|
||||
Those = det Pl (mkTab "acei" "acele");
|
||||
|
||||
Wine = mkNoun "vin" "vinuri" NNeut ;
|
||||
Cheese = mkNoun "brânză" "brânzeturi" NFem ;
|
||||
Fish = mkNoun "peşte" "peşti" NMasc ;
|
||||
Pizza = mkNoun "pizza" "pizze" NFem;
|
||||
|
||||
Very a = {s = \\n,g => "foarte" ++ a.s ! n ! g};
|
||||
|
||||
Fresh = mkAdj "proaspăt" "proaspătă" "proaspeţi" "proaspete" ;
|
||||
Warm = mkAdj "cald" "caldă" "calzi" "calde" ;
|
||||
Italian = mkAdj "italian" "italiană" "italieni" "italiene" ;
|
||||
Expensive = mkAdj "scump" "scumpă" "scumpi" "scumpe" ;
|
||||
Delicious = mkAdj "delicios" "delcioasă" "delicioşi" "delicioase" ;
|
||||
Boring = mkAdj "plictisitor" "plictisitoare" "plictisitori" "plictisitoare" ;
|
||||
|
||||
Pred item quality = {s = item.s ++ copula ! item.n ++ quality.s ! item.n ! item.g} ;
|
||||
|
||||
Mod quality kind = {s = \\n => kind.s ! n ++ quality.s ! n ! (getAgrGender kind.g n) ; g = kind.g};
|
||||
|
||||
oper
|
||||
|
||||
mkTab : Str -> Str -> {s : Gender => Str} = \acesta, aceasta ->
|
||||
{s = table{Masc => acesta;
|
||||
Fem => aceasta}};
|
||||
|
||||
det : Number -> {s : Gender => Str} -> {s : Number => Str ; g : NGender} -> {s : Str; n : Number; g : Gender} =
|
||||
\n,det,noun -> let gg = getAgrGender noun.g n
|
||||
in
|
||||
{s = det.s ! gg ++ noun.s ! n ; n = n ; g = gg};
|
||||
|
||||
mkNoun : Str -> Str -> NGender -> {s : Number => Str; g : NGender} = \peste, pesti,g ->
|
||||
{s = table {Sg => peste;
|
||||
Pl => pesti};
|
||||
g = g
|
||||
};
|
||||
|
||||
oper mkAdj : (x1,_,_,x4 : Str) -> {s : Number => Gender => Str} = \scump, scumpa, scumpi, scumpe ->
|
||||
{s = \\n,g => case <n,g> of
|
||||
{<Sg,Masc> => scump ; <Sg,Fem> => scumpa;
|
||||
<Pl,Masc> => scumpi ; <Pl,Fem> => scumpe
|
||||
}};
|
||||
|
||||
copula : Number => Str = table {Sg => "este" ; Pl => "sunt"};
|
||||
|
||||
getAgrGender : NGender -> Number -> Gender = \ng,n ->
|
||||
case <ng,n> of
|
||||
{<NMasc,_> => Masc ; <NFem,_> => Fem;
|
||||
<NNeut,Sg> => Masc ; <NNeut,Pl> => Fem
|
||||
};
|
||||
|
||||
}
|
||||
31
samples/Grammatical Framework/FoodsSpa.gf
Normal file
31
samples/Grammatical Framework/FoodsSpa.gf
Normal file
@@ -0,0 +1,31 @@
|
||||
--# -path=.:present
|
||||
|
||||
concrete FoodsSpa of Foods = open SyntaxSpa, StructuralSpa, ParadigmsSpa in {
|
||||
|
||||
lincat
|
||||
Comment = Utt ;
|
||||
Item = NP ;
|
||||
Kind = CN ;
|
||||
Quality = AP ;
|
||||
|
||||
lin
|
||||
Pred item quality = mkUtt (mkCl item quality) ;
|
||||
This kind = mkNP this_QuantSg kind ;
|
||||
That kind = mkNP that_QuantSg kind ;
|
||||
These kind = mkNP these_QuantPl kind ;
|
||||
Those kind = mkNP those_QuantPl kind ;
|
||||
Mod quality kind = mkCN quality kind ;
|
||||
Very quality = mkAP very_AdA quality ;
|
||||
Wine = mkCN (mkN "vino") ;
|
||||
Pizza = mkCN (mkN "pizza") ;
|
||||
Cheese = mkCN (mkN "queso") ;
|
||||
Fish = mkCN (mkN "pescado") ;
|
||||
Fresh = mkAP (mkA "fresco") ;
|
||||
Warm = mkAP (mkA "caliente") ;
|
||||
Italian = mkAP (mkA "italiano") ;
|
||||
Expensive = mkAP (mkA "caro") ;
|
||||
Delicious = mkAP (mkA "delicioso") ;
|
||||
Boring = mkAP (mkA "aburrido") ;
|
||||
|
||||
}
|
||||
|
||||
7
samples/Grammatical Framework/FoodsSwe.gf
Normal file
7
samples/Grammatical Framework/FoodsSwe.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:present
|
||||
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsSwe of Foods = FoodsI with
|
||||
(Syntax = SyntaxSwe),
|
||||
(LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ;
|
||||
33
samples/Grammatical Framework/FoodsTha.gf
Normal file
33
samples/Grammatical Framework/FoodsTha.gf
Normal file
@@ -0,0 +1,33 @@
|
||||
--# -path=.:alltenses
|
||||
|
||||
concrete FoodsTha of Foods = open SyntaxTha, LexiconTha,
|
||||
ParadigmsTha, (R=ResTha) in {
|
||||
|
||||
flags coding = utf8 ;
|
||||
|
||||
lincat
|
||||
Comment = Utt ;
|
||||
Item = NP ;
|
||||
Kind = CN ;
|
||||
Quality = AP ;
|
||||
|
||||
lin
|
||||
Pred item quality = mkUtt (mkCl item quality) ;
|
||||
This kind = mkNP this_Det kind ;
|
||||
That kind = mkNP that_Det kind ;
|
||||
These kind = mkNP these_Det kind ;
|
||||
Those kind = mkNP those_Det kind ;
|
||||
Mod quality kind = mkCN quality kind ;
|
||||
Very quality = mkAP very_AdA quality ;
|
||||
Wine = mkCN (mkN (R.thword "เหล้าอ" "งุ่น") "ขวด") ;
|
||||
Pizza = mkCN (mkN (R.thword "พิซ" "ซา") "ถาด") ;
|
||||
Cheese = mkCN (mkN (R.thword "เนย" "แข็ง") "ก้อน") ;
|
||||
Fish = mkCN fish_N ;
|
||||
Fresh = mkAP (mkA "สด") ;
|
||||
Warm = mkAP warm_A ;
|
||||
Italian = mkAP (mkA " อิตาลี") ;
|
||||
Expensive = mkAP (mkA "แพง") ;
|
||||
Delicious = mkAP (mkA "อร่อย") ;
|
||||
Boring = mkAP (mkA (R.thword "น่า" "เบิ่อ")) ;
|
||||
|
||||
}
|
||||
178
samples/Grammatical Framework/FoodsTsn.gf
Normal file
178
samples/Grammatical Framework/FoodsTsn.gf
Normal file
@@ -0,0 +1,178 @@
|
||||
--# -path=alltenses
|
||||
|
||||
-- (c) 2009 Laurette Pretorius Sr & Jr and Ansu Berg under LGPL
|
||||
|
||||
concrete FoodsTsn of Foods = open Prelude, Predef in {
|
||||
flags coding = utf8;
|
||||
lincat
|
||||
Comment = {s:Str};
|
||||
Item = {s:Str; c:NounClass; n:Number};
|
||||
Kind = {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool};
|
||||
Quality = {s: NounClass => Number => Str; p_form: Str; t: TType};
|
||||
lin
|
||||
Pred item quality = {s = item.s ++ ((mkPredDescrCop quality.t) ! item.c ! item.n) ++ quality.p_form};
|
||||
|
||||
This kind = {s = (kind.w ! Sg) ++ (mkDemPron1 ! kind.c ! Sg) ++ (kind.q ! Sg); c = kind.c; n = Sg};
|
||||
That kind = {s = (kind.w ! Sg) ++ (mkDemPron2 ! kind.c ! Sg) ++ (kind.q ! Sg); c = kind.c; n = Sg};
|
||||
These kind = {s = (kind.w ! Pl) ++ (mkDemPron1 ! kind.c ! Pl) ++ (kind.q ! Pl); c = kind.c; n = Pl};
|
||||
Those kind = {s = (kind.w ! Pl) ++ (mkDemPron2 ! kind.c ! Pl) ++ (kind.q ! Pl); c = kind.c; n = Pl};
|
||||
|
||||
Mod quality kind = mkMod quality kind;
|
||||
|
||||
-- Lexicon
|
||||
Wine = mkNounNC14_6 "jalwa";
|
||||
Cheese = mkNounNC9_10 "kase";
|
||||
Fish = mkNounNC9_10 "thlapi";
|
||||
Pizza = mkNounNC9_10 "pizza";
|
||||
Very quality = smartVery quality;
|
||||
Fresh = mkVarAdj "ntsha";
|
||||
Warm = mkOrdAdj "bothitho";
|
||||
Italian = mkPerAdj "Itali";
|
||||
Expensive = mkVerbRel "tura";
|
||||
Delicious = mkOrdAdj "monate";
|
||||
Boring = mkOrdAdj "bosula";
|
||||
|
||||
param
|
||||
NounClass = NC9_10 | NC14_6;
|
||||
Number = Sg | Pl;
|
||||
TType = P | V | ModV | R ;
|
||||
oper
|
||||
mkMod : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str;
|
||||
b: Bool} = \x,y -> case y.b of
|
||||
{
|
||||
True => {w = y.w; r = y.r; c = y.c;
|
||||
q = table {
|
||||
Sg => ((y.q ! Sg) ++ "le" ++ ((smartQualRelPart (x.t)) ! y.c ! Sg) ++ ((smartDescrCop (x.t)) ! y.c ! Sg) ++ (x.s ! y.c ! Sg));
|
||||
Pl => ((y.q ! Pl) ++ "le" ++ ((smartQualRelPart (x.t))! y.c ! Pl) ++ ((smartDescrCop (x.t)) ! y.c ! Pl) ++(x.s ! y.c ! Pl))
|
||||
}; b = True
|
||||
};
|
||||
False => {w = y.w; r = y.r; c = y.c;
|
||||
q = table {
|
||||
Sg => ((y.q ! Sg) ++ ((smartQualRelPart (x.t)) ! y.c ! Sg) ++ ((smartDescrCop (x.t)) ! y.c ! Sg) ++ (x.s ! y.c ! Sg));
|
||||
Pl => ((y.q ! Pl) ++ ((smartQualRelPart (x.t)) ! y.c ! Pl) ++ ((smartDescrCop (x.t)) ! y.c ! Pl) ++(x.s ! y.c ! Pl))
|
||||
}; b = True
|
||||
}
|
||||
};
|
||||
|
||||
mkNounNC14_6 : Str -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} = \x -> {w = table {Sg => "bo" + x; Pl => "ma" + x}; r = x; c = NC14_6;
|
||||
q = table {Sg => ""; Pl => ""}; b = False};
|
||||
|
||||
mkNounNC9_10 : Str -> {w: Number => Str; r: Str; c: NounClass; q: Number => Str; b: Bool} = \x -> {w = table {Sg => "" + x; Pl => "di" + x}; r = x; c = NC9_10;
|
||||
q = table {Sg => ""; Pl => ""}; b = False};
|
||||
|
||||
mkVarAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table {
|
||||
NC9_10 => table {Sg => "" + x; Pl => "di" + x};
|
||||
NC14_6 => table {Sg => "bo" + x; Pl => "ma" + x}
|
||||
};
|
||||
p_form = x;
|
||||
t = R;
|
||||
};
|
||||
|
||||
mkOrdAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table {
|
||||
NC9_10 => table {Sg => "" + x; Pl => "" + x};
|
||||
NC14_6 => table {Sg => "" + x; Pl => "" + x}
|
||||
};
|
||||
p_form = x;
|
||||
t = R;
|
||||
};
|
||||
|
||||
mkVerbRel : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table {
|
||||
NC9_10 => table {Sg => x + "ng"; Pl => x + "ng"};
|
||||
NC14_6 => table {Sg => x + "ng"; Pl => x + "ng"}
|
||||
};
|
||||
p_form = x;
|
||||
t = V;
|
||||
};
|
||||
|
||||
mkPerAdj : Str -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table {
|
||||
NC9_10 => table {Sg => "" + x; Pl => "" + x};
|
||||
NC14_6 => table {Sg => "" + x; Pl => "" + x}
|
||||
};
|
||||
p_form = "mo" ++ x;
|
||||
t = P;
|
||||
};
|
||||
|
||||
mkVeryAdj : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table{c => table{n => (x.s!c!n) ++ "thata"}}; p_form = x.p_form ++ "thata"; t = x.t
|
||||
};
|
||||
|
||||
mkVeryVerb : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} = \x ->
|
||||
{
|
||||
s = table{c => table{n => (x.s!c!n) ++ "thata"}}; p_form = x.p_form ++ "thata"; t = ModV
|
||||
};
|
||||
|
||||
smartVery : {s: NounClass => Number => Str; p_form: Str; t: TType} -> {s: NounClass => Number => Str; p_form: Str; t: TType} =
|
||||
\x -> case x.t of --(x.s!c!n)
|
||||
{
|
||||
(V | ModV) => mkVeryVerb x;
|
||||
--ModV => mkVeryVerb x;
|
||||
_ => mkVeryAdj x
|
||||
};
|
||||
|
||||
mkDemPron1 : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "e"; Pl => "tse"};
|
||||
NC14_6 => table {Sg => "bo"; Pl => "a"}
|
||||
};
|
||||
|
||||
mkDemPron2 : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "eo"; Pl => "tseo"};
|
||||
NC14_6 => table {Sg => "boo"; Pl => "ao"}
|
||||
};
|
||||
|
||||
smartQualRelPart : TType -> (NounClass => Number => Str) = \x -> case x of
|
||||
{
|
||||
P => mkQualRelPart_PName;
|
||||
_ => mkQualRelPart
|
||||
};
|
||||
|
||||
mkQualRelPart : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "e"; Pl => "tse"};
|
||||
NC14_6 => table {Sg => "bo"; Pl => "a"}
|
||||
};
|
||||
|
||||
mkQualRelPart_PName : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "ya"; Pl => "tsa"};
|
||||
NC14_6 => table {Sg => "ba"; Pl => "a"}
|
||||
};
|
||||
|
||||
smartDescrCop : TType -> (NounClass => Number => Str) = \x -> case x of
|
||||
{
|
||||
P => mkDescrCop_PName;
|
||||
_ => mkDescrCop
|
||||
};
|
||||
|
||||
mkDescrCop : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "e"; Pl => "di"};
|
||||
NC14_6 => table {Sg => "bo"; Pl => "a"}
|
||||
};
|
||||
|
||||
mkDescrCop_PName : NounClass => Number => Str = table
|
||||
{
|
||||
NC9_10 => table {Sg => "ga"; Pl => "ga"};
|
||||
NC14_6 => table {Sg => "ga"; Pl => "ga"}
|
||||
};
|
||||
|
||||
mkPredDescrCop : TType -> (NounClass => Number => Str) = \x -> case x of
|
||||
{
|
||||
V => table {NC9_10 => table {Sg => "e" ++ "a"; Pl => "di" ++ "a"};
|
||||
NC14_6 => table {Sg => "bo" ++ "a"; Pl => "a" ++ "a"}};
|
||||
|
||||
_ => table {NC9_10 => table {Sg => "e"; Pl => "di"};
|
||||
NC14_6 => table {Sg => "bo"; Pl => "a"}}
|
||||
};
|
||||
|
||||
}
|
||||
140
samples/Grammatical Framework/FoodsTur.gf
Normal file
140
samples/Grammatical Framework/FoodsTur.gf
Normal file
@@ -0,0 +1,140 @@
|
||||
{-
|
||||
File : FoodsTur.gf
|
||||
Author : Server Çimen
|
||||
Version : 1.0
|
||||
Created on: August 26, 2009
|
||||
|
||||
This file contains concrete grammar of Foods abstract grammar for Turkish Language.
|
||||
This grammar is to be used for Fridge demo and developed in the scope of GF Resource
|
||||
Grammar Summer School.
|
||||
|
||||
-}
|
||||
|
||||
concrete FoodsTur of Foods = open Predef in {
|
||||
flags
|
||||
coding=utf8 ;
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Quality = {s : Str ; c : Case; softness : Softness; h : Harmony} ;
|
||||
Kind = {s : Case => Number => Str} ;
|
||||
Item = {s : Str; n : Number} ;
|
||||
lin
|
||||
This = det Sg "bu" ;
|
||||
That = det Sg "şu" ;
|
||||
These = det Pl "bu" ;
|
||||
Those = det Pl "şu" ;
|
||||
-- Reason for excluding plural form of copula: In Turkish if subject is not a human being,
|
||||
-- then singular form of copula is used regardless of the number of subject. Since all
|
||||
-- possible subjects are non human, copula do not need to have plural form.
|
||||
Pred item quality = {s = item.s ++ quality.s ++ "&+" ++ copula ! quality.softness ! quality.h} ;--! item.n} ;
|
||||
Mod quality kind = {s = case quality.c of {
|
||||
Nom => \\t,n => quality.s ++ kind.s ! t ! n ;
|
||||
Gen => \\t,n => quality.s ++ kind.s ! Gen ! n
|
||||
}
|
||||
} ;
|
||||
Wine = mkN "şarap" "şaraplar" "şarabı" "şarapları" ;
|
||||
Cheese = mkN "peynir" "peynirler" "peyniri" "peynirleri" ;
|
||||
Fish = mkN "balık" "balıklar" "balığı" "balıkları" ;
|
||||
Pizza = mkN "pizza" "pizzalar" "pizzası" "pizzaları" ;
|
||||
Very a = {s = "çok" ++ a.s ; c = a.c; softness = a.softness; h = a.h} ;
|
||||
Fresh = adj "taze" Nom;
|
||||
Warm = adj "ılık" Nom;
|
||||
Italian = adj "İtalyan" Gen ;
|
||||
Expensive = adj "pahalı" Nom;
|
||||
Delicious = adj "lezzetli" Nom;
|
||||
Boring = adj "sıkıcı" Nom;
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Case = Nom | Gen ;
|
||||
Harmony = I_Har | Ih_Har | U_Har | Uh_Har ; --Ih = İ; Uh = Ü
|
||||
Softness = Soft | Hard ;
|
||||
oper
|
||||
det : Number -> Str -> {s : Case => Number => Str} -> {s : Str; n : Number} =
|
||||
\num,det,noun -> {s = det ++ noun.s ! Nom ! num; n = num} ;
|
||||
mkN = overload {
|
||||
mkN : Str -> Str -> {s : Case => Number => Str} = regNoun ;
|
||||
mkn : Str -> Str -> Str -> Str-> {s : Case => Number => Str} = noun ;
|
||||
} ;
|
||||
regNoun : Str -> Str -> {s : Case => Number => Str} =
|
||||
\peynir,peynirler -> noun peynir peynirler [] [] ;
|
||||
noun : Str -> Str -> Str -> Str-> {s : Case => Number => Str} =
|
||||
\sarap,saraplar,sarabi,saraplari -> {
|
||||
s = table {
|
||||
Nom => table {
|
||||
Sg => sarap ;
|
||||
Pl => saraplar
|
||||
} ;
|
||||
Gen => table {
|
||||
Sg => sarabi ;
|
||||
Pl => saraplari
|
||||
}
|
||||
}
|
||||
};
|
||||
{-
|
||||
Since there is a bug in overloading, this overload is useless.
|
||||
|
||||
mkA = overload {
|
||||
mkA : Str -> {s : Str; c : Case; softness : Softness; h : Harmony} = \base -> adj base Nom ;
|
||||
mkA : Str -> Case -> {s : Str; c : Case; softness : Softness; h : Harmony} = adj ;
|
||||
} ;
|
||||
-}
|
||||
adj : Str -> Case -> {s : Str; c : Case; softness : Softness; h : Harmony} =
|
||||
\italyan,ca -> {s = italyan ; c = ca; softness = (getSoftness italyan); h = (getHarmony italyan)} ;
|
||||
-- See the comment at lines 26 and 27 for excluded plural form of copula.
|
||||
copula : Softness => Harmony {-=> Number-} => Str =
|
||||
table {
|
||||
Soft => table {
|
||||
I_Har => "dır" ;--table {
|
||||
-- Sg => "dır" ;
|
||||
-- Pl => "dırlar"
|
||||
--} ;
|
||||
Ih_Har => "dir" ;--table {
|
||||
--Sg => "dir" ;
|
||||
--Pl => "dirler"
|
||||
--} ;
|
||||
U_Har => "dur" ;--table {
|
||||
-- Sg => "dur" ;
|
||||
-- Pl => "durlar"
|
||||
--} ;
|
||||
Uh_Har => "dür" --table {
|
||||
--Sg => "dür" ;
|
||||
--Pl => "dürler"
|
||||
--}
|
||||
} ;
|
||||
Hard => table {
|
||||
I_Har => "tır" ;--table {
|
||||
--Sg => "tır" ;
|
||||
--Pl => "tırlar"
|
||||
--} ;
|
||||
Ih_Har => "tir" ;--table {
|
||||
--Sg => "tir" ;
|
||||
--Pl => "tirler"
|
||||
--} ;
|
||||
U_Har => "tur" ;--table {
|
||||
-- Sg => "tur" ;
|
||||
-- Pl => "turlar"
|
||||
--} ;
|
||||
Uh_Har => "tür"--table {
|
||||
--Sg => "tür" ;
|
||||
--Pl => "türler"
|
||||
--}
|
||||
}
|
||||
} ;
|
||||
|
||||
getHarmony : Str -> Harmony
|
||||
= \base -> case base of {
|
||||
_+c@("ı"|"a"|"i"|"e"|"u"|"o"|"ü"|"ö")+
|
||||
("b"|"v"|"d"|"z"|"j"|"c"|"g"|"ğ"|"l"|"r"|"m"|"n"|"y"|"p"|"f"|"t"|"s"|"ş"|"ç"|"k"|"h")* =>
|
||||
case c of {
|
||||
("ı"|"a") => I_Har ;
|
||||
("i"|"e") => Ih_Har ;
|
||||
("u"|"o") => U_Har ;
|
||||
("ü"|"ö") => Uh_Har
|
||||
}
|
||||
} ;
|
||||
getSoftness : Str -> Softness
|
||||
= \base -> case base of {
|
||||
_+("f"|"s"|"t"|"k"|"ç"|"ş"|"h"|"p") => Hard ;
|
||||
_ => Soft
|
||||
} ;
|
||||
}
|
||||
53
samples/Grammatical Framework/FoodsUrd.gf
Normal file
53
samples/Grammatical Framework/FoodsUrd.gf
Normal file
@@ -0,0 +1,53 @@
|
||||
-- (c) 2009 Shafqat Virk under LGPL
|
||||
|
||||
concrete FoodsUrd of Foods = {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
|
||||
param Number = Sg | Pl ;
|
||||
param Gender = Masc | Fem;
|
||||
|
||||
oper coupla : Number -> Str =\n -> case n of {Sg => "ہے" ; Pl => "ہیں"};
|
||||
|
||||
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Item = {s: Str ; n: Number ; g:Gender};
|
||||
Kind = {s: Number => Str ; g:Gender};
|
||||
Quality = {s: Gender => Number => Str};
|
||||
|
||||
lin
|
||||
Pred item quality = {s = item.s ++ quality.s ! item.g ! item.n ++ coupla item.n} ;
|
||||
This kind = {s = "یھ" ++ kind.s ! Sg; n= Sg ; g = kind.g } ;
|
||||
These kind = {s = "یھ" ++ kind.s ! Pl; n = Pl ; g = kind.g} ;
|
||||
That kind = {s = "وہ" ++ kind.s ! Sg; n= Sg ; g = kind.g} ;
|
||||
Those kind = {s = "وہ" ++ kind.s ! Pl; n=Pl ; g = kind.g} ;
|
||||
Mod quality kind = {s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ; g = kind.g};
|
||||
Wine = {s = table { Sg => "شراب" ; Pl => "شرابیں"} ; g = Fem};
|
||||
Cheese = {s = table { Sg => "پنیر" ; Pl => "پنیریں"} ; g = Fem};
|
||||
Fish = {s = table { Sg => "مچھلی" ; Pl => "مچھلیاں"} ; g = Fem};
|
||||
Pizza = {s = table { Sg => "پیزہ" ; Pl => "پیزے"} ; g = Masc};
|
||||
Very quality = {s = \\g,n => "بہت" ++ quality.s ! g ! n} ;
|
||||
Fresh = regAdj "تازہ" ;
|
||||
Warm = regAdj "گرم" ;
|
||||
Italian = regAdj "اٹا لوی" ;
|
||||
Expensive = regAdj "مہنگا" ;
|
||||
Delicious = regAdj "مزیدار" ;
|
||||
Boring = regAdj "فضول" ;
|
||||
|
||||
oper
|
||||
regAdj : Str -> {s: Gender => Number => Str} = \a -> case a of {
|
||||
x + "ا" => mkAdj a (x+"ے") (x+"ی");
|
||||
_ => mkAdj a a a
|
||||
};
|
||||
mkAdj : Str -> Str -> Str -> {s: Gender => Number => Str} = \s,p,f -> {
|
||||
s = table {
|
||||
Masc => table {
|
||||
Sg => s;
|
||||
Pl => p
|
||||
};
|
||||
Fem => \\_ => f
|
||||
}
|
||||
};
|
||||
}
|
||||
15
samples/Grammatical Framework/LexFoods.gf
Normal file
15
samples/Grammatical Framework/LexFoods.gf
Normal file
@@ -0,0 +1,15 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
interface LexFoods = open Syntax in {
|
||||
oper
|
||||
wine_N : N ;
|
||||
pizza_N : N ;
|
||||
cheese_N : N ;
|
||||
fish_N : N ;
|
||||
fresh_A : A ;
|
||||
warm_A : A ;
|
||||
italian_A : A ;
|
||||
expensive_A : A ;
|
||||
delicious_A : A ;
|
||||
boring_A : A ;
|
||||
}
|
||||
18
samples/Grammatical Framework/LexFoodsCat.gf
Normal file
18
samples/Grammatical Framework/LexFoodsCat.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
-- (c) 2009 Jordi Saludes under LGPL
|
||||
|
||||
instance LexFoodsCat of LexFoods =
|
||||
open SyntaxCat, ParadigmsCat, (M = MorphoCat) in {
|
||||
flags
|
||||
coding = utf8 ;
|
||||
oper
|
||||
wine_N = mkN "vi" "vins" M.Masc ;
|
||||
pizza_N = mkN "pizza" ;
|
||||
cheese_N = mkN "formatge" ;
|
||||
fish_N = mkN "peix" "peixos" M.Masc;
|
||||
fresh_A = mkA "fresc" "fresca" "frescos" "fresques" "frescament";
|
||||
warm_A = mkA "calent" ;
|
||||
italian_A = mkA "italià" "italiana" "italians" "italianes" "italianament" ;
|
||||
expensive_A = mkA "car" ;
|
||||
delicious_A = mkA "deliciós" "deliciosa" "deliciosos" "delicioses" "deliciosament";
|
||||
boring_A = mkA "aburrit" "aburrida" "aburrits" "aburrides" "aburridament" ;
|
||||
}
|
||||
20
samples/Grammatical Framework/LexFoodsFin.gf
Normal file
20
samples/Grammatical Framework/LexFoodsFin.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
instance LexFoodsFin of LexFoods =
|
||||
open SyntaxFin, ParadigmsFin in {
|
||||
oper
|
||||
wine_N = mkN "viini" ;
|
||||
pizza_N = mkN "pizza" ;
|
||||
cheese_N = mkN "juusto" ;
|
||||
fish_N = mkN "kala" ;
|
||||
fresh_A = mkA "tuore" ;
|
||||
warm_A = mkA
|
||||
(mkN "l<>mmin" "l<>mpim<69>n" "l<>mmint<6E>" "l<>mpim<69>n<EFBFBD>" "l<>mpim<69><6D>n"
|
||||
"l<>mpimin<69>" "l<>mpimi<6D>" "l<>mpimien" "l<>mpimiss<73>" "l<>mpimiin"
|
||||
)
|
||||
"l<>mpim<69>mpi" "l<>mpimin" ;
|
||||
italian_A = mkA "italialainen" ;
|
||||
expensive_A = mkA "kallis" ;
|
||||
delicious_A = mkA "herkullinen" ;
|
||||
boring_A = mkA "tyls<6C>" ;
|
||||
}
|
||||
16
samples/Grammatical Framework/LexFoodsGer.gf
Normal file
16
samples/Grammatical Framework/LexFoodsGer.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
instance LexFoodsGer of LexFoods =
|
||||
open SyntaxGer, ParadigmsGer in {
|
||||
oper
|
||||
wine_N = mkN "Wein" ;
|
||||
pizza_N = mkN "Pizza" "Pizzen" feminine ;
|
||||
cheese_N = mkN "K<>se" "K<>se" masculine ;
|
||||
fish_N = mkN "Fisch" ;
|
||||
fresh_A = mkA "frisch" ;
|
||||
warm_A = mkA "warm" "w<>rmer" "w<>rmste" ;
|
||||
italian_A = mkA "italienisch" ;
|
||||
expensive_A = mkA "teuer" ;
|
||||
delicious_A = mkA "k<>stlich" ;
|
||||
boring_A = mkA "langweilig" ;
|
||||
}
|
||||
16
samples/Grammatical Framework/LexFoodsIta.gf
Normal file
16
samples/Grammatical Framework/LexFoodsIta.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
instance LexFoodsIta of LexFoods =
|
||||
open SyntaxIta, ParadigmsIta in {
|
||||
oper
|
||||
wine_N = mkN "vino" ;
|
||||
pizza_N = mkN "pizza" ;
|
||||
cheese_N = mkN "formaggio" ;
|
||||
fish_N = mkN "pesce" ;
|
||||
fresh_A = mkA "fresco" ;
|
||||
warm_A = mkA "caldo" ;
|
||||
italian_A = mkA "italiano" ;
|
||||
expensive_A = mkA "caro" ;
|
||||
delicious_A = mkA "delizioso" ;
|
||||
boring_A = mkA "noioso" ;
|
||||
}
|
||||
16
samples/Grammatical Framework/LexFoodsSwe.gf
Normal file
16
samples/Grammatical Framework/LexFoodsSwe.gf
Normal file
@@ -0,0 +1,16 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
instance LexFoodsSwe of LexFoods =
|
||||
open SyntaxSwe, ParadigmsSwe in {
|
||||
oper
|
||||
wine_N = mkN "vin" "vinet" "viner" "vinerna" ;
|
||||
pizza_N = mkN "pizza" ;
|
||||
cheese_N = mkN "ost" ;
|
||||
fish_N = mkN "fisk" ;
|
||||
fresh_A = mkA "f<>rsk" ;
|
||||
warm_A = mkA "varm" ;
|
||||
italian_A = mkA "italiensk" ;
|
||||
expensive_A = mkA "dyr" ;
|
||||
delicious_A = mkA "l<>cker" ;
|
||||
boring_A = mkA "tr<74>kig" ;
|
||||
}
|
||||
53
samples/Grammatical Framework/MutationsGla.gf
Normal file
53
samples/Grammatical Framework/MutationsGla.gf
Normal file
@@ -0,0 +1,53 @@
|
||||
resource MutationsGla = open CharactersGla in {
|
||||
param Mutation = Unmutated|Lenition1|Lenition1DNTLS|Lenition2|PrefixT|PrefixH;
|
||||
|
||||
--Turns a string into a mutation table
|
||||
oper mutate : (_ : Str) -> (Mutation => Str) = \str -> table {
|
||||
Unmutated => str ;
|
||||
Lenition1 => lenition1 str ;
|
||||
Lenition1DNTLS => lenition1dntls str ;
|
||||
Lenition2 => lenition2 str ;
|
||||
PrefixT => prefixT str ;
|
||||
PrefixH => prefixH str
|
||||
};
|
||||
|
||||
--Performs lenition 1: inserts "h" if the word begins with a lenitable character
|
||||
oper lenition1 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"t"|"d"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"T"|"D"|"C"|"G") + rest => start + "h" + rest ;
|
||||
("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
|
||||
start@("s"|"S") + rest => start + "h" + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs lenition 1 with dentals: same as lenition 1 but leaves "d", "t" and "s" unmutated
|
||||
oper lenition1dntls : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs lenition 2: same as lenition 1 with dentals but also changes "s" into "ts"
|
||||
oper lenition2 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
|
||||
("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
|
||||
start@("s"|"S") + rest => "t-" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Prefixes a "t" to words beginning with a vowel
|
||||
oper prefixT : Str -> Str = \str -> case str of {
|
||||
start@(#vowel) + rest => "t-" + start + rest ;
|
||||
start@(#vowelCap) + rest => "t-" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Prefixes a "h" to words beginning with a vowel
|
||||
oper prefixH : Str -> Str = \str -> case str of {
|
||||
start@(#vowel) + rest => "h-" + start + rest ;
|
||||
start@(#vowelCap) + rest => "h-" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
}
|
||||
92
samples/Grammatical Framework/MutationsGle.gf
Normal file
92
samples/Grammatical Framework/MutationsGle.gf
Normal file
@@ -0,0 +1,92 @@
|
||||
resource MutationsGle = open CharactersGle in {
|
||||
param Mutation = Unmutated|Lenition1|Lenition1DNTLS|Lenition2|Eclipsis1|Eclipsis2|Eclipsis3|PrefixT|PrefixH;
|
||||
|
||||
--Turns a string into a mutation table
|
||||
oper mutate : (_ : Str) -> (Mutation => Str) = \str -> table {
|
||||
Unmutated => str ;
|
||||
Lenition1 => lenition1 str ;
|
||||
Lenition1DNTLS => lenition1dntls str ;
|
||||
Lenition2 => lenition2 str ;
|
||||
Eclipsis1 => eclipsis1 str ;
|
||||
Eclipsis2 => eclipsis2 str ;
|
||||
Eclipsis3 => eclipsis3 str ;
|
||||
PrefixT => prefixT str ;
|
||||
PrefixH => prefixH str
|
||||
};
|
||||
|
||||
--Performs lenition 1: inserts "h" if the word begins with a lenitable character
|
||||
oper lenition1 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"t"|"d"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"T"|"D"|"C"|"G") + rest => start + "h" + rest ;
|
||||
("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
|
||||
start@("s"|"S") + rest => start + "h" + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs lenition 1 with dentals: same as lenition 1 but leaves "d", "t" and "s" unmutated
|
||||
oper lenition1dntls : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs lenition 2: same as lenition 1 with dentals but also changes "s" into "ts"
|
||||
oper lenition2 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"b"|"m"|"f"|"c"|"g") + rest => start + "h" + rest ;
|
||||
start@("P"|"B"|"M"|"F"|"C"|"G") + rest => start + "h" + rest ;
|
||||
("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
|
||||
start@("s"|"S") + rest => "t" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs eclisis 1: prefixes something to every word that begins with an ecliptable character
|
||||
oper eclipsis1 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"P") + rest => "b" + start + rest ;
|
||||
start@("b"|"B") + rest => "m" + start + rest ;
|
||||
start@("f"|"F") + rest => "bh" + start + rest ;
|
||||
start@("c"|"C") + rest => "g" + start + rest ;
|
||||
start@("g"|"G") + rest => "n" + start + rest ;
|
||||
start@("t"|"T") + rest => "d" + start + rest ;
|
||||
start@("d"|"D") + rest => "n" + start + rest ;
|
||||
start@(#vowel) + rest => "n-" + start + rest ;
|
||||
start@(#vowelCap) + rest => "n" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs eclipsis 2: same as eclipsis 1 but leaves "t", "d" and vowels unchanges
|
||||
oper eclipsis2 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"P") + rest => "b" + start + rest ;
|
||||
start@("b"|"B") + rest => "m" + start + rest ;
|
||||
start@("f"|"F") + rest => "bh" + start + rest ;
|
||||
start@("c"|"C") + rest => "g" + start + rest ;
|
||||
start@("g"|"G") + rest => "n" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Performs eclipsis 3: same as eclipsis 2 but also changes "s" to "ts"
|
||||
eclipsis3 : Str -> Str = \str -> case str of {
|
||||
start@("p"|"P") + rest => "b" + start + rest ;
|
||||
start@("b"|"B") + rest => "m" + start + rest ;
|
||||
start@("f"|"F") + rest => "bh" + start + rest ;
|
||||
start@("c"|"C") + rest => "g" + start + rest ;
|
||||
start@("g"|"G") + rest => "n" + start + rest ;
|
||||
("s"|"S") + ("p"|"t"|"c") + _ => str ; --the sequences "sp", "st", "sc" are never mutated
|
||||
start@("s"|"S") + rest => "t" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Prefixes a "t" to words beginning with a vowel
|
||||
oper prefixT : Str -> Str = \str -> case str of {
|
||||
start@(#vowel) + rest => "t-" + start + rest ;
|
||||
start@(#vowelCap) + rest => "t" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
--Prefixes a "h" to words beginning with a vowel
|
||||
oper prefixH : Str -> Str = \str -> case str of {
|
||||
start@(#vowel) + rest => "h" + start + rest ;
|
||||
start@(#vowelCap) + rest => "h" + start + rest ;
|
||||
_ => str
|
||||
};
|
||||
|
||||
}
|
||||
46
samples/Grammatical Framework/ResCze.gf
Normal file
46
samples/Grammatical Framework/ResCze.gf
Normal file
@@ -0,0 +1,46 @@
|
||||
-- (c) 2011 Katerina Bohmova under LGPL
|
||||
|
||||
resource ResCze = open Prelude in {
|
||||
flags
|
||||
coding = utf8 ;
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Gender = Masc | Fem | Neutr;
|
||||
oper
|
||||
NounPhrase : Type =
|
||||
{s : Str ; g : Gender ; n : Number} ;
|
||||
Noun : Type = {s : Number => Str ; g : Gender} ;
|
||||
Adjective : Type = {s : Gender => Number => Str} ;
|
||||
|
||||
det : Number -> Str -> Str -> Str -> Noun -> NounPhrase =
|
||||
\n,m,f,ne,cn -> {
|
||||
s = table {Masc => m ; Fem => f; Neutr => ne} ! cn.g ++
|
||||
cn.s ! n ;
|
||||
g = cn.g ;
|
||||
n = n
|
||||
} ;
|
||||
noun : Str -> Str -> Gender -> Noun =
|
||||
\muz,muzi,g -> {
|
||||
s = table {Sg => muz ; Pl => muzi} ;
|
||||
g = g
|
||||
} ;
|
||||
adjective : (msg,fsg,nsg,mpl,fpl,npl : Str) -> Adjective =
|
||||
\msg,fsg,nsg,mpl,fpl,npl -> {
|
||||
s = table {
|
||||
Masc => table {Sg => msg ; Pl => mpl} ;
|
||||
Fem => table {Sg => fsg ; Pl => fpl} ;
|
||||
Neutr => table {Sg => nsg ; Pl => npl}
|
||||
}
|
||||
} ;
|
||||
regAdj : Str -> Adjective =
|
||||
\mlad ->
|
||||
adjective (mlad+"ý") (mlad+"á") (mlad+"é")
|
||||
(mlad+"é") (mlad+"é") (mlad+"á") ;
|
||||
regnfAdj : Str -> Adjective =
|
||||
\vynikajici ->
|
||||
adjective vynikajici vynikajici vynikajici
|
||||
vynikajici vynikajici vynikajici;
|
||||
copula : Number => Str =
|
||||
table {Sg => "je" ; Pl => "jsou"} ;
|
||||
}
|
||||
|
||||
75
samples/Grammatical Framework/transFoodsHin.gf
Normal file
75
samples/Grammatical Framework/transFoodsHin.gf
Normal file
@@ -0,0 +1,75 @@
|
||||
-- (c) 2009 Aarne Ranta under LGPL
|
||||
|
||||
concrete FoodsHin of Foods = {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
param
|
||||
Gender = Masc | Fem ;
|
||||
Number = Sg | Pl ;
|
||||
lincat
|
||||
Comment = {s : Str} ;
|
||||
Item = {s : Str ; g : Gender ; n : Number} ;
|
||||
Kind = {s : Number => Str ; g : Gender} ;
|
||||
Quality = {s : Gender => Number => Str} ;
|
||||
lin
|
||||
Pred item quality = {
|
||||
s = item.s ++ quality.s ! item.g ! item.n ++ copula item.n
|
||||
} ;
|
||||
This kind = {s = "yah" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ;
|
||||
That kind = {s = "vah" ++ kind.s ! Sg ; g = kind.g ; n = Sg} ;
|
||||
These kind = {s = "ye" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ;
|
||||
Those kind = {s = "ve" ++ kind.s ! Pl ; g = kind.g ; n = Pl} ;
|
||||
Mod quality kind = {
|
||||
s = \\n => quality.s ! kind.g ! n ++ kind.s ! n ;
|
||||
g = kind.g
|
||||
} ;
|
||||
Wine = regN "madirA" ;
|
||||
Cheese = regN "panIr" ;
|
||||
Fish = regN "maClI" ;
|
||||
Pizza = regN "pijjA" ;
|
||||
Very quality = {s = \\g,n => "bahut" ++ quality.s ! g ! n} ;
|
||||
Fresh = regAdj "tAzA" ;
|
||||
Warm = regAdj "garam" ;
|
||||
Italian = regAdj "i-t.alI" ;
|
||||
Expensive = regAdj "mahaNgA" ;
|
||||
Delicious = regAdj "rucikar" ;
|
||||
Boring = regAdj "pEriyA" ;
|
||||
|
||||
oper
|
||||
mkN : Str -> Str -> Gender -> {s : Number => Str ; g : Gender} =
|
||||
\s,p,g -> {
|
||||
s = table {
|
||||
Sg => s ;
|
||||
Pl => p
|
||||
} ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
regN : Str -> {s : Number => Str ; g : Gender} = \s -> case s of {
|
||||
lark + "A" => mkN s (lark + "e") Masc ;
|
||||
lark + "I" => mkN s (lark + "iyaM") Fem ;
|
||||
_ => mkN s s Masc
|
||||
} ;
|
||||
|
||||
mkAdj : Str -> Str -> Str -> {s : Gender => Number => Str} = \ms,mp,f -> {
|
||||
s = table {
|
||||
Masc => table {
|
||||
Sg => ms ;
|
||||
Pl => mp
|
||||
} ;
|
||||
Fem => \\_ => f
|
||||
}
|
||||
} ;
|
||||
|
||||
regAdj : Str -> {s : Gender => Number => Str} = \a -> case a of {
|
||||
acch + "A" => mkAdj a (acch + "e") (acch + "I") ;
|
||||
_ => mkAdj a a a
|
||||
} ;
|
||||
|
||||
copula : Number -> Str = \n -> case n of {
|
||||
Sg => "hE" ;
|
||||
Pl => "hEN"
|
||||
} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user