forked from GitHub/gf-rgl
produce a readable word list
This commit is contained in:
@@ -14,6 +14,7 @@
|
|||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
import GF.Text.Thai
|
import GF.Text.Thai
|
||||||
|
import GF.Text.UTF8
|
||||||
import Data.List
|
import Data.List
|
||||||
import System
|
import System
|
||||||
|
|
||||||
@@ -22,5 +23,21 @@ main = do
|
|||||||
xx <- getArgs
|
xx <- getArgs
|
||||||
case xx of
|
case xx of
|
||||||
"-p":f:[] -> thaiPronFile f Nothing
|
"-p":f:[] -> thaiPronFile f Nothing
|
||||||
|
"-w":f:[] -> thaiWordList f
|
||||||
f :[] -> thaiFile f Nothing
|
f :[] -> thaiFile f Nothing
|
||||||
_ -> putStrLn "usage: filethai (-p) File"
|
_ -> putStrLn "usage: filethai (-p) File"
|
||||||
|
|
||||||
|
|
||||||
|
-- adapted to the format of StringsThai
|
||||||
|
|
||||||
|
thaiWordList :: FilePath -> IO ()
|
||||||
|
thaiWordList f = do
|
||||||
|
ss <- readFile f >>= return . lines
|
||||||
|
mapM_ mkLine ss
|
||||||
|
where
|
||||||
|
mkLine s = case words s of
|
||||||
|
o : "=" : s : ";" : "--" : es ->
|
||||||
|
putStrLn $ thai s ++ "\t" ++ pron s ++ "\t" ++ unwords es
|
||||||
|
_ -> return ()
|
||||||
|
thai = encodeUTF8 . mkThaiWord . init . tail
|
||||||
|
pron = mkThaiPron . init . tail
|
||||||
|
|||||||
@@ -2,3 +2,6 @@ strings:
|
|||||||
runghc -i../../../src FileThai.hs StringsThai.gf >StringsTha.gf
|
runghc -i../../../src FileThai.hs StringsThai.gf >StringsTha.gf
|
||||||
pronstrings:
|
pronstrings:
|
||||||
runghc -i../../../src FileThai.hs -p StringsThai.gf >pronunciation/StringsTha.gf
|
runghc -i../../../src FileThai.hs -p StringsThai.gf >pronunciation/StringsTha.gf
|
||||||
|
wordlist:
|
||||||
|
runghc -i../../../src FileThai.hs -w StringsThai.gf
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user