mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
more efficient way of compiling Finnish compounds
This commit is contained in:
@@ -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 ;
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
Reference in New Issue
Block a user