blob: c57b5ea7d28d4d479d0d03f207ae291a89ca2330 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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)
|