From 10bd5b02ea72e95f28e69143c5cef25907318ed5 Mon Sep 17 00:00:00 2001 From: aarne Date: Sat, 17 Feb 2007 21:44:42 +0000 Subject: [PATCH] essential LP phrases, pron table --- examples/travel/Essential.gf | 30 +++++++++++++++++++ examples/travel/EssentialThai.gf | 44 ++++++++++++++++++++++++++++ lib/resource-1.0/thai/StringsTha.gf | 30 +++++++++++++++---- lib/resource-1.0/thai/StringsThai.gf | 26 +++++++++++++--- src/GF/Text/Thai.hs | 39 +++++++++++++++++------- 5 files changed, 148 insertions(+), 21 deletions(-) create mode 100644 examples/travel/Essential.gf create mode 100644 examples/travel/EssentialThai.gf diff --git a/examples/travel/Essential.gf b/examples/travel/Essential.gf new file mode 100644 index 000000000..f90dc45b6 --- /dev/null +++ b/examples/travel/Essential.gf @@ -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 ; + +} \ No newline at end of file diff --git a/examples/travel/EssentialThai.gf b/examples/travel/EssentialThai.gf new file mode 100644 index 000000000..25255b9a5 --- /dev/null +++ b/examples/travel/EssentialThai.gf @@ -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) ; + +} \ No newline at end of file diff --git a/lib/resource-1.0/thai/StringsTha.gf b/lib/resource-1.0/thai/StringsTha.gf index 28ca06cf5..46020d6f5 100644 --- a/lib/resource-1.0/thai/StringsTha.gf +++ b/lib/resource-1.0/thai/StringsTha.gf @@ -6,30 +6,44 @@ resource StringsTha = { oper +aphai_s = "อภัย" ; -- excuse2 baan_s = "บ้าน" ; -- house -biar_s = "เบีอร์" ; +biar_s = "เบีอร์" ; -- beer ca_s = "จะ" ; -- Modal cet_s = "เจ็ด" ; -- seven chan_s = "ฉัน" ; -- I -chay_s = "ไช่" ; -- be-not +chay_s = "ใช่" ; -- yes +chuay_s = "ช่วย" ; -- help1 +di_s = "ดิ" ; -- I (fem)1 +dii_s = "ดี" ; -- hello2 +duay_s = "ด้วย" ; -- help2 dvm_s = "ดึม" ; -- drink et_s = "เอ็ด" ; -- one' haa_s = "ห้า" ; -- five hay_s = "ให้" ; -- give +hoog_s = "ห้อง" ; -- room hok_s = "หก" ; -- six +jai_s = "ใ" ; -- understand2 kaaw_s = "เกา" ; -- nine kew_s = "แก้ว" ; -- glass (drink Classif) -khaw_s = "เขว" ; -- he +khaw_s = "เขา" ; -- he khon_s = "คน" ; -- people Classif +khoo_s = "ขอ" ; -- please khoog_s = "ของ" ; -- Possessive +khoop_s = "ขอบ" ; -- thank +khow_s = "เข้ว" ; -- understand1 khun_s = "คุณ" ; -- you +koon_s = "ก่อน" ; -- bye2 +laa_s = "ลา" ; -- bye1 lag_s = "หลัง" ; -- houses Classif lap_s = "หลับ" ; -- sleep2 lem_s = "เล่ม" ; -- books Classif -may_s = "ไม" ; -- not +may_s = "ไม่" ; -- not m'ay_s = "ไหม" ; -- Question mvvn_s = "หมื่น" ; -- ten thousand nag_s = "หนะง" ; -- book1 +nai_s = "ไหน" ; -- where2 +nam_s = "นำ" ; -- water nan_s = "นั้น" ; -- that noon_s = "นอน" ; -- sleep1 nvg_s = "หนึง" ; -- one @@ -37,11 +51,13 @@ pay_s = "ไป" ; -- go peet_s = "แปด" ; -- eight pen_s = "เป็น" ; -- be, can-know phan_s = "พัน" ; -- thousand +phom_s = "ผม" ; -- I (masc) puu_s = "ผู้" ; -- woman1 rak_s = "รัก" ; -- love raw_s = "เรา" ; -- we rooy_s = "ร้อย" ; -- hundred saam_s = "สาม" ; -- three +sawat_s = "สวัส" ; -- hello1 seen_s = "แสน" ; -- hundred thousand si_s = "ซิ" ; -- Imperative sii_s = "สี่" ; -- four @@ -49,14 +65,16 @@ sip_s = "สิบ" ; -- ten soog_s = "สอง" ; -- two svv_s = "สือ" ; -- book2 thii_s = "ที่" ; -- Ord +thoot_s = "โทษ" ; -- sorry2 tog_s = "ต้อง" ; -- must waa_s = "ว่า" ; -- that Conj way_s = "ไหว" ; -- can-potent -yaa_s = "อยา" ; -- Neg Imper +yaa_s = "อย่า" ; -- Neg Imper yaak_s = "อยาก" ; -- want yay_s = "ใหญ" ; -- big yig_s = "หญิง" ; -- woman2 yii_s = "ยี่" ; -- two' - +yin_s = "ยิน" ; -- you're-welcome1 +yuu_s = "ยู" ; -- where0(?) } diff --git a/lib/resource-1.0/thai/StringsThai.gf b/lib/resource-1.0/thai/StringsThai.gf index b2c45b55a..570285556 100644 --- a/lib/resource-1.0/thai/StringsThai.gf +++ b/lib/resource-1.0/thai/StringsThai.gf @@ -6,30 +6,44 @@ resource StringsTha = { oper +aphai_s = "[`aphai]Op3ay" ; -- excuse2 baan_s = "bT2a:n" ; -- house -biar_s = "ebi:OrK" ; +biar_s = "ebi:OrK" ; -- beer ca_s = "ca." ; -- Modal cet_s = "ecSd" ; -- seven chan_s = "c1an" ; -- I -chay_s = "a&c2T1" ; -- be-not +chay_s = "a%c2T1" ; -- yes +chuay_s = "[ch^uay]c2T1wy" ; -- help1 +di_s = "di" ; -- I (fem)1 +dii_s = "di:" ; -- hello2 +duay_s = "[d^uay]dT2wy" ; -- help2 dvm_s = "dvm" ; -- drink et_s = "eOSd" ; -- one' haa_s = "hT2a:" ; -- five hay_s = "a%hT2" ; -- give +hoog_s = "hT2Og" ; -- room hok_s = "ho?k" ; -- six +jai_s = "a%j" ; -- understand2 kaaw_s = "eka:" ; -- nine kew_s = "e'kT2w" ; -- glass (drink Classif) khaw_s = "ek1a:" ; -- he khon_s = "k2n" ; -- people Classif +khoo_s = "k1O" ; -- please khoog_s = "k1Og" ; -- Possessive +khoop_s = "k1Ob" ; -- thank +khow_s = "ek1T2w" ; -- understand1 khun_s = "k2un'" ; -- you +koon_s = "kT1On" ; -- bye2 +laa_s = "la:" ; -- bye1 lag_s = "hlag" ; -- houses Classif lap_s = "hlab" ; -- sleep2 lem_s = "elT1m" ; -- books Classif -may_s = "a&m" ; -- not +may_s = "a&mT1" ; -- not m'ay_s = "a&hm" ; -- Question mvvn_s = "hmv:T1n" ; -- ten thousand nag_s = "hna.g" ; -- book1 +nai_s = "a&hn" ; -- where2 +nam_s = "na+" ; -- water nan_s = "naT2n" ; -- that noon_s = "nOn" ; -- sleep1 nvg_s = "hnvg" ; -- one @@ -37,11 +51,13 @@ pay_s = "a&p" ; -- go peet_s = "e'pd" ; -- eight pen_s = "epSn" ; -- be, can-know phan_s = "p2an" ; -- thousand +phom_s = "p1m" ; -- I (masc) puu_s = "p1u:T2" ; -- woman1 rak_s = "rak" ; -- love raw_s = "era:" ; -- we rooy_s = "rT2Oy" ; -- hundred saam_s = "sa:m" ; -- three +sawat_s = "swas" ; -- hello1 seen_s = "e'sn" ; -- hundred thousand si_s = "s'i" ; -- Imperative sii_s = "si:T1" ; -- four @@ -49,6 +65,7 @@ sip_s = "sib" ; -- ten soog_s = "sOg" ; -- two svv_s = "sv:O" ; -- book2 thii_s = "t5i:T1" ; -- Ord +thoot_s = "o:t5r'" ; -- sorry2 tog_s = "tT2Og" ; -- must waa_s = "wT1a:" ; -- that Conj way_s = "a&hw" ; -- can-potent @@ -57,6 +74,7 @@ yaak_s = "[y`aak]Oya:k" ; -- want yay_s = "a%hy'" ; -- big yig_s = "hy'ig" ; -- woman2 yii_s = "yi:T1" ; -- two' - +yin_s = "yin" ; -- you're-welcome1 +yuu_s = "yu:" ; -- where0(?) } 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" "
"
-  appendFile "thai.html" thaiTable
-  appendFile "thai.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]