diff options
| author | aarne <aarne@cs.chalmers.se> | 2008-02-07 16:03:16 +0000 |
|---|---|---|
| committer | aarne <aarne@cs.chalmers.se> | 2008-02-07 16:03:16 +0000 |
| commit | 9bd9e2ee7a739de62733c082074e1bfcdc44a539 (patch) | |
| tree | 071e47f238d5eddfbc7e6faccc8be4beba7eea9d /examples/uusisuomi/kotus | |
| parent | 53106abf7ef91c73a39a8465df11a41d08dba3e4 (diff) | |
kotus paradigms implemented
Diffstat (limited to 'examples/uusisuomi/kotus')
| -rw-r--r-- | examples/uusisuomi/kotus/Kotus.hs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/examples/uusisuomi/kotus/Kotus.hs b/examples/uusisuomi/kotus/Kotus.hs index 57557ae42..694465782 100644 --- a/examples/uusisuomi/kotus/Kotus.hs +++ b/examples/uusisuomi/kotus/Kotus.hs @@ -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> |
