1
0
forked from GitHub/gf-core

soundness checks in Romance smart V paradigms to eliminate non-verbs

This commit is contained in:
aarne
2014-12-07 13:07:07 +00:00
parent 122230cdc0
commit a080258582
4 changed files with 36 additions and 6 deletions

View File

@@ -229,7 +229,8 @@ oper v_besch101 : Str -> VerbeN = \s -> mkNV (conj s) ; --- to do
_ + "cer" => conj1placer parler ;
_ + "ger" => conj1manger parler ;
_ + "yer" => conj1payer parler ;
_ => conj1aimer parler
_ + "er" => conj1aimer parler ;
_ => Predef.error ("verb infinitive must end er/ir/re, not satisfied by" ++ parler)
} ;
-- The following can be more reliable.

View File

@@ -386,7 +386,7 @@ oper
verb = case are of {
"ire" => finire_100 x ;
"ere" => temere_20 x ;
_ => case i of {
"are" => case i of {
"c" => cercare_7 x ;
"g" => legare_8 x ;
_ => case ci of {
@@ -394,7 +394,8 @@ oper
"gi" => mangiare_10 x ;
_ => amare_6 x
}
}
} ;
_ => Predef.error ("regular verb infinitive must end are/ire/ere, not satisfied by" ++ x)
}
in verbBesch verb ** {vtyp = VHabere ; p = [] ; lock_V = <>} ;

View File

@@ -375,15 +375,16 @@ oper
verb = case ar of {
"ir" => vivir_7 x ;
"er" => deber_6 x ;
_ => case z of {
"ar" => case z of {
"u" => actuar_9 x ;
"z" => cazar_21 x ;
"i" => guiar_43 x ;
"g" => pagar_53 x ;
"c" => sacar_72 x ;
_ => cortar_5 x
}
}
} ;
_ => Predef.error ("regular verb infinitive must end ar/ir/er, not satisfied by" ++ x)
}
in verbBesch verb ** {vtyp = VHabere ; p = [] ; lock_V = <>} ;
reflV v = v ** {vtyp = VRefl} ;

View File

@@ -0,0 +1,27 @@
-- elementary soundness check of a dictionary, e.g. if all verbs have verb-like endings
-- usage: checkSoundness <Filename> <Lang>
-- comment out bad lines in tmp/file with --UNSOUND
checkSoundness file lang = do
dict <- readFile file >>= return . lines
let wrongs = [(if has then ("--UNSOUND " ++ d) else d,has) | d <- dict, let has = hasError lang (words d)]
putStrLn $ unlines $ [p | (p,h) <- wrongs, h]
writeFile ("tmp/" ++ file) $ unlines $ map fst wrongs
hasError lang ws = case ws of
u:v:ww | isError lang u v -> True
_:v:ww -> hasError lang (v:ww)
_ -> False
isError lang u v = case lang of
"Spa" -> case bareOp u of
"mkV" | head v == '"' -> notElem (dp 2 (stringOf v)) ["ar","er","ir","se"]
"mkV2" | head v == '"' -> notElem (dp 2 (stringOf v)) ["ar","er","ir","se"]
_ -> False
dp :: Int -> String -> String
dp i s = drop (length s - i) s
stringOf s = takeWhile (/='"') (tail s)
bareOp = filter (notElem "()")