new big and shallow modules

This commit is contained in:
aarne
2006-11-02 17:04:35 +00:00
parent b8a454a7d3
commit 3396a13ee7
12 changed files with 6312 additions and 67 deletions

26
examples/big/MkDict.hs Normal file
View File

@@ -0,0 +1,26 @@
infile = "mywordlist1"
main = do
s <- readFile infile
mapM_ (putStrLn . mkOne) $ lines s
mkOne s = case words s of
"--":_ -> ""
('(':_):w:cat:ws ->
let
(c,f) = mkCatf (nopar cat) (more ws)
in unwords $ [c, f, w]
_ -> "-- " ++ s
where
more ws = case ws of
_ | elem "(REG" ws -> "irreg"
_ -> "reg"
nopar = filter (flip notElem "()")
mkCatf c r = case c of
"Noun" -> ("N","regN")
"Adject" -> ("A","regA")
"Adject_LONG" -> ("A","longA")
"Verb" -> ("V","regV")
"PNoun" -> ("PN","regPN")
_ -> (c,"mk" ++ c)