forked from GitHub/gf-core
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:
@@ -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
|
||||
} ;
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ lin pot3plus n m = {
|
||||
|
||||
oper
|
||||
commaIf : DTail -> Str = \t -> case t of {
|
||||
T3 => "," ;
|
||||
T3 => frontComma ;
|
||||
_ => []
|
||||
} ;
|
||||
|
||||
|
||||
@@ -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
|
||||
} ;
|
||||
|
||||
|
||||
@@ -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} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -543,6 +543,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
}
|
||||
} ;
|
||||
|
||||
finalComma : Str = pre {"," | "." => []; "" => ","; _ => []} ;
|
||||
finalComma : Str = pre {"," | "." => []; "" => SOFT_BIND ++ ","; _ => []} ;
|
||||
frontComma : Str = SOFT_BIND ++ "," ;
|
||||
|
||||
}
|
||||
|
||||
@@ -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 ;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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} ;
|
||||
|
||||
@@ -38,5 +38,6 @@ resource Predef = {
|
||||
-- map all strings in a data structure; experimental ---
|
||||
oper nonExist : Str = variants {} ; -- a placeholder for non-existant morphological forms
|
||||
oper BIND : Str = variants {} ; -- a token for gluing
|
||||
oper SOFT_BIND : Str = variants {} ; -- a token for soft gluing
|
||||
|
||||
} ;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
-- This file defines some prelude facilities usable in all grammars.
|
||||
|
||||
resource Prelude = open (Predef=Predef) in {
|
||||
resource Prelude = Predef[nonExist, BIND, SOFT_BIND] ** open (Predef=Predef) in {
|
||||
|
||||
oper
|
||||
|
||||
@@ -33,10 +33,6 @@ oper
|
||||
|
||||
--2 Optional elements
|
||||
|
||||
-- Missing form.
|
||||
|
||||
nonExist : Str = Predef.nonExist;
|
||||
|
||||
-- Optional string with preference on the string vs. empty.
|
||||
|
||||
optStr : Str -> Str = \s -> variants {s ; []} ;
|
||||
@@ -114,7 +110,6 @@ oper
|
||||
|
||||
-- These should be hidden, and never changed since they are hardcoded in (un)lexers
|
||||
|
||||
BIND : Str = Predef.BIND;
|
||||
PARA : Str = "&-" ;
|
||||
CAPIT : Str = "&|" ;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user