mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-06 17:52:51 -06:00
kotus paradigms implemented
This commit is contained in:
@@ -6,9 +6,20 @@ kotus = "sanat.xxmmll"
|
||||
main = do
|
||||
ss <- readFile kotus >>= return . lines
|
||||
let ws = map analyse ss
|
||||
mapM putStrLn $ treat ws
|
||||
writeFile "kotus.gf" $ unlines $ treat ws
|
||||
-- mapM putStrLn $ treat ws
|
||||
|
||||
treat = map mkRule . paradigms
|
||||
treat = map mkLin . entries
|
||||
|
||||
entries = zip [10000..] . 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 ++ "\" ;"
|
||||
|
||||
-- treat = map mkRule . paradigms
|
||||
|
||||
mkRule ((pa,ex),nu) =
|
||||
" " ++ pos ++ pa ++ " : Str -> " ++ poss ++
|
||||
@@ -16,12 +27,12 @@ mkRule ((pa,ex),nu) =
|
||||
where
|
||||
(pos,poss) = if read (take 2 pa) < 52 then ("d","N") else ("c","V")
|
||||
|
||||
paradigms = map info . groupByFst . sort
|
||||
-- paradigms = map info . groupByFst . sort
|
||||
|
||||
info x = (last x, length x)
|
||||
--info = last
|
||||
|
||||
groupByFst = groupBy (\ x y -> fst x == fst y)
|
||||
-- groupByFst = groupBy (\ x y -> fst x == fst y)
|
||||
|
||||
-- <st><s>aaloe</s><t><tn>3</tn></t></st>
|
||||
-- <st><s>vuoksi</s><hn>1</hn><t><tn>7</tn></t></st>
|
||||
|
||||
Reference in New Issue
Block a user