From 0882e5eac274f11a0cd3a98fa93c57d6ee479981 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 9 Jan 2007 14:53:19 +0000 Subject: thai phrasebook example started --- src/GF/Text/Thai.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/GF/Text/Thai.hs b/src/GF/Text/Thai.hs index 33d2b3a16..eda261051 100644 --- a/src/GF/Text/Thai.hs +++ b/src/GF/Text/Thai.hs @@ -121,6 +121,7 @@ pronSyllable s = vowel = case (initv s, midv s, finalv s, shorten s, tone s) of ([0x0e40],[0x0e30,0x0e2d],_,_,_) -> "รถ" -- eOa ([0x0e40],[0x0e30,0x0e32],_,_,_) -> "o" -- ea:a + ([],[],[],_,_) -> "o" (i,m,f,_,_) -> concatMap pronThaiChar (reverse $ f ++ m ++ i) ---- initCons = concatMap pronThaiChar $ case (reverse $ initc s) of @@ -179,12 +180,14 @@ getSyllable = foldl get (Syll [] [] [] [] [] [] False False) where | isVowel c -> if null (initc syll) then syll {initv = c : initv syll} else syll {midv = c : midv syll} - | isCons c -> if null (midv syll) + | isCons c -> if null (initc syll) || + (null (midv syll) && isCluster (initc syll) c) then syll {initc = c : initc syll} else syll {finalc = c : finalc syll} | isTone c -> syll {tone = [c]} _ -> syll ---- check this + isCluster s c = length s == 1 && (c == 0x0e23 || s == [0x0e2b]) -- to test -- cgit v1.2.3