mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
kotus experiments; bindings in gfcc
This commit is contained in:
@@ -142,9 +142,9 @@ resource Declensions = ResFin ** open MorphoFin,CatFin,Prelude in {
|
||||
silakoiden = case <silakoita : Str> of {
|
||||
_ + "i" + ("a" | "ä") => -- asemia
|
||||
<silakka+a, silakk + "ien", silakk, silak, silakk + "iin"> ;
|
||||
_ + O@("o" | "ö") + ("ja" | "jä") => -- pasuunoja
|
||||
_ + O@("o" | "ö" | "u" | "y" | "e") + ("ja" | "jä") => -- pasuunoja
|
||||
<silakka+a,silakk+O+"jen",silakk+O, silak+O, silakk +O+ "ihin"> ;
|
||||
_ + O@("o" | "ö") + ("ita" | "itä") => -- silakoita
|
||||
_ + O@("o" | "ö" | "u" | "y" | "e") + ("ita" | "itä") => -- silakoita
|
||||
<silakkaa, silak+O+"iden",silakk+O, silak+O, silakk +O+ "ihin"> ;
|
||||
_ => Predef.error silakoita
|
||||
} ;
|
||||
|
||||
@@ -9,12 +9,12 @@ oper
|
||||
d01A : Str -> NForms -- 166 yökkö
|
||||
= \s -> dUkko s (weakGrade s + "n") ;
|
||||
d02 : Str -> NForms -- 1189 ääntely
|
||||
= \s -> dSilakka s (s + "n") (s + "j" + vowelHarmony (last s)) ;
|
||||
= \s -> dSilakka s (s + "n") (s + "j" + getHarmony (last s)) ;
|
||||
d03 : Str -> NForms -- 481 ääntiö
|
||||
= \s -> dSilakka s (s + "n") (s + "it" + vowelHarmony (last s)) ;
|
||||
= \s -> dSilakka s (s + "n") (s + "it" + vowelHarmony s) ;
|
||||
d04A : Str -> NForms -- 273 äpärikkö
|
||||
= \s -> let ws = weakGrade s in
|
||||
dSilakka s (ws + "n") (ws + "it" + vowelHarmony (last s)) ;
|
||||
dSilakka s (ws + "n") (ws + "it" + getHarmony (last s)) ;
|
||||
d05 : Str -> NForms -- 3212 öljymaali
|
||||
= \s -> dPaatti s (s + "n") ;
|
||||
d05A : Str -> NForms -- 1959 öylätti
|
||||
@@ -136,9 +136,9 @@ oper
|
||||
d40 : Str -> NForms -- 2482 öykkärimäisyys
|
||||
= dLujuus ;
|
||||
d41 : Str -> NForms -- 127 äyräs
|
||||
= \s -> let is = init s in dRae s (is + last is ++ "n") ;
|
||||
= \s -> let is = init s in dRae s (is + last is + "n") ;
|
||||
d41A : Str -> NForms -- 401 öljykangas
|
||||
= \s -> let is = init s in dRae s (strongGrade is + last is ++ "n") ;
|
||||
= \s -> let is = init s in dRae s (strongGrade is + last is + "n") ;
|
||||
d42 : Str -> NForms -- 1 mies
|
||||
= \s -> let mieh = init s + "s" in
|
||||
nForms10
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
LEX=Omat
|
||||
CAT=N
|
||||
|
||||
.PHONY: kotus
|
||||
|
||||
all: nouns
|
||||
|
||||
verbs:
|
||||
@@ -21,6 +23,10 @@ nouns:
|
||||
cat all-diff-* >all-differences
|
||||
cat all-differences
|
||||
|
||||
kotus:
|
||||
export LEX=KOTUS ; make -e tests
|
||||
cat all-diff-KOTUS
|
||||
|
||||
CSC:
|
||||
export LEX=NCSC ; make -e tests
|
||||
cat all-diff-NCSC
|
||||
@@ -33,7 +39,7 @@ gf-files:
|
||||
runghc MkLex.hs 4 $(CAT) $(LEX) > $(LEX)4.gf
|
||||
|
||||
experiments: gf-files
|
||||
echo "gt -cat=Utt | l | wf exper1-$(LEX).txt" | gf -s $(LEX)1.gf
|
||||
# echo "gt -cat=Utt | l | wf exper1-$(LEX).txt" | gf -s $(LEX)1.gf
|
||||
echo "gt -cat=Utt | l | wf exper2-$(LEX).txt" | gf -s $(LEX)2.gf
|
||||
echo "gt -cat=Utt | l | wf exper3-$(LEX).txt" | gf -s $(LEX)3.gf
|
||||
echo "gt -cat=Utt | l | wf exper4-$(LEX).txt" | gf -s $(LEX)4.gf
|
||||
|
||||
@@ -37,9 +37,9 @@ initiate tgt cat i = mapM_ putStrLn [
|
||||
"lin testV = showV ;"
|
||||
]
|
||||
|
||||
nums = map prt [1 ..] where
|
||||
nums = map prt [10001 ..] where
|
||||
---- prt i = (if i < 10 then "0" else "") ++ show i ++ ". "
|
||||
prt i = let n = show i in replicate (4-length n) '0' ++ n ++ ". "
|
||||
prt i = show i ++ ". "
|
||||
|
||||
-- W is the flag for mixed-class word lists
|
||||
mkLex "W" 0 line = case words line of
|
||||
|
||||
55334
examples/uusisuomi/correct-KOTUS.txt
Normal file
55334
examples/uusisuomi/correct-KOTUS.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,19 +5,19 @@ kotus = "sanat.xxmmll"
|
||||
|
||||
main = do
|
||||
ss <- readFile kotus >>= return . lines
|
||||
let ws = map analyse ss
|
||||
let ws = [w | Just w <- map analyse ss]
|
||||
writeFile "kotus.gf" $ unlines $ treat ws
|
||||
-- mapM putStrLn $ treat ws
|
||||
|
||||
treat = map mkLin . entries
|
||||
|
||||
entries = zip [10000..] . filter isNoun
|
||||
entries = zip [10001..] . filter isNoun
|
||||
|
||||
isNoun x = ((<5) . read . take 1 . fst) x && (all isAlpha . snd) x
|
||||
|
||||
mkLin (n,(pa,ex)) =
|
||||
"fun n" ++ show n ++ "_" ++ ex ++ " : N ;\n" ++
|
||||
"lin n" ++ show n ++ "_" ++ ex ++ " = d" ++ pa ++ " \"" ++ ex ++ "\" ;"
|
||||
"lin n" ++ show n ++ "_" ++ ex ++ " = ud d" ++ pa ++ " \"" ++ ex ++ "\" ;"
|
||||
|
||||
-- treat = map mkRule . paradigms
|
||||
|
||||
@@ -45,8 +45,11 @@ analyse s =
|
||||
lst = drop 6 $ dropWhile (/='t') end
|
||||
(num,gr) = span isDigit lst
|
||||
para = (replicate (2 - length num) '0' ++ num) ++ ['A' | isPrefixOf "av" (drop 6 gr)]
|
||||
in
|
||||
(para,word)
|
||||
in case num of
|
||||
"" -> Nothing
|
||||
"0" -> Nothing
|
||||
_ | length num > 2 -> Nothing
|
||||
_ -> if last word == 't' then Nothing else Just (para,word)
|
||||
|
||||
sub cs s = isPrefixOf cs s || isPrefixOf cs (drop 1 s)
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Last update: Fri Dec 21 18:15:24 2007
|
||||
<center>
|
||||
</P>
|
||||
<P>
|
||||
<IMG ALIGN="middle" SRC="10lang-large.png" BORDER="0" ALT="">
|
||||
<IMG ALIGN="middle" SRC="../../../doc/lang10.png" BORDER="0" ALT="">
|
||||
</P>
|
||||
<P>
|
||||
</center>
|
||||
|
||||
@@ -317,7 +317,8 @@ lin
|
||||
sock_N = nPotolok "нос" ;
|
||||
--- son_N = nSyn "сын" ; -- +++ MG_UR: added +++
|
||||
song_N = nTetya "песн" ;
|
||||
speak_V2 = dirV2 (regV imperfective second "говор" "ю" "говорил" "говори" "говорить" );
|
||||
speak_V2 = mkV2 (regV imperfective secondA "говор" "ю" "говорил" "говори" "говорить")
|
||||
"на" prepositional ;
|
||||
spit_V = regV imperfective firstE "плю" "ю" "плевал" "плюй" "плевать" ;
|
||||
split_V2 = dirV2 (regV imperfective first "разбива" "ю" "разбивал" "разбей" "разбивать" ) ;
|
||||
squeeze_V2 = dirV2 (regV imperfective first "сжима" "ю" "сжимал" "сжимай" "сжимать" ) ;
|
||||
|
||||
@@ -2266,7 +2266,7 @@ oper uy_oj_EndDecl : Str -> Adjective = \s ->{s = table {
|
||||
---- patterns in the present tense in the indicative mood.
|
||||
|
||||
-- +++ MG_UR: new conjugation class 'Foreign' introduced +++
|
||||
param Conjugation = First | FirstE | Second | Mixed | Dolzhen | Foreign ;
|
||||
param Conjugation = First | FirstE | Second | SecondA | Mixed | Dolzhen | Foreign ;
|
||||
|
||||
|
||||
--3 First conjugation (in Present) verbs :
|
||||
@@ -2367,6 +2367,16 @@ table {
|
||||
PRF APl P3 => del+ "дят"
|
||||
};
|
||||
|
||||
oper presentConj2a: Str -> Str -> PresentVerb = \del, sgP1End ->
|
||||
table {
|
||||
PRF (ASg _) P1 => del+ sgP1End ; -- sgP1End "жу"
|
||||
PRF (ASg _) P2 => del+ "ишь" ;
|
||||
PRF (ASg _) P3 => del+ "ит" ;
|
||||
PRF APl P1 => del+ "им" ;
|
||||
PRF APl P2 => del+ "ите" ;
|
||||
PRF APl P3 => del+ "ят"
|
||||
};
|
||||
|
||||
oper presentConj1E: Str -> Str -> PresentVerb = \del, sgP1End ->
|
||||
table {
|
||||
PRF (ASg _) P1 => del+ sgP1End ;
|
||||
@@ -2438,6 +2448,7 @@ oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum
|
||||
First => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
FirstE => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
Second => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
SecondA => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConj2a del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
Mixed => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
Dolzhen => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast);
|
||||
Foreign => mkVerb (perfectiveActivePattern inf imperSgP2 (presentConjForeign del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
|
||||
@@ -2446,6 +2457,7 @@ oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum
|
||||
First => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
FirstE => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj1E del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
Second => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2 del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
SecondA => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConj2a del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast);
|
||||
Mixed => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjMixed del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast) ;
|
||||
Dolzhen => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjDolzhen del sgP1End) (pastConjDolzhen sgMascPast)) (pastConjDolzhen sgMascPast);
|
||||
Foreign => mkVerb (imperfectiveActivePattern inf imperSgP2 (presentConjForeign del sgP1End) (pastConj sgMascPast)) (pastConj sgMascPast)
|
||||
|
||||
@@ -72,7 +72,8 @@ lin pot01 =
|
||||
lin pot0 d =
|
||||
{s = table {_ => d.s} ; size = d.size} ;
|
||||
lin pot110 =
|
||||
{s = table {_ => gg "десять"} ; size = plg} ;
|
||||
{s = table {_ => gg "десяти"} ; size = plg} ;
|
||||
-- {s = table {_ => gg "десять"} ; size = plg} ;
|
||||
lin pot111 =
|
||||
{s = table {_ => gg "одиннадцать"} ; size = plg} ; --- 11
|
||||
lin pot1to19 d =
|
||||
|
||||
@@ -330,6 +330,7 @@ perfective: Aspect ;
|
||||
first = First ;
|
||||
firstE = FirstE ;
|
||||
second = Second ;
|
||||
secondA = SecondA ;
|
||||
mixed = Mixed ;
|
||||
dolzhen = Dolzhen;
|
||||
foreign = Foreign; -- +++ MG_UR: added +++
|
||||
|
||||
@@ -28,14 +28,14 @@ realize trm = case trm of
|
||||
|
||||
linExp :: GFCC -> CId -> Exp -> Term
|
||||
linExp mcfg lang tree@(DTr xs at trees) =
|
||||
case at of
|
||||
AC fun -> addB $ comp (lmap lin trees) $ look fun
|
||||
addB $ case at of
|
||||
AC fun -> comp (lmap lin trees) $ look fun
|
||||
AS s -> R [kks (show s)] -- quoted
|
||||
AI i -> R [kks (show i)]
|
||||
--- [C lst, kks (show i), C size] where
|
||||
--- lst = mod (fromInteger i) 10 ; size = if i < 10 then 0 else 1
|
||||
AF d -> R [kks (show d)]
|
||||
AV x -> addB $ TM (prCId x)
|
||||
AV x -> TM (prCId x)
|
||||
AM i -> TM (show i)
|
||||
where
|
||||
lin = linExp mcfg lang
|
||||
@@ -45,6 +45,7 @@ linExp mcfg lang tree@(DTr xs at trees) =
|
||||
| Data.List.null xs = t
|
||||
| otherwise = case t of
|
||||
R ts -> R $ ts ++ (Data.List.map (kks . prCId) xs)
|
||||
TM s -> R $ t : (Data.List.map (kks . prCId) xs)
|
||||
|
||||
compute :: GFCC -> CId -> [Term] -> Term -> Term
|
||||
compute mcfg lang args = comp where
|
||||
|
||||
Reference in New Issue
Block a user