summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2008-01-28 17:41:51 +0000
committeraarne <aarne@cs.chalmers.se>2008-01-28 17:41:51 +0000
commit4c3aa8c164a920abcbe306c704e6e8229a6d0025 (patch)
treec4c903f325507316cc87d223e2458c3356fa6aea /examples
parent327c63eb741606adf5d7d98cd32b731f6bda7ae7 (diff)
finnish updates
Diffstat (limited to 'examples')
-rw-r--r--examples/uusisuomi/Makefile4
-rw-r--r--examples/uusisuomi/MkLex.hs22
-rw-r--r--examples/uusisuomi/Nominal.gf36
-rw-r--r--examples/uusisuomi/Verbal.gf9
4 files changed, 63 insertions, 8 deletions
diff --git a/examples/uusisuomi/Makefile b/examples/uusisuomi/Makefile
index 0df65f1b1..67c609e9f 100644
--- a/examples/uusisuomi/Makefile
+++ b/examples/uusisuomi/Makefile
@@ -21,6 +21,10 @@ nouns:
cat all-diff-* >all-differences
cat all-differences
+CSC:
+ export LEX=NCSC ; make -e tests
+ cat all-diff-NCSC
+
gf-files:
runghc MkLex.hs 0 $(CAT) $(LEX) > $(LEX)Abs.gf
runghc MkLex.hs 1 $(CAT) $(LEX) > $(LEX)1.gf
diff --git a/examples/uusisuomi/MkLex.hs b/examples/uusisuomi/MkLex.hs
index 9d6525aee..f91f5f585 100644
--- a/examples/uusisuomi/MkLex.hs
+++ b/examples/uusisuomi/MkLex.hs
@@ -38,7 +38,23 @@ initiate tgt cat i = mapM_ putStrLn [
]
nums = map prt [1 ..] where
- prt i = (if i < 10 then "0" else "") ++ show i ++ ". "
+---- prt i = (if i < 10 then "0" else "") ++ show i ++ ". "
+ prt i = let n = show i in replicate (4-length n) '0' ++ n ++ ". "
+
+-- W is the flag for mixed-class word lists
+mkLex "W" 0 line = case words line of
+ num:cat:sana:_ -> do
+ let nimi = "n" ++ init num ++ "_" ++ sana
+ putStrLn $ "fun " ++ nimi ++ "_" ++ cat ++ " : " ++ cat ++ " ;"
+ _ -> return ()
+
+mkLex "W" 1 line = case words line of
+ num:cat:sanat@(sana:_) -> do
+ let nimi = "n" ++ init num ++ "_" ++ sana
+ putStrLn $ "lin " ++ nimi ++
+ "_" ++ cat ++ " = mk" ++ cat ++ " " ++
+ unwords (map prQuoted sanat) ++" ;"
+ _ -> return ()
mkLex cat 0 line = case words line of
num:sana:_ -> do
@@ -68,6 +84,7 @@ mkLex "N" 2 line = case words line of
_ -> return ()
mkLex "N" 3 line = case words line of
+---- num:sana:sanan:sanoja:_ -> do
num:sana:sanan:_:_:_:_:sanoja:_ -> do
let nimi = "n" ++ init num ++ "_" ++ sana
putStrLn $ "lin " ++ nimi ++
@@ -82,7 +99,6 @@ mkLex "N" 4 line = case words line of
"\" \"" ++ sanoja ++ "\" \"" ++ sanaa ++ "\" ;"
_ -> return ()
-
-- to initiate from a noun list that has compounds
mkLex "N" 11 line = case words line of
@@ -94,6 +110,8 @@ mkLex "N" 11 line = case words line of
putStrLn $ "lin " ++ nimi ++ "_N = mkN \"" ++ sana ++ "\" ;"
_ -> return ()
+prQuoted s = concat ["\"",s,"\""]
+
-- from sora+tie to tie
uncompound = reverse . takeWhile (/= '+') . reverse
diff --git a/examples/uusisuomi/Nominal.gf b/examples/uusisuomi/Nominal.gf
index e9973f95d..23a28d892 100644
--- a/examples/uusisuomi/Nominal.gf
+++ b/examples/uusisuomi/Nominal.gf
@@ -44,6 +44,9 @@ resource Nominal = ResFin ** open MorphoFin,Declensions,CatFin,Prelude in {
-- \s,t,u -> nForms2N (nForms3 s t u) ;
mkN : (talo,talon,taloja,taloa : Str) -> N = mk4N ;
-- \s,t,u,v -> nForms2N (nForms4 s t u v) ;
+ mkN :
+ (talo,talon,taloa,talona,taloon,talojen,taloja,taloina,taloissa,taloihin
+ : Str) -> N = mk10N ;
mkN : (sora : Str) -> (tie : N) -> N = mkStrN ;
mkN : (oma,tunto : N) -> N = mkNN ;
} ;
@@ -56,6 +59,11 @@ resource Nominal = ResFin ** open MorphoFin,Declensions,CatFin,Prelude in {
mk3N : (talo,talon,taloja : Str) -> N = \s,t,u -> nForms2N (nForms3 s t u) ;
mk4N : (talo,talon,taloa,taloja : Str) -> N = \s,t,u,v ->
nForms2N (nForms4 s t u v) ;
+ mk10N :
+ (talo,talon,taloa,talona,taloon,talojen,taloja,taloina,taloissa,taloihin
+ : Str) -> N = \a,b,c,d,e,f,g,h,i,j ->
+ nForms2N (nForms10 a b c d e f g h i j) ;
+
mkStrN : Str -> N -> N = \sora,tie -> {
s = \\c => sora + tie.s ! c ; lock_N = <>
} ;
@@ -68,6 +76,7 @@ resource Nominal = ResFin ** open MorphoFin,Declensions,CatFin,Prelude in {
ukk = init ukko ;
uko = weakGrade ukko ;
ukon = uko + "n" ;
+ o = case last ukko of {"ä" => "ö" ; "a" => "o"} ; -- only used then
renka = Declensions.strongGrade (init ukko) ;
rake = Declensions.strongGrade ukko ;
in
@@ -83,14 +92,29 @@ resource Nominal = ResFin ** open MorphoFin,Declensions,CatFin,Prelude in {
_ + "e" => dRae ukko (rake + "en") ;
_ + ("ut" | "yt") => dRae ukko (ukk + "en") ;
_ + ("as" | "äs") => dRae ukko (renka + last renka + "n") ;
- _ + ("uus" | "yys") => dLujuus ukko ;
+ _ + ("uus" | "yys" | "eus" | "eys") => dLujuus ukko ;
_ + "s" => dJalas ukko ;
- _ + ("a" | "e" | "i") + C_ + _ + "aja" => -- opettaja correct autom.
+
+{- heuristics for 3-syllable nouns ending a/ä
+ _ + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") + C_ +
+ _ + "i" + C_ + a@("a" | "ä") =>
+ dSilakka ukko (ukko + "n") (ukk + o + "it" + a) ;
+ _ + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") + C_ + _ +
+ ("a" | "e" | "o" | "u" | "y" | "ä" | "ö") +
+ ("l" | "r" | "n") + a@("a" | "ä") =>
+ dSilakka ukko (ukko + "n") (ukk + o + "it" + a) ;
+ _ + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") + C_ + _ +
+ ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") +
+ ("n" | "k" | "s") + "k" + a@("a" | "ä") =>
+ dSilakka ukko (uko + "n") (init uko + o + "it" + a) ;
+ _ + ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") + C_ + _ +
+ ("a" | "e" | "i" | "o" | "u" | "y" | "ä" | "ö") +
+ ("n" | "t" | "s") + "t" + a@("a" | "ä") =>
+ dSilakka ukko (uko + "n") (ukk + o + "j" + a) ;
+ _ + ("a" | "e" | "i" | "o" | "u") + C_ + _ +
+ ("a" | "e" | "o" | "u") + C_ + "a" =>
dSilakka ukko (ukko + "n") (ukk + "ia") ;
- _ + ("a" | "e" | "i" | "o" | "u") + C_ + _ + "ija" =>
- dSilakka ukko (ukko + "n") (ukk + "oita") ;
- _ + ("e" | "i" | "y" | "ä" | "ö") + C_ + _ + "ijä" =>
- dSilakka ukko (ukko + "n") (ukk + "öitä") ;
+-}
_ + "i" +o@("o"|"ö") => dSilakka ukko (ukko+"n") (ukko+"it"+getHarmony o);
_ + "i" + "a" => dSilakka ukko (ukko + "n") (ukk + "oita") ;
_ + "i" + "ä" => dSilakka ukko (ukko + "n") (ukk + "öitä") ;
diff --git a/examples/uusisuomi/Verbal.gf b/examples/uusisuomi/Verbal.gf
index d38303405..fbc60fed5 100644
--- a/examples/uusisuomi/Verbal.gf
+++ b/examples/uusisuomi/Verbal.gf
@@ -10,6 +10,9 @@ resource Verbal = ResFin **
mkV = overload {
mkV : (huutaa : Str) -> V = mk1V ;
mkV : (huutaa,huusi : Str) -> V = mk2V ;
+ mkV : (
+ huutaa,huudan,huutaa,huutavat,huutakaa,huudetaan,
+ huusin,huusi,huusisi,huutanut,huudettu,huutanee : Str) -> V = mk12V ;
} ;
showV : V -> Utt = \v -> ss (
@@ -29,6 +32,12 @@ resource Verbal = ResFin **
mk1V : Str -> V = \s -> vforms2V (vForms1 s) ;
mk2V : (_,_ : Str) -> V = \s,t -> vforms2V (vForms2 s t) ;
+ mk12V : (
+ huutaa,huudan,huutaa,huutavat,huutakaa,huudetaan,
+ huusin,huusi,huusisi,huutanut,huudettu,huutanee : Str) -> V =
+ \a,b,c,d,e,f,g,h,i,j,k,l ->
+ vforms2V (vForms12 a b c d e f g h i j k l) ;
+
vForms1 : Str -> VForms = \ottaa ->
let
a = last ottaa ;