summaryrefslogtreecommitdiff
path: root/examples/big/postedit.hs
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2006-11-03 10:23:06 +0000
committeraarne <aarne@cs.chalmers.se>2006-11-03 10:23:06 +0000
commitdb95cbad6d2b3a5ba8ca90dafbb8e7513637a7e3 (patch)
tree731477e796c8982f9b18a6012813279952a14b0e /examples/big/postedit.hs
parentc922c0c4885b002b2b553ba24f52502b495fb05e (diff)
bew BigLexEng (not ready)
Diffstat (limited to 'examples/big/postedit.hs')
-rw-r--r--examples/big/postedit.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/examples/big/postedit.hs b/examples/big/postedit.hs
new file mode 100644
index 000000000..ce67739db
--- /dev/null
+++ b/examples/big/postedit.hs
@@ -0,0 +1,38 @@
+import Char
+import System
+
+infile = "BigLexEng.gf"
+tmp = "tm"
+
+main = do
+ writeFile tmp ""
+ s <- readFile infile
+ mapM_ (appendFile tmp . mkOne) $ lines s --- $ chop s
+ system "mv tm BigLexEng.gf"
+
+chop s = case s of
+ ';':cs -> ";\n"++chop cs
+ c:cs -> c:chop cs
+ _ -> s
+
+mkOne s = case words s of
+ lin:a2:eq:pa2:ws | take 6 pa2 == "prepA2" ->
+ unwords $ [lin,a2,eq,"prepA2"] ++ ws ++ ["\n"]
+ lin:a2:eq:pa2:ws | take 6 pa2 == "prepV2" ->
+ unwords $ [lin,a2,eq,"prepV2"] ++ ws ++ ["\n"]
+ lin:v2:eq:"mkV2":v:_:ws ->
+ unwords $ [lin,v2,eq,"mkV2",(read v ++ "_V")] ++ ws ++ ["\n"]
+ lin:v2:eq:"mkV3":v:_:ws ->
+ unwords $ [lin,v2,eq,"dirV3",(read v ++ "_V")] ++ ws ++ ["\n"]
+ lin:a2:eq:pa2:ws | take 4 pa2 == "mkV2" ->
+ unwords $ [lin,a2,eq,"mkV2"] ++ ws ++ ["\n"]
+ lin:a2:eq:pa2:ws | take 6 pa2 == "prepN2" ->
+ unwords $ [lin,a2,eq,"prepN2"] ++ ws ++ ["\n"]
+ lin:a2:eq:pa2:ws | take 4 pa2 == "mkV3" ->
+ unwords $ [lin,a2,eq,"mkV3"] ++ ws ++ ["\n"]
+
+ lin:v2:eq:"irreg":v:_:ws ->
+ unwords $ [lin,v2,eq,"dirV2",(read v ++ "_V")] ++ ws ++ ["\n"]
+
+
+ _ -> s ++ "\n"