1
0
forked from GitHub/gf-core

adjustments in Phrasebook and synopsis

This commit is contained in:
aarne
2011-12-08 14:04:42 +00:00
parent c20745480f
commit 2cc65efff8
16 changed files with 271 additions and 236 deletions

View File

@@ -1,6 +1,7 @@
concrete SentencesTha of Sentences = NumeralTha ** SentencesI - [
PGreetingMale, PGreetingFemale,
GObjectPlease,
IMale, YouFamMale, YouFamFemale,
ACitizen
] with
(Syntax = SyntaxTha),
@@ -17,6 +18,9 @@ lin
ACitizen p n = mkCl p.name (mkVP (mkCN n (P.personN R.khon_s))) ;
IMale = mkPerson (R.mkNP "ผม") ;
YouFamMale, YouFamFemale = mkPerson (R.mkNP "เธอ") ;
oper
thpron = R.thpron ;
}

View File

@@ -155,12 +155,12 @@ concrete WordsTha of Words = SentencesTha **
HowMuchCost item = mkQS (mkQCl (mkIComp how8much_IAdv) item) ;
ItCost item price = mkCl item (mkV2 (R.thword "เป็น" "รา" "คา")) price ;
PropOpen p = mkCl p.name open_Adv ;
PropClosed p = mkCl p.name closed_Adv ;
PropOpenDate p d = mkCl p.name (mkVP (mkVP open_Adv) d) ;
PropClosedDate p d = mkCl p.name (mkVP (mkVP closed_Adv) d) ;
PropOpenDay p d = mkCl p.name (mkVP (mkVP open_Adv) d.habitual) ;
PropClosedDay p d = mkCl p.name (mkVP (mkVP closed_Adv) d.habitual) ;
PropOpen p = mkCl p.name open_A ;
PropClosed p = mkCl p.name closed_A ;
PropOpenDate p d = mkCl p.name (mkVP (mkVP open_A) d) ;
PropClosedDate p d = mkCl p.name (mkVP (mkVP closed_A) d) ;
PropOpenDay p d = mkCl p.name (mkVP (mkVP open_A) d.habitual) ;
PropClosedDay p d = mkCl p.name (mkVP (mkVP closed_A) d.habitual) ;
-- Building phrases from strings is complicated: the solution is to use
-- mkText : Text -> Text -> Text ;
@@ -244,8 +244,8 @@ concrete WordsTha of Words = SentencesTha **
mkPlace : N -> {name : CN ; at : Prep ; to : Prep; isPl : Bool} = \p ->
mkCNPlace (mkCN p) at_Prep noPrep ;
open_Adv = P.mkAdv "เปิด" ;
closed_Adv = P.mkAdv "ปิด" ;
open_A = P.mkA "เปิด" ;
closed_A = P.mkA "ปิด" ;
xOf : Str -> NPPerson -> NPPerson = \f,p ->
{name = mkNP the_Det (mkCN (personN f) (SyntaxTha.mkAdv possess_Prep p.name)) ;

View File

@@ -1,5 +1,5 @@
DisambPhrasebookEng :
PhrasebookBul : ABusinessman ACook ADoctor AEngineer ALawyer AProfessor AStudent ATeacher Baht Beach Beef Chili Coke Durian Egg Garlic IceCream ItsCold ItsRaining ItsWarm ItsWindy Lemonade Mango Noodles ObjPlur OrangeJuice Pineapple Pork Rice Salad Shrimps Smoke SunShine Thai ThesPlur ThesePlur ThosePlur
PhrasebookBul : Noodles
PhrasebookCat : ABusinessman ACook ADoctor AEngineer ALawyer AProfessor AStudent ATeacher Baht Beach Beef Chili Coke Durian Egg Garlic IceCream ItsCold ItsRaining ItsWarm ItsWindy Lemonade MMust Mango Noodles ObjPlur OrangeJuice Pineapple Pork Rice Salad Shrimps Smoke SunShine Thai ThesPlur ThesePlur ThosePlur
PhrasebookDan : ABusinessman ACook ADoctor AEngineer ALawyer AProfessor AStudent ATeacher Baht Beach Beef Chili Coke Durian Egg Garlic IceCream ItsCold ItsRaining ItsWarm ItsWindy Lemonade Mango Noodles ObjPlur OrangeJuice Pineapple Pork Rice Salad Shrimps Smoke SunShine Thai ThesPlur ThesePlur ThosePlur
PhrasebookDut : ABusinessman ACook ADoctor AEngineer ALawyer AProfessor AStudent ATeacher Baht Beach Beef Chili Coke Durian Egg Garlic IceCream ItsCold ItsRaining ItsWarm ItsWindy Lemonade Mango Noodles ObjPlur OrangeJuice Pineapple Pork Rice Salad Shrimps Smoke SunShine Thai ThesPlur ThesePlur ThosePlur

View File

@@ -65,11 +65,11 @@ she sleeps
mkUtt (mkQS pastTense negativePol (mkQCl who_IP sleep_V))
who didn't sleep
ครไม่นอนหลับ -- neg place not preferred
ครไม่นอนหลับ -- neg place not preferred
mkUtt (mkQCl who_IP sleep_V)
who sleeps
ครนอนหลับ
ครนอนหลับ
mkUtt pluralImpForm negativePol (mkImp (mkVP man_N))
don't be men
@@ -217,7 +217,7 @@ she answers to him that we sleep
mkCl she_NP ask_V2Q he_NP (mkQS (mkQCl who_IP sleep_V))
she asks him who sleeps
หล่อนถามเขาว่าครนอนหลับ
หล่อนถามเขาว่าครนอนหลับ
mkCl she_NP beg_V2V he_NP (mkVP sleep_V)
she begs him to sleep
@@ -854,7 +854,7 @@ it is good that she sleeps
mkCl (mkVP (mkAP (mkAP uncertain_A) (mkQS (mkQCl who_IP sleep_V))))
it is uncertain who sleeps
ลังเลใจว่าครนอนหลับ
ลังเลใจว่าครนอนหลับ
mkCl she_NP (mkAP (mkAP ready_A) (mkVP sleep_V))
she is ready to sleep

22
lib/doc/Test.hs Normal file
View File

@@ -0,0 +1,22 @@
import qualified Data.Map as Map
import Data.Char
gold = "CC_eng_tha.txt"
tested = "api-examples-Tha.txt"
main = do
s <- readFile gold
let corrects = Map.fromList $ exx 1 5 2 (lines s)
-- mapM_ putStrLn $ concat [[t,s] | (t,s) <- Map.toList corrects]
t <- readFile tested
mapM_ (doTest corrects) (exx 18 22 1 (map (drop 4) (lines t)))
exx x y z ss = [(ss!!k,ss!!(k+z)) | k <- [x,y .. length ss - 2]]
doTest corrects (t,s) = case Map.lookup t corrects of
Just c -> if unspace s == uncomment c then return () else mapM_ putStrLn [t,unspace s,c]
_ -> return ()
unspace = filter (not . isSpace)
uncomment = unspace . takeWhile (/= '-')

View File

@@ -750,7 +750,7 @@ mkUtt everything_NP
everywhere_Adv : Adv
everywhere_Adv
few_Det : Det
mkUtt (mkNP few_Det women_N)
mkUtt (mkNP few_Det woman_N)
for_Prep : Prep
mkAdv for_Prep it_NP
from_Prep : Prep

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,7 @@ lin
married_A2 = mkA2 (mkA "getrouwd") (mkPrep "met") ;
mother_N2 = mkN2 (mkN "moeder") ;
now_Adv = mkAdv "nu" ;
paint_V2A = mkV2A (mkV "schilderen") noPrep ;
paint_V2A = mkV2A (mkV "schilderen" "schildert") noPrep ;
paris_PN = mkPN "Parijs" ;
red_A = mkA "rood" ;
say_VS = mkVS zeggen_V ;
@@ -196,7 +196,7 @@ laugh_V = lachen_V ;
leaf_N = mkN "blad" neuter ;
learn_V2 = mkV2 "leren" ;
leather_N = mkN "leer" neuter ;
leave_V2 = mkV2 laten_V ;
leave_V2 = mkV2 (mkV "verlaten" "verliet" "verlieten" "verlaten") ;
leg_N = mkN "been" neuter ;
lie_V = liggen_V ;
like_V2 = mkV2 houden_V van_Prep ;

View File

@@ -116,6 +116,7 @@ oper
mkV : overload {
mkV : (aaien : Str) -> V ; -- regular verb
mkV : (aaien,aait : Str) -> V ; -- regular verb with third person sg pres (giving stem)
mkV : (breken,brak,gebroken : Str) -> V ; -- theme of irregular verb
mkV : (breken,brak,braken,gebroken : Str) -> V ; -- also past plural irregular
mkV : (aai,aait,aaien,aaide,aaide,aaiden,geaaid : Str) -> V ; -- worst-case verb
@@ -216,6 +217,8 @@ oper
mkV = overload {
mkV : (aaien : Str) -> V =
\s -> lin V (v2vv (regVerb s)) ;
mkV : (aaien, aait : Str) -> V =
\s,t -> lin V (v2vv (smartVerb s (init t))) ;
mkV : (breken,brak,gebroken : Str) -> V =
\a,b,c -> lin V (v2vv (irregVerb a b c)) ;
mkV : (breken,brak,braken,gebroken : Str) -> V =

View File

@@ -224,7 +224,7 @@ resource ResDut = ParamX ** open Prelude in {
-- For regular verbs with past tense 'd'
d_regVerb : (_,_ :Str) -> Verb = \geeuwen,geeuw ->
let stem = mkStem geeuwen
let stem = geeuw --- mkStem geeuwen
in
mkVerb stem (stem + "t") geeuwen
(stem + "de") (stem + "de") (stem + "den")

View File

@@ -44,7 +44,8 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in {
CN = ResTha.Noun ;
NP, Pron = ResTha.NP ;
Det, Quant = ResTha.Determiner ;
Predet, Ord = {s : Str} ;
Predet = {s1,s2 : Str} ;
Ord = {s : Str} ;
Num = {s : Str ; hasC : Bool} ;
-- Numeral
@@ -60,8 +61,8 @@ concrete CatTha of Cat = CommonX ** open ResTha, Prelude in {
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = Verb ;
V2, V2A, V2Q, V2S, V2V = Verb ** {c2 : Str} ;
V3 = Verb ** {c2, c3 : Str} ;
V2, V2Q, V2S = Verb ** {c2 : Str} ;
V3, V2A, V2V = Verb ** {c2, c3 : Str} ;
VV = VVerb ;
A = ResTha.Adj ;

View File

@@ -26,7 +26,7 @@ lin
beautiful_A = mkA "สวย" ;
become_VA = mkV (thword "กลาย" "เป็น") ; -- pen
beer_N = mkN biar_s kew_s ;
beg_V2V = regV "ขอ" ** {c2 = []} ;
beg_V2V = regV "ขอ" ** {c2 = [] ; c3 = "ให้"} ; --- hay as prep of VP
belly_N = mkN (thword "พุง") ;
big_A = mkA (thword "ใหญ่") ;
bike_N = mkN (thword "จักร" "ยาน") "คัน" ;
@@ -35,7 +35,7 @@ lin
black_A = mkA (thword "ดำ") ;
blood_N = mkN (thword "เลือด") ;
blow_V = mkV (thword "พัด") ;
blue_A = mkA (thword "สี" "น้ำ" "เงิน") ;
blue_A = mkA (thword "น้ำ" "เงิน") ; --- (thword "สี" "น้ำ" "เงิน") ;
boat_N = mkN (thword "เรือ") "ลำ" ;
bone_N = mkN (thword "กระ" "ดูก") ;
book_N = mkN (thword nag_s svv_s) lem_s ;
@@ -137,7 +137,7 @@ lin
good_A = mkA "ดี" ;
grammar_N = mkN (thword "ไวย" "กรณ์") ; ----?
grass_N = mkN "หญ้า" ;
green_A = mkA (thword "สี" "เขียว") ;
green_A = mkA "เขียว" ; --- (thword "สี" "เขียว") ;
guts_N = mkN (thword "ไส้") ;
hair_N = mkN (thword "ผม") ;
hand_N = mkN (thword "มือ") ;
@@ -214,7 +214,7 @@ lin
old_A = mkA (thword "แก่") ;
open_V2 = mkV2 (mkV "เปิด") ;
other_A = mkA "อื่น" ;
paint_V2A = mkV2A (regV "ทา") [] ;
paint_V2A = mkV2A (regV "ทา") [] "สี" ;
paper_N = mkN (thword "กระ" "ดาษ") ; ----?
paris_PN = ss "ปารีส" ;
peace_N = mkN (thword "สัน" "ติ" "ภาพ"); ----?
@@ -237,7 +237,7 @@ lin
ready_A = mkA "พร้อม" ;
reason_N = verbalN "เหตู" ;
read_V2 = mkV2 "อ่าน" ;
red_A = mkA (thword "สี" "แดง") ;
red_A = mkA "แดง" ; --- (thword "สี" "แดง") ;
religion_N = mkN (thword "ศาส" "นา") ; ----?
restaurant_N = placeN (thword "ร้าน" "อา" "หาร") ;
right_Ord = ss "ขวา" ;
@@ -264,7 +264,7 @@ lin
seed_N = mkN (thword "เม็ด") ;
seek_V2 = mkV2 "หา" ;
sell_V3 = mkV3 "ขาย" ;
send_V3 = mkV3 (mkV "ส่ง" "ให้") ;
send_V3 = mkV3 (mkV "ส่ง") [] (thword "ให้" "กับ") ; --- hai kab as prep
sew_V = mkV (thword "เย็บ") ;
sharp_A = mkA (thword "คม") ;
sheep_N = animalN "แกะ" ;
@@ -356,7 +356,7 @@ lin
worm_N = animalN (thword "หนอน") ;
write_V2 = mkV2 "เขียน" ;
year_N = mkN (thword "ปี") ;
yellow_A = mkA (thword "สี" "เหลือง") ;
yellow_A = mkA "เหลือง" ; ---- (thword "สี" "เหลือง") ;
young_A = mkA "รุ่น" ;
oper

View File

@@ -11,7 +11,7 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in {
DetNP det = mkNP (thbind det.s1 det.s2) ;
PredetNP pred np = thbind pred np ;
PredetNP pred np = mkNP (thbind pred.s1 np.s pred.s2) ;
PPartNP np v2 = thbind np (ss ((predV v2).s ! Pos)) ; ---- ??

View File

@@ -76,14 +76,14 @@ oper
mkV2Q : V -> Str -> V2Q =
\v,p -> lin V2Q (v ** {c2 = p}) ;
mkV2V : V -> Str -> V2V =
\v,p -> lin V2V (v ** {c2 = p}) ;
mkV2V : V -> Str -> Str -> V2V =
\v,p,q -> lin V2V (v ** {c2 = p ; c3 = q}) ;
mkV2S : V -> Str -> V2S =
\v,p -> lin V2S (v ** {c2 = p}) ;
mkV2A : V -> Str -> V2A =
\v,p -> lin V2A (v ** {c2 = p}) ;
mkV2A : V -> Str -> Str -> V2A =
\v,p,q -> lin V2A (v ** {c2 = p ; c3 = q}) ;
mkAdv : Str -> Adv =
\s -> lin Adv (ss s) ;

View File

@@ -6,7 +6,7 @@ concrete StructuralTha of Structural = CatTha **
lin
above_Prep = ss (thword "ข้าง" "บน") ;
after_Prep = ss (thword "หลัง" "จาก") ;
all_Predet = ss (thword "ทั้ง" "หมด") ;
all_Predet = {s1 = thword "ทั้ง" "หมด" ; s2 = []} ;
almost_AdA, almost_AdN = ss (thword "เกิ" "อบ") ;
although_Subj = ss "ถืง" ;
always_AdV = ss (thword "เส" "มอ") ; --- pronunciation
@@ -51,16 +51,16 @@ concrete StructuralTha of Structural = CatTha **
less_CAdv = {s = "น้อย" ; p = "กว่า"} ;
many_Det = quantDet "หลาย" ;
more_CAdv = {s = "มาก" ; p = "กว่า"} ;
most_Predet = ss (thword "มาก" "ที่" "สุด") ;
most_Predet = {s1 = thword "มาก" "ที่" "สุด" ; s2 = []} ;
much_Det = quantDet "หลาย" ; ---- always?
must_VV = {s = tog_s ; typ = VVPre} ;
no_Quant = quantDet (thword "ไม่" "มี") ;
no_Utt = ss may_s ;
nobody_NP = mkNP (thword "ไม่" "มี" "ใคร") ;
not_Predet = ss may_s ; ----
not_Predet = {s1 = may_s ; s2 = []} ; ----
nothing_NP = mkNP "เปล่า" ;
on_Prep = ss "บน" ;
only_Predet = ss (thword "เท่า" "นั้น") ;
only_Predet = {s1 = [] ; s2 = thword "เท่า" "นั้น"} ;
or_Conj = {s1 = [] ; s2 = "หริอ"} ;
otherwise_PConj = ss (thword "ไม่" "อย่าง" "นั้น") ;
part_Prep = ss "" ; ----

View File

@@ -7,16 +7,16 @@ concrete VerbTha of Verb = CatTha ** open ResTha, StringsTha, Prelude in {
SlashV2a v = predV v ** {c2 = v.c2} ;
Slash2V3 v np = insertObj np (predV v) ** {c2 = v.c3} ;
Slash3V3 v np = insertObj np (predV v) ** {c2 = v.c2} ;
Slash2V3 v np = insertObject <thbind v.c2 np.s : Str> (predV v) ** {c2 = v.c3} ;
Slash3V3 v np = insertExtra <thbind v.c3 np.s : Str> (predV v) ** {c2 = v.c2} ;
SlashV2A v ap =
insertExtra <thbind v.c2 ap.s : Str> (predV v) ** {c2 = v.c2} ;
insertExtra <thbind pen_s v.c3 ap.s : Str> (predV v) ** {c2 = v.c2} ; --- pen?
SlashV2V v vp = ---- looks too simple compared with ComplVV
insertExtra <thbind <v.c2 : Str> <infVP vp : Str> : Str> (predV v) ** {c2 = v.c2} ;
insertExtra <thbind <v.c3 : Str> <infVP vp : Str> : Str> (predV v) ** {c2 = v.c2} ;
SlashV2S v s =
insertExtra conjThat (predV v) ** {c2 = v.c2} ;
insertExtra <thbind conjThat s.s : Str> (predV v) ** {c2 = v.c2} ;
SlashV2Q v q =
insertExtra (q.s ! QIndir) (predV v) ** {c2 = v.c2} ;
@@ -57,7 +57,7 @@ concrete VerbTha of Verb = CatTha ** open ResTha, StringsTha, Prelude in {
ReflVP vp = insertObj (mkNP (thbind vp.c2 reflPron)) vp ;
PassV2 v = {s = \\p => thbind thuuk_s ((predV v).s ! p) ; e = []} ;
PassV2 v = {s = \\p => thbind (polStr may_s p) thuuk_s ; e = thbind v.s1 v.s2} ; -- to put agent before verb; --- the place of neg?
CompAP ap = {s = \\p => thbind (polStr may_s p) ap.s} ;