summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoraarne <aarne@cs.chalmers.se>2007-02-17 21:44:42 +0000
committeraarne <aarne@cs.chalmers.se>2007-02-17 21:44:42 +0000
commit1d803dff1056e8cc04e9ef3998a7107b952b99c1 (patch)
tree32779bbc586c2dc24b0396816cc71414bb774cd2 /src
parentd9e0521c5810e4214f20f0a2ebe737316fb5757d (diff)
essential LP phrases, pron table
Diffstat (limited to 'src')
-rw-r--r--src/GF/Text/Thai.hs39
1 files changed, 28 insertions, 11 deletions
diff --git a/src/GF/Text/Thai.hs b/src/GF/Text/Thai.hs
index 2ac752a2b..2b9456f06 100644
--- a/src/GF/Text/Thai.hs
+++ b/src/GF/Text/Thai.hs
@@ -216,9 +216,11 @@ getSyllable = foldl get (Syll [] [] [] [] [] [] False False) where
test1 = testThai "k2wa:mrak"
test2 = putStrLn $ thaiTable
test3 = do
- writeFile "thai.html" "<html><body><pre>"
- appendFile "thai.html" thaiTable
- appendFile "thai.html" "</pre></body></html>"
+ writeFile "thai.txt" "Thai Character Coding in GF\nAR 2007\n"
+ appendFile "thai.txt" thaiTable
+test4 = do
+ writeFile "alphthai.txt" "Thai Characters by Pronunciation\nAR 2007\n"
+ appendFile "alphthai.txt" thaiTableAlph
testThai :: String -> IO ()
@@ -256,18 +258,33 @@ readClass s = case s of
thaiTable :: String
-thaiTable = unlines [
- "\t" ++
- hex c ++ "\t" ++
- encodeUTF8 (showThai s) ++ "\t" ++
- s ++ "\t" ++
- pronThai s ++ "\t" ++
- [f] ++ "\t" ++
- [q] ++ "\t"
+thaiTable = unlines $ ("\n|| hex | thai | trans | pron | fin | class |" ) : [
+ "| " ++
+ hex c ++ " | " ++
+ encodeUTF8 (showThai s) ++ " | " ++
+ s ++ " | " ++
+ pronThai s ++ " | " ++
+ [f] ++ " | " ++
+ [q] ++ " | "
|
(c,q,f,s) <- zip4 allThaiCodes heights finals allThaiTrans
]
+thaiTableAlph :: String
+thaiTableAlph = unlines $ ("\n|| pron | thai | trans |" ) : [
+ "| " ++ a ++
+ " | " ++ unwords (map (encodeUTF8 . showThai) ss) ++
+ " | " ++ unwords ss ++
+ " |"
+ |
+ (a,ss) <- allProns
+ ]
+ where
+ prons = sort $ nub
+ [p | s <- allThaiTrans, let p = pronThai s, not (null p),isAlpha (head p)]
+ allProns =
+ [(a,[s | s <- allThaiTrans, pronThai s == a]) | a <- prons]
+
showThai s = case s of
"-" -> "-"
--- v:_ | elem v "ivu" -> map (toEnum . mkThaiChar) ["O",s]