mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
refactored Thai so that it can now be compiled producing BIND tokens instead of spaces, by just changing the definition of ResTha.bIND. This is not to be exploited yet, because it produces consecutive BIND tokens, which are not supported at runtime.
This commit is contained in:
@@ -18,18 +18,18 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in {
|
||||
AdvNP np adv = thbind np adv ;
|
||||
|
||||
DetQuant quant num = {
|
||||
s1 = num.s ++ quant.s1 ; --- can there be quant.s1 ??
|
||||
s1 = num.s ++bIND++ quant.s1 ; --- can there be quant.s1 ??
|
||||
s2 = quant.s2 ;
|
||||
hasC = orB num.hasC quant.hasC ;
|
||||
} ;
|
||||
DetQuantOrd quant num ord = {
|
||||
s1 = num.s ++ quant.s1 ; --- can there be quant.s1 ??
|
||||
s2 = ord.s ++ quant.s2 ;
|
||||
s1 = num.s ++bIND++ quant.s1 ; --- can there be quant.s1 ??
|
||||
s2 = ord.s ++bIND++ quant.s2 ;
|
||||
hasC = True ;
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s1 = khoog_s ++ p.s ;
|
||||
s1 = khoog_s ++bIND++ p.s ;
|
||||
s2 = [] ;
|
||||
hasC = False
|
||||
} ;
|
||||
@@ -60,7 +60,7 @@ concrete NounTha of Noun = CatTha ** open StringsTha, ResTha, Prelude in {
|
||||
ComplN2 f x = {s = thbind f.s f.c2 x.s ; c = f.c} ;
|
||||
ComplN3 f x = {s = thbind f.s f.c2 x.s ; c = f.c ; c2 = f.c3} ;
|
||||
|
||||
AdjCN ap cn = {s = cn.s ++ ap.s ; c = cn.c} ;
|
||||
AdjCN ap cn = {s = cn.s ++bIND++ ap.s ; c = cn.c} ;
|
||||
|
||||
RelCN cn rs = {s = thbind cn.s rs.s ; c = cn.s} ;
|
||||
AdvCN cn ad = {s = thbind cn.s ad.s ; c = cn.s} ;
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
concrete PhraseTha of Phrase = CatTha ** open Prelude, ResTha in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++bIND++ utt.s ++bIND++ voc.s} ;
|
||||
|
||||
UttS s = s ;
|
||||
UttQS qs = {s = qs.s ! QDir} ;
|
||||
UttImpSg pol imp = {s = pol.s ++ imp.s ! pol.p} ;
|
||||
UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p} ;
|
||||
UttImpPol pol imp = {s = pol.s ++ imp.s ! pol.p} ; --- add politeness here?
|
||||
UttImpSg pol imp = {s = pol.s ++bIND++ imp.s ! pol.p} ;
|
||||
UttImpPl pol imp = {s = pol.s ++bIND++ imp.s ! pol.p} ;
|
||||
UttImpPol pol imp = {s = pol.s ++bIND++ imp.s ! pol.p} ; --- add politeness here?
|
||||
|
||||
UttIP ip = ip ;
|
||||
UttIAdv iadv = iadv ;
|
||||
@@ -15,7 +15,7 @@ concrete PhraseTha of Phrase = CatTha ** open Prelude, ResTha in {
|
||||
UttCN cn = cn ;
|
||||
UttAP ap = ap ;
|
||||
UttCard x = x ;
|
||||
UttVP vp = {s = vp.s ! Pos ++ vp.e} ;
|
||||
UttVP vp = {s = vp.s ! Pos ++bIND++ vp.e} ;
|
||||
UttAdv adv = adv ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
|
||||
@@ -30,7 +30,7 @@ concrete QuestionTha of Question = CatTha **
|
||||
IdetIP idet = mkNP (thbind idet.s1 idet.s2) ;
|
||||
|
||||
IdetQuant iquant num = {
|
||||
s1 = num.s ++ iquant.s1 ; --- is num even possible ??
|
||||
s1 = num.s ++bIND++ iquant.s1 ; --- is num even possible ??
|
||||
s2 = iquant.s2 ;
|
||||
hasC = iquant.hasC
|
||||
} ;
|
||||
|
||||
@@ -11,9 +11,10 @@ resource ResTha = ParamX, StringsTha ** open Prelude in {
|
||||
|
||||
oper
|
||||
|
||||
-- binding words together - if you want. But better do it with the unlexer -unchars.
|
||||
-- binding words together
|
||||
-- will be activated when the parser supports consecutive BINDs AR 16/3/2015
|
||||
|
||||
bIND = [] ;
|
||||
bIND = [] ; ---- Predef.BIND ;
|
||||
|
||||
thbind = overload {
|
||||
thbind : Str -> Str = \s -> s ;
|
||||
@@ -99,8 +100,8 @@ resource ResTha = ParamX, StringsTha ** open Prelude in {
|
||||
|
||||
predV : Verb -> VP = \v -> {
|
||||
s = \\p => if_then_Str v.isCompl
|
||||
(thbind v.s1 (polStr may_s p ++ v.s2))
|
||||
(v.s1 ++ (polStr may_s p ++ v.s2)) ; --- v.s1 = [] ;
|
||||
(thbind v.s1 (polStr may_s p ++bIND++ v.s2))
|
||||
(v.s1 ++bIND++ (polStr may_s p ++bIND++ v.s2)) ; --- v.s1 = [] ;
|
||||
e = []
|
||||
} ;
|
||||
|
||||
@@ -111,7 +112,7 @@ resource ResTha = ParamX, StringsTha ** open Prelude in {
|
||||
|
||||
insertExtra : Str -> VP -> VP = \o,vp -> {
|
||||
s = vp.s ;
|
||||
e = vp.e ++ o
|
||||
e = vp.e ++bIND++ o
|
||||
} ;
|
||||
|
||||
adjVP : Adj -> VP = \a -> {
|
||||
|
||||
@@ -32,17 +32,20 @@ concrete SentenceTha of Sentence = CatTha **
|
||||
EmbedQS qs = {s = qs.s ! QIndir} ;
|
||||
EmbedVP vp = {s = infVP vp} ;
|
||||
|
||||
UseCl t p cl = {s = thbind t.s p.s (cl.s ! ClDecl ! p.p)} ;
|
||||
UseCl t p cl = {s = t.s ++ p.s ++ (cl.s ! ClDecl ! p.p)} ; --- no bIND here, to prevent spurious &+ tokens
|
||||
UseQCl t p cl = {
|
||||
s = \\q => thbind t.s p.s
|
||||
(case q of {QIndir => waa_s ; _ => []}) (cl.s ! p.p)
|
||||
s = \\q => t.s ++ p.s ++
|
||||
(case q of {QIndir => waa_s ; _ => []}) ++bIND++ (cl.s ! p.p)
|
||||
} ;
|
||||
UseRCl t p cl = {
|
||||
s = thbind t.s p.s (cl.s ! p.p) ;
|
||||
s = t.s ++ p.s ++ (cl.s ! p.p) ;
|
||||
} ;
|
||||
UseSlash t p cl = {s = thbind t.s p.s (cl.s ! p.p) ; c2 = cl.c2} ;
|
||||
UseSlash t p cl = {s = t.s ++ p.s ++ (cl.s ! p.p) ; c2 = cl.c2} ;
|
||||
|
||||
AdvS a s = thbind a s ;
|
||||
|
||||
RelS s r = thbind s r ;
|
||||
|
||||
ExtAdvS a s = thbind a s ;
|
||||
SSubjS a c b = thbind a c b ;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ oper mmkV2V : Str -> V2V = \s -> mkV2V (mkV s) [] [] ;
|
||||
oper mmkV2A : Str -> V2A = \s -> mkV2A (mkV s) [] [] ;
|
||||
oper mmkV2S : Str -> V2S = \s -> mkV2S (mkV s) [] ;
|
||||
oper prepV2 : V -> Prep -> V2 = \v,p -> mkV2 v p.s ;
|
||||
oper advV : V -> Adv -> V = \v,a -> mkV v.s1 (v.s2 ++ a.s) ; ----
|
||||
oper advV : V -> Adv -> V = \v,a -> mkV v.s1 (thbind v.s2 a.s) ; ----
|
||||
|
||||
|
||||
lin aardvark_N = mkN "ตัวกินมด" ; -- src=panlex
|
||||
|
||||
@@ -14,9 +14,9 @@ lin
|
||||
---- ConjVPI = E.ConjVPI ;
|
||||
---- ComplVPIVV = E.ComplVPIVV ;
|
||||
|
||||
MkVPS _ p vp = {s = vp.s ! p.p} ; ----
|
||||
MkVPS t p vp = {s = t.s ++ p.s ++ vp.s ! p.p} ; ----
|
||||
---- ConjVPS = E.ConjVPS ;
|
||||
PredVPS np vp = cc2 np vp ;
|
||||
PredVPS np vp = thbind np vp ;
|
||||
{-
|
||||
BaseVPI = E.BaseVPI ;
|
||||
ConsVPI = E.ConsVPI ;
|
||||
|
||||
Reference in New Issue
Block a user