1
0
forked from GitHub/gf-rgl

added Predef.SOFT_BIND. This special token allows zero or more spaces between ordinary tokens. It is also used in the English RGL to attach the commas to the previous word.

This commit is contained in:
kr.angelov
2013-11-12 09:54:57 +00:00
parent 72f6c2cfdd
commit 26b65e5785
10 changed files with 17 additions and 20 deletions

View File

@@ -22,7 +22,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
} ;
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ++ finalComma ;
s = \\c => np.s ! c ++ frontComma ++ rs.s ! np.a ++ finalComma ;
a = np.a
} ;
@@ -32,7 +32,7 @@ concrete NounEng of Noun = CatEng ** open MorphoEng, ResEng, Prelude in {
} ;
ExtAdvNP np adv = {
s = \\c => np.s ! c ++ "," ++ adv.s ++ finalComma;
s = \\c => np.s ! c ++ frontComma ++ adv.s ++ finalComma;
a = np.a
} ;

View File

@@ -69,7 +69,7 @@ lin pot3plus n m = {
oper
commaIf : DTail -> Str = \t -> case t of {
T3 => "," ;
T3 => frontComma ;
_ => []
} ;

View File

@@ -90,8 +90,8 @@ lin
compl = vp.s2 ! np.a
in
case o of {
ODir => compl ++ "," ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ;
OQuest => verb.aux ++ compl ++ "," ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf
ODir => compl ++ frontComma ++ np.s ! npNom ++ verb.aux ++ vp.ad ++ verb.fin ++ verb.adv ++ verb.inf ;
OQuest => verb.aux ++ compl ++ frontComma ++ np.s ! npNom ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf
}
} ;
@@ -102,7 +102,7 @@ lin
compl = vp.s2 ! np.a
in
case o of {
ODir => compl ++ "," ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ;
ODir => compl ++ frontComma ++ verb.aux ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom ;
OQuest => verb.aux ++ compl ++ verb.adv ++ vp.ad ++ verb.fin ++ verb.inf ++ np.s ! npNom
}
} ;
@@ -137,7 +137,7 @@ lin
} ;
ApposNP np1 np2 = {
s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ++ finalComma ;
s = \\c => np1.s ! c ++ frontComma ++ np2.s ! npNom ++ finalComma ;
a = np1.a
} ;

View File

@@ -23,6 +23,6 @@ concrete PhraseEng of Phrase = CatEng ** open Prelude, ResEng in {
PConjConj conj = {s = conj.s2} ; ---
NoVoc = {s = []} ;
VocNP np = {s = "," ++ np.s ! npNom} ;
VocNP np = {s = frontComma ++ np.s ! npNom} ;
}

View File

@@ -543,6 +543,7 @@ resource ResEng = ParamX ** open Prelude in {
}
} ;
finalComma : Str = pre {"," | "." => []; "" => ","; _ => []} ;
finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ;
frontComma : Str = SOFT_BIND ++ "," ;
}

View File

@@ -57,11 +57,11 @@ concrete SentenceEng of Sentence = CatEng ** open Prelude, ResEng in {
} ;
AdvS a s = {s = a.s ++ s.s} ;
ExtAdvS a s = {s = a.s ++ "," ++ s.s} ;
ExtAdvS a s = {s = a.s ++ frontComma ++ s.s} ;
SSubjS a s b = {s = a.s ++ "," ++ s.s ++ b.s} ;
SSubjS a s b = {s = a.s ++ frontComma ++ s.s ++ b.s} ;
RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ;
RelS s r = {s = s.s ++ frontComma ++ r.s ! agrP3 Sg} ;
oper
ctr : CPolarity -> CPolarity = \x -> x ;

View File

@@ -33,7 +33,7 @@ lin
MkSymb s = s ;
BaseSymb = infixSS "and" ;
ConsSymb = infixSS "," ;
ConsSymb = infixSS frontComma ;
oper
-- Note: this results in a space before 's, but there's

View File

@@ -39,7 +39,7 @@ concrete VerbEng of Verb = CatEng ** open ResEng, Prelude in {
UseComp comp = insertObj comp.s (predAux auxBe) ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
ExtAdvVP vp adv = insertObj (\\_ => "," ++ adv.s ++ finalComma) vp ;
ExtAdvVP vp adv = insertObj (\\_ => frontComma ++ adv.s ++ finalComma) vp ;
AdVVP adv vp = insertAdV adv.s vp ;
AdvVPSlash vp adv = insertObj (\\_ => adv.s) vp ** {c2 = vp.c2 ; gapInMiddle = vp.gapInMiddle} ;