1
0
forked from GitHub/gf-rgl

check dict: multiline changes

This commit is contained in:
aarne
2014-05-21 08:17:42 +00:00
parent 25e4de63bb
commit 32a6befdf0

View File

@@ -1,13 +1,14 @@
import qualified Data.Map import qualified Data.Map
import qualified Data.Set
import Data.List import Data.List
langs = words "Bul Chi Dut Eng Fin Fre Ger Hin Ita Spa Swe" langs = words "Bul Chi Dut Eng Fin Fre Ger Hin Ita Spa Swe"
-- apply a function to every line -- apply a function to every line, changing it to a list
changeLinesLang :: (String -> String) -> String -> IO () changeLinesLang :: (String -> [String]) -> String -> IO ()
changeLinesLang f lang = do changeLinesLang f lang = do
dict <- readFile (gfFile "Dictionary" lang) >>= return . lines dict <- readFile (gfFile "Dictionary" lang) >>= return . lines
writeFile (gfFile "tmp/Dictionary" lang) $ unlines $ map f dict writeFile (gfFile "tmp/Dictionary" lang) $ unlines $ concatMap f dict
createAllConcretes = do createAllConcretes = do
createAbstract createAbstract
@@ -115,3 +116,20 @@ statLang lang = do
statAll = mapM_ statLang langs statAll = mapM_ statLang langs
{-
-- lin f = def ; -- comment
analyseLine :: String -> (String,String,String,String,String)
analyseLine s = case words s of
k:f:s:dc -> (k,f,s)
-------
-- handle split senses: remove the unsplit variant ; if the split ones are empty, copy the unsplit to them
handleSplit :: Data.Set.Set String -> String -> [String]
handleSplit sset line =
let (keyw,fun,sep,def,comment) = analyseLine line
-}