more efficient way of compiling Finnish compounds

This commit is contained in:
aarne
2010-12-29 09:22:07 +00:00
parent 3f9313cc0f
commit d1301b75f1
4 changed files with 15 additions and 3 deletions

View File

@@ -299,7 +299,11 @@ oper
= c99 ; -- dummy
-- compound nouns, latter part inflected
compoundNK : (Str -> NForms) -> Str -> Str -> NForms = \d,x,y ->
compoundNK : Str -> NForms -> NForms = \x,y ->
\\v => x + y ! v ;
--- this is a lot slower
fcompoundNK : (Str -> NForms) -> Str -> Str -> NForms = \d,x,y ->
let ys = d y in \\v => x + ys ! v ;
}

View File

@@ -56,7 +56,7 @@ mkCompound compMap (w,ent) =
Just (e,b) -> return (w, ent {
word = word e,
tn = tn e,
par = "compoundNK " ++ par e ++ " " ++ quoted b,
par = unwords ["compoundNK",par e,quoted b],
isDummy = tn e == 0
}
)
@@ -112,7 +112,9 @@ mkRules e = do
| otherwise = putStrLn
mkFun fun cat = unwords ["fun",fun,":",cat,";"]
mkLin fun par w = unwords ["lin",fun,"=",par,quoted w,";"]
mkLin fun par w = case words par of
f@"compoundNK":p:v:_ -> unwords ["lin",fun,"=",f,v,"("++ p,quoted w ++")",";"]
_ -> unwords ["lin",fun,"=",par,quoted w,";"]
mkId = concatMap trim where
trim c = case fromEnum c of

View File

@@ -2,5 +2,8 @@
concrete DictCompFin of DictCompFinAbs = DictFin ** open MorphoFin, Kotus, Prelude in {
-- extracted from http://kaino.kotus.fi/sanat/nykysuomi/, licensed under LGPL
-- non-compounds in DictFin (inherited)
flags coding = utf8 ;

View File

@@ -2,6 +2,9 @@
concrete DictFin of DictFinAbs = open MorphoFin, Kotus, Prelude in {
-- extracted from http://kaino.kotus.fi/sanat/nykysuomi/, licensed under LGPL
-- compounds in DictCompFin
flags coding = utf8 ;
lincat NK = NForms ; AK = NForms ; VK = VForms ; AdvK = SS ;