1
0
forked from GitHub/gf-core

Remove examples directory; these now live in gf-contrib

All changes have been reflected in the gf-contrib repository:
https://github.com/GrammaticalFramework/gf-contrib

Now, for WebSetup to build the example grammars, one must have gf-contrib
cloned in the same top-level directory as GF. When this isn't the case,
WebSetup displays a notice without failing.
This commit is contained in:
John J. Camilleri
2018-07-04 10:09:58 +02:00
parent 00476ae386
commit c6f4edaea5
185 changed files with 34 additions and 16828 deletions

View File

@@ -1,12 +1,13 @@
module WebSetup(buildWeb,installWeb,copyWeb,numJobs,execute) where
import System.Directory(createDirectoryIfMissing,copyFile)
import System.Directory(createDirectoryIfMissing,copyFile,doesDirectoryExist)
import System.FilePath((</>),dropExtension)
import System.Process(rawSystem)
import System.Exit(ExitCode(..))
import Distribution.Simple.Setup(BuildFlags(..),Flag(..),CopyDest(..),copyDest)
import Distribution.Simple.LocalBuildInfo(datadir,buildDir,absoluteInstallDirs)
import Distribution.Simple.Utils(die)
import Distribution.Simple.Utils(die,noticeNoWrap)
import qualified Distribution.Verbosity
{-
To test the GF web services, the minibar and the grammar editor, use
@@ -16,6 +17,16 @@ import Distribution.Simple.Utils(die)
Chrome). The example grammars listed below will be available in the minibar.
-}
{-
Update 2018-07-04
The example grammars have now been removed from the GF repository.
This script will look for them in ../gf-contrib and build them from there if possible.
If not, the user will be given a message and nothing is build or copied.
(Unfortunately cabal install seems to hide all messages from stdout,
so users won't see this message unless they check the log.)
-}
example_grammars = -- :: [(pgf, subdir, src)]
[("Letter.pgf","letter",letterSrc)
,("Foods.pgf","foods",foodsSrc)
@@ -34,10 +45,20 @@ example_grammars = -- :: [(pgf, subdir, src)]
letterSrc = ["Letter"++lang++".gf"|lang<-letterLangs]
letterLangs = words "Eng Fin Fre Heb Rus Swe"
contrib_dir :: FilePath
contrib_dir = ".."</>"gf-contrib"
buildWeb gf (flags,pkg,lbi) =
do --putStrLn "buildWeb"
mapM_ build_pgf example_grammars
buildWeb gf (flags,pkg,lbi) = do
contrib_exists <- doesDirectoryExist contrib_dir
if contrib_exists
then mapM_ build_pgf example_grammars
else noticeNoWrap Distribution.Verbosity.normal $ unlines
[ "---"
, "Example grammars are no longer included in the main GF repository, but have moved to gf-contrib."
, "If you want these example grammars to be built, clone this repository in the same top-level directory as GF:"
, "https://github.com/GrammaticalFramework/gf-contrib.git"
, "---"
]
where
gfo_dir = buildDir lbi </> "examples"
@@ -47,7 +68,7 @@ buildWeb gf (flags,pkg,lbi) =
execute gf args
where
tmp_dir = gfo_dir</>subdir
dir = "examples"</>subdir
dir = contrib_dir</>subdir
args = numJobs flags++["-make","-s"] -- ,"-optimize-pgf"
++["--gfo-dir="++tmp_dir,
"--gf-lib-path="++buildDir lbi </> "rgl",
@@ -63,10 +84,13 @@ copyWeb flags = setupWeb dest
NoFlag -> NoCopyDest
Flag d -> d
setupWeb dest (pkg,lbi) =
do mapM_ (createDirectoryIfMissing True) [grammars_dir,cloud_dir]
mapM_ copy_pgf example_grammars
copyGFLogo
setupWeb dest (pkg,lbi) = do
mapM_ (createDirectoryIfMissing True) [grammars_dir,cloud_dir]
contrib_exists <- doesDirectoryExist contrib_dir
if contrib_exists
then mapM_ copy_pgf example_grammars
else return () -- message already displayed from buildWeb
copyGFLogo
where
grammars_dir = www_dir </> "grammars"
cloud_dir = www_dir </> "tmp" -- hmm

View File

@@ -1,16 +0,0 @@
# `/examples`
All contributions (`contrib` and `examples` folders) have now been
moved to a separate git repository at:
https://github.com/GrammaticalFramework/gf-contrib
This `examples` folder remains because its contents are compiled by
SetupWeb, so that when you run the GF cloud server locally you already
have some toy grammars to play with.
Any updates to these grammars should be made at the gf-contrib repository
above; changes will be copied from there to here manually.
John J. Camilleri,
2013-09-16

View File

@@ -1,13 +0,0 @@
--# -coding=latin1
resource CharactersGla = {
--Character classes
oper
vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"à"|"è"|"ì"|"ò"|"ù") ;
vowelCap : pattern Str = #("A"|"E"|"I"|"O"|"U"|"À"|"É"|"Ì"|"Ò"|"Ù") ;
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"|"à"|"ò"|"ù") ;
slenderVowel : pattern Str = #("e"|"i"|"è"|"ì") ;
}

View File

@@ -1,13 +0,0 @@
--# -coding=latin1
resource CharactersGle = {
--Character classes
oper
vowel : pattern Str = #("a"|"e"|"i"|"o"|"u"|"á"|"é"|"í"|"ó"|"ú") ;
vowelCap : pattern Str = #("A"|"E"|"I"|"O"|"U"|"Á"|"É"|"Í"|"Ó"|"Ú") ;
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"|"á"|"ó"|"ú") ;
slenderVowel : pattern Str = #("e"|"i"|"é"|"í") ;
}

View File

@@ -1,15 +0,0 @@
-- (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 ;
}

View File

@@ -1,77 +0,0 @@
-- (c) 2009 Laurette Pretorius Sr & Jr and Ansu Berg under LGPL
--# -coding=latin1
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 + "ë") w ;
declAdj_oog : Str -> {s : AdjAP=> Str} = \w ->
let v = init w
in
let i = init v
in mkAdj (i + "ë") 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
};
}

View File

@@ -1,21 +0,0 @@
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 = "አስቀያሚ";
}

View File

@@ -1,43 +0,0 @@
-- (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 => "еднообразни"}};
}

View File

@@ -1,6 +0,0 @@
-- (c) 2009 Jordi Saludes under LGPL
concrete FoodsCat of Foods = FoodsI with
(Syntax = SyntaxCat),
(LexFoods = LexFoodsCat) ;

View File

@@ -1,35 +0,0 @@
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 = "的"} ;
}

View File

@@ -1,35 +0,0 @@
-- (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" ;
}

View File

@@ -1,58 +0,0 @@
-- (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"};
}

View File

@@ -1,43 +0,0 @@
-- (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"} ;
}

View File

@@ -1,48 +0,0 @@
-- (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" ;
}

View File

@@ -1,6 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
concrete FoodsFin of Foods = FoodsI with
(Syntax = SyntaxFin),
(LexFoods = LexFoodsFin) ;

View File

@@ -1,31 +0,0 @@
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") ;
}

View File

@@ -1,6 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
concrete FoodsGer of Foods = FoodsI with
(Syntax = SyntaxGer),
(LexFoods = LexFoodsGer) ;

View File

@@ -1,67 +0,0 @@
--# -coding=latin1
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" "è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 "úr" "ùra" ;
Warm = makeAdjective "blàth" "blà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è"++(lenition1dntls sg); Pl => "glè"++(lenition1dntls pl)}
} ;
}

View File

@@ -1,60 +0,0 @@
--# -coding=latin1
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" "éisc" Masc ;
Pizza = makeNoun "píotsa" "píotsaí" 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 "úr" "úra" ;
Warm = makeAdjective "te" "te" ;
Italian = makeAdjective "Iodálach" "Iodá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)}
} ;
}

View File

@@ -1,107 +0,0 @@
--(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

View File

@@ -1,75 +0,0 @@
-- (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 => "हैं"
} ;
}

View File

@@ -1,29 +0,0 @@
-- (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 ;
}

View File

@@ -1,83 +0,0 @@
-- (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 "þessi" "þessi" "þetta" ;
These, Those = det Pl "þessir" "þessar" "þ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ökur" Fem ;
Very qual = {s = \\g,n,defOrInd => "mjög" ++ qual.s ! g ! n ! defOrInd } ;
Fresh = regAdj "ferskur" ;
Warm = regAdj "heitur" ;
Boring = regAdj "leiðinlegur" ;
-- the order of the given adj forms is: mSg fSg nSg mPl fPl nPl mSgDef f/nSgDef _PlDef
Italian = adjective "ítalskur" "ítölsk" "ítalskt" "ítalskir" "ítalskar" "ítölsk" "ítalski" "ítalska" "ítalsku" ;
Expensive = adjective "dýr" "dýr" "dýrt" "dýrir" "dýrar" "dýr" "dýri" "dýra" "dýru" ;
Delicious = adjective "ljúffengur" "ljúffeng" "ljúffengt" "ljúffengir" "ljúffengar" "ljúffeng" "ljúffengi" "ljúffenga" "ljú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"
} ;
}

View File

@@ -1,7 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
concrete FoodsIta of Foods = FoodsI with
(Syntax = SyntaxIta),
(LexFoods = LexFoodsIta) ;

View File

@@ -1,71 +0,0 @@
-- (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 => \\_ => "です" } ;
}

View File

@@ -1,90 +0,0 @@
-- (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
}
} ;
}

View File

@@ -1,120 +0,0 @@
-- (c) 2009 Krasimir Angelov under LGPL
concrete FoodsMkd of Foods = {
flags coding = utf8 ;
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 => "овоj";
Fem => "оваа";
Neutr => "ова"
} ++
kind.s ! Sg;
a = ASg kind.g};
That kind = {
s = case kind.g of {
Masc => "оноj";
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 => "сирењa"
};
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 => "досадни"}
};
param
Gender = Masc | Fem | Neutr;
Number = Sg | Pl;
Agr = ASg Gender | APl;
}

View File

@@ -1,105 +0,0 @@
-- (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
} ;
}

View File

@@ -1,48 +0,0 @@
-- (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 + "нууд"}
} ;
}

View File

@@ -1,60 +0,0 @@
-- (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 => "छन्"} ;
}

View File

@@ -1,30 +0,0 @@
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 = "ଅରୁଚିକର";
}

View File

@@ -1,65 +0,0 @@
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 => "هستند"};
}

View File

@@ -1,78 +0,0 @@
-- (c) 2009 Rami Shashati under LGPL
--# -coding=latin1
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 => "é" ; Pl => "são"} ;
}

View File

@@ -1,72 +0,0 @@
-- (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
};
}

View File

@@ -1,30 +0,0 @@
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") ;
}

View File

@@ -1,6 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
concrete FoodsSwe of Foods = FoodsI with
(Syntax = SyntaxSwe),
(LexFoods = LexFoodsSwe) ** {flags language = sv_SE;} ;

View File

@@ -1,32 +0,0 @@
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 "น่า" "เบิ่อ")) ;
}

View File

@@ -1,177 +0,0 @@
-- (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"}}
};
}

View File

@@ -1,140 +0,0 @@
{-
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 ++ BIND ++ 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
} ;
}

View File

@@ -1,53 +0,0 @@
-- (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
}
};
}

View File

@@ -1,15 +0,0 @@
-- (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 ;
}

View File

@@ -1,18 +0,0 @@
-- (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" ;
}

View File

@@ -1,21 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
--# -coding=latin1
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än" "lämmintä" "lämpimänä" "lämpimään"
"lämpiminä" "lämpimiä" "lämpimien" "lämpimissä" "lämpimiin"
)
"lämpimämpi" "lämpimin" ;
italian_A = mkA "italialainen" ;
expensive_A = mkA "kallis" ;
delicious_A = mkA "herkullinen" ;
boring_A = mkA "tylsä" ;
}

View File

@@ -1,17 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
--# -coding=latin1
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" ;
}

View File

@@ -1,16 +0,0 @@
-- (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" ;
}

View File

@@ -1,17 +0,0 @@
-- (c) 2009 Aarne Ranta under LGPL
--# -coding=latin1
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åkig" ;
}

View File

@@ -1,8 +0,0 @@
all:: Foods.pgf
Foods.pgf: Foods???.gf
gf -make -s Foods???.gf
clean:
rm -rf *.gfo Foods.pgf

View File

@@ -1,53 +0,0 @@
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
};
}

View File

@@ -1,92 +0,0 @@
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
};
}

View File

@@ -1,8 +0,0 @@
Foods grammars from GF Summer School 2009. To build:
$ gf -make -s Foods???.gf -- to create Foods.pgf
$ mv Foods.pgf ~/GF/src/server/gwt/www/grammars/ -- to use in web applications

View File

@@ -1,46 +0,0 @@
-- (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"} ;
}

View File

@@ -1,75 +0,0 @@
-- (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"
} ;
}

View File

@@ -1,83 +0,0 @@
abstract Letter = {
--1 An Abstract Syntax for Business and Love Letters
--
-- This file defines the abstract syntax of a grammar set whose concrete syntax
-- has so far been written to five languages: English, Finnish, French, Russian,
-- and Swedish.
--
-- The main category of the grammar is $Letter$. The other categories are
-- parts of the letter.
flags startcat=Letter ;
cat
Letter ;
Recipient ; Author ;
Message ;
Heading ; Ending ;
Mode ; Sentence ; NounPhrase ; Position ;
-- There is just one top-level letter structure.
fun
MkLetter : Heading -> Message -> Ending -> Letter ;
-- The heading consists of a greeting of the recipient. The $JustHello$
-- function will actually suppress the name (and title) of the recipient,
-- but the $Recipient$ argument keeps track of the gender and number.
DearRec : Recipient -> Heading ;
PlainRec : Recipient -> Heading ;
HelloRec : Recipient -> Heading ;
JustHello : Recipient -> Heading ;
-- A message is a sentence with of without a *mode*, which is either
-- regret or honour.
ModeSent : Mode -> Sentence -> Message ;
PlainSent : Sentence -> Message ;
Honour, Regret : Mode ;
-- The ending is either formal or informal. It does not currently depend on
-- the heading: making it so would eliminate formality mismatches between
-- the heading and the ending.
FormalEnding : Author -> Ending ;
InformalEnding : Author -> Ending ;
-- The recipient is either a colleague, colleagues, or darling.
-- It can also be a named person. The gender distinction is made
-- because there are things in the body of the letter that depend on it.
ColleagueHe, ColleagueShe : Recipient ;
ColleaguesHe, ColleaguesShe : Recipient ;
DarlingHe, DarlingShe : Recipient ;
NameHe, NameShe : String -> Recipient ;
-- For the author, there is likewise a fixed set of titles, plus the named author.
-- Gender distinctions could be useful even here, for the same reason as with
-- $Recipient$. Notice that the rendering of $Spouse$ will depend on the
-- gender of the recipient.
President, Mother, Spouse, Dean : Author ;
Name : String -> Author ;
-- As for the message body, no much choice is yet available: one can say that
-- the recipient is promoted to some position, that someone has gone bankrupt,
-- or that the author loves the recipient.
BePromoted : Position -> Sentence ;
GoBankrupt : NounPhrase -> Sentence ;
ILoveYou : Sentence ;
Competitor : NounPhrase ;
Company : NounPhrase ;
OurCustomers : NounPhrase ;
Senior : Position ;
ProjectManager : Position ;
}

View File

