mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-14 15:29:31 -06:00
*** empty log message ***
This commit is contained in:
@@ -54,18 +54,20 @@ lincat
|
||||
-- = {s : Case => Gender => Str} ;
|
||||
|
||||
V = Verb ;
|
||||
-- = {s : VF => Str ; t: Tense ; a : Aspect ; v: Voice} ;
|
||||
VG = {s : Bool => VF => Str ; s2 : Bool => Str ; t: Tense ; a : Aspect ; v: Voice} ;
|
||||
-- = {s : VF => Str ; t: Tense ; a : Aspect ; w: Voice} ;
|
||||
VG = VerbGroup ;
|
||||
-- = Verb ;
|
||||
VP = VerbPhrase ;
|
||||
-- = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
|
||||
-- negBefore: Bool} ;
|
||||
TV = TransVerb ;
|
||||
-- = Verb ** {s2 : Str ; c: Case } ;
|
||||
V3 = TransVerb ** {s4 : Str; c2: Case} ;
|
||||
V3 = DitransVerb ;
|
||||
-- = TransVerb ** {s4 : Str; c2: Case} ;
|
||||
VS = SentenceVerb ;
|
||||
-- = Verb ;
|
||||
VV = Verb ;
|
||||
|
||||
VV = VerbVerb ;
|
||||
-- = Verb ;
|
||||
AdV = Adverb ;
|
||||
-- = {s : Str} ;
|
||||
Prep = Preposition;
|
||||
@@ -147,6 +149,22 @@ lin
|
||||
--PosVS = complSentVerb True ;
|
||||
--NegVS = complSentVerb False ;
|
||||
|
||||
PosVG = predVerbGroup True ;
|
||||
NegVG = predVerbGroup False ;
|
||||
|
||||
PredV v = v ;
|
||||
PredAP = predAdjective ;
|
||||
PredCN = predCommNoun ;
|
||||
PredTV = complTransVerb ;
|
||||
PredV3 = complDitransVerb ;
|
||||
PredPassV v = v ;
|
||||
PredNP = predNounPhrase ;
|
||||
PredAdV = predAdverb ;
|
||||
PredVS = complSentVerb ;
|
||||
PredVV = complVerbVerb ;
|
||||
VTrans = verbOfTransVerb ;
|
||||
|
||||
|
||||
AdjAdv a = mkAdverb (a.s ! AdvF) ;
|
||||
PrepNP p = prepPhrase p ;
|
||||
AdvVP = adVerbPhrase ;
|
||||
@@ -156,8 +174,8 @@ lin
|
||||
|
||||
PosSlashTV = slashTransVerb True ;
|
||||
NegSlashTV = slashTransVerb False ;
|
||||
-- OneVP = predVerbPhrase (nameNounPhrase (nameReg "one")) ;
|
||||
--ThereNP = thereIs ;
|
||||
OneVP = predVerbPhrase (pron2NounPhrase pronKtoTo Animate) ;
|
||||
ThereNP = thereIs ;
|
||||
|
||||
IdRP = identRelPron ;
|
||||
FunRP = funRelPron ;
|
||||
@@ -178,7 +196,7 @@ lin
|
||||
IntVP = intVerbPhrase ;
|
||||
IntSlash = intSlash ;
|
||||
QuestAdv = questAdverbial ;
|
||||
--IsThereNP = isThere ;
|
||||
IsThereNP = isThere ;
|
||||
|
||||
ImperVP = imperVerbPhrase ;
|
||||
|
||||
|
||||
@@ -457,6 +457,7 @@ oper eEndInAnimateDecl: Str -> CommNoun = \proizvedeni ->
|
||||
SF Pl Gen => proizvedeni+"й" ;
|
||||
SF Pl Dat => proizvedeni+"ям" ;
|
||||
SF Pl Acc => proizvedeni+"я" ;
|
||||
SF Pl Inst => proizvedeni+"ями" ;
|
||||
SF Pl Prepos => proizvedeni+"ях"
|
||||
} ;
|
||||
g = Neut ; anim = Inanimate
|
||||
@@ -555,7 +556,9 @@ oper EN_softSignEndDeclMasc: Str -> CommNoun = \rem ->
|
||||
SF Sg Acc => rem+"ень" ;
|
||||
SF Sg Inst => rem+"нем" ;
|
||||
|
||||
SF Sg Prepos => rem+"не" ;
|
||||
SF Pl Nom => rem+"ни" ;
|
||||
SF Pl Gen => rem+"ней" ;
|
||||
SF Pl Dat => rem+"ням" ;
|
||||
SF Pl Acc => rem+"ни" ;
|
||||
SF Pl Inst => rem+"нями" ;
|
||||
@@ -717,6 +720,8 @@ oper eEnd_Decl: Str -> CommNoun = \vs ->
|
||||
SF Sg Dat => vs+"ем" ;
|
||||
SF Sg Acc => vs+"ех" ;
|
||||
SF Sg Inst => vs+"еми" ;
|
||||
SF Sg Prepos => vs+"ех" ;
|
||||
SF Pl Nom => vs+"е" ;
|
||||
SF Pl Gen => vs +"ех";
|
||||
|
||||
SF Pl Dat => vs+"ем" ;
|
||||
@@ -742,6 +747,7 @@ oper mkAdjDeg: Adjective -> Str -> AdjDegr = \adj, s ->
|
||||
kazhdujDet: Adjective = uy_j_EndDecl "кажд" ;
|
||||
samuj: Adjective = uy_j_EndDecl "сам" ;
|
||||
lubojDet: Adjective = uy_oj_EndDecl "люб" ;
|
||||
kotorujDet: Adjective = uy_j_EndDecl "котор";
|
||||
nekotorujDet: Adjective = uy_j_EndDecl "некотор";
|
||||
takoj: Adjective = i_oj_EndDecl "так" [];
|
||||
kakojNibudDet: Adjective = i_oj_EndDecl "как" "-нибудь";
|
||||
@@ -1001,7 +1007,7 @@ oper have: Verbum = {s=\\ vf => "-" ; asp = Imperfective} ;
|
||||
AF _ _ (ASg Masc) => s;
|
||||
AF _ _ (ASg Fem) => s+"а";
|
||||
AF _ _ (ASg Neut) => s+"о";
|
||||
AF _ _ APl => s+"ы" ;
|
||||
AF _ _ APl => s+"ы" ;
|
||||
AdvF => "о"
|
||||
}
|
||||
} ;
|
||||
@@ -1012,11 +1018,16 @@ oper verbZhdat : Verbum = verbDecl Imperfective First "жд" "у" "ждал" "ж
|
||||
AF _ _ APl => s+"ны" ;
|
||||
AdvF => "о"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
-- 2 Adverbs
|
||||
|
||||
oper vsegda: Adverb = { s = "всегда" } ;
|
||||
oper chorosho: Adverb = { s = "хорошо" } ;
|
||||
|
||||
-- 2 Verbs
|
||||
|
||||
|
||||
-- Dummy verbum "have" that corresponds to the phrases like
|
||||
-- "I have a headache" in English. The corresponding sentence
|
||||
@@ -1069,6 +1080,15 @@ oper presentConj2: Str -> Str -> PresentVerb = \del, sgP1End ->
|
||||
-- so that the full type can be described as a combination
|
||||
-- of the intermediate types. For example "AspectVoice"
|
||||
-- is a type for defining a pattern for a particular
|
||||
-- aspect and voice.
|
||||
|
||||
oper AspectVoice: Type = { s : VerbConj => Str ; asp: Aspect } ;
|
||||
|
||||
-- "PresentVerb" takes care of the present tense conjugation.
|
||||
|
||||
param PresentVF = PRF Number Person ;
|
||||
oper PresentVerb : Type = PresentVF => Str ;
|
||||
oper presentConjDolzhen: Str -> Str -> PresentVerb = \del, sgP1End ->
|
||||
table {
|
||||
PRF Sg P1 => del+ sgP1End ;
|
||||
PRF Sg P2 => del+ sgP1End ;
|
||||
@@ -1106,12 +1126,14 @@ oper verbDecl: Aspect -> Conjugation -> Str -> Str -> Str -> Str ->Str -> Verbum
|
||||
PRF Pl P3 => del+ sgP1End + "т"
|
||||
};
|
||||
oper presentConj1: Str -> Str -> PresentVerb = \del, sgP1End ->
|
||||
table {
|
||||
PRF Sg P1 => del+ sgP1End ;
|
||||
PRF Sg P2 => del+ "ешь" ;
|
||||
PRF Sg P3 => del+ "ет" ;
|
||||
PRF Pl P1 => del+ "ем" ;
|
||||
|
||||
PRF Pl P2 => del+ "ете'" ;
|
||||
PRF Pl P3 => del+ sgP1End + "т"
|
||||
};
|
||||
|
||||
-- "PastVerb" takes care of the past tense conjugation.
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
--# -path=.:../abstract:../../prelude
|
||||
|
||||
resource ResourceRus = reuse StructuralRus ;
|
||||
--# -path=.:../abstract:../../prelude
|
||||
resource ResourceRus = reuse StructuralRus ;
|
||||
|
||||
@@ -175,8 +175,7 @@ oper
|
||||
-- (for semantic reasons) is useful, e.g. "русский".
|
||||
|
||||
oper
|
||||
|
||||
extAdjective : AdjDegr -> Adjective = \adj ->
|
||||
extAdjective : AdjDegr -> Adjective = \adj ->
|
||||
{ s = \\af => adj.s ! Pos ! af } ;
|
||||
|
||||
-- Coercions between the compound gen-num type and gender and number:
|
||||
@@ -365,10 +364,9 @@ oper
|
||||
|
||||
-- The rule for using transitive verbs is the complementization rule:
|
||||
|
||||
complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,se,tu ->
|
||||
{s = se.s ; a = se.a ; t = se.t ; w = se.w ; s2 = negation b ;
|
||||
s3 = \\_,_ => se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ;
|
||||
negBefore = True } ;
|
||||
complTransVerb :TransVerb -> NounPhrase -> VerbGroup = \se,tu ->
|
||||
{s =\\vf => se.s ! vf ++ se.s2 ++ tu.s ! (mkPronForm se.c No NonPoss) ;
|
||||
a = se.a ; t = se.t ; w = se.w } ;
|
||||
|
||||
--3 Verb phrases
|
||||
--
|
||||
@@ -377,17 +375,18 @@ oper
|
||||
-- (s3) complement. This discontinuity is needed in sentence formation
|
||||
-- to account for word order variations.
|
||||
|
||||
VerbGroup = Verb ;
|
||||
|
||||
VerbPhrase : Type = Verb ** {s2 : Str ; s3 : Gender => Number => Str ;
|
||||
negBefore: Bool} ;
|
||||
|
||||
-- A simple verb can be made into a verb phrase with an empty complement.
|
||||
-- There are two versions, depending on if we want to negate the verb.
|
||||
|
||||
predVerb : Bool -> Verb -> VerbPhrase = \b,vidit ->
|
||||
predVerbGroup : Bool -> VerbGroup -> VerbPhrase = \b,vidit ->
|
||||
vidit ** {
|
||||
s2 = negation b ;
|
||||
s3 = \\_,_ => [] ;
|
||||
negBefore = True
|
||||
negBefore = True -- this should be a parameter !
|
||||
} ;
|
||||
|
||||
negation : Bool -> Str = \b -> if_then_else Str b [] "не" ;
|
||||
@@ -405,37 +404,56 @@ oper
|
||||
-- Note: in some case we can even omit a dash "-" :
|
||||
-- "Я думаю, что это хорошая машина".
|
||||
|
||||
predAdjective : Bool -> Adjective -> VerbPhrase = \b,zloj ->
|
||||
{ s= \\_ => "-" ;
|
||||
predAdverb : Adverb -> VerbGroup = \zloj ->
|
||||
{ s= \\vf => case vf of {
|
||||
VFin _ _ => "-" ++ zloj.s ;
|
||||
VImper _ _ => "";
|
||||
VInf => "";
|
||||
VSubj _ => ""
|
||||
} ;
|
||||
t = Present ;
|
||||
a = Imperfective ;
|
||||
w = Act ;
|
||||
s2 = negation b ;
|
||||
s3 = \\g,n => case n of {
|
||||
Sg => zloj.s ! AF Nom Animate (ASg g) ;
|
||||
Pl => zloj.s ! AF Nom Animate APl
|
||||
} ;
|
||||
negBefore = False
|
||||
w = Act
|
||||
} ;
|
||||
|
||||
predCommNoun : Bool -> CommNounPhrase -> VerbPhrase = \b,chelovek ->
|
||||
{ s= \\_ => "-" ;
|
||||
predAdjective : AdjPhrase -> VerbGroup = \zloj ->
|
||||
{ s= \\vf => case vf of {
|
||||
VFin gn _ => case (numGNum gn) of {
|
||||
Sg => "-" ++ zloj.s ! AF Nom Animate (ASg (genGNum gn)) ;
|
||||
Pl => "-" ++ zloj.s ! AF Nom Animate APl
|
||||
} ;
|
||||
VImper _ _ => "";
|
||||
VInf => "";
|
||||
VSubj _ => ""
|
||||
} ;
|
||||
t = Present ;
|
||||
a = Imperfective ;
|
||||
w = Act ;
|
||||
s2 = negation b ;
|
||||
s3 = \\_,n => (indefNounPhrase n chelovek ).s ! (mkPronForm Nom No NonPoss) ;
|
||||
negBefore = False
|
||||
} ;
|
||||
w = Act
|
||||
} ;
|
||||
|
||||
predNounPhrase : Bool -> NounPhrase -> VerbPhrase = \b,masha ->
|
||||
{ s= \\_ => "-" ;
|
||||
predCommNoun : CommNounPhrase -> VerbGroup = \chelovek ->
|
||||
{ s= \\vf => case vf of {
|
||||
VFin gn _ => "-" ++
|
||||
(indefNounPhrase (numGNum gn) chelovek ).s ! (mkPronForm Nom No NonPoss) ;
|
||||
VImper _ _ => "";
|
||||
VInf => "";
|
||||
VSubj _ => ""
|
||||
} ;
|
||||
t = Present ;
|
||||
a = Imperfective ;
|
||||
w = Act ;
|
||||
s2 = negation b ;
|
||||
s3 = \\_,_ => masha.s ! (mkPronForm Nom No NonPoss) ;
|
||||
negBefore = False
|
||||
w = Act
|
||||
} ;
|
||||
|
||||
predNounPhrase : NounPhrase -> VerbGroup = \masha ->
|
||||
{ s= \\vf => case vf of {
|
||||
VFin _ _ => "-" ++ masha.s ! (mkPronForm Nom No NonPoss) ;
|
||||
VImper _ _ => "";
|
||||
VInf => "";
|
||||
VSubj _ => ""
|
||||
} ;
|
||||
t = Present ;
|
||||
a = Imperfective ;
|
||||
w = Act
|
||||
} ;
|
||||
|
||||
-- A function specific for Russian :
|
||||
@@ -462,6 +480,28 @@ oper
|
||||
s2 = poezd.s3; c = poezd.c2
|
||||
} ;
|
||||
|
||||
-- *Ditransitive verbs* are verbs with three argument places.
|
||||
-- We treat so far only the rule in which the ditransitive
|
||||
-- verb takes both complements to form a verb phrase.
|
||||
|
||||
DitransVerb = TransVerb ** {s4 : Str; c2: Case} ;
|
||||
|
||||
mkDitransVerb : Verb -> Case -> Case -> DitransVerb = \v,c1,c2 ->
|
||||
v ** {s2 = ""; c = c1; s4 = ""; c2=c2 } ;
|
||||
|
||||
complDitransVerb : DitransVerb -> NounPhrase -> NounPhrase -> VerbGroup =
|
||||
\dat,tu,pivo ->
|
||||
let
|
||||
tebepivo = dat.s2 ++
|
||||
tu.s ! PF dat.c Yes NonPoss ++ dat.s4 ++ pivo.s ! PF dat.c2 Yes NonPoss
|
||||
in
|
||||
{s = \\vf => (dat.s ! vf) ++ tebepivo ;
|
||||
t = dat.t ;
|
||||
a = dat.a ;
|
||||
w = dat.w
|
||||
} ;
|
||||
|
||||
|
||||
--2 Adverbials
|
||||
--
|
||||
adVerbPhrase : VerbPhrase -> Adverb -> VerbPhrase = \poet, khorosho ->
|
||||
@@ -539,7 +579,7 @@ oper
|
||||
-- This is a macro for simultaneous predication and complementation.
|
||||
|
||||
predTransVerb : Bool -> TransVerb -> NounPhrase -> NounPhrase -> Sentence =
|
||||
\b,vizhu,ya,tu -> predVerbPhrase ya (complTransVerb b vizhu tu) ;
|
||||
\b,vizhu,ya,tu -> predVerbPhrase ya (predVerbGroup b (complTransVerb vizhu tu)) ;
|
||||
|
||||
--3 Sentence-complement verbs
|
||||
--
|
||||
@@ -549,12 +589,33 @@ oper
|
||||
|
||||
-- To generate "сказал, что Иван гуляет" / "не сказал, что Иван гуляет":
|
||||
|
||||
complSentVerb : Bool -> SentenceVerb -> Sentence -> VerbPhrase =
|
||||
\b,vidit,tuUlubaeshsya ->
|
||||
{s = vidit.s ; s2 = negation b ; s3 = \\_,_ => [", что"] ++
|
||||
tuUlubaeshsya.s ;
|
||||
t = vidit.t ; w = vidit.w ; a = vidit.a ; negBefore = True } ;
|
||||
complSentVerb : SentenceVerb -> Sentence -> VerbGroup =
|
||||
\vidit,tuUlubaeshsya ->
|
||||
{s = \\vf => vidit.s ! vf ++ [", что"] ++ tuUlubaeshsya.s ;
|
||||
t = vidit.t ; w = vidit.w ; a = vidit.a } ;
|
||||
|
||||
--3 Verb-complement verbs
|
||||
--
|
||||
-- Sentence-complement verbs take verb phrases as complements.
|
||||
-- They can be auxiliaries ("can", "must") or ordinary verbs
|
||||
-- ("try"); this distinction cannot be done in the multilingual
|
||||
-- API and leads to some anomalies in English, such as the necessity
|
||||
-- to create the infinitive form "to be able to" for "can" so that
|
||||
-- the construction can be iterated, and the corresponding complication
|
||||
-- in the parameter structure.
|
||||
|
||||
VerbVerb : Type = Verb ;
|
||||
|
||||
-- To generate "can walk"/"can't walk"; "tries to walk"/"does not try to walk":
|
||||
-- The contraction of "not" is not provided, since it would require changing
|
||||
-- the verb parameter type.
|
||||
|
||||
complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \putatsya,bezhat ->
|
||||
{ s = \\vf => putatsya.s ! vf ++ bezhat.s ! VInf ;
|
||||
t = putatsya.t ;
|
||||
a = putatsya.a ;
|
||||
w = putatsya.w
|
||||
} ;
|
||||
|
||||
--2 Sentences missing noun phrases
|
||||
--
|
||||
@@ -570,16 +631,13 @@ oper
|
||||
|
||||
slashTransVerb : Bool -> NounPhrase -> TransVerb -> SentenceSlashNounPhrase =
|
||||
\b,ivan,lubit ->
|
||||
predVerbPhrase ivan (predVerb b (verbOfTransVerb lubit)) **
|
||||
predVerbPhrase ivan (predVerbGroup b (verbOfTransVerb lubit)) **
|
||||
complementOfTransVerb lubit ;
|
||||
|
||||
--thereIs : NounPhrase -> Sentence = \abar ->
|
||||
-- predVerbPhrase
|
||||
-- (case abar.n of {
|
||||
-- Sg => nameNounPhrase (nameReg "there") ;
|
||||
-- Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
||||
-- })
|
||||
-- (predVerbGroup True (predNounPhrase abar)) ;
|
||||
thereIs : NounPhrase -> Sentence = \bar ->
|
||||
predVerbPhrase
|
||||
({s = \\_ => "есть" ; n = bar.n ; p = P3; g = bar.g; anim = bar.anim; pron = bar.pron })
|
||||
(predVerbGroup True (predNounPhrase bar)) ;
|
||||
|
||||
--2 Coordination
|
||||
--
|
||||
@@ -752,13 +810,10 @@ oper
|
||||
}
|
||||
} ;
|
||||
|
||||
--isThere : NounPhrase -> Question = \abar ->
|
||||
-- questVerbPhrase
|
||||
-- (case abar.n of {
|
||||
-- Sg => nameNounPhrase (nameReg "there") ;
|
||||
-- Pl => {s = \\_ => "there" ; n = Pl ; p = P3}
|
||||
-- })
|
||||
-- (predVerbGroup True (predNounPhrase abar)) ;
|
||||
isThere : NounPhrase -> Question = \bar ->
|
||||
questVerbPhrase
|
||||
({s = \\_ => ["есть ли"] ; n = bar.n ; p = P3; g = bar.g; anim = bar.anim; pron = bar.pron})
|
||||
(predVerbGroup True (predNounPhrase bar)) ;
|
||||
|
||||
--3 Wh-questions
|
||||
--
|
||||
|
||||
@@ -14,12 +14,17 @@ lin
|
||||
Old = staruj ;
|
||||
Young = molodoj ;
|
||||
|
||||
--Connection = cnNoHum (nounReg "connection") ** {s2 = "from" ; s3 = "to"} ; Fun2
|
||||
-- American = adj1Malenkij "американск" ;
|
||||
-- Finnish = adj1Malenkij "финск" ;
|
||||
-- Married = adjInvar "замужем" ** {s2 = "за"; c = instructive} ;
|
||||
--Give = mkDitransVerb (verbNoPart (mkVerb "give" "gave" "given")) [] [] ; V3
|
||||
--Prefer = mkDitransVerb (mkVerb "prefer" "preferred" "preferred")) [] "to" ; V3
|
||||
Connection = (noun2CommNounPhrase (doroga) )** {s2 = "из" ; c = Gen; s3 = "в"; c2=Acc} ;
|
||||
American = ij_EndK_G_KH_Decl "американск" ; -- adj1Malenkij from Paradigms
|
||||
Finnish = ij_EndK_G_KH_Decl "финск" ; -- adj1Malenkij from Paradigms
|
||||
Married = adjInvar "замужем" ** {s2 = "за"; c = Inst} ; -- adjinvar from Paradigms
|
||||
Give = mkDitransVerb (extVerb verbDavat Act Present) Acc Dat;
|
||||
Prefer = mkDitransVerb (extVerb verbPredpochitat Act Present) Acc Dat ;
|
||||
Bar = bar ;
|
||||
Bottle = butyulka ;
|
||||
Wine = vino ;
|
||||
Drink = mkDirectVerb (extVerb verbPit Act Present ) ;
|
||||
Happy = schastlivyuj ;
|
||||
|
||||
Man = muzhchina ;
|
||||
Woman = zhenchina ;
|
||||
|
||||
Reference in New Issue
Block a user