summaryrefslogtreecommitdiff
path: root/src/GF/Canon/GFCC
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-09-26 10:23:50 +0000
committeraarne <aarne@cs.chalmers.se>2006-09-26 10:23:50 +0000
commitdeee60f2c2075731be0db1d431114ac1ecf8e483 (patch)
treedc4dca80f901dd7253f5523446faf2f92739fae6 /src/GF/Canon/GFCC
parentbe2f1ac5c8272837a553dfe484a678813c73fd5b (diff)
improving gfcc generation
Diffstat (limited to 'src/GF/Canon/GFCC')
-rw-r--r--src/GF/Canon/GFCC/DataGFCC.hs2
-rw-r--r--src/GF/Canon/GFCC/GFCC.cf6
-rw-r--r--src/GF/Canon/GFCC/Test.gf28
3 files changed, 16 insertions, 20 deletions
diff --git a/src/GF/Canon/GFCC/DataGFCC.hs b/src/GF/Canon/GFCC/DataGFCC.hs
index 32b61b9c8..74cced037 100644
--- a/src/GF/Canon/GFCC/DataGFCC.hs
+++ b/src/GF/Canon/GFCC/DataGFCC.hs
@@ -78,6 +78,8 @@ compute mcfg lang args = compg [] where
P r p -> case (comp r, comp p) of
-- for the suffix optimization
+ (W s t, R (C i : _)) -> comp $ P (W s t) (C i)
+
(W s t, C i) -> case comp t of
R ss -> case comp $ idx ss (fromInteger i) of
K (KS u) -> kks (s ++ u) -- the only case where W occurs
diff --git a/src/GF/Canon/GFCC/GFCC.cf b/src/GF/Canon/GFCC/GFCC.cf
index b7298cdd9..a58544953 100644
--- a/src/GF/Canon/GFCC/GFCC.cf
+++ b/src/GF/Canon/GFCC/GFCC.cf
@@ -29,9 +29,9 @@ A. Term ::= "(" CId "->" Term ")" ; -- lambda abstraction (compressed ta
FV. Term ::= "[|" [Term] "|]" ; -- free variation
W. Term ::= "(" String "+" Term ")" ; -- prefix + suffix table
-KS. Tokn ::= String ;
-KP. Tokn ::= "[" "pre" [String] "[" [Variant] "]" "]" ;
-Var. Variant ::= [String] "/" [String] ;
+KS. Tokn ::= String ;
+KP. Tokn ::= "[" "pre" [String] "[" [Variant] "]" "]" ;
+Var. Variant ::= [String] "/" [String] ;
terminator Concrete ";" ;
diff --git a/src/GF/Canon/GFCC/Test.gf b/src/GF/Canon/GFCC/Test.gf
index 6700d90f3..5cd4c5474 100644
--- a/src/GF/Canon/GFCC/Test.gf
+++ b/src/GF/Canon/GFCC/Test.gf
@@ -1,11 +1,13 @@
-- to test GFCC compilation
+flags coding=utf8 ;
+
cat S ; NP ; N ; VP ;
fun Pred : NP -> VP -> S ;
fun Pred2 : NP -> VP -> NP -> S ;
fun Det, Dets : N -> NP ;
-fun Mina, Te : NP ;
+fun Mina, Sina, Me, Te : NP ;
fun Raha, Paska, Pallo : N ;
fun Puhua, Munia, Sanoa : VP ;
@@ -22,24 +24,16 @@ lincat VP = Verb ;
oper Noun = {s : NForm => Str} ;
oper Verb = {s : VForm => Str} ;
-lincat NP = {s : Case => Str ; n : Number ; p : Person} ;
-lin Pred np vp = {s = np.s ! Nom ++ vp.s ! VF np.n np.p} ;
-lin Pred2 np vp ob = {s = np.s ! Nom ++ vp.s ! VF np.n np.p ++ ob.s ! Part} ;
-lin Det no = {s = \\c => no.s ! NF Sg c ; n = Sg ; p = P3} ;
-lin Dets no = {s = \\c => no.s ! NF Pl c ; n = Pl ; p = P3} ;
-lin Mina = {s = table Case ["minä" ; "minua"] ; n = Sg ; p = P1} ;
-lin Te = {s = table Case ["te" ; "teitä"] ; n = Pl ; p = P2} ;
-
+lincat NP = {s : Case => Str ; a : {n : Number ; p : Person}} ;
--- for test
-cat NPR ;
-fun PredR : NPR -> VP -> S ;
-fun Sina, Me : NPR ;
-lincat NPR = {s : Case => Str ; a : {n : Number ; p : Person}} ;
-lin PredR np vp = {s = np.s ! Nom ++ vp.s ! VF np.a.n np.a.p} ;
+lin Pred np vp = {s = np.s ! Nom ++ vp.s ! VF np.a.n np.a.p} ;
+lin Pred2 np vp ob = {s = np.s ! Nom ++ vp.s ! VF np.a.n np.a.p ++ ob.s ! Part} ;
+lin Det no = {s = \\c => no.s ! NF Sg c ; a = {n = Sg ; p = P3}} ;
+lin Dets no = {s = \\c => no.s ! NF Pl c ; a = {n = Pl ; p = P3}} ;
+lin Mina = {s = table Case ["minä" ; "minua"] ; a = {n = Sg ; p = P1}} ;
+lin Te = {s = table Case ["te" ; "teitä"] ; a = {n = Pl ; p = P2}} ;
lin Sina = {s = table Case ["sinä" ; "sinua"] ; a = {n = Sg ; p = P2}} ;
-lin Me = {s = table Case ["me" ; "meitä"] ; a = {n = Pl ; p = P1}} ;
--- end test
+lin Me = {s = table Case ["me" ; "meitä"] ; a = {n = Pl ; p = P1}} ;
lin Raha = mkN "raha" ;
lin Paska = mkN "paska" ;