@@ -1,158 +0,0 @@
concrete LetterEng of Letter = {
--1 An English Concrete Syntax for Business and Love Letters
--
-- This file defines the English syntax of the grammar set
-- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ;
param Sex = masc | fem ;
param Num = sg | pl ;
param Kas = nom | acc ;
param DepNum = depnum | cnum Num ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Sex => Str} ; -- needs Num and Sex
oper SSSrc = {s : Str ; n : Num ; x : Sex} ; -- gives Num and Sex
oper SSSrc2 = {s : Num => Sex => Str ; n : DepNum ; x : Sex} ; -- gives and needs
oper SSDep2 = {s : DepNum => Sex => Num => Sex => Str} ; -- needs Auth's & Recp's
oper SSSrcNum = {s : Str ; n : Num} ; -- gives Num only
oper
ss : Str -> SS = \s -> {s = s} ;
constNX : Str -> Num -> Sex -> SSSrc2 = \str,num,sex ->
{s = table {_ => table {_ => str}} ; n = cnum num ; x = sex} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum cn => cn
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcNum ;
Position = SSDep ;
lin
MkLetter head mess end =
ss (head.s ++ "," ++ RET ++
mess.s ! end.n ! end.x ! head.n ! head.x ++ "." ++ RET ++
end.s ! head.n ! head.x) ;
DearRec rec = {s = "Dear" ++ rec.s ; n = rec.n ; x = rec.x} ;
PlainRec rec = rec ;
HelloRec rec = {s = "Hello" ++ rec.s ; n = rec.n ; x = rec.x} ;
JustHello rec = {s = "Hello" ; n = rec.n ; x = rec.x} ;
ModeSent mode sent =
{s =
table {dna => table {xa => table {nr => table {xr =>
mode.s ! dna ! xa ! nr ! xr ++ sent.s ! dna ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s = table {n => table {x =>
["Sincerely yours"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
InformalEnding auth =
{s = table {n => table {x =>
["With best regards"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
ColleaguesHe = {s = kollega ! pl ; n = pl ; x = masc} ;
ColleaguesShe = {s = kollega ! pl ; n = pl ; x = fem} ;
ColleagueHe = {s = kollega ! sg ; n = sg ; x = masc} ;
ColleagueShe = {s = kollega ! sg ; n = sg ; x = fem} ;
DarlingHe = {s = "darling" ; n = sg ; x = masc} ;
DarlingShe = {s = "darling" ; n = sg ; x = fem} ;
NameHe s = {s = s.s ; n = sg ; x = masc} ;
NameShe s = {s = s.s ; n = sg ; x = fem} ;
Honour = {s =
table {dna => table {xa => table {nr => table {xr =>
let {na = dep2num dna nr} in
ego ! na ! nom ++ ["have the honour to inform you that"]}}}}
} ;
Regret = {s =
table {dna => table {xa => table {nr => table {xr =>
let {na = dep2num dna nr} in
ego ! na ! nom ++ am ! na ++ ["sorry to inform you that"]}}}}
} ;
President = constNX ["the President"] sg masc ;
Mother = constNX "Mom" sg fem ;
Spouse = {s = table {
sg => table {fem => ["your husband"] ; masc => ["your wife"]} ;
pl => table {fem => ["your husbands"] ; masc => ["your wives"]}
} ; n = depnum ; x = masc} ; -- sex does not matter here
Dean = constNX ["the Dean"] sg masc ;
Name s = constNX s.s sg masc ; ---
BePromoted pos = {s =
table {na => table {xa => table {nr => table {xr =>
["you have been promoted to"] ++
pos.s ! nr ! xr}}}}
} ;
GoBankrupt np = {s =
table {na => table {xa => table {nr => table {xr =>
np.s ++ have ! np.n ++ ["gone bankrupt"]}}}}
} ;
ILoveYou = {s =
table {na => table {xa => table {nr => table {xr =>
ego ! dep2num na nr ! nom ++ ["love you"]}}}}
} ;
Company = {s = ["our company"] ; n = sg} ;
Competitor = {s = ["our worst competitor"] ; n = sg} ;
OurCustomers = {s = ["our customers"] ; n = pl} ;
Senior = {s =
table {
sg => table {x => ["a senior fellow"]} ;
pl => table {x => ["senior fellows"]}
}} ;
ProjectManager = {s =
table {
sg => table {_ => ["a project manager"]} ;
pl => table {_ => ["project managers"]}
}} ;
oper
kollega :
Num => Str =
table {sg => "colleague" ; pl => "colleagues"} ;
am :
Num => Str =
table {sg => "am" ; pl => "are"} ;
have :
Num => Str =
table {sg => "has" ; pl => "have"} ;
ego :
Num => Kas => Str =
table {
sg => table {nom => "I" ; acc => "me"} ;
pl => table {nom => "we" ; acc => "us"}
} ;
-- added by John 2013-01-11 for testing syntax editor
printname cat Recipient = "Someone who receives a letter";
printname fun HelloRec = "Saying hello to a recipient";
}

View File

@@ -1,181 +0,0 @@
concrete LetterFin of Letter = {
--1 A Finnish Concrete Syntax for Business and Love Letters
--
-- This file defines the Finnish syntax of the grammar set
-- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; coding=utf8;
-- modified from French in 20 min, 15/6/2002
param Gen = masc | fem ;
param Num = sg | pl ;
param Kas = nom | acc ;
param DepNum = depnum | cnum Num ;
param DepGen = depgen | cgen Gen ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Gen => Str} ; -- needs Num and Gen
oper SSSrc = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper SSSrc2 = {s : Num => Gen => Str ; n : DepNum ; g : DepGen} ; -- gives&needs
oper SSDep2 = {s : DepNum => DepGen => Num => Gen => Str} ; -- needs Auth's&Rec's
oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper
ss : Str -> SS = \s -> {s = s} ;
noDep : (P : Type) -> Str -> P => Str = \_,s -> table {_ => s} ;
cher : Num => Gen => Tok =
table {sg => noDep Gen "rakas" ; pl => noDep Gen "rakkaat"} ;
egosum : Num => Str =
table {sg => "olen" ; pl => "olemme"} ;
egohabeo : Num => Str =
table {sg => "minulla" ++ "on" ; pl => "meillä" ++ "on"} ;
fuisti : Num => Str =
table {sg => "sinut" ++ "on"; pl => "teidät" ++ "on"} ;
quePrep = "että" ; ----
tuinformare : Num => Str =
table {sg => "ilmoittaa" ++ "sinulle" ; pl => "ilmoittaa" ++ "teille"} ;
regNom : Str -> Num => Str = \pora -> table {sg => pora ; pl => pora + "t"} ;
avoir : Num => Str =
table {sg => "on"; pl => "ovat"} ;
mes : Num => Str = table {sg => "minun" ; pl => "meidän"} ;
teamo : Num => Num => Str = table {
sg => table {sg => "rakastan" ++ "sinua" ;
pl => "rakastan" ++ "teitä"} ;
pl => table {sg => "rakastamme" ++ "sinua" ;
pl => "rakastamme" ++ "teitä"}
} ;
constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen ->
{s = table {_ => table {_ => str}} ; n = cnum num ; g = cgen gen} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum cn => cn
} ;
dep2gen : DepGen -> Gen -> Gen = \dg,g -> case dg of {
depgen => case g of {
masc => fem ;
fem => masc
}; -- negative dependence: the author is of opposite sex
cgen cg => cg
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcGen ;
Position = SSDep ;
lin
MkLetter head mess end =
ss (head.s ++ "," ++ RET ++
mess.s ! end.n ! end.g ! head.n ! head.g ++ "." ++ RET ++
end.s ! head.n ! head.g) ;
DearRec rec = {s = cher ! rec.n ! rec.g ++ rec.s ; n = rec.n ; g = rec.g} ;
PlainRec rec = rec ;
HelloRec rec = {s = "Terve" ++ rec.s ; n = rec.n ; g = rec.g} ;
JustHello rec = {s = "Terve" ; n = rec.n ; g = rec.g} ;
ModeSent mode sent =
{s =
table {na => table {xa => table {nr => table {xr =>
mode.s ! na ! xa ! nr ! xr ++ sent.s ! na ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s = table {n => table {g => ["parhain terveisin"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
InformalEnding auth =
{s = table {n => table {g => ["terveisin"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
ColleaguesHe = {s = regNom "kollega" ! pl ; n = pl ; g = masc} ;
ColleaguesShe = {s = regNom "kollega" ! pl ; n = pl ; g = fem} ;
ColleagueHe = {s = regNom "kollega" ! sg ; n = sg ; g = masc} ;
ColleagueShe = {s = regNom "kollega" ! sg ; n = sg ; g = fem} ;
DarlingHe = {s = "kulta" ; n = sg ; g = masc} ;
DarlingShe = {s = "kulta" ; n = sg ; g = fem} ;
NameHe s = {s = s.s ; n = sg ; g = masc} ;
NameShe s = {s = s.s ; n = sg ; g = fem} ;
Honour = {s =
table {na => table {xa => table {nr => table {xr =>
egohabeo ! dep2num na nr ++
["kunnia"] ++ tuinformare ! nr ++ quePrep}}}}
} ;
Regret = {s =
table {na => table {ga => table {nr => table {gr =>
mes ! dep2num na nr ++
["on valitettavasti ilmoitettava"] ++ quePrep}}}}
} ;
President = constNG ["presidentti"] sg masc ;
Mother = constNG ["äiti"] sg fem ;
Spouse = {s = table {
sg => table {fem => ["miehesi"] ; masc => ["vaimosi"]} ;
pl => table {fem => ["miehenne"] ; masc => ["vaimonne"]}
} ; n = depnum ; g = depgen} ;
Dean = constNG ["dekaani"] sg masc ;
Name s = constNG s.s sg masc ; ---
BePromoted pos = {s =
table {na => table {xa => table {nr => table {xr =>
fuisti ! nr ++ "ylennetty" ++
pos.s ! nr ! xr}}}}
} ;
GoBankrupt np = {s =
table {na =>
table {xa =>
table {nr =>
table {xr =>
np.s ++ avoir ! np.n ++
(case np.n of {sg => "mennyt" ; pl => "menneet"}) ++
"konkurssiin"
}
}
}
}
} ;
ILoveYou = {s =
table {na => table {xa => table {nr => table {xr =>
teamo ! dep2num na nr ! nr}}}}} ;
Company = {s = ["yrityksemme"] ; n = sg ; g = fem} ;
Competitor = {s = ["pahin kilpailijamme"] ; n = sg ; g = masc} ;
OurCustomers = {s = ["asiakkaamme"] ; n = pl ; g = masc} ;
Senior = {s = table {sg => table {g => ["vanhemmaksi tutkijaksi"]} ;
pl => table {g => ["vanhemmiksi tutkijoiksi"]}
}
} ;
ProjectManager = {s =
table {
sg => table {_ => ["projektipäälliköksi"]} ;
pl => table {_ => ["projektipäälliköiksi"]}
}} ;
}

View File

@@ -1,171 +0,0 @@
concrete LetterFre of Letter = {
--1 An French Concrete Syntax for Business and Love Letters
--
-- This file defines the French syntax of the grammar set
-- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; coding=utf8;
param Gen = masc | fem ;
param Num = sg | pl ;
param Kas = nom | acc ;
param DepNum = depnum | cnum Num ;
param DepGen = depgen | cgen Gen ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Gen => Str} ; -- needs Num and Gen
oper SSSrc = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper SSSrc2 = {s : Num => Gen => Str ; n : DepNum ; g : DepGen} ; -- gives&needs
oper SSDep2 = {s : DepNum => DepGen => Num => Gen => Str} ; -- needs Auth's&Rec's
oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper
ss : Str -> SS = \s -> {s = s} ;
cher : Num => Gen => Tok =
table {n => table {masc => regNom "cher" ! n ; fem => regNom "chère" ! n}};
regAdj : Str -> Gen => Num => Str = \s ->
table {masc => regNom s ; fem => regNom (s + "e")} ;
regNom : Str -> Num => Str = \s -> table {sg => s ; pl => s + "s"} ;
egosum : Num => Str =
table {sg => "je" ++ "suis" ; pl => "nous" ++ "sommes"} ;
egohabeo : Num => Str =
table {sg => "j'ai" ; pl => "nous" ++ "avons"} ;
fuisti : Num => Str =
table {sg => "tu" ++ "as" ++ "été"; pl => "vous" ++ "avez" ++ "été"} ;
quePrep = "que" ; ----
tuinformare : Num => Str =
table {sg => "t'informer"; pl => "vous" ++ "informer"} ;
avoir : Num => Str =
table {sg => "a"; pl => "ont"} ;
mes : Num => Str = table {sg => "mes" ; pl => "nos"} ;
teamo : Num => Num => Str = table {
sg => table {sg => "je" ++ "t'aime" ;
pl => "je" ++ "vous" ++ "aime"} ;
pl => table {sg => "nous" ++ "t'aimons" ;
pl => "nous" ++ "vous" ++ "aimons"}
} ;
constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen ->
{s = table {_ => table {_ => str}} ; n = cnum num ; g = cgen gen} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum sg => sg ;
cnum pl => pl
} ;
dep2gen : DepGen -> Gen -> Gen = \dg,g -> case dg of {
depgen => case g of {
masc => fem ;
fem => masc
}; -- negative dependence: the author is of opposite sex
cgen cg => cg
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcGen ;
Position = SSDep ;
lin
MkLetter head mess end =
ss (head.s ++ "," ++ RET ++
mess.s ! end.n ! end.g ! head.n ! head.g ++ "." ++ RET ++
end.s ! head.n ! head.g) ;
DearRec rec = {s = cher ! rec.n ! rec.g ++ rec.s ; n = rec.n ; g = rec.g} ;
PlainRec rec = rec ;
HelloRec rec = {s = "Bonjour" ++ rec.s ; n = rec.n ; g = rec.g} ;
JustHello rec = {s = "Bonjour" ; n = rec.n ; g = rec.g} ;
ModeSent mode sent =
{s =
table {na => table {xa => table {nr => table {xr =>
mode.s ! na ! xa ! nr ! xr ++ sent.s ! na ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s =
table {n => table {g =>
"avec" ++ mes ! dep2num auth.n n ++
["salutations distinguées"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
InformalEnding auth =
{s = table {n => table {g => ["Amicalement"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
ColleaguesHe = {s = regNom "collègue" ! pl ; n = pl ; g = masc} ;
ColleaguesShe = {s = regNom "collègue" ! pl ; n = pl ; g = fem} ;
ColleagueHe = {s = regNom "collègue" ! sg ; n = sg ; g = masc} ;
ColleagueShe = {s = regNom "collègue" ! sg ; n = sg ; g = fem} ;
DarlingHe = {s = "chéri" ; n = sg ; g = masc} ;
DarlingShe = {s = "chérie" ; n = sg ; g = fem} ;
NameHe s = {s = s.s ; n = sg ; g = masc} ;
NameShe s = {s = s.s ; n = sg ; g = fem} ;
Honour = {s =
table {na => table {xa => table {nr => table {xr =>
egohabeo ! dep2num na nr ++
["l'honneur de"] ++ tuinformare ! nr ++ quePrep}}}}
} ;
Regret = {s =
table {na => table {ga => table {nr => table {gr =>
let {dga = dep2gen ga gr ; dna = dep2num na nr} in
egosum ! dna ++ regAdj "désolé" ! dga ! dna ++
["d'informer"] ++ quePrep}}}}
} ;
President = constNG ["le président"] sg masc ;
Mother = constNG ["maman"] sg fem ;
Spouse = {s = table {
sg => table {fem => ["ton mari"] ; masc => ["ta femme"]} ;
pl => table {fem => ["vos maris"] ; masc => ["vos femmes"]}
} ; n = depnum ; g = depgen} ;
Dean = constNG ["le doyen"] sg masc ;
Name s = constNG s.s sg masc ; ---
BePromoted pos = {s =
table {na => table {xa => table {nr => table {xr =>
fuisti ! nr ++ regAdj "promu" ! xr ! nr ++
pos.s ! nr ! xr}}}}
} ;
GoBankrupt np = {s =
table {na => table {xa => table {nr => table {xr =>
np.s ++ avoir ! np.n ++ ["fait banqueroute"]}}}}
} ;
ILoveYou = {s =
table {na => table {xa => table {nr => table {xr =>
teamo ! dep2num na nr ! nr}}}}
} ;
Company = {s = ["notre entreprise"] ; n = sg ; g = fem} ;
Competitor = {s = ["notre pire compétiteur"] ; n = sg ; g = masc} ;
OurCustomers = {s = ["nos clients"] ; n = pl ; g = masc} ;
Senior = {s = table {sg => table {g => ["responsable scientifique"]} ;
pl => table {g => ["responsables scientifiques"]}
}
} ;
ProjectManager = {s =
table {
sg => table {_ => ["chef de projet"]} ;
pl => table {_ => ["chefs de projets"]}
}} ;
}

View File

@@ -1,216 +0,0 @@
concrete LetterHeb of Letter = {
-- (c) Alex Kutsela 2005
flags lexer=textlit ; unlexer=textlit ; coding=utf8 ;
param Gen = masc | fem ;
param Num = sg | pl ;
param Kas = nom | dat | acc ;
param DepNum = depnum | cnum Num ;
param DepGen = depgen | cgen Gen ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Gen => Str} ; -- needs Num and Gen
oper SSSrc = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper SSSrc2 = {s : Num => Gen => Str ; n : DepNum ; g : DepGen} ; -- gives&needs
oper SSDep2 = {s : DepNum => DepGen => Num => Gen => Str} ; -- needs Auth's&Rec's
oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper
ss : Str -> SS = \s -> {s = s} ;
regAdj : Str -> Num => Gen => Tok =\s -> table {
sg => table {masc => s; fem => s+"ה"};
pl => table {masc => s+"ים"; fem => s+"ות"}
};
hello : Str -> Num => Str = \s -> table {sg => s ; pl => s} ;
regVerPerf : Str -> Num => Gen => Str = \s ->
table {sg => table {masc => s; fem => s+"ה"};
pl => table {masc => s+"ו"; fem => s+"ו"}
};
ego : Num => Str = table {sg => "אןי" ; pl => "אןחןו" } ;
tu : Num => Gen => Kas => Str =
table {sg => table {fem => table {nom => "את"; dat => "לך"; acc => "אותך"} ;
masc => table {nom => "אתה"; dat => "לך"; acc => "אותך"}
} ;
pl => table {fem => table {nom => "אתן"; dat => "לכן"; acc => "אתכן"} ;
masc => table {nom => "אתם"; dat => "לכם"; acc => "אתכם"}
}
};
hereIam : Num => Str =
table {sg => "הןןי" ; pl => "הןןו" } ;
haveBeen : Str -> Num => Gen => Str = \s ->
table {sg => table {masc => s+"ת"; fem => s+"ת"};
pl => table {masc => s+"תם"; fem => s+"תן"}
};
thatConj = ["ש"] ;
regVer : Str -> Num => Gen => Str = \s ->
table {sg => table {masc => s; fem => s+"ת"};
pl => table {masc => s+"ים"; fem => s+"ות"}
};
constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen ->
{s = table {_ => table {_ => str}} ; n = cnum num ; g = cgen gen} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum cn => cn
} ;
dep2gen : DepGen -> Gen -> Gen = \dg,g -> case dg of {
depgen => case g of {
masc => fem ;
fem => masc
}; -- negative dependence: the author is of opposite sex
cgen cg => cg
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcGen ;
Position = SSDep ;
lin
MkLetter head mess end =
ss ("," ++ head.s ++ RET ++
mess.s ! end.n ! end.g ! head.n ! head.g ++ RET ++
end.s ! head.n ! head.g) ;
DearRec rec = {s = rec.s ++ regAdj "יקר" ! rec.n ! rec.g;
n = rec.n;
g = rec.g};
PlainRec rec = rec ;
HelloRec rec = {s = hello "שלום" ! rec.n ++ rec.s ; n = rec.n ; g = rec.g} ;
JustHello rec = {s = hello "שלום" ! rec.n ; n = rec.n ; g = rec.g} ;
ModeSent mode sent =
{s =
table {na => table {xa => table {nr => table {xr =>
mode.s ! na ! xa ! nr ! xr ++ sent.s ! na ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s =
table {n => table {g =>
[", בכבוד רב"] ++ RET ++
auth.s ! n ! g
}} ;
n = auth.n ; g = auth.g} ;
InformalEnding auth =
{s = table {n => table {g => [", בברכה"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
ColleagueHe = {s = "עמית" ; n = sg ; g = masc} ;
ColleagueShe = {s = "עמיתה" ; n = sg ; g = fem} ;
ColleaguesHe = {s = "עמיתים" ; n = pl ; g = masc} ;
ColleaguesShe = {s = "עמיתות" ; n = pl ; g = fem} ;
DarlingHe = {s = "אהובי" ; n = sg ; g = masc} ;
DarlingShe = {s = "אהובתי" ; n = sg ; g = fem} ;
NameHe s = {s = s.s ; n = sg ; g = masc} ;
NameShe s = {s = s.s ; n = sg ; g = fem} ;
Honour = {s = table {
na => table {
xa => table {
nr => table {
xr => hereIam ! dep2num na nr ++
regVer "מתכבד" ! dep2num na nr ! dep2gen xa xr ++
["להודיע"] ++ tu ! nr ! xr ! dat ++ thatConj
}
}
}
}
} ;
Regret = {s = table {
na => table {
ga => table {
nr => table {
gr => let {dga = dep2gen ga gr ; dna = dep2num na nr} in
ego ! dna ++ regVer "מצטער" ! dna ! dga ++
["להודיע"] ++ tu ! nr ! gr ! dat ++ thatConj
}
}
}
}
} ;
Dean = constNG ["דיקן"] sg masc ;
President = constNG ["ןשיא"] sg masc ;
Mother = constNG ["אמא"] sg fem ;
Name s = constNG s.s sg masc ; ---
Spouse = {s = table {
sg => table {fem => ["בעלך"] ; masc => ["אישתך"]} ;
pl => table {fem => ["בעליכן"] ; masc => ["ןשותיכם"]}
} ; n = depnum ; g = depgen} ;
BePromoted pos = {s = table {
na => table {
xa => table {
nr => table {
xr => haveBeen "קודמ" ! nr !xr ++ "לתפקיד" ++ "של" ++ pos.s ! nr ! xr
}
}
}
}
} ;
GoBankrupt np =
{s = table
{na => table
{xa => table
{nr => table
{xr => np.s ++ regVerPerf "פשט" ! np.n ! np.g ++ "רגל"}
}
}
}
} ;
ILoveYou = {s = table
{na => table
{ga => table
{nr => table
{gr => let {dga = dep2gen ga gr ; dna = dep2num na nr} in
ego ! dna ++ regVer "אוהב" ! dna ! dga ++
tu ! nr ! gr ! acc}
}
}
}
} ;
Company = {s = ["חברתןו"] ; n = sg ; g = fem} ;
Competitor = {s = ["המתחרה הגרוע ביותר שלןו"] ; n = sg ; g = masc} ;
OurCustomers = {s = ["לקוחותיןו"] ; n = pl ; g = masc} ;
Senior = {s = table
{sg => table {g => ["חבר בכיר"]} ;
pl => table {g => ["חברים בכירים"]}
}
} ;
ProjectManager = {s = table {
sg => table {fem => ["מןהלת פרוייקט"]; masc => ["מןהל פרוייקט"]} ;
pl => table {fem => ["מןהלות פרוייקט"]; mask =>["מןהלי פרוייקט"]}
}
} ;
}

View File

@@ -1,178 +0,0 @@
concrete LetterRus of Letter = {
flags lexer=textlit ; unlexer=textlit ; coding=utf8 ;
param Gen = masc | fem ;
param Num = sg | pl ;
param Kas = nom | acc ;
param DepNum = depnum | cnum Num ;
param DepGen = depgen | cgen Gen ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Gen => Str} ; -- needs Num and Gen
oper SSSrc = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper SSSrc2 = {s : Num => Gen => Str ; n : DepNum ; g : DepGen} ; -- gives&needs
oper SSDep2 = {s : DepNum => DepGen => Num => Gen => Str} ; -- needs Auth's&Rec's
oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper
ss : Str -> SS = \s -> {s = s} ;
regAdj : Str -> Num => Gen => Tok =\s -> table {
sg => table {masc => s+"ой"; fem => s+"ая"};
pl => table {masc => s+"ие"; fem => s+"ие"}
};
regVer : Str -> Num => Gen => Str = \s -> table {
sg => table {masc => s; fem => s+"а"};
pl => table {masc => s+"ы"; fem => s+"ы"}
};
hello : Str -> Num => Str = \s ->
table {sg => s ; pl => s+"те" } ;
regVerPerf : Str -> Num => Gen => Str = \s -> table {
sg => table {masc => s+"ся"; fem => s+"ось"};
pl => table {masc => s+"ись"; fem => s+"ись"}
};
ego : Num => Str =
table {sg => "я" ; pl => "вы" } ;
egoHave : Num => Str =
table {sg => ["я имею"] ; pl => ["мы имеем"]} ;
haveBeen : Num => Gen => Str = table {
sg => table {masc => ["ты был"] ; fem => ["ты была"] };
pl => table {masc => ["вы были"]; fem => ["вы были"]}
};
thatPrep = [", что"] ;
informYou : Num => Str =
table {sg => ["сообщить тебе"]; pl => ["сообщить вам"]} ;
loveYou : Num => Num => Str = table {
sg => table {sg => ["я тебя люблю"] ;
pl => ["я вас люблю"]} ;
pl => table {sg => ["мы тебя любим"] ;
pl => ["мы вас любим"]}
} ;
constNG : Str -> Num -> Gen -> SSSrc2 = \str,num,gen ->
{s = table {_ => table {_ => str}} ; n = cnum num ; g = cgen gen} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum cn => cn
} ;
dep2gen : DepGen -> Gen -> Gen = \dg,g -> case dg of {
depgen => case g of {
masc => fem ;
fem => masc
}; -- negative dependence: the author is of opposite sex
cgen cg => cg
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcGen ;
Position = SSDep ;
lin
MkLetter head mess end =
ss (head.s ++ "," ++ RET ++
mess.s ! end.n ! end.g ! head.n ! head.g ++ "." ++ RET ++
end.s ! head.n ! head.g) ;
DearRec rec = {s = regAdj "Дорог"
! rec.n ! rec.g ++ rec.s ; n = rec.n ; g = rec.g} ;
PlainRec rec = rec ;
HelloRec rec = {s = hello "Здравствуй" ! rec.n ++ rec.s ; n = rec.n ; g = rec.g} ;
JustHello rec = {s = hello "Здравствуй" ! rec.n ; n = rec.n ; g = rec.g} ;
ModeSent mode sent =
{s =
table {na => table {xa => table {nr => table {xr =>
mode.s ! na ! xa ! nr ! xr ++ sent.s ! na ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s =
table {n => table {g =>
"С" ++
["наилучшими пожеланиями ,"] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
InformalEnding auth =
{s = table {n => table {g => ["С дружеским приветом , "] ++ RET ++ auth.s ! n ! g}} ;
n = auth.n ; g = auth.g} ;
ColleaguesHe = {s = "коллеги" ; n = pl ; g = masc} ;
ColleaguesShe = {s = "коллеги" ; n = pl ; g = fem} ;
ColleagueHe = {s = "коллега" ; n = sg ; g = masc} ;
ColleagueShe = {s = "коллега" ; n = sg ; g = fem} ;
DarlingHe = {s = "любимый" ; n = sg ; g = masc} ;
DarlingShe = {s = "любимая" ; n = sg ; g = fem} ;
NameHe s = {s = s.s ; n = sg ; g = masc} ;
NameShe s = {s = s.s ; n = sg ; g = fem} ;
Honour = {s =
table {na => table {xa => table {nr => table {xr =>
egoHave ! dep2num na nr ++
["честь"] ++ informYou ! nr ++ thatPrep}}}}
} ;
Regret = {s =
table {na => table {ga => table {nr => table {gr =>
let {dga = dep2gen ga gr ; dna = dep2num na nr} in
ego ! dna ++ regVer "вынужден" ! dna ! dga ++
["сообщить"] ++ thatPrep}}}}
} ;
President = constNG ["президент"] sg masc ;
Mother = constNG ["мама"] sg fem ;
Spouse = {s = table {
sg => table {fem => ["твой муж"] ; masc => ["твоя жена"]} ;
pl => table {fem => ["ваши мужья"] ; masc => ["ваши жены"]}
} ; n = depnum ; g = depgen} ;
Dean = constNG ["декан"] sg masc ;
Name s = constNG s.s sg masc ; ---
BePromoted pos = {s =
table {na => table {xa => table {nr => table {xr =>
haveBeen ! nr ! xr ++ regVer "назначен" ! nr ! xr ++
pos.s ! nr ! xr}}}}
} ;
GoBankrupt np = {s =
table {na => table {xa => table {nr => table {xr =>
np.s ++ regVerPerf "обанкротил" ! np.n ! np.g }}}}
} ;
ILoveYou = {s =
table {na => table {xa => table {nr => table {xr =>
loveYou ! dep2num na nr ! nr}}}}
} ;
Company = {s = ["наше предприятие"] ; n = sg ; g = fem} ;
Competitor = {s = ["наш конкурент"] ; n = sg ; g = masc} ;
OurCustomers = {s = ["наши клиенты"] ; n = pl ; g = masc} ;
Senior = {s = table {sg => table {g => ["старшим научным сотрудником"]} ;
pl => table {g =>[ "старшими научными сотрудниками"]}
}
} ;
ProjectManager = {s =
table {
sg => table {_ => ["менеджером проекта"]} ;
pl => table {_ => ["менеджерами проектов"]}
}} ;
}

View File

@@ -1,164 +0,0 @@
concrete LetterSwe of Letter = {
--1 An Swedish Concrete Syntax for Business and Love Letters
--
-- This file defines the Swedish syntax of the grammar set
-- whose abstract syntax is $letter.Abs.gf$.
flags lexer=textlit ; unlexer=textlit ; coding=utf8;
printname cat Letter = "Brev" ;
printname fun MkLetter = "brevmall" ;
param Sex = masc | fem ;
param Gen = en | ett ;
param Num = sg | pl ;
param Kas = nom | acc ;
param DepNum = depnum | cnum Num ;
oper SS = {s : Str} ;
oper SSDep = {s : Num => Sex => Str} ; -- needs Num and Sex
oper SSSrc = {s : Str ; n : Num ; x : Sex} ; -- gives Num and Sex
oper SSSrc2 = {s : Num => Sex => Str ; n : DepNum ; x : Sex} ; -- gives and needs
oper SSDep2 = {s : DepNum => Sex => Num => Sex => Str} ; -- needs Auth's & Recp's
oper SSSrcGen = {s : Str ; n : Num ; g : Gen} ; -- gives Num and Gen
oper
ss : Str -> SS = \s -> {s = s} ;
constNX : Str -> Num -> Sex -> SSSrc2 = \str,num,sex ->
{s = table {_ => table {_ => str}} ; n = cnum num ; x = sex} ;
dep2num : DepNum -> Num -> Num = \dn,n -> case dn of {
depnum => n ;
cnum cn => cn
} ;
RET = "" ; -- &-
lincat
Letter = SS ;
Recipient = SSSrc ;
Author = SSSrc2 ;
Message = SSDep2 ;
Heading = SSSrc ;
Ending = SSSrc2 ;
Mode = SSDep2 ;
Sentence = SSDep2 ;
NounPhrase = SSSrcGen ;
Position = SSDep ;
lin
MkLetter head mess end =
ss (head.s ++ "," ++ RET ++
mess.s ! end.n ! end.x ! head.n ! head.x ++ "." ++ RET ++
end.s ! head.n ! head.x) ;
DearRec rec = {s = kaer ! rec.n ! rec.x ++ rec.s ; n = rec.n ; x = rec.x} ;
PlainRec rec = rec ;
HelloRec rec = {s = "Hej" ++ rec.s ; n = rec.n ; x = rec.x} ;
JustHello rec = {s = "Hej" ; n = rec.n ; x = rec.x} ;
ModeSent mode sent =
{s =
table {na => table {xa => table {nr => table {xr =>
mode.s ! na ! xa ! nr ! xr ++ sent.s ! na ! xa ! nr ! xr}}}}
} ;
PlainSent sent = sent ;
FormalEnding auth =
{s = table {n => table {x =>
["Med vänlig hälsning"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
InformalEnding auth =
{s = table {n => table {x =>
["Med hälsningar"] ++ RET ++ auth.s ! n ! x}} ; n = auth.n ; x = auth.x} ;
ColleaguesHe = {s = kollega ! pl ; n = pl ; x = masc} ;
ColleaguesShe = {s = kollega ! pl ; n = pl ; x = fem} ;
ColleagueHe = {s = kollega ! sg ; n = sg ; x = masc} ;
ColleagueShe = {s = kollega ! sg ; n = sg ; x = fem} ;
DarlingHe = {s = "älskling" ; n = sg ; x = masc} ;
DarlingShe = {s = "älskling" ; n = sg ; x = fem} ;
NameHe s = {s = s.s ; n = sg ; x = masc} ;
NameShe s = {s = s.s ; n = sg ; x = fem} ;
Honour = {s =
table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["har äran att meddela"] ++
du ! nr ! acc ++ "att"}}}}
} ;
Regret = {s =
table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["måste tyvärr meddela"] ++
du ! nr ! acc ++ "att"}}}}
} ;
President = constNX ["Presidenten"] sg masc ;
Mother = constNX ["Mamma"] sg fem ;
Spouse = {s = table {
sg => table {fem => ["din man"] ; masc => ["din hustru"]} ;
pl => table {fem => ["era män"] ; masc => ["era hustrur"]}
} ; n = depnum ; x = masc} ; -- sex does not matter here
Dean = constNX ["Dekanus"] sg masc ;
Name s = constNX s.s sg masc ; ---
BePromoted pos = {s =
table {na => table {xa => table {nr => table {xr =>
du ! nr ! nom ++ ["har blivit"] ++ befordrad ! nr ++
"till" ++ pos.s ! nr ! xr}}}}
} ;
GoBankrupt np = {s =
table {na => table {xa => table {nr => table {xr =>
np.s ++ ["har gått i konkurs"]}}}}
} ;
ILoveYou = {s =
table {na => table {xa => table {nr => table {xr =>
jag ! dep2num na nr ! nom ++ ["älskar"] ++ du ! nr ! acc}}}}
} ;
Company = {s = ["vårt företag"] ; n = sg ; g = ett} ;
Competitor = {s = ["vår värsta konkurrent"] ; n = sg ; g = en} ;
OurCustomers = {s = ["våra kunder"] ; n = pl ; g = en} ;
Senior = {s = table {n => table {x => ["äldre forskare"]}}} ;
ProjectManager = {s =
table {
sg => table {_ => "projektchef"} ;
pl => table {_ => "projektchefer"}
}} ;
oper
kaer :
Num => Sex => Str =
table {
sg => table {masc => "Käre" ; fem => "Kära"} ;
pl => table {_ => "Kära"}
} ;
kollega :
Num => Str =
table {sg => "kollega" ; pl => "kollegor"} ;
befordrad :
Num => Str =
table {sg => "befordrad" ; pl => "befordrade"} ;
jag :
Num => Kas => Str =
table {
sg => table {nom => "jag" ; acc => "mig"} ;
pl => table {nom => "vi" ; acc => "oss"}
} ;
du :
Num => Kas => Str =
table {
sg => table {nom => "du" ; acc => "dig"} ;
pl => table {nom => "ni" ; acc => "er"}
} ;
}

View File

@@ -1,35 +0,0 @@
GF challenges Microsoft Works! Here you find templates for
multilingual authoring of business and love letters!
Another point of these grammars is to illustrate how
local updates are propagated everywhere in the document.
Form, in the editor
Dear Colleague,
I love you.
With best regards,
your wife
and change between ColleagueHe, ColleagueShe, ColleaguesHe, ColleaguesShe.
The grammars are somewhat ad hoc and messy, and could be improved
with better abstractions.
(AR 2001)
To use the grammars in an editor, first compile them to javascript:
gfc --make --output-format=js Letter???.gf
Then open the file ./editor/editor.html in a web browser. You also need the javascript
libraries from
GF/lib/javascript/
Copyright (c) 2001-2008 Janna Khegai, Alex Kutsela, Aarne Ranta
under GNU General Public License (GPL).
Document last updated December 4, 2008, by Aarne Ranta.

View File

@@ -1,17 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="gflib.js"></script>
<script type="text/javascript" src="editorGrammar.js"></script>
<script type="text/javascript" src="grammar.js"></script>
<script type="text/javascript" src="gfjseditor.js"></script>
<title>Web-based Syntax Editor</title>
</head>
<body onload="mkEditor('editor',Letter)" onkeydown="hotKeys(event)">
<div id="editor">
</div>
</body>
</html>

View File

@@ -1,65 +0,0 @@
module Main where
import Control.Monad
import Data.Maybe
import Data.Char
import System.Cmd
import System.Directory
import System.Environment
import System.Exit
-- To clone a project from one language to another:
--
-- 1. for each Module in 'modules', copy ModuleFROM to ModuleTO
-- 2. in each ModuleTO, replace substrings FROM by TO, if not prefixes of an Ident
-- 3. in each ModuleTO in 'specifics', comment out every line in the body, except
-- those whose first word is in 'commons'.
--
-- Syntax: runghc Clone FROM TO
-- Example: runhugs Clone Swe Nor
-- The following lines are for the phrasebook project, and can be changed
-- to fit other projects.
modules = "Phrasebook":"Sentences":specifics
specifics = ["Words","Greetings"]
commons = ["Apple","Beer","Bread","Fish","Milk","Salt","Water","Wine",
"Bad","Cold","Good","Warm","AHasChildren"]
main = do
from:to:_ <- getArgs
mapM_ (clone from to) modules
clone from to pref = do
s <- readFile (pref ++ from ++ ".gf")
writeFile (pref ++ to ++ ".gf") (commentIf (isSpecific pref) (replaceLang from to s))
isSpecific = flip elem specifics
replaceLang s1 s2 = repl where
repl s = case s of
c:cs -> case splitAt lgs s of
(pre,c:rest) | pre == s1 && elem c " \n\t,:=(){}.-[];" -> s2 ++ [c] ++ repl rest
_ -> c : repl cs
_ -> s
lgs = 3 -- length s1
-- the file name has the form p....pLLL.gf, i.e. 3-letter lang name, suffix .gf
getLangName fi =
let (nal,ferp) = splitAt 3 (drop 3 (reverse fi)) in
(reverse ferp,reverse nal)
commentIf c = if c then (unlines . commentBody . lines) else id
commentBody ss = header ++ map comment body ++ ["}"] where
(header,body) = break (isJment . words) ss
isJment ws = case ws of
k:_ | elem k ["flags","lin","lincat","oper","param"] -> True
_ -> False
comment l = case l of
_ | take 2 l == "--" -> l -- already commented
_ | all isSpace l -> l -- empty line
_ | elem (head (words l)) commons -> l -- in 'commons'
_ -> "--" ++ l

View File

@@ -1,47 +0,0 @@
import Data.List(partition)
import Control.Monad(when)
import System.Cmd(system)
import System.Environment(getArgs)
-- (c) Aarne Ranta 2010 under GNU LGPL
-- Compile files into pgf, in chosen combinations.
-- Usage: runghc Compile (-make | -link)? Eng Fre Fin ...
-- The -make option links all pgf files to one in the end
-- The -link option only links, without first compiling
-- Arguments whose length are 3 characters are prefixed with mainmodu.
-- Other arguments are passed literally.
-- Thus, for instance, to produce an English-Swedish-Romanian phrasebook with English
-- disambiguation, the command is
--
-- runghc Compile -link Eng Swe Ron DisambPhrasebookEng
-- change this to apply to another project; alternatively, just use full file names
mainmodu = "Phrasebook"
main = do
(opts,langs) <- partition ((=='-') . head) `fmap` getArgs
let modus = [mkFile la | la <- langs]
let opt = elem "-opt" opts
putStrLn $ unwords modus
when (notElem "-link" opts) $ mapM_ (compileOne opt) modus
case opts of
_ | elem "-make" opts || elem "-link" opts -> do
let comm = "gf -make -s " ++ unwords (map (++ ".pgf") modus)
putStrLn comm
system comm
return ()
_ -> return ()
compileOne opt modu = do
let optim = if opt then " -optimize-pgf" else ""
comm = "gf -make -s" ++ optim ++ " -name=" ++
modu ++ " " ++ modu ++ ".gf" ++
" +RTS -K32M"
putStrLn comm
system comm
mkFile la = if length la == 3 then mainmodu ++ la else la

View File

@@ -1,84 +0,0 @@
--# -path=.:present
concrete DisambPhrasebookEng of Phrasebook = PhrasebookEng -
[
PGreetingMale, PGreetingFemale,
IMale, IFemale,
YouFamMale, YouFamFemale,
YouPolMale, YouPolFemale,
LangNat, -- CitiNat,
GExcuse, GExcusePol,
GSorry, GSorryPol,
GPleaseGive, GPleaseGivePol,
GNiceToMeetYou, -- GNiceToMeetYouPol,
PYes, PYesToNo, ObjMass,
MKnow,
WeMale, WeFemale,
YouPlurFamMale, YouPlurFamFemale,
YouPlurPolMale, YouPlurPolFemale,
TheyMale, TheyFemale,
PImperativeFamPos,
PImperativeFamNeg,
PImperativePolPos,
PImperativePolNeg,
PImperativePlurPos,
PImperativePlurNeg
]
** open SyntaxEng, ParadigmsEng, IrregEng, Prelude in {
lin
PGreetingMale g = mkText (lin Text g) (lin Text (ss "(by male)")) ;
PGreetingFemale g = mkText (lin Text g) (lin Text (ss "(by female)")) ;
IMale = mkP i_Pron "(male)" ;
IFemale = mkP i_Pron "(female)" ;
WeMale = mkP we_Pron "(male)" ;
WeFemale = mkP we_Pron "(female)" ;
YouFamMale = mkP youSg_Pron "(singular,familiar,male)" ;
YouFamFemale = mkP youSg_Pron "(singular,familiar,female)" ;
YouPolMale = mkP youPol_Pron "(singular,polite,male)" ;
YouPolFemale = mkP youPol_Pron "(singular,polite,female)" ;
YouPlurFamMale = mkP youSg_Pron "(plural,familiar,male)" ;
YouPlurFamFemale = mkP youSg_Pron "(plural,familiar,female)" ;
YouPlurPolMale = mkP youPol_Pron "(plural,polite,male)" ;
YouPlurPolFemale = mkP youPol_Pron "(plural,polite,female)" ;
TheyMale = mkP they_Pron "(male)" ;
TheyFemale = mkP they_Pron "(female)" ;
MKnow = mkVV (partV know_V "how") ; ---
LangNat nat = mkNP nat.lang (ParadigmsEng.mkAdv "(language)") ;
-- CitiNat nat = nat.prop ;
GExcuse = fam "excuse me" ;
GExcusePol = pol "excuse me" ;
GSorry = fam "sorry" ;
GSorryPol = pol "sorry" ;
GPleaseGive = fam "please" ;
GPleaseGivePol = pol "please" ;
GNiceToMeetYou = fam "nice to meet you" ;
-- GNiceToMeetYouPol = pol "nice to meet you" ;
PYes = mkPhrase (lin Utt (ss "yes (answer to positive question)")) ;
PYesToNo = mkPhrase (lin Utt (ss "yes (answer to negative question)")) ;
ObjMass x = mkNP (mkNP x) (ParadigmsEng.mkAdv "(a portion of)") ;
PImperativeFamPos v = phrasePlease (mkUtt (mkImp (addAdv ("singular,familiar") v))) ;
PImperativeFamNeg v = phrasePlease (mkUtt negativePol (mkImp (addAdv ("singular,familiar") v))) ;
PImperativePolPos v = phrasePlease (mkUtt politeImpForm (mkImp (addAdv ("singular,polite") v))) ;
PImperativePolNeg v = phrasePlease (mkUtt politeImpForm negativePol (mkImp (addAdv ("singular,polite") v))) ;
PImperativePlurPos v = phrasePlease (mkUtt pluralImpForm (mkImp (addAdv ("plural,familiar") v))) ;
PImperativePlurNeg v = phrasePlease (mkUtt pluralImpForm negativePol (mkImp (addAdv ("plural,familiar") v))) ;
oper
fam : Str -> SS = \s -> postfixSS "(familiar)" (ss s) ;
pol : Str -> SS = \s -> postfixSS "(polite)" (ss s) ;
mkP : Pron -> Str -> {name : NP ; isPron : Bool ; poss : Quant} = \p,s ->
{name = mkNP (mkNP p) (ParadigmsEng.mkAdv s) ;
isPron = False ; -- to show the disambiguation
poss = SyntaxEng.mkQuant youSg_Pron
} ;
addAdv : Str -> VP -> VP = \s,vp -> mkVP vp (ParadigmsEng.mkAdv ("("+s+")")) ;
}

View File

@@ -1,11 +0,0 @@
--# -path=.:present
concrete DisambPhrasebookRon of Phrasebook = PhrasebookRon -
[PSentence, PQuestion, ObjIndef
]
** open SyntaxRon, Prelude in {
lin
PSentence s = mkText s ; -- punctuation not optional
PQuestion s = mkText s ;
ObjIndef k = mkNP someSg_Det k ;
}

View File

@@ -1,28 +0,0 @@
abstract Greetings = Sentences [Greeting] ** {
fun
GBye : Greeting ;
GCheers : Greeting ;
GDamn : Greeting ;
GExcuse, GExcusePol : Greeting ;
GGoodDay : Greeting ;
GGoodEvening : Greeting ;
GGoodMorning : Greeting ;
GGoodNight : Greeting ;
GGoodbye : Greeting ;
GHello : Greeting ;
GHelp : Greeting ;
GHowAreYou : Greeting ;
GLookOut : Greeting ;
GNiceToMeetYou : Greeting ;
GPleaseGive, GPleaseGivePol : Greeting ;
GSeeYouSoon : Greeting ;
GSorry, GSorryPol : Greeting ;
GThanks : Greeting ;
GTheCheck : Greeting ;
GCongratulations : Greeting ;
GHappyBirthday : Greeting ;
GGoodLuck : Greeting ;
GWhatTime : Greeting ;
}

View File

@@ -1,31 +0,0 @@
concrete GreetingsBul of Greetings = SentencesBul [Greeting,mkGreeting] ** open Prelude in {
flags
coding=utf8;
lin
GBye = mkGreeting "чао" ;
GCheers = mkGreeting "наздраве" ;
GDamn = mkGreeting "по дяволите" ;
GExcuse, GExcusePol = mkGreeting "извинете" ;
GGoodDay = mkGreeting "добър ден" ;
GGoodEvening = mkGreeting "добра вечер" ;
GGoodMorning = mkGreeting "добро утро" ;
GGoodNight = mkGreeting "лека нощ" ;
GGoodbye = mkGreeting "довиждане" ;
GHello = mkGreeting "здравей" ;
GHelp = mkGreeting "помощ" ;
GHowAreYou = mkGreeting "как си" ;
GLookOut = mkGreeting "погледни" ;
GNiceToMeetYou = mkGreeting "радвам се да се видим" ;
GPleaseGive, GPleaseGivePol = mkGreeting "моля" ;
GSeeYouSoon = mkGreeting "до скоро" ;
GSorry, GSorryPol = mkGreeting "извинете" ;
GThanks = mkGreeting "благодаря ти" ;
GTheCheck = mkGreeting "сметката" ;
GCongratulations = mkGreeting "поздравления";
GHappyBirthday = mkGreeting "честит рожден ден" ;
GGoodLuck = mkGreeting "успех" ;
GWhatTime = mkGreeting "колко е часът" ;
}

View File

@@ -1,31 +0,0 @@
--# -coding=latin1
concrete GreetingsCat of Greetings = SentencesCat [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "adéu" ;
GCheers = mkGreeting "salut" ;
GDamn = mkGreeting "merda" ;
GExcuse = mkGreeting "perdona" ;
GExcusePol = mkGreeting ("perdoni" | "disculpi") ;
GCongratulations = mkGreeting "felicitats" ;
GHappyBirthday = mkGreeting "feliç aniversari" ;
GGoodLuck = mkGreeting "sort" ;
GGoodDay = mkGreeting "bon dia" ;
GGoodEvening = mkGreeting "bona tarda" ;
GGoodMorning = mkGreeting "bon dia" ;
GGoodNight = mkGreeting "bona nit" ;
GGoodbye = mkGreeting "a reveure" ;
GHello = mkGreeting "hola" ;
GHelp = mkGreeting "socors" ;
GHowAreYou = mkGreeting "què tal" ;
GLookOut = mkGreeting "compte" ;
GNiceToMeetYou = mkGreeting "encantat de conèixer-lo" ; -- make distinction Masc/Fem
GPleaseGive = mkGreeting "si et plau" ;
GPleaseGivePol = mkGreeting "si us plau" ;
GSeeYouSoon = mkGreeting "fins aviat" ;
GSorry = mkGreeting "perdoni" ;
GSorryPol = mkGreeting "em sap greu" ;
GThanks = mkGreeting "gràcies" ;
GTheCheck = mkGreeting "el compte" ;
}

View File

@@ -1,33 +0,0 @@
concrete GreetingsChi of Greetings =
SentencesChi [Greeting,mkGreeting] **
open ParadigmsChi, ResChi, Prelude in {
flags coding = utf8 ;
lin
GBye = (mkInterj "再见" ) ;
GCheers = (mkInterj "干杯" ) ;
GDamn = (mkInterj "该死的" ) ;
GExcuse, GExcusePol = (mkInterj "原谅我" ) ;
GGoodDay = (mkInterj "你好" ) ;
GGoodEvening = (mkInterj "下午好" ) ;
GGoodMorning = (mkInterj "早上好" ) ;
GGoodNight = (mkInterj "晚安" ) ;
GGoodbye = (mkInterj "再见" ) ;
GHello = (mkInterj "你好" ) ;
GHelp = mkInterj "帮助" ;
GHowAreYou = mkInterj "你好吗" ;
GLookOut = mkInterj "留意" ;
GNiceToMeetYou = mkInterj "很高兴见到你" ;
GNiceToMeetYouPol = mkInterj "很高兴见到您" ;
GPleaseGive, GPleaseGivePol = mkInterj "请" ;
GSeeYouSoon = mkInterj "很快再见" ;
GSorry, GSorryPol = mkInterj "对不起" ;
GThanks = (mkInterj "谢谢" ) ;
GTheCheck = mkInterj "检查" ;
GCongratulations = mkInterj "祝贺您" ;
GHappyBirthday = mkInterj "祝你生日快乐" ;
GGoodLuck = (mkInterj "祝你好运" ) ;
GWhatTime = mkInterj "现在是什么时候" ;
}

View File

@@ -1,29 +0,0 @@
--# -coding=latin1
concrete GreetingsDan of Greetings = SentencesDan [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "hej hej" ; -- not google translate
GCheers = mkGreeting "skål" ;
GDamn = mkGreeting "satans" ; -- X
GExcuse, GExcusePol = mkGreeting "undskyld mig" ;
GGoodDay = mkGreeting "god dag" ;
GGoodEvening = mkGreeting "god aften" ;
GGoodMorning = mkGreeting "god morgen" ;
GGoodNight = mkGreeting "godnat" ;
GGoodbye = mkGreeting "farvel" ;
GHello = mkGreeting "hej" ;
GHelp = mkGreeting "hjælp" ;
GHowAreYou = mkGreeting "hvordan har du det" ;
GLookOut = mkGreeting "pas på" ;
GNiceToMeetYou, GNiceToMeetYouPol = mkGreeting "hyggeligt at møde dig" ; -- more common than rart (google translate)
GPleaseGive = mkGreeting "vær så sød" ; -- can also have flink instead of sod
GPleaseGivePol = mkGreeting "venligst" ; -- X not behage
GSeeYouSoon = mkGreeting "vi ses snart" ; -- X se dig snart
GSorry, GSorryPol = mkGreeting "undskyld" ;
GThanks = mkGreeting "tak" ;
GTheCheck = mkGreeting "regningen" ;
GCongratulations = mkGreeting "tillykke";
GHappyBirthday = mkGreeting "tillykke med fødselsdagen" ;
GGoodLuck = mkGreeting "held og lykke" ;
}

View File

@@ -1,30 +0,0 @@
concrete GreetingsDut of Greetings = SentencesDut [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "doei" ;
GCheers = mkGreeting "proost" ;
GDamn = mkGreeting "verdomme" ;
GExcuse, GExcusePol = mkGreeting "pardon" ;
GGoodDay = mkGreeting "goedendag" ;
GGoodEvening = mkGreeting "goedenavond" ;
GGoodMorning = mkGreeting "goedemorgen" ;
GGoodNight = mkGreeting "goedenacht" ;
GGoodbye = mkGreeting "tot ziens" ;
GHello = mkGreeting "hallo" ;
GHelp = mkGreeting "help" ;
GHowAreYou = mkGreeting "hoe gaat het" ;
GLookOut = mkGreeting "kijk uit" ;
GNiceToMeetYou = mkGreeting "leuk je te ontmoeten" ;
GNiceToMeetYouPol = mkGreeting "leuk je u ontmoeten" ;
GPleaseGive, GPleaseGivePol = mkGreeting "alstublieft" ;
GSeeYouSoon = mkGreeting "tot ziens" ;
GSorry = mkGreeting "sorry";
GSorryPol = mkGreeting "mijn verontschuldiging" ;
GThanks = mkGreeting "dank je wel" ;
GTheCheck = mkGreeting "rekening" ;
GCongratulations = mkGreeting "gefeliciteerd";
GHappyBirthday = mkGreeting "gelukkige verjaardag" ;
GGoodLuck = mkGreeting "veel geluk" ;
GWhatTime = mkGreeting "hoe laat is het" ;
}

View File

@@ -1,27 +0,0 @@
concrete GreetingsEng of Greetings = SentencesEng [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "bye" ;
GCheers = mkGreeting "cheers" ;
GDamn = mkGreeting "damn" ;
GExcuse, GExcusePol = mkGreeting "excuse me" ;
GGoodDay = mkGreeting "good afternoon" ; ----
GGoodEvening = mkGreeting "good evening" ;
GGoodMorning = mkGreeting "good morning" ;
GGoodNight = mkGreeting "good night" ;
GGoodbye = mkGreeting "goodbye" ;
GHello = mkGreeting "hello" ;
GHelp = mkGreeting "help" ;
GHowAreYou = mkGreeting "how are you" ;
GLookOut = mkGreeting "look out" ;
GNiceToMeetYou, GNiceToMeetYouPol = mkGreeting "nice to meet you" ;
GPleaseGive, GPleaseGivePol = mkGreeting "please" ;
GSeeYouSoon = mkGreeting "see you soon" ;
GSorry, GSorryPol = mkGreeting "sorry" ;
GThanks = mkGreeting "thank you" ;
GTheCheck = mkGreeting "the bill" ;
GCongratulations = mkGreeting "congratulations";
GHappyBirthday = mkGreeting "happy birthday" ;
GGoodLuck = mkGreeting "good luck" ;
GWhatTime = mkGreeting "what time is it" | mkGreeting "what is the time" ;
}

View File

@@ -1,26 +0,0 @@
concrete GreetingsEst of Greetings = SentencesEst [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "head aega" ;
GCheers = mkGreeting "terviseks" ;
GDamn = mkGreeting "neetud" ;
GExcuse, GExcusePol = mkGreeting "vabandust" ;
GGoodDay = mkGreeting "tere päevast" ;
GGoodEvening = mkGreeting "tere õhtust" ;
GGoodMorning = mkGreeting "tere hommikust" ;
GGoodNight = mkGreeting "head ööd" ;
GGoodbye = mkGreeting "head aega" ;
GHello = mkGreeting "tere" ;
GHelp = mkGreeting "appi" ;
GHowAreYou = mkGreeting "kuidas käsi käib" ;
GLookOut = mkGreeting "ettevaatust" ;
GNiceToMeetYou = mkGreeting "meeldiv tutvuda" ;
GPleaseGive, GPleaseGivePol = mkGreeting "palun" ;
GSeeYouSoon = mkGreeting "kohtumiseni" ;
GSorry, GSorryPol = mkGreeting "vabandust" ;
GThanks = mkGreeting "suur tänu" ;
GTheCheck = mkGreeting "arve" ;
GCongratulations = mkGreeting "palju õnne";
GHappyBirthday = mkGreeting "palju õnne sünnipäevaks" ;
GGoodLuck = mkGreeting "palju edu" ;
}

View File

@@ -1,30 +0,0 @@
--# -coding=latin1
concrete GreetingsFin of Greetings = SentencesFin [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "hei hei" ;
GCheers = mkGreeting "terveydeksi" ;
GDamn = mkGreeting "hitto" ;
GExcuse, GExcusePol = mkGreeting "anteeksi" ;
GGoodDay = mkGreeting "hyvää päivää" ;
GGoodEvening = mkGreeting "hyvää iltaa" ;
GGoodMorning = mkGreeting "hyvää huomenta" ;
GGoodNight = mkGreeting "hyvää yötä" ;
GGoodbye = mkGreeting "näkemiin" ;
GHello = mkGreeting "hei" ;
GHelp = mkGreeting "apua" ;
GHowAreYou = mkGreeting "mitä kuuluu" ;
GLookOut = mkGreeting "varo" ;
GNiceToMeetYou = mkGreeting "hauska tutustua" ;
GPleaseGive = mkGreeting "ole hyvä" ;
GPleaseGivePol = mkGreeting "olkaa hyvä" ;
GSeeYouSoon = mkGreeting "nähdään pian" ;
GSorry, GSorryPol = mkGreeting "anteeksi" ;
GThanks = mkGreeting "kiitos" ;
GTheCheck = mkGreeting "lasku" ;
GCongratulations = mkGreeting "onnittelut";
GHappyBirthday = mkGreeting "hyvää syntymäpäivää" ;
GGoodLuck = mkGreeting "onnea" ;
GWhatTime = mkGreeting "paljonko kello on" | mkGreeting "mitä kello on" ;
}

View File

@@ -1,31 +0,0 @@
--# -coding=latin1
concrete GreetingsFre of Greetings = SentencesFre [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "au revoir" ;
GCheers = mkGreeting "santé" ;
GDamn = mkGreeting "maudit" ;
GExcuse = mkGreeting "excuse-moi" ;
GExcusePol = mkGreeting "excusez-moi" ;
GGoodDay = mkGreeting "bonjour" ;
GGoodEvening = mkGreeting "bon soir" ;
GGoodMorning = mkGreeting "bonjour" ;
GGoodNight = mkGreeting "bonne nuit" ;
GGoodbye = mkGreeting "au revoir" ;
GHello = mkGreeting "salut" ;
GHelp = mkGreeting "au secours" ;
GHowAreYou = mkGreeting "comment ça va" ;
GLookOut = mkGreeting "attention" ;
GNiceToMeetYou = mkGreeting "enchanté" ;
GPleaseGive = mkGreeting "s'il te plaît" ;
GPleaseGivePol = mkGreeting "s'il vous plaît" ;
GSeeYouSoon = mkGreeting "à bientôt" ;
GSorry, GSorryPol = mkGreeting "pardon" ;
GThanks = mkGreeting "merci" ;
GTheCheck = mkGreeting "l'addition" ;
GCongratulations = mkGreeting "félicitations";
GHappyBirthday = mkGreeting "joyeux anniversaire" ;
GGoodLuck = mkGreeting "bonne chance" ;
GWhatTime = mkGreeting "quelle heure est-il" ;
}

View File

@@ -1,31 +0,0 @@
--# -path=.:abstract:prelude:german:api:common
--# -coding=latin1
concrete GreetingsGer of Greetings = SentencesGer [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "tschüß" ;
GCheers = mkGreeting "zum Wohl" ;
GDamn = mkGreeting "verdammt" ;
GExcuse, GExcusePol = mkGreeting "Entschuldigung" ;
GGoodDay = mkGreeting "guten Tag" ;
GGoodEvening = mkGreeting "guten Abend" ;
GGoodMorning = mkGreeting "guten Morgen" ;
GGoodNight = mkGreeting "gute Nacht" ;
GGoodbye = mkGreeting "auf Wiedersehen" ;
GHello = mkGreeting "Hallo" ;
GHelp = mkGreeting "Hilfe" ;
GHowAreYou = mkGreeting "wie geht's" ;
GLookOut = mkGreeting "Achtung" ;
GNiceToMeetYou = mkGreeting "nett, Sie zu treffen" ;
GPleaseGive, GPleaseGivePol = mkGreeting "bitte" ;
GSeeYouSoon = mkGreeting "bis bald" ;
GSorry, GSorryPol = mkGreeting "Entschuldigung" ;
GThanks = mkGreeting "Danke" ;
GTheCheck = mkGreeting "die Rechnung" ;
GCongratulations = mkGreeting "herzlichen Glückwunsch";
GHappyBirthday = mkGreeting "alles Gute zum Geburtstag" ;
GGoodLuck = mkGreeting "viel Glück" ;
GWhatTime = mkGreeting "wieviel Uhr ist es" | mkGreeting "wie spät ist es" ;
}

View File

@@ -1,31 +0,0 @@
concrete GreetingsHin of Greetings = SentencesHin [Greeting,mkGreeting] ** open (P=Prelude) in {
-- lincat
-- Greeting = {s : Str; lock_Text : {}} ;
flags coding = utf8 ;
lin
GBye = P.ss "नमस्कार" ;
GCheers = P.ss "चियर्ज़" ;
GDamn = P.ss "ाफ़" ;
GExcuse, GExcusePol = P.ss "क्षमा कीजिये" ;
GGoodDay = P.ss "नमस्कार" ; ----
GGoodEvening = P.ss "नमस्कार" ;
GGoodMorning = P.ss "नमस्कार" ;
GGoodNight = P.ss "नमस्कार" ;
GGoodbye = P.ss "हम आपसे विदा लेते हैं" ;
GHello = P.ss "नमस्कार" ;
GHelp = P.ss "सहायता" ;
GHowAreYou = P.ss "आप कैसे हैं" ;
GLookOut = P.ss "सावधान" ;
GNiceToMeetYou, GNiceToMeetYouPol = P.ss "आप से मिल कर च्छा लगा" ;
GPleaseGive, GPleaseGivePol = P.ss "कृपया" ;
GSeeYouSoon = P.ss "फिर मिलेंगे" ;
GSorry, GSorryPol = P.ss "क्षमा कीजिये" ;
GThanks = P.ss "धन्यवाद" ;
GTheCheck = P.ss "बिल" ;
GCongratulations = P.ss "बधाई हो";
GHappyBirthday = P.ss "जन्मदिन की शुभकामनाएँ" ;
GGoodLuck = P.ss "शुभकामनाएँ" ;
GWhatTime = P.ss "कितने बजे हैं" ;
}

View File

@@ -1,31 +0,0 @@
concrete GreetingsIta of Greetings = SentencesIta [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "ciao" ;
GCheers = mkGreeting "cincin" ;
GDamn = mkGreeting "maledizione" ;
GExcuse = mkGreeting "scusa" ;
GExcusePol = mkGreeting "scusi" ;
GGoodDay = mkGreeting "buongiorno" ;
GGoodEvening = mkGreeting "buona sera" ;
GGoodMorning = mkGreeting "buongiorno" ;
GGoodNight = mkGreeting "buona notte" ;
GGoodbye = mkGreeting "arrivederci" ;
GHello = mkGreeting "ciao" ;
GHelp = mkGreeting "aiuto" ;
GHowAreYou = mkGreeting "come sta" ;
GLookOut = mkGreeting "attenzione" ;
GNiceToMeetYou = mkGreeting "piacere di conoscerti" ;
GNiceToMeetYouPol = mkGreeting "piacere di conoscerLa" ;
GPleaseGive, GPleaseGivePol = mkGreeting "per favore" ;
GSeeYouSoon = mkGreeting "a presto" ; ----
GSorry = mkGreeting "scusami" ; ----
GSorryPol = mkGreeting "scusimi" ; ----
GThanks = mkGreeting "grazie" ;
GTheCheck = mkGreeting "il conto" ;
GCongratulations = mkGreeting "congratulazioni";
GHappyBirthday = mkGreeting "buon compleanno" ;
GGoodLuck = mkGreeting "buona fortuna" ;
GWhatTime = mkGreeting "che ore sono" ;
}

View File

@@ -1,30 +0,0 @@
concrete GreetingsJpn of Greetings = SentencesJpn [Greeting,mkGreeting] ** open Prelude in {
flags coding = utf8 ;
lin
GBye = mkGreeting "バイ" ;
GCheers = mkGreeting "かんぱい" ;
GDamn = mkGreeting "くそ" ;
GExcuse, GExcusePol = mkGreeting "すみません" ;
GGoodDay, GHello = mkGreeting "こんにちは" ; ----
GGoodEvening = mkGreeting "こんばんは" ;
GGoodMorning = mkGreeting "おはようございます" ;
GGoodNight = mkGreeting "おやすみなさい" ;
GGoodbye = mkGreeting "さようなら" ;
GHelp = mkGreeting "助けて" ;
GHowAreYou = mkGreeting "お元気ですか" ;
GLookOut = mkGreeting "危ない" ;
GNiceToMeetYou = mkGreeting "初めまして" ;
GPleaseGive = mkGreeting "ください" ;
GPleaseGivePol = mkGreeting "お願いします" ;
GSeeYouSoon = mkGreeting "またね" ;
GSorry = mkGreeting "ごめんなさい" ;
GSorryPol = mkGreeting "申し訳ありません" ;
GThanks = mkGreeting "ありがとう" ;
GTheCheck = mkGreeting "会計" ;
GCongratulations = mkGreeting "お目出度うご座います";
GHappyBirthday = mkGreeting "お誕生日おめでとうございます" ;
GGoodLuck = mkGreeting "がんばってください" ;
GWhatTime = mkGreeting "今何時ですか" ;
}

View File

@@ -1,33 +0,0 @@
--# -path=.:present
concrete GreetingsLav of Greetings = SentencesLav [Greeting, mkGreeting] **
open Prelude
in {
flags
coding = utf8 ;
lin
GBye = mkGreeting "atā" ;
GCheers = mkGreeting "priekā" ;
GDamn = mkGreeting "sasodīts" ;
GExcuse, GExcusePol = mkGreeting "atvainojiet" ;
GGoodDay = mkGreeting "labdien" ;
GGoodEvening = mkGreeting "labvakar" ;
GGoodMorning = mkGreeting "labrīt" ;
GGoodNight = mkGreeting "ar labunakti" ;
GGoodbye = mkGreeting "visu labu" ;
GHello = mkGreeting "sveiki" ;
GHelp = mkGreeting "palīdziet" ;
GHowAreYou = mkGreeting "kā klājas" ;
GLookOut = mkGreeting "uzmanīgi" ;
GNiceToMeetYou, GNiceToMeetYouPol = mkGreeting "prieks iepazīties" ;
GPleaseGive, GPleaseGivePol = mkGreeting "lūdzu" ;
GSeeYouSoon = mkGreeting "uz drīzu tikšanos" ;
GSorry, GSorryPol = mkGreeting "piedodiet" ;
GThanks = mkGreeting "paldies" ;
GTheCheck = mkGreeting "rēķins" ;
GCongratulations = mkGreeting "apsveicu" ;
GHappyBirthday = mkGreeting "daudz laimes dzimšanas dienā" ;
GGoodLuck = mkGreeting "veiksmīgi" ;
}

View File

@@ -1,28 +0,0 @@
--# -coding=latin1
concrete GreetingsNor of Greetings = SentencesNor [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "ha det" ;
GCheers = mkGreeting "skål" ; -- google translate !
GDamn = mkGreeting "faen" ;
GExcuse, GExcusePol = mkGreeting "unnskyld" ;
GGoodDay = mkGreeting "god dag" ;
GGoodEvening = mkGreeting "god kveld" ;
GGoodMorning = mkGreeting "god morgen" ;
GGoodNight = mkGreeting "god natt" ;
GGoodbye = mkGreeting "ha det bra" ;
GHello = mkGreeting "hei" ;
GHelp = mkGreeting "hjelp" ;
GHowAreYou = mkGreeting "hvordan går det" ;
GLookOut = mkGreeting "se opp" ; -- google translate !
GNiceToMeetYou, GNiceToMeetYouPol = mkGreeting "hyggelig å treffe deg" ;
GPleaseGive, GPleaseGivePol = mkGreeting "vær så snill" ;
GSeeYouSoon = mkGreeting "se deg snart" ; -- google translate !
GSorry, GSorryPol = mkGreeting "beklager" ;
GThanks = mkGreeting "takk" ;
GTheCheck = mkGreeting "regningen" ;
GCongratulations = mkGreeting "gratulerer";
GHappyBirthday = mkGreeting "gratulerer med dagen" ;
GGoodLuck = mkGreeting "lykke til" ;
}

View File

@@ -1,29 +0,0 @@
concrete GreetingsPes of Greetings = SentencesPes [mkGreeting] ** open (P=Prelude) in {
-- lincat
-- Greeting = {s : Str; lock_Text : {}} ;
flags coding = utf8 ;
lin
GBye = P.ss ["خداحافظ"] ;
GCheers = P.ss ["به سلامتی"] ;
GDamn = P.ss "لعنتی" ;
GExcuse, GExcusePol = P.ss ["ببخشید"] ;
GGoodDay = P.ss ["روز به خیر"] ; ----
GGoodEvening = P.ss ["عصر به خیر"] ;
GGoodMorning = P.ss ["صبح به خیر"] ;
GGoodNight = P.ss ["شب به خیر"] ;
GGoodbye = P.ss ["خداحافظ"] ;
GHello = P.ss "سلام" ;
GHelp = P.ss "کمک" ;
GHowAreYou = P.ss ["حال شما چطور است"] ;
GLookOut = P.ss ["مراقب باشید"] ;
GNiceToMeetYou, GNiceToMeetYouPol = P.ss ["از ملاقات شما خوشوقتم"] ;
GPleaseGive, GPleaseGivePol = P.ss ["لطفاً بدهید"] ;
GSeeYouSoon = P.ss ["به امید دیدار"] ;
GSorry, GSorryPol = P.ss "متأسفم" ;
GThanks = P.ss "ممنونم" ;
GTheCheck = P.ss "چک" ;
GCongratulations = P.ss ["تبریک میگم"];
GHappyBirthday = P.ss ["تولدت مبارک"] ;
GGoodLuck = P.ss ["موفق باشید"] ;
}

View File

@@ -1,27 +0,0 @@
concrete GreetingsPol of Greetings = SentencesPol [Greeting,mkGreeting] ** open Prelude in {
flags
optimize =values ; coding =utf8 ;
lin
GBye = mkGreeting "cześć" ;
GCheers = mkGreeting "na zdrowie" ;
GDamn = mkGreeting "cholera" ; -- not polite
GExcuse, GExcusePol, GSorry, GSorryPol = mkGreeting "przepraszam" ;
GGoodDay, GGoodMorning = mkGreeting "dzień dobry" ;
GGoodEvening = mkGreeting "dobry wieczór" ;
GGoodNight = mkGreeting "dobranoc" ;
GGoodbye = mkGreeting "do widzenia" ;
GHello = mkGreeting "cześć" ;
GHelp = mkGreeting "pomocy" ;
GHowAreYou = mkGreeting "jak się masz" ;
GLookOut = mkGreeting "uwaga" ;
GNiceToMeetYou = mkGreeting "miło mi" ;
GPleaseGive, GPleaseGivePol = mkGreeting "poproszę" ;
GSeeYouSoon = mkGreeting "do zobaczenia" ;
GThanks = mkGreeting "dziękuję" ;
GTheCheck = mkGreeting "rachunek" ;
GCongratulations = mkGreeting "gratulacje";
GHappyBirthday = mkGreeting "wszystkiego najlepszego z okazji urodzin" ;
GGoodLuck = mkGreeting "powodzenia" ;
}

View File

@@ -1,31 +0,0 @@
concrete GreetingsRon of Greetings = SentencesRon [Greeting,mkGreeting] ** open Prelude in {
flags coding = utf8 ;
lin
GBye = mkGreeting "pa" ;
GCheers = mkGreeting "noroc" ;
GDamn = mkGreeting "ptiu" ;
GExcuse = mkGreeting "pardon" ;
GExcusePol = mkGreeting "mă scuzați" ;
GGoodDay = mkGreeting "bună ziua" ;
GGoodEvening = mkGreeting "bună seara" ;
GGoodMorning = mkGreeting "bună dimineaţa" ;
GGoodNight = mkGreeting "noapte bună" ;
GGoodbye = mkGreeting "la revedere" ;
GHello = mkGreeting "salut" ;
GHelp = mkGreeting "ajutor" ;
GHowAreYou = mkGreeting "ce faci" ;
GLookOut = mkGreeting "atenţie" ;
GNiceToMeetYou = mkGreeting "încântat" ;
GPleaseGive = mkGreeting "te rog" ;
GPleaseGivePol = mkGreeting "vă rog" ;
GSeeYouSoon = mkGreeting "pe curând" ;
GSorry, GSorryPol = mkGreeting "îmi pare rău" ;
GThanks = mkGreeting "mulţumesc" ;
GTheCheck = mkGreeting "nota de plată" ;
GCongratulations = mkGreeting "felicitări";
GHappyBirthday = mkGreeting "la mulți ani" ;
GGoodLuck = mkGreeting "baftă" ;
}

View File

@@ -1,29 +0,0 @@
concrete GreetingsRus of Greetings = open Prelude in {
flags coding = utf8 ;
lin
GBye = ss "до свидания" ;
GCheers = ss "ура" ;
GDamn = ss "чёрт" ;
GExcuse, GExcusePol = ss "извините" ;
GGoodDay = ss "добрый день" ; ----
GGoodEvening = ss "добрый вечер" ;
GGoodMorning = ss "доброе утро" ;
GGoodNight = ss "спокойной ночи" ;
GGoodbye = ss "до свидания" ;
GHello = ss "привет" ;
GHelp = ss "помогите" ;
GHowAreYou = ss "Как поживаете" ;
GLookOut = ss "смотреть" ;
GNiceToMeetYou, GNiceToMeetYouPol = ss "приятно познакомиться" ;
GPleaseGive, GPleaseGivePol = ss "пожалуйста" ;
GSeeYouSoon = ss "до скорой встречи" ;
GSorry, GSorryPol = ss "Мне жаль" ;
GThanks = ss "спасибо" ;
GTheCheck = ss "проверить" ;
GCongratulations = ss "поздравляю";
GHappyBirthday = ss "с днем рождения" ;
GGoodLuck = ss "желаю удачи" ;
}

View File

@@ -1,29 +0,0 @@
concrete GreetingsSnd of Greetings = SentencesSnd [mkGreeting,Greeting] ** open (P=Prelude) in {
-- lincat
-- Greeting = {s : Str; lock_Text : {}} ;
flags coding = utf8 ;
lin
GBye = P.ss "خدا حافظ" ;
GCheers = P.ss "چيئرز" ;
GDamn = P.ss "اف" ;
GExcuse, GExcusePol = P.ss "معاف ڪجو" ;
GGoodDay = P.ss "ڏينهن بخير" ; ----
GGoodEvening = P.ss "شام بخير" ;
GGoodMorning = P.ss "صبح بخير" ;
GGoodNight = P.ss "رات بخير" ;
GGoodbye = P.ss "خدا حافظ" ;
GHello = P.ss "السلام عليڪم" ;
GHelp = P.ss "مدد" ;
GHowAreYou = P.ss "توهان ڪيئن آهيو" ;
GLookOut = P.ss "سنڀالي" ;
GNiceToMeetYou, GNiceToMeetYouPol = P.ss "توهان سان ملي ڪري سٺو لڳو" ;
GPleaseGive, GPleaseGivePol = P.ss "مهرباني ڪريو" ;
GSeeYouSoon = P.ss "موڪلاڻي ڪانهي" ;
GSorry, GSorryPol = P.ss "معاف ڪجو" ;
GThanks = P.ss "ٿورا" ;
GTheCheck = P.ss "بل" ;
GCongratulations = P.ss "مبارڪ هجي";
GHappyBirthday = P.ss "جنم ڏينهن مبارڪ" ;
GGoodLuck = P.ss "قسمت ڀلي هجي" ;
}

View File

@@ -1,31 +0,0 @@
concrete GreetingsSpa of Greetings = SentencesSpa [Greeting,mkGreeting] ** open Prelude in {
flags coding = utf8 ;
lin
GBye = mkGreeting "adiós" ;
GCheers = mkGreeting "salud" ;
GDamn = mkGreeting "joder" ;
GExcuse = mkGreeting "perdón" ;
GExcusePol = mkGreeting "perdone" ;
GCongratulations = mkGreeting "felicitaciones" ;
GGoodLuck = mkGreeting "buena suerte" ;
GHappyBirthday = mkGreeting "feliz cumpleaños" ;
GGoodMorning, GGoodDay = mkGreeting "buenos días" ;
GGoodEvening = mkGreeting "buenas tardes" ;
GGoodNight = mkGreeting "buenas noches" ;
GGoodbye = mkGreeting "hasta luego" ;
GHello = mkGreeting "hola" ;
GHelp = mkGreeting "socorro" ;
GHowAreYou = mkGreeting "cómo está¡" ; -- the polite singular "you"
GLookOut = mkGreeting "atención" ;
GNiceToMeetYou = mkGreeting "encantado de conocerle" ; -- the polite singular "you"
GPleaseGive, GPleaseGivePol = mkGreeting "por favor" ;
GSeeYouSoon = mkGreeting "nos vemos pronto" ;
GSorry = mkGreeting "disculpa" ;
GSorryPol = mkGreeting "disculpe" ;
GThanks = mkGreeting "gracias" ;
GTheCheck = mkGreeting "la cuenta" ;
GWhatTime = mkGreeting "qué ora es" ;
}

View File

@@ -1,29 +0,0 @@
--# -coding=latin1
concrete GreetingsSwe of Greetings = SentencesSwe [Greeting,mkGreeting] ** open Prelude in {
lin
GBye = mkGreeting "hej då" ;
GCheers = mkGreeting "skål" ;
GDamn = mkGreeting "fan" ;
GExcuse, GExcusePol = mkGreeting "ursäkta" ;
GGoodDay = mkGreeting "god dag" ;
GGoodEvening = mkGreeting "god afton" ;
GGoodMorning = mkGreeting "god morgon" ;
GGoodNight = mkGreeting "god natt" ;
GGoodbye = mkGreeting "hej då" ;
GHello = mkGreeting "hej" ;
GHelp = mkGreeting "hjälp" ;
GHowAreYou = mkGreeting "hur står det till" ;
GLookOut = mkGreeting "se upp" ;
GNiceToMeetYou, GNiceToMeetYouPol = mkGreeting "trevligt att träffas" ;
GPleaseGive, GPleaseGivePol = mkGreeting "var så god" ;
GSeeYouSoon = mkGreeting "vi ses snart" ;
GSorry, GSorryPol = mkGreeting "förlåt" ;
GThanks = mkGreeting "tack" ;
GTheCheck = mkGreeting "notan" ;
GCongratulations = mkGreeting "grattis";
GHappyBirthday = mkGreeting "grattis på födelsedagen" ;
GGoodLuck = mkGreeting "lycka till" ;
GWhatTime = mkGreeting "vad är klockan" | mkGreeting "hur mycket är klockan" ;
}

View File

@@ -1,35 +0,0 @@
concrete GreetingsTha of Greetings =
SentencesTha [Greeting,mkGreeting] **
open ResTha, Prelude in {
-- สุขสันต์วันเกิด
flags coding = utf8 ;
lin
GBye = mkGreeting (thword "ลา" "ก่อน") ;
GCheers = mkGreeting (thword "ไช" "โย") ;
GDamn = mkGreeting (thword "ชิบ" "หาย") ;
GExcuse, GExcusePol = mkGreeting (thword "ขอ" "โทษ") ;
GGoodDay = mkGreeting (thword "สวัส" "ดี") ;
GGoodEvening = mkGreeting (thword "สวัส" "ดี") ;
GGoodMorning = mkGreeting (thword "สวัส" "ดี") ;
GGoodNight = mkGreeting (thword "รา" "ตรี" "สวัส" "ดิ์") ;
GGoodbye = mkGreeting (thword "ลา" "ก่อน") ;
GHello = mkGreeting (thword "สวัส" "ดี") ;
GHelp = mkGreeting (thword "ช่วย" "ด้วย") ;
GHowAreYou = mkGreeting (thword "สบาย" "ดี" "ไหม") ;
GLookOut = mkGreeting (thword "ระ" "วัง") ; ---- google
GNiceToMeetYou, GNiceToMeetYouPol =
mkGreeting (thword "ยิน" "ดี" "ที่" "ได้" "รู้" "จัก") ;
GPleaseGive, GPleaseGivePol = mkGreeting "นะ" ;
GSeeYouSoon = mkGreeting (thword "เจอ" "กัน" "นะ") ;
GSorry, GSorryPol = mkGreeting (thword "ขอ" "โทษ") ;
GThanks = mkGreeting (thword "ขอบ" "คุณ") ;
GTheCheck = mkGreeting (thword "เช็ค" "บิล") ;
GCongratulations = mkGreeting (thword "ยิน" "ดี" "ด้วย") ;
GHappyBirthday = mkGreeting (thword "สุข" "สันต์" "วัน" "เกิด") ;
GGoodLuck = mkGreeting (thword "โชค" "ดี" "นะ") ;
}

View File

@@ -1,29 +0,0 @@
concrete GreetingsUrd of Greetings = SentencesUrd [mkGreeting,Greeting] ** open (P=Prelude) in {
-- lincat
-- Greeting = {s : Str; lock_Text : {}} ;
flags coding = utf8 ;
lin
GBye = P.ss "خدا حافظ" ;
GCheers = P.ss "چیرز" ;
GDamn = P.ss "اف" ;
GExcuse, GExcusePol = P.ss "معاف كیجیے گا" ;
GGoodDay = P.ss "دن بخیر" ; ----
GGoodEvening = P.ss "شام بخیر" ;
GGoodMorning = P.ss "صبح بخیر" ;
GGoodNight = P.ss "رات بخیر" ;
GGoodbye = P.ss "خدا حافظ" ;
GHello = P.ss "اسلام علیكم" ;
GHelp = P.ss "مدد" ;
GHowAreYou = P.ss "آپ كیسی ہو" ;
GLookOut = P.ss "دیكھ كر" ;
GNiceToMeetYou, GNiceToMeetYouPol = P.ss "آپ سے مل كر اچھا لگا" ;
GPleaseGive, GPleaseGivePol = P.ss "مہربانی كر كے" ;
GSeeYouSoon = P.ss "ملتے ہیں" ;
GSorry, GSorryPol = P.ss "معاف كیجیے گا" ;
GThanks = P.ss "شكریہ" ;
GTheCheck = P.ss "بل" ;
GCongratulations = P.ss "مبارك ہو";
GHappyBirthday = P.ss "سالگرہ مبارك" ;
GGoodLuck = P.ss "گڈ لك" ;
}

View File

@@ -1,500 +0,0 @@
<html>
<body>
<i> Produced by
gfdoc - a rudimentary GF document generator.
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
</i>
<p>
<h1> Implementation of MOLTO Phrasebook</h1>
<h2> The functor for (mostly) common structures</h2>
<pre>
incomplete concrete SentencesI of Sentences = Numeral **
open
Syntax,
Lexicon,
Symbolic, -- for names as strings
Prelude
in {
lincat
Phrase = Text ;
Sentence = S ;
Question = QS ;
Proposition = Cl ;
Item = NP ;
Kind = CN ;
MassKind = CN ;
Quality = AP ;
Property = A ;
Object = NP ;
PrimObject = NP ;
Place = NPPlace ; -- {name : NP ; at : Adv ; to : Adv} ;
PlaceKind = CNPlace ; -- {name : CN ; at : Prep ; to : Prep} ;
Currency = CN ;
Price = NP ;
Action = Cl ;
Person = NPPerson ; -- {name : NP ; isPron : Bool ; poss : Quant} ;
Nationality = NPNationality ; -- {lang : NP ; country : NP ; prop : A} ;
Language = NP ;
Citizenship = A ;
Country = NP ;
Day = NPDay ; -- {name : NP ; point : Adv ; habitual : Adv} ;
Date = Adv ;
Name = NP ;
Number = Card ;
ByTransport = Adv ;
Transport = {name : CN ; by : Adv} ;
Superlative = Det ;
lin
PSentence s = mkText s | lin Text (mkUtt s) ; -- optional '.'
PQuestion s = mkText s | lin Text (mkUtt s) ; -- optional '?'
PObject x = mkPhrase (mkUtt x) ;
PKind x = mkPhrase (mkUtt x) ;
PMassKind x = mkPhrase (mkUtt x) ;
PQuality x = mkPhrase (mkUtt x) ;
PNumber x = mkPhrase (mkUtt x) ;
PPlace x = mkPhrase (mkUtt x.name) ;
PPlaceKind x = mkPhrase (mkUtt x.name) ;
PCurrency x = mkPhrase (mkUtt x) ;
PPrice x = mkPhrase (mkUtt x) ;
PLanguage x = mkPhrase (mkUtt x) ;
PCountry x = mkPhrase (mkUtt x) ;
PCitizenship x = mkPhrase (mkUtt (mkAP x)) ;
PDay d = mkPhrase (mkUtt d.name) ;
PTransport t = mkPhrase (mkUtt t.name) ;
PByTransport t = mkPhrase (mkUtt t) ;
PYes = mkPhrase yes_Utt ;
PNo = mkPhrase no_Utt ;
PYesToNo = mkPhrase yes_Utt ;
Is = mkCl ;
SProp = mkS ;
SPropNot = mkS negativePol ;
QProp p = mkQS (mkQCl p) ;
WherePlace place = mkQS (mkQCl where_IAdv place.name) ;
WherePerson person = mkQS (mkQCl where_IAdv person.name) ;
PropAction a = a ;
AmountCurrency num curr = mkNP num curr ;
ObjItem i = i ;
ObjNumber n k = mkNP n k ;
ObjIndef k = mkNP a_Quant k ;
ObjPlural k = mkNP aPl_Det k ;
ObjMass k = mkNP k ;
ObjAndObj = mkNP and_Conj ;
OneObj o = o ;
This kind = mkNP this_Quant kind ;
That kind = mkNP that_Quant kind ;
These kind = mkNP this_Quant plNum kind ;
Those kind = mkNP that_Quant plNum kind ;
The kind = mkNP the_Quant kind ;
Thes kind = mkNP the_Quant plNum kind ;
ThisMass kind = mkNP this_Quant kind ;
ThatMass kind = mkNP that_Quant kind ;
TheMass kind = mkNP the_Quant kind ;
SuchKind quality kind = mkCN quality kind ;
SuchMassKind quality kind = mkCN quality kind ;
Very property = mkAP very_AdA (mkAP property) ;
Too property = mkAP too_AdA (mkAP property) ;
PropQuality property = mkAP property ;
ThePlace kind = let dd = if_then_else Det kind.isPl thePl_Det theSg_Det
in placeNP dd kind ;
APlace kind = let dd = if_then_else Det kind.isPl thePl_Det theSg_Det
in placeNP dd kind ;
IMale, IFemale = mkPerson i_Pron ;
YouFamMale, YouFamFemale = mkPerson youSg_Pron ;
YouPolMale, YouPolFemale = mkPerson youPol_Pron ;
LangNat n = n.lang ;
CitiNat n = n.prop ;
CountryNat n = n.country ;
PropCit c = c ;
OnDay d = d.point ;
Today = today_Adv ;
PersonName n =
{name = n ; isPron = False ; poss = mkQuant he_Pron} ; -- poss not used
</pre>
<pre>
NameNN = symb "NN" ;
NNumeral n = mkCard &lt;lin Numeral n : Numeral> ;
SHave p obj = mkS (mkCl p.name have_V2 obj) ;
SHaveNo p k = mkS negativePol (mkCl p.name have_V2 (mkNP aPl_Det k)) ;
SHaveNoMass p m = mkS negativePol (mkCl p.name have_V2 (mkNP m)) ;
QDoHave p obj = mkQS (mkQCl (mkCl p.name have_V2 obj)) ;
AHaveCurr p curr = mkCl p.name have_V2 (mkNP aPl_Det curr) ;
ACitizen p n = mkCl p.name n ;
ABePlace p place = mkCl p.name place.at ;
ByTransp t = t.by ;
oper
</pre>
These operations are used internally in Sentences.
<pre>
mkPhrase : Utt -> Text = \u -> lin Text u ; -- no punctuation
mkPerson : Pron -> {name : NP ; isPron : Bool ; poss : Quant} = \p ->
{name = mkNP p ; isPron = True ; poss = mkQuant p} ;
</pre>
These are used in Words for each language.
<pre>
NPNationality : Type = {lang : NP ; country : NP ; prop : A} ;
mkNPNationality : NP -> NP -> A -> NPNationality = \la,co,pro ->
{lang = la ;
country = co ;
prop = pro
} ;
NPDay : Type = {name : NP ; point : Adv ; habitual : Adv} ;
mkNPDay : NP -> Adv -> Adv -> NPDay = \d,p,h ->
{name = d ;
point = p ;
habitual = h
} ;
NPPlace : Type = {name : NP ; at : Adv ; to : Adv} ;
CNPlace : Type = {name : CN ; at : Prep ; to : Prep; isPl : Bool} ;
mkCNPlace : CN -> Prep -> Prep -> CNPlace = \p,i,t -> {
name = p ;
at = i ;
to = t ;
isPl = False
} ;
mkCNPlacePl : CN -> Prep -> Prep -> CNPlace = \p,i,t -> {
name = p ;
at = i ;
to = t ;
isPl = True
} ;
placeNP : Det -> CNPlace -> NPPlace = \det,kind ->
let name : NP = mkNP det kind.name in {
name = name ;
at = mkAdv kind.at name ;
to = mkAdv kind.to name
} ;
NPPerson : Type = {name : NP ; isPron : Bool ; poss : Quant} ;
relativePerson : GNumber -> CN -> (Num -> NP -> CN -> NP) -> NPPerson -> NPPerson =
\n,x,f,p ->
let num = if_then_else Num n plNum sgNum in {
name = case p.isPron of {
True => mkNP p.poss num x ;
_ => f num p.name x
} ;
isPron = False ;
poss = mkQuant he_Pron -- not used because not pron
} ;
GNumber : PType = Bool ;
sing = False ; plur = True ;
</pre>
for languages without GenNP, use <i>the wife of p</i>
<pre>
mkRelative : Bool -> CN -> NPPerson -> NPPerson = \n,x,p ->
relativePerson n x
(\a,b,c -> mkNP (mkNP the_Quant a c) (Syntax.mkAdv possess_Prep b)) p ;
</pre>
for languages with GenNP, use <i>p's wife</i>
relativePerson n x (\a,b,c -> mkNP (GenNP b) a c) p ;
<pre>
}
</pre>
<h2> Implementations of Words, with English as example</h2>
<pre>
concrete WordsEng of Words = SentencesEng **
open
SyntaxEng,
ParadigmsEng,
(L = LexiconEng),
(P = ParadigmsEng),
IrregEng,
ExtraEng,
Prelude in {
lin
</pre>
Kinds; many of them are in the resource lexicon, others can be built by <tt>mkN</tt>.
<pre>
Apple = mkCN L.apple_N ;
Beer = mkCN L.beer_N ;
Bread = mkCN L.bread_N ;
Cheese = mkCN (mkN "cheese") ;
Chicken = mkCN (mkN "chicken") ;
Coffee = mkCN (mkN "coffee") ;
Fish = mkCN L.fish_N ;
Meat = mkCN (mkN "meat") ;
Milk = mkCN L.milk_N ;
Pizza = mkCN (mkN "pizza") ;
Salt = mkCN L.salt_N ;
Tea = mkCN (mkN "tea") ;
Water = mkCN L.water_N ;
Wine = mkCN L.wine_N ;
</pre>
Properties; many of them are in the resource lexicon, others can be built by <tt>mkA</tt>.
<pre>
Bad = L.bad_A ;
Boring = mkA "boring" ;
Cheap = mkA "cheap" ;
Cold = L.cold_A ;
Delicious = mkA "delicious" ;
Expensive = mkA "expensive" ;
Fresh = mkA "fresh" ;
Good = L.good_A ;
Suspect = mkA "suspect" ;
Warm = L.warm_A ;
</pre>
Places require different prepositions to express location; in some languages
also the directional preposition varies, but in English we use <tt>to</tt>, as
defined by <tt>mkPlace</tt>.
<pre>
Airport = mkPlace "airport" "at" ;
AmusementPark = mkCompoundPlace "amusement" "park" "at" ;
Bank = mkPlace "bank" "at" ;
Bar = mkPlace "bar" "in" ;
Cafeteria = mkPlace "canteen" "in" ;
Center = mkPlace "center" "in" ;
Cinema = mkPlace "cinema" "at" ;
Church = mkPlace "church" "in" ;
Disco = mkPlace "disco" "at" ;
Hospital = mkPlace "hospital" "in" ;
Hotel = mkPlace "hotel" "in" ;
Museum = mkPlace "museum" "at" ;
Park = mkPlace "park" "in" ;
Parking = mkCompoundPlace "car" "park" "in" ;
Pharmacy = mkPlace "pharmacy" "at" ;
PostOffice = mkCompoundPlace "post" "office" "at" ;
Pub = mkPlace "pub" "at" ;
Restaurant = mkPlace "restaurant" "in" ;
School = mkPlace "school" "at" ;
Shop = mkPlace "shop" "at" ;
Station = mkPlace "station" "at" ;
Supermarket = mkPlace "supermarket" "at" ;
Theatre = mkPlace "theatre" "at" ;
Toilet = mkPlace "toilet" "in" ;
University = mkPlace "university" "at" ;
Zoo = mkPlace "zoo" "at" ;
CitRestaurant cit = mkCNPlace (mkCN cit (mkN "restaurant")) in_Prep to_Prep ;
</pre>
Currencies; <tt>crown</tt> is ambiguous between Danish and Swedish crowns.
<pre>
DanishCrown = mkCN (mkA "Danish") (mkN "crown") | mkCN (mkN "crown") ;
Dollar = mkCN (mkN "dollar") ;
Euro = mkCN (mkN "euro" "euros") ; -- to prevent euroes
Lei = mkCN (mkN "leu" "lei") ;
Leva = mkCN (mkN "lev") ;
NorwegianCrown = mkCN (mkA "Norwegian") (mkN "crown") | mkCN (mkN "crown") ;
Pound = mkCN (mkN "pound") ;
Rouble = mkCN (mkN "rouble") ;
SwedishCrown = mkCN (mkA "Swedish") (mkN "crown") | mkCN (mkN "crown") ;
Zloty = mkCN (mkN "zloty" "zloty") ;
</pre>
Nationalities
<pre>
Belgian = mkA "Belgian" ;
Belgium = mkNP (mkPN "Belgium") ;
Bulgarian = mkNat "Bulgarian" "Bulgaria" ;
Catalan = mkNPNationality (mkNP (mkPN "Catalan")) (mkNP (mkPN "Catalonia")) (mkA "Catalonian") ;
Danish = mkNat "Danish" "Denmark" ;
Dutch = mkNPNationality (mkNP (mkPN "Dutch")) (mkNP the_Quant (mkN "Netherlands")) (mkA "Dutch") ;
English = mkNat "English" "England" ;
Finnish = mkNat "Finnish" "Finland" ;
Flemish = mkNP (mkPN "Flemish") ;
French = mkNat "French" "France" ;
German = mkNat "German" "Germany" ;
Italian = mkNat "Italian" "Italy" ;
Norwegian = mkNat "Norwegian" "Norway" ;
Polish = mkNat "Polish" "Poland" ;
Romanian = mkNat "Romanian" "Romania" ;
Russian = mkNat "Russian" "Russia" ;
Spanish = mkNat "Spanish" "Spain" ;
Swedish = mkNat "Swedish" "Sweden" ;
</pre>
Means of transportation
<pre>
Bike = mkTransport L.bike_N ;
Bus = mkTransport (mkN "bus") ;
Car = mkTransport L.car_N ;
Ferry = mkTransport (mkN "ferry") ;
Plane = mkTransport L.airplane_N ;
Subway = mkTransport (mkN "subway") ;
Taxi = mkTransport (mkN "taxi") ;
Train = mkTransport (mkN "train") ;
Tram = mkTransport (mkN "tram") ;
ByFoot = P.mkAdv "by foot" ;
</pre>
Actions: the predication patterns are very often language-dependent.
<pre>
AHasAge p num = mkCl p.name (mkNP (mkNP num L.year_N) (ParadigmsEng.mkAdv "old"));
AHasChildren p num = mkCl p.name have_V2 (mkNP num L.child_N) ;
AHasRoom p num = mkCl p.name have_V2
(mkNP (mkNP a_Det (mkN "room")) (SyntaxEng.mkAdv for_Prep (mkNP num (mkN "person")))) ;
AHasTable p num = mkCl p.name have_V2
(mkNP (mkNP a_Det (mkN "table")) (SyntaxEng.mkAdv for_Prep (mkNP num (mkN "person")))) ;
AHasName p name = mkCl (nameOf p) name ;
AHungry p = mkCl p.name (mkA "hungry") ;
AIll p = mkCl p.name (mkA "ill") ;
AKnow p = mkCl p.name IrregEng.know_V ;
ALike p item = mkCl p.name (mkV2 (mkV "like")) item ;
ALive p co = mkCl p.name (mkVP (mkVP (mkV "live")) (SyntaxEng.mkAdv in_Prep co)) ;
ALove p q = mkCl p.name (mkV2 (mkV "love")) q.name ;
AMarried p = mkCl p.name (mkA "married") ;
AReady p = mkCl p.name (mkA "ready") ;
AScared p = mkCl p.name (mkA "scared") ;
ASpeak p lang = mkCl p.name (mkV2 IrregEng.speak_V) lang ;
AThirsty p = mkCl p.name (mkA "thirsty") ;
ATired p = mkCl p.name (mkA "tired") ;
AUnderstand p = mkCl p.name IrregEng.understand_V ;
AWant p obj = mkCl p.name (mkV2 (mkV "want")) obj ;
AWantGo p place = mkCl p.name want_VV (mkVP (mkVP IrregEng.go_V) place.to) ;
</pre>
miscellaneous
<pre>
QWhatName p = mkQS (mkQCl whatSg_IP (mkVP (nameOf p))) ;
QWhatAge p = mkQS (mkQCl (ICompAP (mkAP L.old_A)) p.name) ;
HowMuchCost item = mkQS (mkQCl how8much_IAdv (mkCl item IrregEng.cost_V)) ;
ItCost item price = mkCl item (mkV2 IrregEng.cost_V) price ;
PropOpen p = mkCl p.name open_Adv ;
PropClosed p = mkCl p.name closed_Adv ;
PropOpenDate p d = mkCl p.name (mkVP (mkVP open_Adv) d) ;
PropClosedDate p d = mkCl p.name (mkVP (mkVP closed_Adv) d) ;
PropOpenDay p d = mkCl p.name (mkVP (mkVP open_Adv) d.habitual) ;
PropClosedDay p d = mkCl p.name (mkVP (mkVP closed_Adv) d.habitual) ;
</pre>
Building phrases from strings is complicated: the solution is to use
mkText : Text -> Text -> Text ;
<pre>
PSeeYouDate d = mkText (lin Text (ss ("see you"))) (mkPhrase (mkUtt d)) ;
PSeeYouPlace p = mkText (lin Text (ss ("see you"))) (mkPhrase (mkUtt p.at)) ;
PSeeYouPlaceDate p d =
mkText (lin Text (ss ("see you")))
(mkText (mkPhrase (mkUtt p.at)) (mkPhrase (mkUtt d))) ;
</pre>
Relations are expressed as <i>my wife</i> or <i>my son's wife</i>, as defined by <tt>xOf</tt>
below. Languages without productive genitives must use an equivalent of
<i>the wife of my son</i> for non-pronouns.
<pre>
Wife = xOf sing (mkN "wife") ;
Husband = xOf sing (mkN "husband") ;
Son = xOf sing (mkN "son") ;
Daughter = xOf sing (mkN "daughter") ;
Children = xOf plur L.child_N ;
</pre>
week days
<pre>
Monday = mkDay "Monday" ;
Tuesday = mkDay "Tuesday" ;
Wednesday = mkDay "Wednesday" ;
Thursday = mkDay "Thursday" ;
Friday = mkDay "Friday" ;
Saturday = mkDay "Saturday" ;
Sunday = mkDay "Sunday" ;
Tomorrow = P.mkAdv "tomorrow" ;
</pre>
modifiers of places
<pre>
TheBest = mkSuperl L.good_A ;
TheClosest = mkSuperl L.near_A ;
TheCheapest = mkSuperl (mkA "cheap") ;
TheMostExpensive = mkSuperl (mkA "expensive") ;
TheMostPopular = mkSuperl (mkA "popular") ;
TheWorst = mkSuperl L.bad_A ;
SuperlPlace sup p = placeNP sup p ;
</pre>
transports
<pre>
HowFar place = mkQS (mkQCl far_IAdv place.name) ;
HowFarFrom x y = mkQS (mkQCl far_IAdv (mkNP y.name (SyntaxEng.mkAdv from_Prep x.name))) ;
HowFarFromBy x y t =
mkQS (mkQCl far_IAdv (mkNP (mkNP y.name (SyntaxEng.mkAdv from_Prep x.name)) t)) ;
HowFarBy y t = mkQS (mkQCl far_IAdv (mkNP y.name t)) ;
WhichTranspPlace trans place =
mkQS (mkQCl (mkIP which_IDet trans.name) (mkVP (mkVP L.go_V) place.to)) ;
IsTranspPlace trans place =
mkQS (mkQCl (mkCl (mkCN trans.name place.to))) ;
</pre>
auxiliaries
<pre>
oper
mkNat : Str -> Str -> NPNationality = \nat,co ->
mkNPNationality (mkNP (mkPN nat)) (mkNP (mkPN co)) (mkA nat) ;
mkDay : Str -> {name : NP ; point : Adv ; habitual : Adv} = \d ->
let day = mkNP (mkPN d) in
mkNPDay day (SyntaxEng.mkAdv on_Prep day)
(SyntaxEng.mkAdv on_Prep (mkNP a_Quant plNum (mkCN (mkN d)))) ;
mkCompoundPlace : Str -> Str -> Str -> {name : CN ; at : Prep ; to : Prep; isPl : Bool} = \comp, p, i ->
mkCNPlace (mkCN (P.mkN comp (mkN p))) (P.mkPrep i) to_Prep ;
mkPlace : Str -> Str -> {name : CN ; at : Prep ; to : Prep; isPl : Bool} = \p,i ->
mkCNPlace (mkCN (mkN p)) (P.mkPrep i) to_Prep ;
open_Adv = P.mkAdv "open" ;
closed_Adv = P.mkAdv "closed" ;
xOf : GNumber -> N -> NPPerson -> NPPerson = \n,x,p ->
relativePerson n (mkCN x) (\a,b,c -> mkNP (GenNP b) a c) p ;
nameOf : NPPerson -> NP = \p -> (xOf sing (mkN "name") p).name ;
mkTransport : N -> {name : CN ; by : Adv} = \n -> {
name = mkCN n ;
by = SyntaxEng.mkAdv by8means_Prep (mkNP n)
} ;
mkSuperl : A -> Det = \a -> SyntaxEng.mkDet the_Art (SyntaxEng.mkOrd a) ;
far_IAdv = ExtraEng.IAdvAdv (ss "far") ;
}
</pre>
</body>
</html>

View File

@@ -1,59 +0,0 @@
compile = runghc Compile
forApp:
$(compile) -opt Bul Cat Chi Dut Eng Est Fin Fre Ger Hin Ita Jpn Rus Spa Swe Tha Urd
make gfos
.PHONY: gfos
Chi:
$(compile) Chi
all: demo missing gfos
gfos:
mkdir -p gfos && cp -p *.gfo gfos
thaidroid: #thaiscript
cp -p Phrasebook.pgf FullPhrasebook.pgf
$(compile) -opt Eng Swe Tha Thb DisambPhrasebookEng
$(compile) -link Eng Fin Swe Tha Thb DisambPhrasebookEng
mv Phrasebook.pgf Thaidroid.pgf
mv FullPhrasebook.pgf Phrasebook.pgf
thaiscript:
runghc ../../lib/src/thai/ThaiScript.hs
demo: compdemo fin linkdemo
compdemo:
$(compile) -opt Bul Cat Chi Dan Dut Eng Fre Ger Hin Ita Jpn Lav Nor Pes Pol Ron Rus Spa Swe Tha Urd DisambPhrasebookEng
linkdemo:
$(compile) -link Eng Bul Cat Chi Dan Dut Fin Fre Ger Hin Ita Jpn Lav Nor Pes Pol Ron Rus Spa Swe Tha Urd DisambPhrasebookEng
linkdemothb:
$(compile) -link Eng Bul Cat Chi Dan Dut Fin Fre Ger Ita Jpn Nor Pol Ron Rus Spa Swe Tha Thb Urd DisambPhrasebookEng
#separate, because slow...
fin:
$(compile) -opt Fin
missing:
echo "pg -missing | wf -file=missing.txt" | gf -run Phrasebook.pgf
doc:
cat Sentences.gf Words.gf >Ontology.gf
gfdoc Ontology.gf
rm -f Ontology.gf
cat SentencesI.gf WordsEng.gf >Implementation.gf
gfdoc Implementation.gf
txt2tags -thtml --toc doc-phrasebook.txt
txt2tags -thtml help-phrasebook.txt
rm -f Ontology.gf Implementation.gf
clean:
rm *.gfo *.pgf
upload:: Phrasebook.pgf
rsync -avb Phrasebook.pgf www.grammaticalframework.org:/usr/local/www/GF-demos/www/grammars

View File

@@ -1,38 +0,0 @@
# Use 'make -j' to compile everything in parallel
# Use e.g. 'make -j4' to compile at most 4 things in parallel
S=-s
GFOPT=gf -make $S -optimize-pgf
all: Phrasebook.pgf
Phrasebook.pgf: PhrasebookFre.pgf PhrasebookGer.pgf PhrasebookFin.pgf PhrasebookEng.pgf PhrasebookBul.pgf PhrasebookCat.pgf PhrasebookChi.pgf PhrasebookDan.pgf PhrasebookDut.pgf PhrasebookHin.pgf PhrasebookIta.pgf PhrasebookJpn.pgf PhrasebookLav.pgf PhrasebookNor.pgf PhrasebookPes.pgf PhrasebookPol.pgf PhrasebookRon.pgf PhrasebookRus.pgf PhrasebookSnd.pgf PhrasebookSpa.pgf PhrasebookSwe.pgf PhrasebookTha.pgf PhrasebookUrd.pgf DisambPhrasebookEng.pgf
gf -make $^
PhrasebookEng.pgf:: ; $(GFOPT) -name=PhrasebookEng PhrasebookEng.gf
PhrasebookBul.pgf:: ; $(GFOPT) -name=PhrasebookBul PhrasebookBul.gf
PhrasebookCat.pgf:: ; $(GFOPT) -name=PhrasebookCat PhrasebookCat.gf
PhrasebookChi.pgf:: ; $(GFOPT) -name=PhrasebookChi PhrasebookChi.gf
PhrasebookDan.pgf:: ; $(GFOPT) -name=PhrasebookDan PhrasebookDan.gf
PhrasebookDut.pgf:: ; $(GFOPT) -name=PhrasebookDut PhrasebookDut.gf
PhrasebookFin.pgf:: ; $(GFOPT) -name=PhrasebookFin PhrasebookFin.gf
PhrasebookFre.pgf:: ; $(GFOPT) -name=PhrasebookFre PhrasebookFre.gf
PhrasebookGer.pgf:: ; $(GFOPT) -name=PhrasebookGer PhrasebookGer.gf
PhrasebookHin.pgf:: ; $(GFOPT) -name=PhrasebookHin PhrasebookHin.gf
PhrasebookIta.pgf:: ; $(GFOPT) -name=PhrasebookIta PhrasebookIta.gf
PhrasebookJpn.pgf:: ; $(GFOPT) -name=PhrasebookJpn PhrasebookJpn.gf
PhrasebookLav.pgf:: ; $(GFOPT) -name=PhrasebookLav PhrasebookLav.gf
PhrasebookNor.pgf:: ; $(GFOPT) -name=PhrasebookNor PhrasebookNor.gf
PhrasebookPes.pgf:: ; $(GFOPT) -name=PhrasebookPes PhrasebookPes.gf
PhrasebookPol.pgf:: ; $(GFOPT) -name=PhrasebookPol PhrasebookPol.gf
PhrasebookRon.pgf:: ; $(GFOPT) -name=PhrasebookRon PhrasebookRon.gf
PhrasebookRus.pgf:: ; $(GFOPT) -name=PhrasebookRus PhrasebookRus.gf
PhrasebookSnd.pgf:: ; $(GFOPT) -name=PhrasebookSnd PhrasebookSnd.gf
PhrasebookSpa.pgf:: ; $(GFOPT) -name=PhrasebookSpa PhrasebookSpa.gf
PhrasebookSwe.pgf:: ; $(GFOPT) -name=PhrasebookSwe PhrasebookSwe.gf
PhrasebookTha.pgf:: ; $(GFOPT) -name=PhrasebookTha PhrasebookTha.gf
PhrasebookUrd.pgf:: ; $(GFOPT) -name=PhrasebookUrd PhrasebookUrd.gf
DisambPhrasebookEng.pgf::
$(GFOPT) -name=DisambPhrasebookEng DisambPhrasebookEng.gf

View File

@@ -1,372 +0,0 @@
<html>
<body>
<i> Produced by
gfdoc - a rudimentary GF document generator.
(c) Aarne Ranta (aarne@cs.chalmers.se) 2002 under GNU GPL.
</i>
<p>
<h1> The Ontology of the Phrasebook</h1>
<h2> Syntactic Structures of the Phrasebook</h2>
This module contains phrases that can be defined by a functor over the
resource grammar API. The phrases that are likely to have different implementations
are in the module Words. But the distinction is not quite sharp; thus it may happen
that the functor instantiations make exceptions.
<pre>
abstract Sentences = Numeral ** {
</pre>
The ontology of the phrasebook is defined by the following types. The commented ones
are defined in other modules.
<pre>
cat
Phrase ; -- complete phrase, the unit of translation e.g. "Where are you?"
Sentence ; -- declarative sentence e.g. "I am in the bar"
Question ; -- question, either yes/no or wh e.g. "where are you"
-- Greeting ; -- idiomatic phrase, not inflected, e.g. "hello"
Proposition ; -- can be turned into sentence or question e.g. "this pizza is good"
Object ; -- the object of wanting, ordering, etc e.g. "three pizzas and a beer"
PrimObject ; -- single object of wanting, ordering, etc e.g. "three pizzas"
Item ; -- a single entity e.g. "this pizza"
Kind ; -- a type of an item e.g. "pizza"
MassKind ; -- a type mass (uncountable) e.g. "water"
Quality ; -- qualification of an item, can be complex e.g. "very good"
Property ; -- basic property of an item, one word e.g. "good"
Place ; -- location e.g. "the bar"
PlaceKind ; -- type of location e.g. "bar"
Currency ; -- currency unit e.g. "leu"
Price ; -- number of currency units e.g. "eleven leu"
Person ; -- agent wanting or doing something e.g. "you"
Action ; -- proposition about a Person e.g. "you are here"
Nationality ; -- complex of language, property, country e.g. "Swedish, Sweden"
Language ; -- language (can be without nationality) e.g. "Flemish"
Citizenship ; -- property (can be without language) e.g. "Belgian"
Country ; -- country (can be without language) e.g. "Belgium"
Day ; -- weekday type e.g. "Friday"
Date ; -- definite date e.g. "on Friday"
Name ; -- name of person e.g. "NN"
Number ; -- number expression 1 .. 999,999 e.g. "twenty"
Transport ; -- transportation device e.g. "car"
ByTransport ; -- mean of transportation e.g. "by tram"
Superlative ; -- superlative modifiers of places e.g. "the best restaurant"
</pre>
Many of the categories are accessible as Phrases, i.e. as translation units.
<pre>
fun
PSentence : Sentence -> Phrase ;
PQuestion : Question -> Phrase ;
PObject : Object -> Phrase ;
PKind : Kind -> Phrase ;
PMassKind : MassKind -> Phrase ;
PQuality : Quality -> Phrase ;
PNumber : Number -> Phrase ;
PPlace : Place -> Phrase ;
PPlaceKind : PlaceKind -> Phrase ;
PCurrency : Currency -> Phrase ;
PPrice : Price -> Phrase ;
PLanguage : Language -> Phrase ;
PCitizenship : Citizenship -> Phrase ;
PCountry : Country -> Phrase ;
PDay : Day -> Phrase ;
PByTransport : ByTransport -> Phrase ;
PTransport : Transport -> Phrase ;
PYes, PNo, PYesToNo : Phrase ; -- yes, no, si/doch (pos. answer to neg. question)
</pre>
This is the way to build propositions about inanimate items.
<pre>
Is : Item -> Quality -> Proposition ; -- this pizza is good
</pre>
To use propositions on higher levels.
<pre>
SProp : Proposition -> Sentence ; -- this pizza is good
SPropNot : Proposition -> Sentence ; -- this pizza isn't good
QProp : Proposition -> Question ; -- is this pizza good
WherePlace : Place -> Question ; -- where is the bar
WherePerson : Person -> Question ; -- where are you
</pre>
This is the way to build propositions about persons.
<pre>
PropAction : Action -> Proposition ; -- (you (are|aren't) | are you) Swedish
</pre>
Here are some general syntactic constructions.
<pre>
ObjItem : Item -> PrimObject ; -- this pizza
ObjNumber : Number -> Kind -> PrimObject ; -- five pizzas
ObjIndef : Kind -> PrimObject ; -- a pizza
ObjPlural : Kind -> PrimObject ; -- pizzas
ObjMass : MassKind -> PrimObject ; -- water
ObjAndObj : PrimObject -> Object -> Object ; -- this pizza and a beer
OneObj : PrimObject -> Object ; -- this pizza
SuchKind : Quality -> Kind -> Kind ; -- Italian pizza
SuchMassKind : Quality -> MassKind -> MassKind ; -- Italian water
Very : Property -> Quality ; -- very Italian
Too : Property -> Quality ; -- too Italian
PropQuality : Property -> Quality ; -- Italian
</pre>
Determiners.
<pre>
This, That, These, Those : Kind -> Item ; -- this pizza,...,those pizzas
The, Thes : Kind -> Item ; -- the pizza, the pizzas
ThisMass, ThatMass, TheMass : MassKind -> Item ; -- this/that/the water
AmountCurrency : Number -> Currency -> Price ; -- five euros
ThePlace : PlaceKind -> Place ; -- the bar
APlace : PlaceKind -> Place ; -- a bar
IMale, IFemale, -- I, said by man/woman (affects agreement)
YouFamMale, YouFamFemale, -- familiar you, said to man/woman (affects agreement)
YouPolMale, YouPolFemale : Person ; -- polite you, said to man/woman (affects agreement)
LangNat : Nationality -> Language ; -- Swedish
CitiNat : Nationality -> Citizenship ; -- Swedish
CountryNat : Nationality -> Country ; -- Sweden
PropCit : Citizenship -> Property ; -- Swedish
OnDay : Day -> Date ; -- on Friday
Today : Date ; -- today
PersonName : Name -> Person ; -- person referred by name
NameNN : Name ; -- the name "NN"
</pre>
<pre>
NNumeral : Numeral -> Number ; -- numeral in words, e.g. "twenty"
</pre>
Actions are typically language-dependent, not only lexically but also
structurally. However, these ones are mostly functorial.
<pre>
SHave : Person -> Object -> Sentence ; -- you have beer
SHaveNo : Person -> Kind -> Sentence ; -- you have no apples
SHaveNoMass : Person -> MassKind -> Sentence ; -- you have no beer
QDoHave : Person -> Object -> Question ; -- do you have beer
AHaveCurr : Person -> Currency -> Action ; -- you have dollars
ACitizen : Person -> Citizenship -> Action ; -- you are Swedish
ABePlace : Person -> Place -> Action ; -- you are in the bar
ByTransp : Transport -> ByTransport ; -- by bus
}
</pre>
<h2> Words and idiomatic phrases of the Phrasebook</h2>
<pre>
abstract Words = Sentences ** {
fun
</pre>
kinds of items (so far mostly food stuff)
<pre>
Apple : Kind ;
Beer : MassKind ;
Bread : MassKind ;
Cheese : MassKind ;
Chicken : MassKind ;
Coffee : MassKind ;
Fish : MassKind ;
Meat : MassKind ;
Milk : MassKind ;
Pizza : Kind ;
Salt : MassKind ;
Tea : MassKind ;
Water : MassKind ;
Wine : MassKind ;
</pre>
properties of kinds (so far mostly of food)
<pre>
Bad : Property ;
Boring : Property ;
Cheap : Property ;
Cold : Property ;
Delicious : Property ;
Expensive : Property ;
Fresh : Property ;
Good : Property ;
Suspect : Property ;
Warm : Property ;
</pre>
kinds of places
<pre>
Airport : PlaceKind ;
AmusementPark : PlaceKind ;
Bank : PlaceKind ;
Bar : PlaceKind ;
Cafeteria : PlaceKind ;
Center : PlaceKind ;
Cinema : PlaceKind ;
Church : PlaceKind ;
Disco : PlaceKind ;
Hospital : PlaceKind ;
Hotel : PlaceKind ;
Museum : PlaceKind ;
Park : PlaceKind ;
Parking : PlaceKind ;
Pharmacy : PlaceKind ;
PostOffice : PlaceKind ;
Pub : PlaceKind ;
Restaurant : PlaceKind ;
School : PlaceKind ;
Shop : PlaceKind ;
Station : PlaceKind ;
Supermarket : PlaceKind ;
Theatre : PlaceKind ;
Toilet : PlaceKind ;
University : PlaceKind ;
Zoo : PlaceKind ;
CitRestaurant : Citizenship -> PlaceKind ;
</pre>
currency units
<pre>
DanishCrown : Currency ;
Dollar : Currency ;
Euro : Currency ; -- Germany, France, Italy, Finland, Spain, The Netherlands
Lei : Currency ; -- Romania
Leva : Currency ; -- Bulgaria
NorwegianCrown : Currency ;
Pound : Currency ; -- UK
Rouble : Currency ; -- Russia
SwedishCrown : Currency ;
Zloty : Currency ; -- Poland
</pre>
nationalities, countries, languages, citizenships
<pre>
Belgian : Citizenship ;
Belgium : Country ;
Bulgarian : Nationality ;
Catalan : Nationality ;
Danish : Nationality ;
Dutch : Nationality ;
English : Nationality ;
Finnish : Nationality ;
Flemish : Language ;
French : Nationality ;
German : Nationality ;
Italian : Nationality ;
Norwegian : Nationality ;
Polish : Nationality ;
Romanian : Nationality ;
Russian : Nationality ;
Spanish : Nationality ;
Swedish : Nationality ;
</pre>
means of transportation
<pre>
Bike : Transport ;
Bus : Transport ;
Car : Transport ;
Ferry : Transport ;
Plane : Transport ;
Subway : Transport ;
Taxi : Transport ;
Train : Transport ;
Tram : Transport ;
ByFoot : ByTransport ;
</pre>
Actions (which can be expressed by different structures in different languages).
Notice that also negations and questions can be formed from these.
<pre>
AHasAge : Person -> Number -> Action ; -- I am seventy years
AHasChildren: Person -> Number -> Action ; -- I have six children
AHasName : Person -> Name -> Action ; -- my name is Bond
AHasRoom : Person -> Number -> Action ; -- you have a room for five persons
AHasTable : Person -> Number -> Action ; -- you have a table for five persons
AHungry : Person -> Action ; -- I am hungry
AIll : Person -> Action ; -- I am ill
AKnow : Person -> Action ; -- I (don't) know
ALike : Person -> Item -> Action ; -- I like this pizza
ALive : Person -> Country -> Action ; -- I live in Sweden
ALove : Person -> Person -> Action ; -- I love you
AMarried : Person -> Action ; -- I am married
AReady : Person -> Action ; -- I am ready
AScared : Person -> Action ; -- I am scared
ASpeak : Person -> Language -> Action ; -- I speak Finnish
AThirsty : Person -> Action ; -- I am thirsty
ATired : Person -> Action ; -- I am tired
AUnderstand : Person -> Action ; -- I (don't) understand
AWant : Person -> Object -> Action ; -- I want two apples
AWantGo : Person -> Place -> Action ; -- I want to go to the hospital
</pre>
Miscellaneous phrases. Notice that also negations and questions can be formed from
propositions.
<pre>
QWhatAge : Person -> Question ; -- how old are you
QWhatName : Person -> Question ; -- what is your name
HowMuchCost : Item -> Question ; -- how much does the pizza cost
ItCost : Item -> Price -> Proposition ; -- the pizza costs five euros
PropOpen : Place -> Proposition ; -- the museum is open
PropClosed : Place -> Proposition ; -- the museum is closed
PropOpenDate : Place -> Date -> Proposition ; -- the museum is open today
PropClosedDate : Place -> Date -> Proposition ; -- the museum is closed today
PropOpenDay : Place -> Day -> Proposition ; -- the museum is open on Mondays
PropClosedDay : Place -> Day -> Proposition ; -- the museum is closed on Mondays
PSeeYouPlaceDate : Place -> Date -> Phrase ; -- see you in the bar on Monday
PSeeYouPlace : Place -> Phrase ; -- see you in the bar
PSeeYouDate : Date -> Phrase ; -- see you on Monday
</pre>
family relations
<pre>
Wife, Husband : Person -> Person ; -- my wife, your husband
Son, Daughter : Person -> Person ; -- my son, your husband
Children : Person -> Person ; -- my children
</pre>
week days
<pre>
Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday : Day ;
Tomorrow : Date ;
</pre>
transports
<pre>
HowFar : Place -> Question ; -- how far is the zoo ?
HowFarFrom : Place -> Place -> Question ; -- how far is the center from the hotel ?
HowFarFromBy : Place -> Place -> ByTransport -> Question ;
-- how far is the airport from the hotel by taxi ?
HowFarBy : Place -> ByTransport -> Question ; -- how far is the museum by bus ?
WhichTranspPlace : Transport -> Place -> Question ; -- which bus goes to the hotel
IsTranspPlace : Transport -> Place -> Question ; -- is there a metro to the airport ?
</pre>
modifiers of places
<pre>
TheBest : Superlative ;
TheClosest : Superlative ;
TheCheapest : Superlative ;
TheMostExpensive : Superlative ;
TheMostPopular : Superlative ;
TheWorst : Superlative ;
SuperlPlace : Superlative -> PlaceKind -> Place ; -- the best bar
}
</pre>
</body>
</html>

View File

@@ -1,8 +0,0 @@
abstract Phrasebook =
Greetings,
Words
** {
flags startcat = Phrase ;
}

View File

@@ -1,9 +0,0 @@
--# -path=.:present
concrete PhrasebookBul of Phrasebook =
GreetingsBul,
WordsBul ** open
SyntaxBul,
Prelude in {
}

View File

@@ -1,11 +0,0 @@
--# -path=.:present
concrete PhrasebookCat of Phrasebook =
GreetingsCat,
WordsCat
** open
SyntaxCat,
Prelude in {
}

View File

@@ -1,11 +0,0 @@
--# -path=.:alltenses
concrete PhrasebookChi of Phrasebook =
GreetingsChi,
WordsChi
** open
SyntaxChi,
Prelude in {
}

View File

@@ -1,9 +0,0 @@
--# -path=.:present:alltenses
concrete PhrasebookDan of Phrasebook =
GreetingsDan,
WordsDan ** open
SyntaxDan,
Prelude in {
}

View File

@@ -1,10 +0,0 @@
--# -path=.:present
concrete PhrasebookDut of Phrasebook =
GreetingsDut,
WordsDut ** open
SyntaxDut,
Prelude in {
}

Some files were not shown because too many files have changed in this diff Show More