mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
essential LP phrases, pron table
This commit is contained in:
30
examples/travel/Essential.gf
Normal file
30
examples/travel/Essential.gf
Normal file
@@ -0,0 +1,30 @@
|
||||
-- the essential phrases from Lone Planet Thai Phrasebook
|
||||
|
||||
abstract Essential = {
|
||||
|
||||
cat
|
||||
Phrase ;
|
||||
Number ;
|
||||
|
||||
fun
|
||||
Hello : Phrase ;
|
||||
Goodbye : Phrase ;
|
||||
Please : Phrase ;
|
||||
ThankYou : Phrase ;
|
||||
YoureWelcome : Phrase ;
|
||||
Yes : Phrase ;
|
||||
No : Phrase ;
|
||||
ExcuseAttention : Phrase ;
|
||||
ExcuseGetPast : Phrase ;
|
||||
Sorry : Phrase ;
|
||||
IUnderstand : Phrase ;
|
||||
IDontUnderstand : Phrase ;
|
||||
Help : Phrase ;
|
||||
WhereAreToilets : Phrase ;
|
||||
|
||||
|
||||
SayNumber : Number -> Phrase ;
|
||||
|
||||
One, Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten : Number ;
|
||||
|
||||
}
|
||||
44
examples/travel/EssentialThai.gf
Normal file
44
examples/travel/EssentialThai.gf
Normal file
@@ -0,0 +1,44 @@
|
||||
--# -path=.:prelude:resource-1.0/thai
|
||||
|
||||
-- the essential phrases from Lone Planet Thai Phrasebook
|
||||
|
||||
concrete EssentialThai of Essential = open Prelude, StringsTha in {
|
||||
|
||||
flags unlexer=concat ;
|
||||
startcat=Phrase ;
|
||||
|
||||
lincat
|
||||
Phrase = SS ;
|
||||
Number = SS ;
|
||||
|
||||
lin
|
||||
Hello = ss (sawat_s ++ dii_s) ;
|
||||
Goodbye = ss (laa_s ++ koon_s) ;
|
||||
Please = ss (khoo_s) ;
|
||||
ThankYou = ss (khoop_s ++ khun_s) ;
|
||||
YoureWelcome = ss (yin_s ++ dii_s) ;
|
||||
Yes = ss (chay_s) ;
|
||||
No = ss (may_s) ;
|
||||
ExcuseAttention = ss (khoo_s ++ thoot_s) ;
|
||||
ExcuseGetPast = ss (khoo_s ++ aphai_s) ;
|
||||
Sorry = ss (khoo_s ++ thoot_s) ;
|
||||
IUnderstand = ss (phom_s ++ khow_s ++ jai_s) ;
|
||||
IDontUnderstand = ss (phom_s ++ may_s ++ khow_s ++ jai_s) ;
|
||||
Help = ss (chuay_s ++ duay_s) ;
|
||||
WhereAreToilets = ss (hoog_s ++ nam_s ++ yuu_s ++ thii_s ++ nai_s) ;
|
||||
|
||||
|
||||
SayNumber n = n ;
|
||||
|
||||
One = ss (nvg_s) ;
|
||||
Two = ss (soog_s) ;
|
||||
Three = ss (saam_s) ;
|
||||
Four = ss (sii_s) ;
|
||||
Five = ss (haa_s) ;
|
||||
Six = ss (hok_s) ;
|
||||
Seven = ss (cet_s) ;
|
||||
Eight = ss (peet_s) ;
|
||||
Nine = ss (kaaw_s) ;
|
||||
Ten = ss (sip_s) ;
|
||||
|
||||
}
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user