summaryrefslogtreecommitdiff
path: root/examples/big/MkDict.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-11-02 17:04:35 +0000
committeraarne <aarne@cs.chalmers.se>2006-11-02 17:04:35 +0000
commit3396a13ee732159216ce128f5df33c3833e1666e (patch)
tree9ee229a3f177f3731f78c5149120512fc74f9974 /examples/big/MkDict.hs
parentb8a454a7d3600195f89b407052f9f0fafe4d5910 (diff)
new big and shallow modules
Diffstat (limited to 'examples/big/MkDict.hs')
-rw-r--r--examples/big/MkDict.hs26
1 files changed, 26 insertions, 0 deletions
diff --git a/examples/big/MkDict.hs b/examples/big/MkDict.hs
new file mode 100644
index 000000000..c57b5ea7d
--- /dev/null
+++ b/examples/big/MkDict.hs
@@ -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)
+