forked from GitHub/gf-core
Tense to Common ; Idiom ; Text
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
--1 The category system
|
||||
|
||||
abstract Cat = Tense ** {
|
||||
abstract Cat = Common ** {
|
||||
|
||||
cat
|
||||
|
||||
--2 Top-level units
|
||||
|
||||
-- Constructed in [Text Text.html].
|
||||
-- Constructed in [Text Text.html]: $Text$.
|
||||
|
||||
Text ; -- text consisting of several phrases
|
||||
-- Constructed in [Phrase Phrase.html]: $Phr$ and
|
||||
|
||||
-- Constructed in [Phrase Phrase.html].
|
||||
|
||||
Phr ; -- phrase in a text e.g. "But be quiet my darling."
|
||||
Utt ; -- sentence, question, word... e.g. "be quiet"
|
||||
Voc ; -- vocative or "please" e.g. "my darling"
|
||||
|
||||
|
||||
26
lib/resource-1.0/abstract/Common.gf
Normal file
26
lib/resource-1.0/abstract/Common.gf
Normal file
@@ -0,0 +1,26 @@
|
||||
--1 Infrastructure with common implementations.
|
||||
|
||||
-- This module defines the abstract parameters of tense, polarity, and
|
||||
-- anteriority, which are used in [Phrase Phrase.html] to generate different
|
||||
-- forms of sentences. Together they give 2 x 4 x 4 = 16 sentence forms.
|
||||
|
||||
-- These tenses are defined for all languages in the library. More tenses
|
||||
-- can be defined in the language extensions, e.g. the "passé simple" of
|
||||
-- Romance languages.
|
||||
|
||||
abstract Common = {
|
||||
|
||||
cat
|
||||
Text ; -- text consisting of several phrases
|
||||
Phr ; -- phrase in a text e.g. "But be quiet my darling."
|
||||
|
||||
Pol ;
|
||||
Tense ;
|
||||
Ant ;
|
||||
|
||||
fun
|
||||
PPos, PNeg : Pol ; -- I sleep/don't sleep
|
||||
TPres, TPast, TFut, TCond : Tense ; -- I sleep/slept/will sleep/would sleep
|
||||
ASimul, AAnter : Ant ; -- I sleep/have slept
|
||||
|
||||
}
|
||||
@@ -6,8 +6,10 @@ abstract Idiom = Cat ** {
|
||||
-- often different even in closely related languages.
|
||||
|
||||
fun
|
||||
ExistNP : NP -> Cl ; -- there is a house
|
||||
ImpersVP : VP -> Cl ; -- it rains
|
||||
ProgrVP : VP -> VP ; -- sleeping
|
||||
ExistNP : NP -> Cl ; -- there is a house
|
||||
ImpersCl : VP -> Cl ; -- it rains
|
||||
GenericCl : VP -> Cl ; -- one sleeps
|
||||
|
||||
ProgrVP : VP -> VP ; -- sleeping
|
||||
|
||||
}
|
||||
|
||||
20
lib/resource-1.0/common/CommonX.gf
Normal file
20
lib/resource-1.0/common/CommonX.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
concrete CommonX of Common = open (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Text, Phr = {s : Str} ;
|
||||
|
||||
Tense = {s : Str ; t : R.Tense} ;
|
||||
Ant = {s : Str ; a : R.Anteriority} ;
|
||||
Pol = {s : Str ; p : R.Polarity} ;
|
||||
|
||||
lin
|
||||
PPos = {s = []} ** {p = R.Pos} ;
|
||||
PNeg = {s = []} ** {p = R.Neg} ;
|
||||
TPres = {s = []} ** {t = R.Pres} ;
|
||||
TPast = {s = []} ** {t = R.Past} ;
|
||||
TFut = {s = []} ** {t = R.Fut} ;
|
||||
TCond = {s = []} ** {t = R.Cond} ;
|
||||
ASimul = {s = []} ** {a = R.Simul} ;
|
||||
AAnter = {s = []} ** {a = R.Anter} ;
|
||||
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
||||
concrete CatEng of Cat = CommonX ** open ResEng, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -6,7 +6,7 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
||||
|
||||
-- Phrase
|
||||
|
||||
Text, Phr, Utt, Voc = {s : Str} ;
|
||||
Utt, Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
@@ -35,9 +35,10 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
||||
-- Verb
|
||||
|
||||
VP = {
|
||||
s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
|
||||
ad : Str ;
|
||||
s2 : Agr => Str
|
||||
s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
|
||||
prp : Str ; -- present participle
|
||||
ad : Str ;
|
||||
s2 : Agr => Str
|
||||
} ;
|
||||
Comp = {s : Agr => Str} ;
|
||||
SC = {s : Str} ;
|
||||
|
||||
@@ -4,9 +4,11 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
|
||||
|
||||
lin
|
||||
ExistNP np =
|
||||
mkClause "there" (agrP3 Sg) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
||||
ImpersVP vp = mkClause "it" (agrP3 Sg) vp ;
|
||||
-- ProgrVP : VP -> VP ; -- sleeping
|
||||
mkClause "there" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
||||
ImpersCl vp = mkClause "it" (agrP3 Sg) vp ;
|
||||
GenericCl vp = mkClause "one" (agrP3 Sg) vp ;
|
||||
|
||||
ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,6 @@ concrete LangEng of Lang =
|
||||
LexiconEng
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -162,9 +162,10 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
|
||||
|
||||
VP : Type = {
|
||||
s : VerbForms ;
|
||||
ad : Str ;
|
||||
s2 : Agr => Str
|
||||
s : VerbForms ;
|
||||
prp : Str ; -- present participle
|
||||
ad : Str ;
|
||||
s2 : Agr => Str
|
||||
} ;
|
||||
|
||||
--- The order gets wrong with AdV, but works around a parser
|
||||
@@ -200,6 +201,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
prp = verb.s ! VPresPart ;
|
||||
ad = [] ;
|
||||
s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) []
|
||||
} ;
|
||||
@@ -230,12 +232,14 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
} ;
|
||||
prp = verb.prpart ;
|
||||
ad = [] ;
|
||||
s2 = \\_ => []
|
||||
} ;
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
prp = vp.prp ;
|
||||
ad = vp.ad ;
|
||||
s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
} ;
|
||||
@@ -244,6 +248,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
|
||||
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
prp = vp.prp ;
|
||||
ad = vp.ad ++ adv ;
|
||||
s2 = \\a => vp.s2 ! a
|
||||
} ;
|
||||
@@ -264,7 +269,8 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
Neg => \\_ => verbs ! VVPastNeg
|
||||
} ;
|
||||
inf = verbs ! VVF VInf ;
|
||||
ppart = verbs ! VVF VPPart
|
||||
ppart = verbs ! VVF VPPart ;
|
||||
prpart = verbs ! VVF VPresPart ;
|
||||
} ;
|
||||
_ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False}
|
||||
} ;
|
||||
@@ -287,7 +293,7 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
does = agrVerb "does" "do" ;
|
||||
doesnt = agrVerb "doesn't" "don't" ;
|
||||
|
||||
Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
|
||||
Aux = {pres,past : Polarity => Agr => Str ; inf,ppart,prpart : Str} ;
|
||||
|
||||
auxBe : Aux = {
|
||||
pres = \\b,a => case <b,a> of {
|
||||
@@ -300,7 +306,8 @@ resource ResEng = ParamX ** open Prelude in {
|
||||
_ => (posneg b "were")
|
||||
} ;
|
||||
inf = "be" ;
|
||||
ppart = "been"
|
||||
ppart = "been" ;
|
||||
prpart = "being"
|
||||
} ;
|
||||
|
||||
posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
|
||||
concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -6,7 +6,7 @@ concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
|
||||
|
||||
-- Phrase
|
||||
|
||||
Text, Phr, Utt, Voc = {s : Str} ;
|
||||
Utt, Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
|
||||
7
lib/resource-1.0/finnish/IdiomFin.gf
Normal file
7
lib/resource-1.0/finnish/IdiomFin.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete IdiomFin of Idiom = CatFin **
|
||||
open MorphoFin, ParadigmsFin, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangFin of Lang =
|
||||
RelativeFin,
|
||||
ConjunctionFin,
|
||||
PhraseFin,
|
||||
TextX,
|
||||
IdiomFin,
|
||||
StructuralFin,
|
||||
LexiconFin
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = finnish ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -35,7 +35,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
|
||||
ComplV2A v np ap =
|
||||
insertObj
|
||||
(\\fin,b,_ => appCompl fin b v.c2 np ++
|
||||
ap.s ! False ! AN (NCase np.a.n (npform2case v.c2.c))) --agr to obj
|
||||
ap.s ! False ! AN (NCase np.a.n (npform2case v.c3.c))) --agr to obj
|
||||
(predV v) ;
|
||||
|
||||
UseComp comp =
|
||||
|
||||
@@ -82,6 +82,22 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
||||
_ => <pdat ++ pacc, []>
|
||||
} ;
|
||||
|
||||
mkImperative vp = {
|
||||
s = \\pol,aag =>
|
||||
let
|
||||
agr = aag ** {p = P2} ;
|
||||
verb = (vp.s ! VPImperat).fin ! agr ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
case pol of {
|
||||
Pos => verb ++ clpr.p1 ++ compl ; ---- clitics can be different
|
||||
Neg => neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ compl
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <elisNe,"pas">
|
||||
|
||||
20
lib/resource-1.0/french/IdiomFre.gf
Normal file
20
lib/resource-1.0/french/IdiomFre.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
concrete IdiomFre of Idiom = CatFre **
|
||||
open PhonoFre, MorphoFre, ParadigmsFre, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
lin
|
||||
ExistNP np =
|
||||
mkClause "il" (agrP3 Masc Sg)
|
||||
(insertClit2 "y" (insertComplement (\\_ => np.s ! Ton Acc) (predV avoir_V))) ;
|
||||
ImpersCl vp = mkClause "il" (agrP3 Masc Sg) vp ;
|
||||
GenericCl vp = mkClause "on" (agrP3 Masc Sg) vp ;
|
||||
|
||||
ProgrVP vp =
|
||||
insertComplement
|
||||
(\\a => "en" ++ "train" ++ elisDe ++ infVP vp a)
|
||||
(predV copula) ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangFre of Lang =
|
||||
RelativeFre,
|
||||
ConjunctionFre,
|
||||
PhraseFre,
|
||||
TextX,
|
||||
IdiomFre,
|
||||
StructuralFre,
|
||||
LexiconFre
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete CatGer of Cat = TenseX ** open ResGer, Prelude in {
|
||||
concrete CatGer of Cat = CommonX ** open ResGer, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -6,7 +6,7 @@ concrete CatGer of Cat = TenseX ** open ResGer, Prelude in {
|
||||
|
||||
-- Phrase
|
||||
|
||||
Text, Phr, Utt, Voc = {s : Str} ;
|
||||
Utt, Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
|
||||
7
lib/resource-1.0/german/IdiomGer.gf
Normal file
7
lib/resource-1.0/german/IdiomGer.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete IdiomGer of Idiom = CatGer **
|
||||
open MorphoGer, ParadigmsGer, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangGer of Lang =
|
||||
RelativeGer,
|
||||
ConjunctionGer,
|
||||
PhraseGer,
|
||||
TextX,
|
||||
IdiomGer,
|
||||
StructuralGer,
|
||||
LexiconGer
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -63,7 +63,7 @@ concrete StructuralGer of Structural = CatGer **
|
||||
a = Strong
|
||||
} ;
|
||||
only_Predet = {s = \\_,_,_ => "nur"} ;
|
||||
no_Phr = ss ["Nein ."] ;
|
||||
no_Phr = ss "nein" ;
|
||||
on_Prep = mkPrep "auf" Dat ;
|
||||
or_Conj = ss "oder" ** {n = Sg} ;
|
||||
otherwise_PConj = ss "sonst" ;
|
||||
@@ -123,6 +123,6 @@ concrete StructuralGer of Structural = CatGer **
|
||||
youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
||||
youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss
|
||||
youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ;
|
||||
yes_Phr = ss ["Ja ."] ;
|
||||
yes_Phr = ss "ja" ;
|
||||
|
||||
}
|
||||
|
||||
@@ -100,6 +100,20 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
|
||||
in
|
||||
<pdat ++ pacc, []> ;
|
||||
|
||||
mkImperative vp = {
|
||||
s = \\pol,aag =>
|
||||
let
|
||||
agr = aag ** {p = P2} ;
|
||||
verb = case <aag.n, pol> of {
|
||||
<Sg,Neg> => (vp.s ! VPInfinit Simul).inf ! aag ;
|
||||
_ => (vp.s ! VPImperat).fin ! agr
|
||||
} ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||
} ;
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
|
||||
7
lib/resource-1.0/italian/IdiomIta.gf
Normal file
7
lib/resource-1.0/italian/IdiomIta.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete IdiomIta of Idiom = CatIta **
|
||||
open MorphoIta, ParadigmsIta, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangIta of Lang =
|
||||
RelativeIta,
|
||||
ConjunctionIta,
|
||||
PhraseIta,
|
||||
TextX,
|
||||
IdiomIta,
|
||||
StructuralIta,
|
||||
LexiconIta
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -23,7 +23,7 @@ lin
|
||||
bike_N = regN "bicicletta" ;
|
||||
bird_N = regN "uccello" ;
|
||||
black_A = regADeg "nero" ;
|
||||
blue_A = regADeg "blù" ;
|
||||
blue_A = mkA "blù" "blù" "blù" "blù" "blumente" ;
|
||||
boat_N = regN "batello" ;
|
||||
book_N = regN "libro" ;
|
||||
boot_N = regN "stivale" ;
|
||||
|
||||
@@ -12,3 +12,6 @@
|
||||
--# prob ComplV2A 0.01
|
||||
--# prob ComplA2 0.1
|
||||
--# prob UsePN 0.01
|
||||
--# prob yes_Phr 0.02
|
||||
--# prob no_Phr 0.02
|
||||
--# prob TEmpty 0.1
|
||||
|
||||
7
lib/resource-1.0/norwegian/IdiomNor.gf
Normal file
7
lib/resource-1.0/norwegian/IdiomNor.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete IdiomNor of Idiom = CatNor **
|
||||
open MorphoNor, ParadigmsNor, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangNor of Lang =
|
||||
RelativeNor,
|
||||
ConjunctionNor,
|
||||
PhraseNor,
|
||||
TextX,
|
||||
IdiomNor,
|
||||
StructuralNor,
|
||||
LexiconNor
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete CatRomance of Cat =
|
||||
TenseX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
|
||||
CommonX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -7,7 +7,7 @@ incomplete concrete CatRomance of Cat =
|
||||
|
||||
-- Phrase
|
||||
|
||||
Text, Phr, Utt, Voc = {s : Str} ;
|
||||
Utt, Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
|
||||
@@ -47,12 +47,14 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
||||
|
||||
-- To render pronominal arguments as clitics and/or ordinary complements.
|
||||
|
||||
pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ;
|
||||
oper pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ;
|
||||
|
||||
-- To render imperatives (with their clitics etc).
|
||||
|
||||
oper mkImperative : CommonRomance.VP -> {s : Polarity => AAgr => Str} ;
|
||||
|
||||
--2 Constants that must derivatively depend on language
|
||||
|
||||
---- nominative : Case ;
|
||||
---- accusative : Case ;
|
||||
dative : Case ;
|
||||
genitive : Case ;
|
||||
|
||||
|
||||
@@ -61,6 +61,11 @@ oper
|
||||
habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ;
|
||||
habere : Str = aux ! VInfin ;
|
||||
|
||||
vimp : Agr -> Str = \a -> verb.s ! VImper (case a.n of {
|
||||
Sg => SgP2 ;
|
||||
Pl => PlP2
|
||||
}) ;
|
||||
|
||||
vf : (Agr -> Str) -> (AAgr -> Str) -> {
|
||||
fin : Agr => Str ;
|
||||
inf : AAgr => Str
|
||||
@@ -72,9 +77,9 @@ oper
|
||||
|
||||
in {
|
||||
s = table {
|
||||
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
|
||||
VPFinite t Anter => vf (habet t) vpart ;
|
||||
VPImperat => vf (\_ -> verb.s ! VImper SgP2) (\_ -> []) ; ----
|
||||
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
|
||||
VPFinite t Anter => vf (habet t) vpart ;
|
||||
VPImperat => vf vimp (\_ -> []) ;
|
||||
VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ;
|
||||
VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a)
|
||||
} ;
|
||||
@@ -139,6 +144,17 @@ oper
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertClit2 : Str -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
clAcc = vp.clAcc ;
|
||||
clDat = vp.clDat ;
|
||||
clit2 = vp.clit2 ++ co ; ---- y en
|
||||
neg = vp.neg ;
|
||||
comp = vp.comp ;
|
||||
ext = vp.ext ;
|
||||
} ;
|
||||
|
||||
insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> {
|
||||
s = vp.s ;
|
||||
agr = vp.agr ;
|
||||
@@ -168,7 +184,7 @@ oper
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b
|
||||
in
|
||||
subj ++ neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ inf ++ compl
|
||||
subj ++ neg.p1 ++ clpr.p1 ++ vp.clit2 ++ verb ++ neg.p2 ++ inf ++ compl
|
||||
} ;
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,agr ->
|
||||
@@ -178,7 +194,7 @@ oper
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
obj = clpr.p2 ++ vp.comp ! agr
|
||||
in
|
||||
clitInf clpr.p1 inf ++ obj ;
|
||||
clitInf (clpr.p1 ++ vp.clit2) inf ++ obj ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,7 @@ incomplete concrete SentenceRomance of Sentence =
|
||||
|
||||
PredSCVP sc vp = mkClause sc.s (agrP3 Masc Sg) vp ;
|
||||
|
||||
ImpVP vp = {
|
||||
s = \\pol,aag =>
|
||||
let
|
||||
agr = aag ** {p = P2} ;
|
||||
verb = (vp.s ! VPImperat).fin ! agr
|
||||
in
|
||||
verb ++ vp.comp ! agr ++ vp.ext ! pol ---- neg,clit
|
||||
} ;
|
||||
ImpVP = mkImperative ;
|
||||
|
||||
SlashV2 np v2 =
|
||||
mkClause
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete CatScand of Cat =
|
||||
TenseX ** open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
||||
CommonX ** open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -7,7 +7,7 @@ incomplete concrete CatScand of Cat =
|
||||
|
||||
-- Phrase
|
||||
|
||||
Text, Phr, Utt, Voc = {s : Str} ;
|
||||
Utt, Voc = {s : Str} ;
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
|
||||
@@ -73,6 +73,21 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
|
||||
-- <Sg,P2,CRefl,CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||
-- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||
|
||||
mkImperative vp = {
|
||||
s = \\pol,aag =>
|
||||
let
|
||||
agr = aag ** {p = P2} ;
|
||||
verb = case <aag.n, pol> of {
|
||||
<Sg,Neg> => (vp.s ! VPFinite (VPres Conjunct) Simul).fin ! agr ;
|
||||
_ => (vp.s ! VPImperat).fin ! agr
|
||||
} ;
|
||||
neg = vp.neg ! pol ;
|
||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||
in
|
||||
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||
} ;
|
||||
|
||||
negation : Polarity => (Str * Str) = table {
|
||||
Pos => <[],[]> ;
|
||||
Neg => <"no",[]>
|
||||
|
||||
7
lib/resource-1.0/spanish/IdiomSpa.gf
Normal file
7
lib/resource-1.0/spanish/IdiomSpa.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
concrete IdiomSpa of Idiom = CatSpa **
|
||||
open MorphoSpa, ParadigmsSpa, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
}
|
||||
|
||||
@@ -11,10 +11,12 @@ concrete LangSpa of Lang =
|
||||
RelativeSpa,
|
||||
ConjunctionSpa,
|
||||
PhraseSpa,
|
||||
TextSpa, -- special punctuation
|
||||
IdiomSpa,
|
||||
StructuralSpa,
|
||||
LexiconSpa
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
11
lib/resource-1.0/spanish/TextSpa.gf
Normal file
11
lib/resource-1.0/spanish/TextSpa.gf
Normal file
@@ -0,0 +1,11 @@
|
||||
concrete TextSpa of Text = {
|
||||
|
||||
-- This works for the special punctuation marks of Spanish.
|
||||
|
||||
lin
|
||||
TEmpty = {s = []} ;
|
||||
TFullStop x xs = {s = x.s ++ "." ++ xs.s} ;
|
||||
TQuestMark x xs = {s = "¿" ++ x.s ++ "?" ++ xs.s} ;
|
||||
TExclMark x xs = {s = "¡" ++ x.s ++ "!" ++ xs.s} ;
|
||||
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete CatSwe of Cat = TenseX ** CatScand with
|
||||
concrete CatSwe of Cat = CommonX ** CatScand with
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -17,6 +17,6 @@ concrete LangSwe of Lang =
|
||||
LexiconSwe
|
||||
** {
|
||||
|
||||
flags startcat = Phr ;
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
} ;
|
||||
|
||||
@@ -71,6 +71,7 @@ formatAsTextGen tag para = unwords . format . cap . words where
|
||||
w : c : ww | major c -> format $ (w ++ c) :(cap ww)
|
||||
w : c : ww | minor c -> format $ (w ++ c) : ww
|
||||
p : c : ww | openp p -> format $ (p ++ c) :ww
|
||||
p : c : ww | spanish p -> format $ (p ++ concat (cap [c])) :ww
|
||||
c : ww | para c -> "\n\n" : format ww
|
||||
w : ww -> w : format ww
|
||||
[] -> []
|
||||
@@ -81,6 +82,7 @@ formatAsTextGen tag para = unwords . format . cap . words where
|
||||
major = flip elem (map singleton ".!?")
|
||||
minor = flip elem (map singleton ",:;)")
|
||||
openp = all (flip elem "(")
|
||||
spanish = all (flip elem "¡¿")
|
||||
|
||||
formatAsCode :: String -> String
|
||||
formatAsCode = rend 0 . words where
|
||||
|
||||
@@ -110,6 +110,6 @@ linearize mgr lang =
|
||||
linTree2string noMark (canModules mgr) (zIdent lang)
|
||||
where
|
||||
sgr = stateGrammarOfLangOpt False mgr (zIdent lang)
|
||||
untok = customOrDefault noOptions useUntokenizer customUntokenizer sgr
|
||||
untok = customOrDefault (stateOptions sgr) useUntokenizer customUntokenizer sgr
|
||||
|
||||
showTree t = prt_ $ tree2exp t
|
||||
|
||||
Reference in New Issue
Block a user