summaryrefslogtreecommitdiff
path: root/examples/foods/FoodsPes.gf
diff options
context:
space:
mode:
authorjohn.j.camilleri <john.j.camilleri@chalmers.se>2013-09-16 07:17:27 +0000
committerjohn.j.camilleri <john.j.camilleri@chalmers.se>2013-09-16 07:17:27 +0000
commitf5461eb3d4eb2605b546a4ed202c12bcdaa1f4e4 (patch)
tree946c9e8542b8e8271b6b529a95c0400fa6613cb4 /examples/foods/FoodsPes.gf
parent8e1c6cca407c82fc09569d80c231b8d256735989 (diff)
Remove contribs and examples
Everything has now been moved to a separate repository at https://github.com/GrammaticalFramework/gf-contrib The contents of the examples folder are build during SetupWeb
Diffstat (limited to 'examples/foods/FoodsPes.gf')
-rw-r--r--examples/foods/FoodsPes.gf65
1 files changed, 65 insertions, 0 deletions
diff --git a/examples/foods/FoodsPes.gf b/examples/foods/FoodsPes.gf
new file mode 100644
index 000000000..c2e631e81
--- /dev/null
+++ b/examples/foods/FoodsPes.gf
@@ -0,0 +1,65 @@
+concrete FoodsPes of Foods = {
+
+ flags optimize=noexpand ; coding=utf8 ;
+
+ lincat
+ Comment = {s : Str} ;
+ Quality = {s : Add => Str; prep : Str} ;
+ Kind = {s : Add => Number => Str ; prep : Str};
+ Item = {s : Str ; n : Number};
+ lin
+ Pred item quality = {s = item.s ++ quality.s ! Indep ++ copula ! item.n} ;
+ This = det Sg "این" ;
+ That = det Sg "آن" ;
+ These = det Pl "این" ;
+ Those = det Pl "آن" ;
+
+ Mod quality kind = {s = \\a,n => kind.s ! Attr ! n ++ kind.prep ++ quality.s ! a ;
+ prep = quality.prep
+ };
+ Wine = regN "شراب" ;
+ Cheese = regN "پنیر" ;
+ Fish = regN "ماهى" ;
+ Pizza = regN "پیتزا" ;
+ Very a = {s = \\at => "خیلی" ++ a.s ! at ; prep = a.prep} ;
+ Fresh = adj "تازه" ;
+ Warm = adj "گرم" ;
+ Italian = adj "ایتالیایی" ;
+ Expensive = adj "گران" ;
+ Delicious = adj "لذىذ" ;
+ Boring = adj "ملال آور" ; -- it must be written as ملال آور.
+
+ param
+ Number = Sg | Pl ;
+ Add = Indep | Attr ;
+ oper
+ det : Number -> Str -> {s: Add => Number => Str ; prep : Str} -> {s : Str ; n: Number} =
+ \n,det,noun -> {s = det ++ noun.s ! Indep ! n ; n = n };
+
+ noun : (x1,_,_,x4 : Str) -> {s : Add => Number => Str ; prep : Str} = \pytzA, pytzAy, pytzAhA,pr ->
+ {s = \\a,n => case <a,n> of
+ {<Indep,Sg> => pytzA ; <Indep,Pl> => pytzAhA ;
+ <Attr,Sg> =>pytzA ; <Attr,Pl> => pytzAhA + "ى" };
+ prep = pr
+ };
+
+ regN : Str -> {s: Add => Number => Str ; prep : Str} = \mrd ->
+ case mrd of
+ { _ + ("ا"|"ه"|"ى"|"و"|"") => noun mrd (mrd+"ى") (mrd + "ها") "";
+ _ => noun mrd mrd (mrd + "ها") "e"
+ };
+
+ adj : Str -> {s : Add => Str; prep : Str} = \tAzh ->
+ case tAzh of
+ { _ + ("ا"|"ه"|"ى"|"و"|"") => mkAdj tAzh (tAzh ++ "ى") "" ;
+ _ => mkAdj tAzh tAzh "ه"
+ };
+
+ mkAdj : Str -> Str -> Str -> {s : Add => Str; prep : Str} = \tAzh, tAzhy, pr ->
+ {s = table {Indep => tAzh;
+ Attr => tAzhy};
+ prep = pr
+ };
+ copula : Number => Str = table {Sg => "است"; Pl => "هستند"};
+
+} \ No newline at end of file