forked from GitHub/gf-core
complete RGL implementation for Mongolian by Nyamsuren Erdenebadrakh
This commit is contained in:
6
lib/src/api/CombinatorsMon.gf
Normal file
6
lib/src/api/CombinatorsMon.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource CombinatorsMon = Combinators with
|
||||
(Cat = CatMon),
|
||||
(Structural = StructuralMon),
|
||||
(Constructors = ConstructorsMon) ;
|
||||
3
lib/src/api/ConstructorsMon.gf
Normal file
3
lib/src/api/ConstructorsMon.gf
Normal file
@@ -0,0 +1,3 @@
|
||||
--# -path=.:alltenses:prelude
|
||||
|
||||
resource ConstructorsMon = Constructors with (Grammar = GrammarMon) ;
|
||||
5
lib/src/api/SyntaxMon.gf
Normal file
5
lib/src/api/SyntaxMon.gf
Normal file
@@ -0,0 +1,5 @@
|
||||
--# -path=.:./alltenses:../prelude
|
||||
|
||||
instance SyntaxMon of Syntax =
|
||||
ConstructorsMon, CatMon, StructuralMon, CombinatorsMon ;
|
||||
|
||||
12
lib/src/api/TryMon.gf
Normal file
12
lib/src/api/TryMon.gf
Normal file
@@ -0,0 +1,12 @@
|
||||
--# -path=.:../mongolian:../common:../abstract:../prelude
|
||||
|
||||
resource TryMon = SyntaxMon, LexiconMon, ParadigmsMon -[mkAdv, mkDet,mkQuant,mkAdA,mkAdN,mkIDet,mkDet,mkNP,mkNum,mkPConj,mkRP,mkOrd]**
|
||||
open (P = ParadigmsMon) in {
|
||||
|
||||
oper
|
||||
|
||||
mkAdv = overload SyntaxMon {
|
||||
mkAdv : Str -> Adv = P.mkAdv ;
|
||||
} ;
|
||||
|
||||
}
|
||||
51
lib/src/mongolian/AdjectiveMon.gf
Normal file
51
lib/src/mongolian/AdjectiveMon.gf
Normal file
@@ -0,0 +1,51 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete AdjectiveMon of Adjective = CatMon ** open ResMon, Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
PositA a = a ;
|
||||
|
||||
-- Comparative forms are used with an object of comparison, as adjectival phrases.
|
||||
|
||||
ComparA a np = {
|
||||
s = np.s ! Abl ++ a.s
|
||||
} ;
|
||||
|
||||
UseComparA a = a ;
|
||||
|
||||
-- $SuperlA$ belongs to determiner syntax in $Noun$.
|
||||
|
||||
ComplA2 a2 np = {
|
||||
s = np.s ! a2.c2.rc ++ a2.c2.s ++ a2.s
|
||||
} ;
|
||||
|
||||
ReflA2 a = {
|
||||
s = reflPron ! Sg ! a.c2.rc ++ a.c2.s ++ a.s
|
||||
} ;
|
||||
|
||||
AdAP ada ap = {
|
||||
s = ada.s ++ ap.s
|
||||
} ;
|
||||
|
||||
UseA2 a = a ;
|
||||
|
||||
CAdvAP cadv ap np = {
|
||||
s = np.s ! cadv.c2.rc ++ cadv.c2.s ++ cadv.s ++ ap.s
|
||||
} ;
|
||||
|
||||
AdvAP ap adv = {
|
||||
s = adv.s ++ ap.s
|
||||
} ;
|
||||
|
||||
AdjOrd ord = {
|
||||
s = ord.s
|
||||
} ;
|
||||
|
||||
SentAP ap sc = {
|
||||
s = sc.s ++ "нь" ++ ap.s
|
||||
} ;
|
||||
|
||||
}
|
||||
31
lib/src/mongolian/AdverbMon.gf
Normal file
31
lib/src/mongolian/AdverbMon.gf
Normal file
@@ -0,0 +1,31 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete AdverbMon of Adverb = CatMon ** open ResMon, Prelude in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lin
|
||||
PositAdvAdj a = a ;
|
||||
|
||||
ComparAdvAdj cadv a np = {
|
||||
s = (appCompl cadv.c2 np.s) ++ cadv.s ++ a.s
|
||||
} ;
|
||||
|
||||
ComparAdvAdjS cadv a s = {
|
||||
s = s.s ! (Part Object) ++ cadv.c2.s ++ cadv.s ++ a.s
|
||||
} ;
|
||||
|
||||
PrepNP prep np = {s = np.s ! prep.rc ++ prep.s} ;
|
||||
|
||||
AdAdv = cc2 ;
|
||||
|
||||
PositAdAAdj a = a ;
|
||||
|
||||
SubjS subj s = {s = subj.s ++ s.s ! Sub Condl} ;
|
||||
|
||||
AdnCAdv cadv = {
|
||||
s = cadv.s ++ cadv.c2.s
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
9
lib/src/mongolian/AllMon.gf
Normal file
9
lib/src/mongolian/AllMon.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
concrete AllMon of AllMonAbs =
|
||||
LangMon, -- - [bank_N, eye_N, hair_N, hand_N, hat_N, radio_N], -- also in DictMon
|
||||
ExtraMon
|
||||
-- DictMon -- normally not in All AR
|
||||
** {
|
||||
flags coding=utf8 ;
|
||||
} ;
|
||||
7
lib/src/mongolian/AllMonAbs.gf
Normal file
7
lib/src/mongolian/AllMonAbs.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:../abstract:../common:prelude
|
||||
|
||||
abstract AllMonAbs =
|
||||
Lang, -- - [bank_N, hair_N, hand_N, hat_N, radio_N], -- auch in DictMonAbs, HL
|
||||
ExtraMonAbs
|
||||
-- DictMonAbs -- normally not in All AR
|
||||
** {} ;
|
||||
113
lib/src/mongolian/CatMon.gf
Normal file
113
lib/src/mongolian/CatMon.gf
Normal file
@@ -0,0 +1,113 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete CatMon of Cat = CommonX - [CAdv,Temp,Tense] ** open ResMon, Prelude in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lincat
|
||||
|
||||
-- Tensed/Untensed
|
||||
|
||||
S = {s : SType => Str} ;
|
||||
QS = {s : QForm => Str} ;
|
||||
RS = {s : ComplType => Str ; existSubject : Bool} ;
|
||||
SSlash = {s : Str ; c2 : Complement} ;
|
||||
|
||||
-- Clause (variable tense) e.g. "John walks"/"John walked"
|
||||
|
||||
Cl = {s : ClTense => Anteriority => Polarity => SType => Str} ;
|
||||
ClSlash = {s : ClTense => Anteriority => Polarity => SType => Str ; c2 : Complement} ;
|
||||
Imp = {s : Polarity => ImpForm => Str} ;
|
||||
|
||||
-- Question
|
||||
|
||||
QCl = {s : ClTense => Anteriority => Polarity => QForm => Str} ;
|
||||
IP = {s : RCase => Str} ;
|
||||
IComp = {s : Str} ;
|
||||
IDet = {s : RCase => Str ; n : Number} ;
|
||||
IQuant = {s : RCase => Str} ;
|
||||
|
||||
-- Relative
|
||||
|
||||
-- Mongolian lacks relative pronouns: a relative clause consists of a truncated sentence
|
||||
-- (desentential phrase) in apposition to. The verbs of relative clauses in Mongolian take
|
||||
-- verbal nominal endings (NDS). The subject goes into the genitive case, which transforms the RP.
|
||||
-- (Binnick, 1979:89; Kullmann 2005:392)
|
||||
|
||||
RCl = {s : ClTense => Anteriority => Polarity => SType => Str ; existSubject : Bool} ;
|
||||
RP = {s : Str} ;
|
||||
|
||||
-- Verb
|
||||
|
||||
VP = VerbPhrase ;
|
||||
Comp = {s : RCase => Str} ;
|
||||
VPSlash = VerbPhrase ** {c2 : Complement} ;
|
||||
|
||||
-- Adjective
|
||||
|
||||
AP = { s : Str } ;
|
||||
CAdv = {s : Str} ** {c2 : Complement} ;
|
||||
|
||||
-- Noun (Mongolian common nouns have neither gender nor animacy):
|
||||
|
||||
CN = {s : Number => NCase => Str} ;
|
||||
NP = NounPhrase ;
|
||||
Pron = { s : PronForm => Str ; n : Number ; p : Person} ;
|
||||
|
||||
-- Determiners
|
||||
|
||||
-- The determined noun has the case parameter specific for the determiner
|
||||
|
||||
Det = {
|
||||
s : Str ;
|
||||
sp : RCase => Str ; -- substantival form
|
||||
isNum : Bool ; -- true, if a numeral is present
|
||||
isPoss : Bool ; -- true, if a possessive is present
|
||||
isDef : Bool ; -- when definite, is true
|
||||
isPre : Bool
|
||||
} ;
|
||||
Ord = { s : Str } ;
|
||||
Predet = {
|
||||
s : Str ;
|
||||
isPre : Bool ;
|
||||
isDef : Bool
|
||||
} ;
|
||||
Quant = {
|
||||
s : Number => Str ;
|
||||
sp : Number => NCase => Str ;
|
||||
isPoss : Bool ;
|
||||
isDef : Bool
|
||||
} ;
|
||||
|
||||
-- Numeral
|
||||
|
||||
Num = {s : Str ; sp : RCase => Str ; n : Number ; isNum : Bool} ;
|
||||
Card = {s : Str ; sp : RCase => Str ; n : Number} ;
|
||||
Numeral = {s : CardOrd => Str; n : Number} ;
|
||||
Digits = {s : CardOrd => Str ; n : Number} ;
|
||||
|
||||
-- Structural
|
||||
|
||||
Conj = {s1,s2 : Str} ;
|
||||
Subj = {s : Str ; isPre : Bool} ;
|
||||
Prep = {s : Str ; rc : RCase} ;
|
||||
|
||||
-- Open lexical classes, e.g. Lexicon
|
||||
|
||||
V,VA,VS,VQ = Verb ;
|
||||
VV = Aux ;
|
||||
V2,V2S,V2A,V2Q,V2V = Verb ** {c2 : Complement} ;
|
||||
V3 = Verb ** {c2,c3 : Complement} ;
|
||||
|
||||
A = Adjective ;
|
||||
A2 = Adjective ** {c2 : Complement} ;
|
||||
|
||||
N = Noun ;
|
||||
N2 = Noun ** {c2 : Complement} ;
|
||||
N3 = Noun ** {c2,c3 : Complement} ;
|
||||
PN = {s : RCase => Str} ;
|
||||
|
||||
Temp = {s : Str ; t : ClTense ; a : Anteriority} ;
|
||||
Tense = {s : Str ; t : ClTense} ;
|
||||
}
|
||||
|
||||
63
lib/src/mongolian/ConjunctionMon.gf
Normal file
63
lib/src/mongolian/ConjunctionMon.gf
Normal file
@@ -0,0 +1,63 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete ConjunctionMon of Conjunction = CatMon ** open ResMon, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
ConjAdv, ConjAP, ConjIAdv = conjunctDistrSS ;
|
||||
ConjS conj s = conjunctDistrTable SType conj s ;
|
||||
ConjRS conj rs = conjunctDistrTable ComplType conj rs ** {
|
||||
existSubject = rs.existSubject
|
||||
} ;
|
||||
|
||||
ConjNP conj ss = conjunctDistrTable RCase conj ss ** {
|
||||
n = ss.n ;
|
||||
p = ss.p ;
|
||||
isPron = False ;
|
||||
isDef = ss.isDef
|
||||
} ;
|
||||
ConjCN conj cn = conjunctDistrTable2 Number NCase conj cn ;
|
||||
|
||||
-- These fun's are generated from the list cat's.
|
||||
|
||||
BaseS x y = twoTable SType x y ;
|
||||
ConsS x y = consrTable SType comma x y ;
|
||||
BaseAdv = twoSS ;
|
||||
ConsAdv = consrSS comma ;
|
||||
|
||||
BaseNP x y = twoTable RCase x y ** {
|
||||
n = conjNumber x.n y.n ;
|
||||
p = conjPerson x.p y.p ;
|
||||
isPron = andB x.isPron y.isPron ;
|
||||
isDef = andB x.isDef y.isDef
|
||||
} ;
|
||||
|
||||
ConsNP x y = consrTable RCase comma x y ** {
|
||||
n = conjNumber x.n y.n ;
|
||||
p = conjPerson x.p y.p ;
|
||||
isPron = andB x.isPron y.isPron ;
|
||||
isDef = andB x.isDef y.isDef
|
||||
} ;
|
||||
BaseAP = twoSS ;
|
||||
ConsAP = consrSS comma ;
|
||||
BaseRS x y = twoTable ComplType x y ** {
|
||||
existSubject = andB x.existSubject y.existSubject
|
||||
} ;
|
||||
ConsRS x y = consrTable ComplType comma x y ** {
|
||||
existSubject = y.existSubject
|
||||
};
|
||||
BaseIAdv = twoSS ;
|
||||
ConsIAdv = consrSS comma ;
|
||||
BaseCN x y = twoTable2 Number NCase x y ;
|
||||
ConsCN x y = consrTable2 Number NCase comma x y ;
|
||||
|
||||
lincat
|
||||
[Adv],[AP],[IAdv] = {s1,s2 : Str} ;
|
||||
[S] = {s1,s2 : SType => Str} ;
|
||||
[RS] = {s1,s2 : ComplType => Str ; existSubject : Bool} ;
|
||||
[NP] = {s1,s2 : RCase => Str ; n : Number ; p : Person ; isPron : Bool ; isDef : Bool} ;
|
||||
[CN] = {s1,s2 : Number => NCase => Str} ;
|
||||
|
||||
}
|
||||
|
||||
24139
lib/src/mongolian/DictMon.gf
Normal file
24139
lib/src/mongolian/DictMon.gf
Normal file
File diff suppressed because it is too large
Load Diff
24139
lib/src/mongolian/DictMonAbs.gf
Normal file
24139
lib/src/mongolian/DictMonAbs.gf
Normal file
File diff suppressed because it is too large
Load Diff
7
lib/src/mongolian/ExtraLexMon.gf
Normal file
7
lib/src/mongolian/ExtraLexMon.gf
Normal file
@@ -0,0 +1,7 @@
|
||||
--# -path=.:abstract:common
|
||||
concrete ExtraLexMon of ExtraLexMonAbs = CatMon **
|
||||
open ParadigmsMon in {
|
||||
flags
|
||||
coding=utf8 ;
|
||||
|
||||
}
|
||||
1058
lib/src/mongolian/ExtraMon.gf
Normal file
1058
lib/src/mongolian/ExtraMon.gf
Normal file
File diff suppressed because it is too large
Load Diff
1054
lib/src/mongolian/ExtraMonAbs.gf
Normal file
1054
lib/src/mongolian/ExtraMonAbs.gf
Normal file
File diff suppressed because it is too large
Load Diff
20
lib/src/mongolian/FoodsMon.gf
Normal file
20
lib/src/mongolian/FoodsMon.gf
Normal file
@@ -0,0 +1,20 @@
|
||||
concrete FoodsMon of Foods = open ResFoodsMon in {
|
||||
flags coding=utf8;
|
||||
|
||||
lincat
|
||||
Phrase = {s : Str} ;
|
||||
Quality = Adjective ;
|
||||
Kind = Noun ;
|
||||
Item = NounPhrase ;
|
||||
|
||||
lin
|
||||
Pred item quality = {s = item.s ++ "бол"++ quality.s} ;
|
||||
This = det Sg "энэ" ;
|
||||
These = det Pl "эдгээр" ;
|
||||
Mod quality kind = {s = \\n => quality.s ++ kind.s ! n} ;
|
||||
Wine = regNoun "дарс" ;
|
||||
Cheese = regNoun "бяслаг" ;
|
||||
Very adj = {s = "маш" ++ adj.s} ;
|
||||
Fresh = mkAdj "шинэ" ;
|
||||
Expensive = mkAdj "үнэтэй" ;
|
||||
}
|
||||
19
lib/src/mongolian/GrammarMon.gf
Normal file
19
lib/src/mongolian/GrammarMon.gf
Normal file
@@ -0,0 +1,19 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete GrammarMon of Grammar =
|
||||
NounMon,
|
||||
VerbMon,
|
||||
AdjectiveMon,
|
||||
AdverbMon,
|
||||
NumeralMon,
|
||||
SentenceMon,
|
||||
QuestionMon,
|
||||
RelativeMon,
|
||||
ConjunctionMon,
|
||||
PhraseMon,
|
||||
TextX - [CAdv,Tense,Temp],
|
||||
StructuralMon,
|
||||
IdiomMon,
|
||||
TenseMon,
|
||||
NumeralTransferMon
|
||||
** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ; } ;
|
||||
51
lib/src/mongolian/IdiomMon.gf
Normal file
51
lib/src/mongolian/IdiomMon.gf
Normal file
@@ -0,0 +1,51 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete IdiomMon of Idiom = CatMon ** open Prelude, ResMon, ParadigmsMon in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
ImpersCl vp = mkClause (\\_ => []) Sg vp.vt Nom vp ;
|
||||
GenericCl vp = mkClause (\\_ => []) Sg vp.vt Nom vp ;
|
||||
|
||||
CleftNP np rs = mkClause (\\_ => []) Sg (predV (auxToVerb auxBe)).vt Nom (insertEmbedCompl (rs.s ! ComplSubj) (insertObj (\\_ => np.s ! Nom) (predV (auxToVerb auxBe)))) ;
|
||||
|
||||
CleftAdv adv s = mkClause (\\_ => []) Sg (predV (auxToVerb auxBe)).vt Nom (insertObj (\\_ => s.s ! (Part Subject)) (insertObj (\\_ => adv.s) (predV (auxToVerb auxBe)))) ;
|
||||
|
||||
ExistNP np = mkClause (\\_ => []) np.n (predV (auxToVerb auxBe)).vt Nom (insertObj (\\_ => np.s ! Nom) (predV (auxToVerb auxBe))) ;
|
||||
|
||||
ExistIP ip = {
|
||||
s = \\t,ant,pol,_ => ip.s ! Nom ++ (mkClause (\\_ => []) Sg (predV (auxToVerb auxBe)).vt Nom (predV (auxToVerb auxBe))).s ! t ! ant ! pol ! Main
|
||||
} ;
|
||||
ExistNPAdv np adv = mkClause (\\_ => []) np.n (predV (auxToVerb auxBe)).vt Nom (insertObj (\\_ => np.s ! Nom ++ adv.s) (predV (auxToVerb auxBe))) ;
|
||||
|
||||
ExistIPAdv ip adv = {
|
||||
s = \\t,ant,pol,_ => (mkClause (\\_ => ip.s ! Nom) Sg (predV (auxToVerb auxBe)).vt Nom (insertObj (\\_ => adv.s)(predV (auxToVerb auxBe)))).s ! t ! ant ! pol ! Main
|
||||
} ;
|
||||
|
||||
ProgrVP vp =
|
||||
let
|
||||
progr = (vp.s ! VPCoord Simul).fin ;
|
||||
verb = predV (auxToVerb auxBe)
|
||||
in
|
||||
insertObj (\\rc => vp.embedCompl ! rc ++ vp.adv ++ vp.compl ! rc ++ progr) (predV (auxToVerb auxBe)) ;
|
||||
|
||||
ImpPl1 vp =
|
||||
let
|
||||
vps = vp.s ! VPImper Pos False
|
||||
in {
|
||||
s = vps.fin ;
|
||||
compl = vp.compl ;
|
||||
adv = vp.adv ;
|
||||
ext = vp.ext
|
||||
} ;
|
||||
|
||||
ImpP3 np vp =
|
||||
let
|
||||
vps = vp.s ! VPPass Causative ClPres
|
||||
in {
|
||||
s = np.s ! Acc ++ vps.fin
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
9
lib/src/mongolian/IrregMon.gf
Normal file
9
lib/src/mongolian/IrregMon.gf
Normal file
@@ -0,0 +1,9 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
|
||||
concrete IrregMon of IrregMonAbs = CatMon ** open ParadigmsMon in {
|
||||
|
||||
flags optimize=values ; coding=utf8 ;
|
||||
|
||||
|
||||
}
|
||||
10
lib/src/mongolian/LangMon.gf
Normal file
10
lib/src/mongolian/LangMon.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
--# -path=.:../abstract:../common:../prelude:
|
||||
|
||||
concrete LangMon of Lang =
|
||||
GrammarMon,
|
||||
LexiconMon -- to compile faster, use TestLexiconMon (see LangExtraMon.gf)
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;
|
||||
|
||||
} ;
|
||||
357
lib/src/mongolian/LexiconMon.gf
Normal file
357
lib/src/mongolian/LexiconMon.gf
Normal file
@@ -0,0 +1,357 @@
|
||||
--# -path=.:abstract:../common:../../prelude
|
||||
|
||||
concrete LexiconMon of Lexicon = CatMon ** open ParadigmsMon, Prelude, StructuralMon, MorphoMon in {
|
||||
|
||||
flags optimize=values ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
add_V3 = mkV3 (mkV "нэмэх") ;
|
||||
airplane_N = mkN "онгоц" ;
|
||||
alas_Interj = ss "ээ халаг" ;
|
||||
already_Adv = mkAdv "хэдийнэ" ;
|
||||
animal_N = mkN "амьтан" ;
|
||||
answer_V2S = mkV2S (mkV "хариулах") (noPrep Dat) ;
|
||||
apartment_N = mkN01a "байр" ;
|
||||
apple_N = mkN01a "алим" ;
|
||||
art_N = mkN01e "урлаг" ;
|
||||
ashes_N = mkN "үнс" ;
|
||||
ask_V2Q = mkV2Q (mkV "асуух") (noPrep Abl) ;
|
||||
baby_N = mk2N "нялх" (mkN01f "хүүхэд") ;
|
||||
back_N = mk2N "ар" (mkN "тал" "талууд") ;
|
||||
bad_A = mkA "муу";
|
||||
bank_N = mkLN "банк" ;
|
||||
bark_N = mkN "холтос";
|
||||
beautiful_A = mkA "хөөрхөн";
|
||||
become_VA = mkVA (mkV "болох") ;
|
||||
beer_N = mk2N "шар" (mkN01b "айраг") ;
|
||||
beg_V2V = mkV2V (mkV "гуйх") (noPrep Acc) ;
|
||||
belly_N = mkN "гүзээ" ;
|
||||
big_A = mkA "том" ;
|
||||
bike_N = mk2N "унадаг" (mkN "дугуй") ;
|
||||
bird_N = mkN "шувуу" "шувууд" ;
|
||||
bite_V2 = mkV2 (mkV "хазах") ;
|
||||
black_A = mkA "хар";
|
||||
blood_N = mkN "цус" ;
|
||||
blow_V = mkV "үлээх" ;
|
||||
blue_A = mkA "цэнхэр" ;
|
||||
boat_N = mkN "завь" ;
|
||||
bone_N = mkN "яс" ;
|
||||
book_N = mkN02c "ном" "номноос" ;
|
||||
boot_N = mk2N "түрийтэй" (mkN "гутал") ;
|
||||
boss_N = mkN "эзэн" ;
|
||||
boy_N = mkN "хөвгүүн" ;
|
||||
bread_N = mkN "талх" ;
|
||||
break_V2 = mkV2 (mkV "таслах") ;
|
||||
breast_N = mkN "хөх" ;
|
||||
breathe_V = mkV "амьсгалах" ;
|
||||
broad_A = mkA "өргөн";
|
||||
brother_N2 = mkN2 (mkN02a "ах" "ах нар") ;
|
||||
brown_A = mkA "бор";
|
||||
burn_V = mkV "шатах" ;
|
||||
butter_N = mk2N "цөцгийн" (mkN "тос") ;
|
||||
buy_V2 = mkV2 (mkV "худалдан авах") ;
|
||||
camera_N = mk2N "зургийн" (mkLN "аппарат") ;
|
||||
cap_N = mkN "аяга" ;
|
||||
car_N = mkLN "машин" "машинууд" ;
|
||||
carpet_N = mkN "хивс" ;
|
||||
cat_N = mkN01h "муур" ;
|
||||
ceiling_N = mkN "тааз" ;
|
||||
chair_N = mkN "сандал" ;
|
||||
cheese_N = mkN "бяслаг" ;
|
||||
child_N = mkN01f "хүүхэд" ;
|
||||
church_N = mkN "сүм" "сүмүүд" ;
|
||||
city_N = mkN02a "хот" "хотууд" ;
|
||||
clean_A = mkA "цэвэр";
|
||||
clever_A = mkA "ухаантай" ;
|
||||
close_V2 = mkV2 (mkV "хаах") ;
|
||||
cloud_N = mkN01a "үүл" ;
|
||||
coat_N = mkN01a "хүрэм" ;
|
||||
cold_A = mkA "хүйтэн";
|
||||
come_V = mkV "ирэх" ;
|
||||
computer_N = mkLN01c "компьютер" ;
|
||||
correct_A = mkA "зөв" ;
|
||||
count_V2 = mkV2 (mkV "тоолох") ;
|
||||
country_N = mkN02a "улс" "улсууд" ;
|
||||
cousin_N = mkN "үеэл" "үеэлүүд" ;
|
||||
cow_N = mkN "үнээ" ;
|
||||
cut_V2 = mkV2 (mkV "хэрчих") ;
|
||||
day_N = mkN01c "өдөр" ;
|
||||
die_V = mkV "үхэх" ;
|
||||
dig_V = mkV "малтах" ;
|
||||
dirty_A = mkA "бохир" ;
|
||||
distance_N3 = mkN3 (mkN "зай") from_Prep to_Prep ;
|
||||
do_V2 = mkV2 (mkV "хийх") ;
|
||||
doctor_N = mkLN01c "доктор" ;
|
||||
dog_N = mkN02b "нохой" "ноход" ;
|
||||
door_N = mkN "хаалга" ;
|
||||
drink_V2 = mkV2 (mkV "уух") ;
|
||||
dry_A = mkA "хуурай";
|
||||
dull_A = mkA "уйтгартай" ;
|
||||
dust_N = mkN "тоос" ;
|
||||
ear_N = mkN "чих" ;
|
||||
earth_N = mkN01a "дэлхий" ;
|
||||
easy_A2V = mkA2 (mkA "хялбар") (noPrep Dat) ;
|
||||
eat_V2 = mkV2 (mkV "идэх") ;
|
||||
egg_N = mkN01a "өндөг" ;
|
||||
empty_A = mkA "хоосон" ;
|
||||
enemy_N = mkN "дайсан" ;
|
||||
eye_N = mkN "нүд" ;
|
||||
factory_N = mkN01c "үйлдвэр" ;
|
||||
fall_V = mkV "унах" ;
|
||||
far_Adv = mkAdv "хол";
|
||||
fat_N = mkN "өөх" ;
|
||||
father_N2 = mkN2 (mkN02d "аав" "аавууд") ;
|
||||
fear_V2 = mkV2 (mkV "айх") ;
|
||||
fear_VS = mkVS (mkV "айх") ;
|
||||
feather_N = mkN "өд" ;
|
||||
fight_V2 = mkV2 (mkV "тэмцэх") ;
|
||||
find_V2 = mkV2 (mkV "олох") ;
|
||||
fingernail_N = mkN "хумс" ;
|
||||
fire_N = mkN "гал" ;
|
||||
fish_N = mkN "загас" ;
|
||||
float_V = mkV "хөвөх" ;
|
||||
floor_N = mkN01a "шал" ;
|
||||
flow_V = mkV "урсах" ;
|
||||
flower_N = mkN01b "цэцэг" ;
|
||||
fly_V = mkV "нисэх" ;
|
||||
fog_N = mkN01d "манан" ;
|
||||
foot_N = mkN "тавхай" ;
|
||||
forest_N = mkN01a "ой" ;
|
||||
forget_V2 = mkV2 (mkV "мартах") ;
|
||||
freeze_V = mkV "хөлдөх" ;
|
||||
fridge_N = mkN "хөргөгч" "хөргөгчнүүд" ;
|
||||
friend_N = mkN02a "найз" "найзууд" ;
|
||||
fruit_N = mkN "жимс" ;
|
||||
full_A = mkA "дүүрэн" ;
|
||||
fun_AV = mkAV (mkA "хөгжилтэй") ;
|
||||
garden_N = mkN01e "цэцэрлэг" ;
|
||||
girl_N = mkN "охин" ;
|
||||
give_V3 = mkV3 (mkV "өгөх") ;
|
||||
glove_N = mkN "бээлий" ;
|
||||
go_V = mkV "явах" ;
|
||||
gold_N = mkN "алт" ;
|
||||
good_A = mkA "сайн" ;
|
||||
grammar_N = mk2N "хэл" (mkN01a "зүй") ;
|
||||
grass_N = mkN "өвс";
|
||||
green_A = mkA "ногоон" ;
|
||||
guts_N = mkN "цувдай" ;
|
||||
hair_N = mkN "үс" ;
|
||||
hand_N = mkN "гар" ;
|
||||
harbour_N = mkN "боомт" "боомтууд" ;
|
||||
hat_N = mkN "малгай" ;
|
||||
hate_V2= mkV2 (mkV "үзэн ядах");
|
||||
head_N = mkN "толгой" ;
|
||||
hear_V2= mkV2 (mkV "сонсох");
|
||||
heart_N = mkN "зүрх" ;
|
||||
heavy_A = mkA "хүнд" ;
|
||||
hill_N = mkN02a "толгод" "толгодууд" ;
|
||||
hit_V2 = mkV2 (mkV "цохих") ;
|
||||
hold_V2 = mkV2 (mkV "барих") ;
|
||||
hope_VS = mkVS (mkV "найдах") ;
|
||||
horn_N = mkN01h "эвэр" ;
|
||||
horse_N = mkN02b "морь" "морьд" ;
|
||||
hot_A = mkA "халуун" ;
|
||||
house_N = mkN01d "байшин" ;
|
||||
hunt_V2 = mkV2 (mkV "агнах") ;
|
||||
husband_N = mkN01c "нөхөр" ;
|
||||
ice_N = mkN "мөс" ;
|
||||
important_A = mkA "чухал" ;
|
||||
industry_N = mkN "үйлдвэрлэл" "үйлдвэрлэлүүд" ;
|
||||
iron_N = mkN "төмөр" ;
|
||||
john_PN = mkPN "Джон" ;
|
||||
jump_V = mkV "үсрэх" ;
|
||||
kill_V2 = mkV2 (mkV "алах") ;
|
||||
king_N = mkN "хаан" ;
|
||||
knee_N = mkN01a "өвдөг" ;
|
||||
know_V2= mkV2 (mkV "таних") ;
|
||||
know_VS = mkVS (mkV "мэдэх") ;
|
||||
know_VQ = mkVQ (mkV "мэдэх") ;
|
||||
lake_N = mkN01b "нуур" ;
|
||||
lamp_N = mkN01d "чийдэн" ;
|
||||
language_N = mkN01a "хэл" ;
|
||||
laugh_V = mkV "инээх" ;
|
||||
leaf_N = mkN "навч" "навчис" ;
|
||||
learn_V2= mkV2 (mkV "сурах") ;
|
||||
leather_N = mkN "савхи" ;
|
||||
leave_V2= mkV2 (mkV "орхин явах") ;
|
||||
left_Ord = mkOrd "зүүн" ;
|
||||
leg_N = mkN "хөл" ;
|
||||
lie_V = mkV "хуурах" ;
|
||||
like_V2 = mkV2 (mkV "таалагдах") ;
|
||||
listen_V2= mkV2 (mkV "сонсох") ;
|
||||
live_V = mkV "амьдрах" ;
|
||||
liver_N = mkN01a "элэг" ;
|
||||
long_A = mkA "урт" ;
|
||||
lose_V2 = mkV2 (mkV "хаях") ;
|
||||
louse_N = mkN "бөөс" ;
|
||||
love_N = mkN02c "хайр" "хайраас" ;
|
||||
love_V2= mkV2 (mkV "хайрлах") ;
|
||||
man_N = mkN02e "хүн" "хүмүүс" ;
|
||||
married_A2 = mkA2 (mkA "гэрлэсэн") (noPrep Com) ;
|
||||
meat_N = mkN "мах" ;
|
||||
milk_N = mkN "сүү" ;
|
||||
moon_N = mkN01a "сар" ;
|
||||
mother_N2 = mkN2 (mkN02a "ээж" "ээжүүд") ;
|
||||
mountain_N = mkN02c "уул" "уулнаас" ;
|
||||
mouth_N = mkN01a "ам" ;
|
||||
music_N = mkN "хөгжим" ;
|
||||
name_N = mkN01b "нэр" ;
|
||||
narrow_A = mkA "нарийн" ;
|
||||
near_A = mkA "ойр";
|
||||
neck_N = mkN "хүзүү" ;
|
||||
new_A = mkA "шинэ" ;
|
||||
newspaper_N = mkN "сонин" ;
|
||||
night_N = mkN "шөнө" ;
|
||||
nose_N = mkN "хамар" "хамарнууд" ;
|
||||
now_Adv = mkAdv "одоо" ;
|
||||
number_N = mkN "тоо" ;
|
||||
oil_N = mkN "тос" ;
|
||||
old_A = mkA "хуучин" ;
|
||||
open_V2= mkV2 (mkV "нээх") ;
|
||||
paint_V2A = mkV2A (mkV "будах") (noPrep Acc) ;
|
||||
paper_N = mkN "цаас" ;
|
||||
paris_PN = mkPN "Парис" ;
|
||||
peace_N = mk2N "энх" (mkN01g "тайван") ;
|
||||
pen_N = mkN01a "үзэг" ;
|
||||
person_N = mk2N "хувь" (mkN02e "хүн" "хүмүүс") ;
|
||||
planet_N = mkN01e "гариг" ;
|
||||
plastic_N = mkN01c "хуванцар" ;
|
||||
play_V2 = mkV2 (mkV "наадах") ;
|
||||
play_V = mkV "тоглох" ;
|
||||
policeman_N = mkN02a "цагдаа" "цагдаа нар" ;
|
||||
priest_N = mkN "санваартан" "санваартнууд" ;
|
||||
probable_AS = mkAS (mkA "боломжийн") ;
|
||||
pull_V2 = mkV2 (mkV "татах" ) ;
|
||||
push_V2 = mkV2 (mkV "түлхэх") ;
|
||||
put_V2 = mkV2 (mkV "тавих") ;
|
||||
queen_N = mkN "хатан" ;
|
||||
question_N = mkN "асуулт" ;
|
||||
radio_N = mkN "радио" ;
|
||||
rain_N = mkN "бороо" ;
|
||||
rain_V0 = mkV0 (mkV "бороо орох") ;
|
||||
read_V2 = mkV2 (mkV "унших") ;
|
||||
ready_A = mkA "бэлэн";
|
||||
reason_N = mkN "шалтгаан" "шалтгаанууд" ;
|
||||
red_A = mkA "улаан" ;
|
||||
religion_N = mkN "шашин" ;
|
||||
restaurant_N = mkLN "ресторан" "ресторанууд" ;
|
||||
right_Ord = mkOrd "баруун" ;
|
||||
river_N = mkN "гол" "голууд" ;
|
||||
road_N = mkN "зам" "замууд" ;
|
||||
rock_N = mkN "хад" ;
|
||||
roof_N = mkN01c "дээвэр" ;
|
||||
root_N = mkN "үндэс" ;
|
||||
rope_N = mkN "уяа" ;
|
||||
rotten_A = mkA "ялзарсан";
|
||||
round_A = mkA "дугуй";
|
||||
rub_V2 = mkV2 (mkV "үрэх") ;
|
||||
rubber_N = mkN01b "баллуур" ;
|
||||
rule_N = mkN "дүрэм" "дүрмүүд" ;
|
||||
run_V = mkV "гүйх" ;
|
||||
salt_N = mkN "давс" ;
|
||||
sand_N = mkN "элс";
|
||||
say_VS = mkVS (mkV "хэлэх") ;
|
||||
school_N = mkN "сургууль" ;
|
||||
science_N = mk2N "шинжлэх" (mkN "ухаан" "ухаанууд") ;
|
||||
scratch_V2 = mkV2 (mkV "маажих") ;
|
||||
sea_N = mkN01a "далай" ;
|
||||
see_V2 = mkV2 (mkV "харах") ;
|
||||
seed_N = mkN02d "үр" "үрс" ;
|
||||
seek_V2 = mkV2 (mkV "эрэх") ;
|
||||
sell_V3 = mkV3 (mkV "худалдах") ;
|
||||
send_V3 = mkV3 (mkV "илгээх") ;
|
||||
sew_V = mkV "оёх" ;
|
||||
sharp_A = mkA "хурц";
|
||||
sheep_N = mkN "хонь" ;
|
||||
ship_N = mk2N "усан" (mkN "онгоц") ;
|
||||
shirt_N = mkN "цамц" ;
|
||||
shoe_N = mkN "гутал" ;
|
||||
shop_N = mkN01c "дэлгүүр" ;
|
||||
short_A = mkA "богино" ;
|
||||
silver_N = mkN "мөнгө" ;
|
||||
sing_V = mkV "дуулах" ;
|
||||
sister_N = mkN02a "эгч" "эгч нар" ;
|
||||
sit_V = mkV "суух" ;
|
||||
skin_N = mkN "арьс" ;
|
||||
sky_N = mkN01c "тэнгэр" ;
|
||||
sleep_V = mkV "унтах" ;
|
||||
small_A = mkA "жижиг" ;
|
||||
smell_V = mkV "үнэртэх" ;
|
||||
smoke_N = mkN "утаа" ;
|
||||
smooth_A = mkA "тэгшхэн";
|
||||
snake_N = mkN "могой" ;
|
||||
snow_N = mkN "цас" ;
|
||||
sock_N = mkN "оймс" ;
|
||||
song_N = mkN "дуу" ;
|
||||
speak_V2 = mkV2 (mkV "ярих") ;
|
||||
spit_V = mkV "нулимах" ;
|
||||
split_V2 = mkV2 (mkV "хуваах") ;
|
||||
squeeze_V2 = mkV2 (mkV "шахах") ;
|
||||
stab_V2 = mkV2 (mkV "зоох") ;
|
||||
stand_V = mkV "зогсох" ;
|
||||
star_N = mkN "од" ;
|
||||
steel_N = mkN01d "ган" ;
|
||||
stick_N = mkN "саваа" ;
|
||||
stone_N = mkN "чулуу" ;
|
||||
stop_V = mkV "зогсох";
|
||||
stove_N = mkN01d "пийшин" ;
|
||||
straight_A = mkA "шулуун" ;
|
||||
student_N = mkN "оюутан" "оюутнууд" ;
|
||||
stupid_A = mkA "тэнэг" ;
|
||||
suck_V2 = mkV2 (mkV "хөхөх") ;
|
||||
sun_N = mkN01a "нар" ;
|
||||
swell_V = mkV "хөөх" ;
|
||||
swim_V = mkV "сэлэх" ;
|
||||
switch8off_V2 = mkV2 (mkV "унтраах") ;
|
||||
switch8on_V2 = mkV2 (mkV "асаах") ;
|
||||
table_N = mkN "ширээ" ;
|
||||
tail_N = mkN01a "сүүл" ;
|
||||
talk_V3 = mkV3 (mkV "ярилцах") ;
|
||||
teach_V2 = mkV2 (mkV "сургах") ;
|
||||
teacher_N = mkN02a "багш" "багш нар" ;
|
||||
television_N = mkN "зурагт" ;
|
||||
thick_A = mkA "зузаан" ;
|
||||
thin_A = mkA "нарийн" ;
|
||||
think_V = mkV "бодох" ;
|
||||
throw_V2 = mkV2 (mkV "шидэх") ;
|
||||
tie_V2 = mkV2 (mkV "уях") ;
|
||||
today_Adv = mkAdv "өнөөдөр" ;
|
||||
tongue_N = mkN01a "хэл" ;
|
||||
tooth_N = mkN "шүд" ;
|
||||
train_N = mk2N "галт" (mkN01a "тэрэг") ;
|
||||
travel_V = mkV "аялах" ;
|
||||
tree_N = mkN "мод" ;
|
||||
turn_V = mkV "эргэх" ;
|
||||
ugly_A = mkA "муухай" ;
|
||||
uncertain_A = mkA "эргэлзээтэй";
|
||||
understand_V2 = mkV2 (mkV "ойлгох") ;
|
||||
university_N = mk2N "их" (mkN "сургууль") ;
|
||||
village_N = mkN "тосгон" ;
|
||||
vomit_V = mkV "бөөлжих" ;
|
||||
wait_V2 = mkV2 (mkV "хүлээх") ;
|
||||
walk_V = mkV "алхах" ;
|
||||
war_N = mkN "дайн" "дайнууд" ;
|
||||
warm_A = mkA "дулаан" ;
|
||||
wash_V2 = mkV2 (mkV "угаах") ;
|
||||
watch_V2 = mkV2 (mkV "үзэх") ;
|
||||
water_N = mkN "ус" ;
|
||||
wet_A = mkA "нойтон" ;
|
||||
white_A = mkA "цагаан" ;
|
||||
wide_A = mkA "өргөн";
|
||||
wife_N = mkN01c "эхнэр" ;
|
||||
win_V2 = mkV2 (mkV "ялах");
|
||||
wind_N = mkN "салхи" ;
|
||||
window_N = mkN "цонх" ;
|
||||
wine_N = mkN "дарс" ;
|
||||
wing_N = mkN "далавч" ;
|
||||
wipe_V2 = mkV2 (mkV "арчих") ;
|
||||
woman_N = mk2N "эмэгтэй" (mkN02e "хүн" "хүмүүс") ;
|
||||
wonder_VQ = mkVQ (mkV "гайхах") ;
|
||||
wood_N = mk2N "боловсруулсан" (mkN "мод") ;
|
||||
worm_N = mkN "өт" ;
|
||||
write_V2 = mkV2 (mkV "бичих") ;
|
||||
year_N = mkN "жил" "жилүүд" ;
|
||||
yellow_A = mkA "шар" ;
|
||||
young_A = mkA "залуу" ;
|
||||
}
|
||||
|
||||
11
lib/src/mongolian/MakeStructuralMon.gf
Normal file
11
lib/src/mongolian/MakeStructuralMon.gf
Normal file
@@ -0,0 +1,11 @@
|
||||
--# -path=.:../common:../abstract
|
||||
|
||||
resource MakeStructuralMon = open CatMon, ParadigmsMon, ResMon, Prelude in {
|
||||
|
||||
oper
|
||||
mkConj : Str -> Str -> Conj = \x,y -> lin Conj
|
||||
{s1 = x ; s2 = y} ;
|
||||
|
||||
mkSubj : Str -> Subj = \x -> lin Subj {s = x} ;
|
||||
|
||||
}
|
||||
618
lib/src/mongolian/MorphoMon.gf
Normal file
618
lib/src/mongolian/MorphoMon.gf
Normal file
@@ -0,0 +1,618 @@
|
||||
--# -path=.:../prelude:../common
|
||||
|
||||
-- A Simple Mongolian Resource Morphology
|
||||
|
||||
-- based on D.Tserenpil, R.Kullmann: Mongolian Grammar, 4th revised edition, 2008
|
||||
-- and Damdinsuren: Modern Mongolian Grammar (in Mongolian) 1983
|
||||
|
||||
-- This resource morphology contains definitions of the lexical entries
|
||||
-- needed in the resource syntax.
|
||||
|
||||
-- We use the parameter types and word classes defined for morphology. We only
|
||||
-- treat inflection, not derivation.
|
||||
|
||||
resource MorphoMon = ResMon ** open Prelude, Formal in {
|
||||
|
||||
flags optimize=all ; coding=utf8 ;
|
||||
|
||||
-- Vowel Harmony
|
||||
|
||||
-- The 7 vowels (and double vowels, diphthongs, auxiliary vowels) are separated in 3 types:
|
||||
-- masculine (=hard) vowels а, аа, аЙ, я (a), о, оо, оЙ, ё (o), у, уу, юу, уЙ, ю, юу (u),
|
||||
-- feminine (=soft) vowels э, ээ, эЙ, е, иЙ (e), ө, өө (ö), ү, үү, юү, үЙ, юЙ, ю, юү (ü),
|
||||
-- and neuter и (i). Vowel harmony means that word forms must not mix masculine and
|
||||
-- feminine vowels.
|
||||
-- Remark: The gender names have nothing to do with genders for nouns;
|
||||
-- in fact, Mongolian nouns have no gender.
|
||||
|
||||
-- Kullmann, p.7, p.20
|
||||
-- Basic vowel := short or neuter vowel
|
||||
-- Strong (= Masc or back) short vowels: a | o | u
|
||||
-- Weak (= Fem or front) short vowels: e| oe | ue
|
||||
-- Neuter vowel: i
|
||||
-- Strong resp. weak words (suffixes) are those whose vowels are strong|neuter resp. weak.
|
||||
|
||||
oper
|
||||
mascBasicVowel : pattern Str = #( "а" | "о" | "у" ) ;
|
||||
femBasicVowel : pattern Str = #( "э" | "ө" | "ү" ) ;
|
||||
neuterVowel : pattern Str = #( "и" ) ;
|
||||
yVowel : pattern Str = #("я"|"е"|"ё"|"ю") ;
|
||||
doubleVowel : pattern Str = #("аа"|"оо"|"уу"| -- mascDoubleVowel (not Kullmann)
|
||||
"ээ"|"өө"|"үү"| -- femDoubleVowel
|
||||
"яа"|"ёо"|"еэ"|"еө"|"юу"|"юү"| -- yDoubleVowel
|
||||
"иа"|"ио"|"иу") ; -- neuterDoubleVowel
|
||||
diphtVowel : pattern Str =#("й") ;
|
||||
|
||||
shortVowel : pattern Str = #("а"|"у"|"о"|"ү"|"э"|"ө") ; -- (masc|fem BasicVowel) ;
|
||||
basicVowel : pattern Str = #("а"|"у"|"о"|"ү"|"э"|"ө"|"и") ; -- (shortVowel | "и") ;
|
||||
longVowel : pattern Str = #("аа"|"оо"|"уу"|
|
||||
"ээ"|"өө"|"үү"|
|
||||
"яа"|"ёо"|"еэ"|"еө"|"юу"|"юү"|
|
||||
"иа"|"ио"|"иу"|
|
||||
"ай"|"ой"|"уй"|"эй"|"үй"|"ий") ;
|
||||
|
||||
-- avoid #vowel where it makes too many distinctions!
|
||||
-- to match double vowels and diphthongs, these must come first?
|
||||
|
||||
-- 2.2.2 (Kullmann) Consonants
|
||||
|
||||
-- WeakCons = C7 (vocalized: must be preceded or followed by a vowel)
|
||||
-- StrongCons = C9 (non-vocalized)
|
||||
|
||||
oper
|
||||
c7 : pattern Str = #("м"|"н"|"г"|"л"|"б"|"в"|"р") ;
|
||||
c9 : pattern Str = #("д"|"ж"|"з"|"с"|"т"|"ц"|"ч"|"ш"|"х") ;
|
||||
consonant : pattern Str = #("м"|"н"|"г"|"л"|"б"|"в"|"р"|
|
||||
"д"|"ж"|"з"|"с"|"т"|"ц"|"ч"|"ш"|"х") ;
|
||||
neuterCons : pattern Str = #("ь") ;
|
||||
|
||||
-- Suffixation: dropping the unstressed vowel in the stem: (Kullmann p.24)
|
||||
-- Adding a suffix beginning with a vowel causes the final unstressed vowel
|
||||
-- between consonants to drop (unless it has a grammatical function).
|
||||
-- The vowel is only dropped if it is unstressed, i.e. not the first vowel in the stem.
|
||||
-- Apply dropVowel in case the suffix begins with a vowel:
|
||||
-- ("ын"|"ийн"|"ы"|"ий"|"ыг"|"ийг"|"аас"|"ээс"|"өөс"|"оос"
|
||||
-- |"аар"|"ээр"|"оор"|"өөр"|"ууд"|"үүд"|"иуд"|"иүд"),
|
||||
-- so we need only check if suffix = ("ы"|"и"|"а"|"э"|"ө"|"о"|"у"|"ү") + rest.
|
||||
|
||||
dropUnstressedVowel : Str -> Str = \stem -> case stem of {
|
||||
_ + #doubleVowel + #consonant => stem ;
|
||||
x@(_+(#femBasicVowel|"и")+"г") + #femBasicVowel + y@(#c7|#c9) => (x+y) ;
|
||||
x@(_+#basicVowel+("н"|"г")) + #shortVowel + y@("н"|"г") => stem ;
|
||||
x@(_+(#basicVowel|"й")+#c7) + #shortVowel + y@#c7 => (x+y) ;
|
||||
(_+#basicVowel+"ш") + "и" + "н" => stem ; -- "шашин" ; "машин"
|
||||
x@(_+?+("ж"|"ч"|"ш")) + ("и") + y@#c7 => (x+y) ;
|
||||
x@(_+#basicVowel+#c7+("хт"|"сч"|"хч"|"ст")) + #shortVowel + y@#c7 => (x+y) ; -- Damdinsuren 18
|
||||
x@(_+(#diphtVowel|#basicVowel|"ь"+#c9)) + #shortVowel + y@(#c7|#c9) => (x+y) ;
|
||||
x@(_+(#basicVowel|"ь")+#c9) + #shortVowel + y@(#c7|#c9) => (x+y) ; -- Damdinsuren 18
|
||||
x@(_+#c7+ #c9) + #shortVowel + y@#c7 => (x+y) ;
|
||||
_ => stem
|
||||
} ;
|
||||
|
||||
-- examples: cc dropUnstressedVowel "орон"
|
||||
-- "дусал"
|
||||
-- "суртал"
|
||||
-- "төрөлхтөн"
|
||||
|
||||
|
||||
-- We use dropUnstressedVowel in noun declination classes and regN explicitly,
|
||||
-- and in regV implicitly via addSuf below.
|
||||
|
||||
|
||||
addSuf : Str -> Suffix -> Str = addSuffix ; -- provide a stem and a suffix with voweltype variants,
|
||||
-- derive the voweltype from the stem and
|
||||
-- use the appropriate suffix
|
||||
|
||||
-- The following addSufVt is used in ParadigmsMon to combine suffix strings,
|
||||
-- and in the addSuffix-function below.
|
||||
|
||||
-- Extend a stem with a suffix string, by inserting a4 (in the given voweltype)
|
||||
-- or a softness marker (in the given voweltype) between stem and suffix, if needed:
|
||||
|
||||
addSufVt : VowelType -> Str -> Str -> Str = \vt, stm, suffix ->
|
||||
let
|
||||
insertVowel = table Str { _+("ж"|"ш"|"ч") => "и" ; _ => a4 ! vt } ;
|
||||
a4 = insertVowel ! stm
|
||||
in
|
||||
case stm of {
|
||||
_ + #yVowel => case suffix of {
|
||||
#doubleVowel + _ => stm + Predef.drop 1 suffix ;
|
||||
_ => stm + suffix } ;
|
||||
_ + #longVowel => case suffix of {
|
||||
#doubleVowel + _ => stm + "г" + suffix ;
|
||||
_ => stm + suffix } ;
|
||||
|
||||
_ + y@(#c7|#c9) + "и" => case suffix of {
|
||||
"" => Predef.tk 1 stm + "ь" ;
|
||||
#doubleVowel + _ => stm + Predef.drop 1 suffix ;
|
||||
#yVowel => Predef.tk 1 stm + "ь" + suffix ;
|
||||
"х" + _ => stm + suffix ;
|
||||
#c9 + _ => case y of {
|
||||
#c7 => Predef.tk 1 stm + "ь" + suffix ;
|
||||
_ => stm + suffix } ;
|
||||
_ => stm + suffix} ;
|
||||
x + y@("лг"|(#c7+"л")) + #shortVowel => case suffix of {
|
||||
#doubleVowel + _ => x + y + suffix ;
|
||||
_ => stm + suffix } ;
|
||||
_ + #consonant + #consonant => case suffix of {
|
||||
("на"|"нэ"|"нө"|"но"|("х" + _)|"я"|"ё"|"е") => stm + a4 + suffix ;
|
||||
(#consonant + (""|(#consonant + _))) => stm + a4 + suffix ;
|
||||
_ => stm + suffix } ;
|
||||
_ + #basicVowel + c@(#c7|#c9) => case suffix of {
|
||||
("я"|"ё") => stm + "ъ" + suffix ;
|
||||
"е" => stm + "ь" + suffix ;
|
||||
(("х" + _)|("в"|"г")) => stm + a4 + suffix ;
|
||||
"ж" => case c of {
|
||||
#c9 => stm + a4 + suffix ;
|
||||
_ => stm + suffix } ;
|
||||
y@#consonant + #consonant + _ => case c of {
|
||||
#c7 => case y of {
|
||||
#c9 => stm + suffix ;
|
||||
_ => stm + a4 + suffix } ;
|
||||
_ => stm + a4 + suffix } ;
|
||||
_ => stm + suffix
|
||||
} ;
|
||||
_ => stm + suffix
|
||||
} ;
|
||||
|
||||
-- Given a string (a stem perhaps extended by suffixes) and a suffix varying with
|
||||
-- the vowel type, choose the proper suffix variant, and concatenate (with addSufVt)
|
||||
-- both, with insertion of a vowel/softness sign
|
||||
|
||||
addSuffix : Str -> Suffix -> Str = \stem,suffix ->
|
||||
let
|
||||
vt = vowelType stem ;
|
||||
suf = suffix ! vt
|
||||
in addSufVt vt stem suf ;
|
||||
|
||||
stemVerb : Str -> Str = \inf -> case inf of {
|
||||
stem@(_ + ("ч"|"ш"|"ж")) + "их" => stem ;
|
||||
stem@(_ + ("и"|#longVowel|#yVowel)) + "х" => stem ;
|
||||
stem@(_ + "н" + #shortVowel) + "х" => stem ;
|
||||
stem@(_ + #c7 + "л" + #shortVowel) + "х" => stem ;
|
||||
stem@(_ + #c9) + "л" + v@(#shortVowel) + "х" => case stem of {
|
||||
_ + ("ж"|"ш"|"ч") => stem + "и" + "л" ;
|
||||
_ => stem + v + "л" } ;
|
||||
stem@((#consonant)* + ?) + "х" => stem ;
|
||||
_ => Predef.tk 2 inf
|
||||
} ;
|
||||
|
||||
-- Personal pronouns with possessive as additional PronForm:
|
||||
|
||||
oper
|
||||
pronEnding : VowelType => RCase => Str = table {
|
||||
MascA => table RCase ["";"ын";"ад";"ыг";"аас";"аар";"тай";"руу"] ;
|
||||
_ => table RCase ["";"ийн";"эд";"ийг";"ээс";"ээр";"тэй"; "рүү"]
|
||||
} ;
|
||||
|
||||
mkPron : (_,_,_,_,_,_,_,_ : Str) -> Number -> Person -> Pron =
|
||||
\bi,minii,nadad,namaig,nadaas,nadaar,nadtai,nadruu,n,p ->
|
||||
let
|
||||
vt = vowelType minii
|
||||
in {
|
||||
s = table {
|
||||
PronCase rc => table RCase [bi;minii;nadad;namaig;nadaas;nadaar;nadtai;nadruu] ! rc ;
|
||||
PronPoss rc => minii + "х" + pronEnding ! vt ! rc
|
||||
} ;
|
||||
n = n ;
|
||||
p = p
|
||||
} ;
|
||||
|
||||
-- Nouns
|
||||
|
||||
-- Mongolian noun declension
|
||||
|
||||
-- There are 5 different plural suffixes, 4 genitive, 2 dative, 2 accusative, 2 directive.
|
||||
-- an ablative, comitative and instrumental suffix which depends on the vowel harmony.
|
||||
|
||||
oper
|
||||
plSuffix : Str -> Str = \stem ->
|
||||
let
|
||||
vt = vowelType stem ;
|
||||
stemDr = dropUnstressedVowel stem -- doesn't drop the vowel in loan words, cf. mkDecl
|
||||
in
|
||||
table VowelType { vts => case stem of {
|
||||
_ + #basicVowel + ("гч"|"лч"|"ч") => stem + "ид" ; -- зохиолчид
|
||||
y@(_ + #doubleVowel + #consonant) + "ь" => y + iud2 ! vts ; -- сургуулиуд
|
||||
y + ("ь") => y + "и" + nuud2 ! vts ; -- хонинууд
|
||||
_ + ("сан"|"нан"|"нин"|"шин") => stem + guud2 ! vts ; -- шашингууд
|
||||
_ + #consonant + #consonant + "и" => stem + nuud2 ! vts ; -- тамхинууд
|
||||
_ + "р" => stemDr + uud2 ! vts ; -- чихрүүд
|
||||
_ + ("га"|"гэ"|"го"|"гө") => stem + nuud2 ! vts ; -- хурганууд
|
||||
_ + "ран" => stem + uud2 ! vts ;
|
||||
y + "н" => y + "д" ; --охид
|
||||
y@(_ + #consonant) + #shortVowel => y + uud2 ! vts ;
|
||||
_ => stem + nuud2 ! vts -- туулайнууд
|
||||
}
|
||||
} ! vt ;
|
||||
|
||||
-- mkDecl is used for declension of nouns and proper names, depending on the
|
||||
-- parameter drop:Bool. The parameter drop is used to distinguish between
|
||||
-- declination for ordinary nouns and declination for proper names
|
||||
-- and foreign nouns. If the suffix added begins with a vowel, the
|
||||
-- unstressed vowel in the stem has to be dropped in noun declension, but not in
|
||||
-- proper name declension. The dropping function is dropUnstressedVowel for
|
||||
-- nouns, but the identity for proper names. For nouns, drop=True,
|
||||
-- and a function dropUnstressedVowel is applied to the stem;
|
||||
-- for proper names, drop=False suppresses the vowel dropping.
|
||||
|
||||
-- Note: It is much more efficient to use a flag drop:Bool instead of a parameter
|
||||
-- drop:(Str -> Str) which is later instantiated to \x->x or dropUnstressedVowel only.
|
||||
-- A previous version with a function parameter drop:(Str->Str) was much slower.
|
||||
|
||||
SemiDcl : Type = Str -> Str -> VowelType => NCase => Str ;
|
||||
|
||||
sgDcl : SemiDcl = \stem,stemDr -> \\vts =>
|
||||
table { NNom => stem ;
|
||||
NGen => stemDr + iin2 ! vts ;
|
||||
NDat => stem + "д" ;
|
||||
NAcc d => case d of {
|
||||
Definite => stem ;
|
||||
Indefinite => stemDr + iig2 ! vts } ;
|
||||
NAbl => stemDr + aas4 ! vts ;
|
||||
NInst => stemDr + aar4 ! vts ;
|
||||
NCom => stem + tai3 ! vts ;
|
||||
NDir => stem ++ ruu2 ! vts
|
||||
} ;
|
||||
|
||||
plDcl : SemiDcl = \stem,stemDr -> \\vts =>
|
||||
table { NNom => stem ;
|
||||
NGen => stemDr + iin2 ! vts ;
|
||||
NDat => case stem of { _ + "нар" => stem + "т" ;
|
||||
_ => stemDr + ad4 ! vts } ;
|
||||
NAcc d => case d of {
|
||||
Definite => stem ;
|
||||
Indefinite => stemDr + iig2 ! vts } ;
|
||||
NAbl => stemDr + aas4 ! vts ;
|
||||
NInst => stemDr + aar4 ! vts ;
|
||||
NCom => stem + tai3 ! vts ;
|
||||
NDir => stem ++ (case stem of { _ + "нар" => "луу" ;
|
||||
_ => ruu2 ! vts })
|
||||
} ;
|
||||
|
||||
Dcl : Type = Str -> Str -> Str -> Str -> VowelType => VowelType => SubstForm => Str ;
|
||||
|
||||
nounDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts => \\vtp =>
|
||||
table { SF Sg NNom => stem ;
|
||||
SF Sg NGen => stemDr + iin2 ! vts ;
|
||||
SF Sg NDat => stem + "д" ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => stemDr + iig2 ! vts ;
|
||||
Indefinite => stem} ;
|
||||
SF Sg NAbl => stemDr + aas4 ! vts ;
|
||||
SF Sg NInst => stemDr + aar4 ! vts ;
|
||||
SF Sg NCom => stem + tai3 ! vts ;
|
||||
SF Sg NDir => stem ++ ruu2 ! vts ;
|
||||
SF Pl NNom => stemPl ;
|
||||
SF Pl NGen => stemPlDr + iin2 ! vtp ;
|
||||
SF Pl NDat => stemPlDr + a4 ! vtp + "д" ;
|
||||
SF Pl (NAcc d) => case d of {
|
||||
Definite => stemPlDr + iig2 ! vts ;
|
||||
Indefinite => stemPl} ;
|
||||
SF Pl NAbl => stemPlDr + aas4 ! vtp ;
|
||||
SF Pl NInst => stemPlDr + aar4 ! vtp ;
|
||||
SF Pl NCom => stemPl + tai3 ! vtp ;
|
||||
SF Pl NDir => stemPl ++ ruu2 ! vtp
|
||||
} ;
|
||||
|
||||
gaDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
n = nounDcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
gaStem = Predef.tk 1 stem
|
||||
in
|
||||
table { SF Sg NGen => stem + nii2 ! vts ;
|
||||
SF Sg NDat => stem + "нд" ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => gaStem + iig2 ! vts ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NAbl => stem + naas4 ! vts ;
|
||||
SF Sg NInst => gaStem + aar4 ! vts ;
|
||||
sf => n ! sf } ;
|
||||
|
||||
longDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg (NAcc d) => case d of {
|
||||
Definite => stem + "г" ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NInst => stem + gaar4 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
iDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
iStem = Predef.tk 1 stem
|
||||
in
|
||||
table { SF Sg (NAcc d) => case d of {
|
||||
Definite => iStem + "ийг" ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NInst => iStem + iar3 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
nDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
n = nounDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NGen => stemDr + i2 ! vts ;
|
||||
sf => n ! sf } ;
|
||||
|
||||
shDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stemDr + and4 ! vts ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => stemDr + iig2 ! vts ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NInst => stemDr + aar4 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
gDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
k = c92kDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NGen => stemDr + "ийн" ;
|
||||
SF Sg NDat => stem + "т" ;
|
||||
sf => k ! sf } ;
|
||||
|
||||
vDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
n = nounDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stem + "т";
|
||||
sf => n ! sf } ;
|
||||
|
||||
shortDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
shortStem = Predef.tk 1 stem ;
|
||||
in
|
||||
table { SF Sg NGen => shortStem + iin2 ! vts ;
|
||||
SF Sg NDat => stem + "д" ;
|
||||
SF Sg NAbl => shortStem + aas4 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
c91Dcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
sh = shDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NGen => case stem of {
|
||||
_ + #doubleVowel + "лт" => stem + iin2 ! vts ;
|
||||
_ => stem + nii2 ! vts } ;
|
||||
sf => sh ! sf } ;
|
||||
|
||||
c92kDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stemDr + "инд" ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => stemDr + "ийг" ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NInst => stemDr + aar4 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
yeyaDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
n = nounDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NAbl => stemDr + as4 ! vts ;
|
||||
SF Sg NInst => stemDr + ar4 ! vts ;
|
||||
sf => n ! sf } ;
|
||||
|
||||
rDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
n = nounDcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stem + "т";
|
||||
SF Sg NAbl => stem + naas4 ! vts ;
|
||||
SF Pl NDir => stem ++ luu2 ! vts ;
|
||||
sf => n ! sf } ;
|
||||
|
||||
neuterConsDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
ga = gaDcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
neuterConsStem = Predef.tk 1 stem ;
|
||||
nCstem = neuterConsStem + "и"
|
||||
in
|
||||
table { SF Sg NGen => nCstem + nii2 ! vts ;
|
||||
SF Sg NDat => nCstem + "нд" ;
|
||||
SF Sg NAbl => neuterConsStem + ias3 ! vts ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => neuterConsStem + "ийг" ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NInst => neuterConsStem + iar3 ! vts ;
|
||||
sf => ga ! sf } ;
|
||||
|
||||
lneuterConsDcl : Dcl = \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nC = neuterConsDcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
neuterConsStem = Predef.tk 1 stem ;
|
||||
in
|
||||
table { SF Sg NGen => neuterConsStem + "ийн" ;
|
||||
SF Sg NDat => stem + "д" ;
|
||||
sf => nC ! sf } ;
|
||||
|
||||
|
||||
modDcl01a : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
d = dcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NGen => case stem of {
|
||||
_ + "й" => stem + "н" ;
|
||||
_ => stem + nii2 ! vts } ;
|
||||
SF Sg NDat => case stem of {
|
||||
_ + "й" => stem + "д" ;
|
||||
_ => stemDr + and4 ! vts } ;
|
||||
SF Sg NAbl => case stem of {
|
||||
_ + "й" => stem + gaas4 ! vts ;
|
||||
_ => stem + naas4 ! vts } ;
|
||||
sf => d ! sf } ;
|
||||
|
||||
modDcl01b : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
d = dcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stemDr + and4 ! vts ;
|
||||
sf => d ! sf } ;
|
||||
|
||||
modDcl01c : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
d = dcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NAbl => stemDr + aas4 ! vts ;
|
||||
sf => d ! sf } ;
|
||||
|
||||
modDcl01d : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSg = dcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
stemSg = stem + "г" ;
|
||||
stemPl = stemSg + uud2 ! vtp ; -- overwrite stemPl,stemPlDr
|
||||
nPl = plDcl stemPl stemPl ! vtp
|
||||
in
|
||||
table { SF Sg NGen => stemSg + "ийн" ;
|
||||
SF Sg (NAcc d) => case d of {
|
||||
Definite => stemSg ;
|
||||
Indefinite => stem } ;
|
||||
SF Sg NAbl => stemSg + aas4 ! vts ;
|
||||
SF Sg NInst => stemSg + aar4 ! vts ;
|
||||
SF Sg c => nSg ! SF Sg c ;
|
||||
SF Pl NGen => stemPl + iin2 ! vtp ;
|
||||
SF Pl NDat => stemPl + a4 ! vtp + "д" ;
|
||||
SF Pl NAbl => stemPl + aas4 ! vtp ;
|
||||
SF Pl c => nPl ! c } ;
|
||||
|
||||
modDcl01e : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSg = dcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
stemPl = stemDr + uud2 ! vts ; -- overwrite stemPl,stemPlDr
|
||||
nPl = plDcl stemPl stemPl ! vts
|
||||
in
|
||||
table { SF Sg NAbl => stemDr + aas4 ! vts ;
|
||||
SF Sg nc => nSg ! (SF Sg nc) ;
|
||||
SF Pl NGen => stemPl + iin2 ! vtp ;
|
||||
SF Pl NDat => stemPl + a4 ! vtp + "д" ;
|
||||
SF Pl NAbl => stemPl + aas4 ! vtp ;
|
||||
SF Pl nc => nPl ! nc } ;
|
||||
|
||||
modDcl01f : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
e = (modDcl01e dcl) stem stemDr stemPl stemPlDr ! vts !vtp
|
||||
in
|
||||
table { SF Sg NGen => stemDr + iin2 ! vts ;
|
||||
SF Sg NDat => stemDr + ad4 ! vts ;
|
||||
sf => e ! sf } ;
|
||||
|
||||
modDcl01g : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSg = dcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF n nc => case n of { Sg => nSg ! SF Sg nc ;
|
||||
Pl => [] } } ;
|
||||
|
||||
modDcl01h : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSg = dcl stem stemDr stemPl stemPlDr ! vts ! vtp ; -- stemPl,stemPlDr irrelevant
|
||||
stemPl = stem + nuud2 ! vts ;
|
||||
nPl = plDcl stemPl stemPl ! vts
|
||||
in
|
||||
table { SF Sg NGen => stem + nii2 ! vts ;
|
||||
SF Sg NDat => stemDr + and4 ! vts ;
|
||||
SF Sg nc => nSg ! (SF Sg nc) ;
|
||||
SF Pl NGen => stemPl + iin2 ! vtp ;
|
||||
SF Pl NDat => stemPl + ad4 ! vtp ;
|
||||
SF Pl nc => nPl ! nc } ;
|
||||
|
||||
|
||||
modDcl2N : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSg = dcl stem stemDr stemPl stemPlDr ! vts ! vtp ;
|
||||
nPl = plDcl stemPl stemPlDr ! vtp
|
||||
in
|
||||
table { SF Sg nc => nSg ! (SF Sg nc) ;
|
||||
SF Pl nc => nPl ! nc } ;
|
||||
|
||||
modDcl02a : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSgPl = (modDcl2N dcl) stem stemDr stemPl stemPlDr ! vts ! vtp -- reg2N stem nompl ;
|
||||
in
|
||||
table { SF Sg NGen => case stem of {
|
||||
_ + #longVowel => stem + "г" + "ийн" ;
|
||||
_ + ("ж"|"ч"|"ш") => stemDr + "ийн" ;
|
||||
_ => stemDr + iin2 ! vts } ;
|
||||
SF Sg NDat => case stem of {
|
||||
_ + #longVowel => stem + "д" ;
|
||||
_ + ("ж"|"ч"|"ш") => stem + "ид" ;
|
||||
_ => stemDr + ad4 ! vts } ;
|
||||
SF Sg NAbl => case stem of {
|
||||
_ + #longVowel => stem + "г" + aas4 ! vts ;
|
||||
_ => stemDr + aas4 ! vts } ;
|
||||
sf => nSgPl ! sf } ;
|
||||
|
||||
modDcl02b : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSgPl = (modDcl2N dcl) stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Pl NGen => stemPlDr + iin2 ! vtp ;
|
||||
SF Pl NDat => stemPlDr + ad4 ! vtp ;
|
||||
SF Pl NAbl => stemPlDr + aas4 ! vtp ;
|
||||
sf => nSgPl ! sf } ;
|
||||
|
||||
modDcl02c : Dcl -> Str -> Dcl = \dcl,ablsg -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSgPl = dcl stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stemDr + and4!vts ;
|
||||
SF Sg NAbl => ablsg ;
|
||||
sf => nSgPl ! sf } ;
|
||||
|
||||
modDcl02d : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSgPl = (modDcl2N dcl) stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Sg NDat => stem + "д" ;
|
||||
SF Sg NAbl => stem + aas4 ! vts ;
|
||||
SF Pl NGen => stemPl + iin2 ! vtp ;
|
||||
SF Pl NAbl => stemPl + aas4 ! vtp ;
|
||||
sf => nSgPl ! sf } ;
|
||||
|
||||
modDcl02e : Dcl -> Dcl = \dcl -> \stem,stemDr,stemPl,stemPlDr -> \\vts,vtp =>
|
||||
let
|
||||
nSgPl = (modDcl02b dcl) stem stemDr stemPl stemPlDr ! vts ! vtp
|
||||
in
|
||||
table { SF Pl NDat => stemPl + "т" ;
|
||||
sf => nSgPl ! sf } ;
|
||||
|
||||
|
||||
-- Slower with optimize=noexpand:
|
||||
|
||||
mkDecl : Bool => Dcl -> Str -> Noun = \\drop => \dcl -> \stem ->
|
||||
let
|
||||
stemDr = case drop of { False => stem ; _ => dropUnstressedVowel stem } ;
|
||||
stemPl = plSuffix stem ;
|
||||
stemPlDr = case drop of { False => stemPl ; _ => dropUnstressedVowel stemPl } ;
|
||||
vts = vowelType stem ;
|
||||
vtp = case stemPl of {"" => MascA ;
|
||||
_ + ("үүд"|"ууд") => vowelType (uud2!vts) ;
|
||||
_ => vowelType stemPl }
|
||||
in
|
||||
{ s = (dcl stem stemDr stemPl stemPlDr) ! vts ! vtp } ;
|
||||
|
||||
mkDeclDrop : Dcl -> Str -> Noun = (mkDecl ! True) ;
|
||||
mkDeclNoDrop : Dcl -> Str -> Noun = (mkDecl ! False) ;
|
||||
|
||||
mkDecl2 : Bool => Dcl -> Str -> Str -> Noun = \\drop => \dcl,stem,stemPl ->
|
||||
let
|
||||
vts = vowelType stem ;
|
||||
vtp = vowelType stemPl ;
|
||||
stemDr = case drop of { False => stem ; _ => dropUnstressedVowel stem } ;
|
||||
stemPlDr = case drop of { False => stemPl ; _ => dropUnstressedVowel stemPl }
|
||||
in
|
||||
{ s = (dcl stem stemDr stemPl stemPlDr) ! vts ! vtp } ;
|
||||
|
||||
mkDecl2Drop : Dcl -> Str -> Str -> Noun = (mkDecl2!True) ;
|
||||
mkDecl2NoDrop : Dcl -> Str -> Str -> Noun = (mkDecl2!False) ;
|
||||
|
||||
};
|
||||
|
||||
211
lib/src/mongolian/NounMon.gf
Normal file
211
lib/src/mongolian/NounMon.gf
Normal file
@@ -0,0 +1,211 @@
|
||||
concrete NounMon of Noun = CatMon ** open ResMon, Prelude, ParadigmsMon, ExtraMon in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
DetCN det cn = {
|
||||
s = \\rc => case <det.isPre,det.isDef> of {
|
||||
<True,True> => case rc of {
|
||||
Acc => det.s ++ cn.s ! Sg ! NAcc Definite ;
|
||||
_ => det.s ++ cn.s ! Sg ! toNCase rc Definite } ;
|
||||
<True,False> => case rc of {
|
||||
Acc => det.s ++ cn.s ! Sg ! NAcc Indefinite ;
|
||||
_ => det.s ++ cn.s ! Sg ! toNCase rc Indefinite } ;
|
||||
_ => cn.s ! Sg ! NNom ++ det.sp ! rc
|
||||
} ;
|
||||
n = Sg ;
|
||||
p = P3 ;
|
||||
isPron = False ;
|
||||
isDef = det.isDef
|
||||
} ;
|
||||
|
||||
UsePron p = {
|
||||
s = \\rc => p.s ! PronCase rc ;
|
||||
n = p.n ;
|
||||
p = p.p ;
|
||||
isPron = True ;
|
||||
isDef = True
|
||||
} ;
|
||||
|
||||
UsePN pn = {
|
||||
s = \\rc => pn.s ! rc ;
|
||||
n = Sg ;
|
||||
p = P3 ;
|
||||
isPron = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
|
||||
PredetNP predet np = {
|
||||
s = \\rc => predet.s ++ np.s ! rc ;
|
||||
n = np.n ;
|
||||
p = np.p ;
|
||||
isPron = np.isPron ;
|
||||
isDef = predet.isDef
|
||||
} ;
|
||||
|
||||
PPartNP np v2 = {
|
||||
s = \\rc => v2.s ! VPART PPast Nom ++ np.s ! rc ;
|
||||
n = np.n ;
|
||||
p = np.p ;
|
||||
isPron = np.isPron ;
|
||||
isDef = np.isDef
|
||||
} ;
|
||||
|
||||
RelNP np rs = {
|
||||
s = \\rc => rs.s ! Attributive ++ np.s ! rc ;
|
||||
n = np.n ;
|
||||
p = np.p ;
|
||||
isPron = False ;
|
||||
isDef = np.isDef
|
||||
} ;
|
||||
|
||||
AdvNP np adv = {
|
||||
s = \\rc => adv.s ++ np.s ! rc ;
|
||||
n = np.n ;
|
||||
p = np.p ;
|
||||
isPron = False ;
|
||||
isDef = np.isDef
|
||||
} ;
|
||||
|
||||
DetQuant quant num = {
|
||||
s = quant.s ! Sg ++ num.s ;
|
||||
sp = \\rc => quant.sp ! num.n ! NNom ++ num.sp ! rc ;
|
||||
isNum = num.isNum ;
|
||||
isPoss = quant.isPoss ;
|
||||
isDef = True ;
|
||||
isPre = True
|
||||
} ;
|
||||
|
||||
DetQuantOrd quant num ord = {
|
||||
s = quant.s ! Sg ++ num.s ++ ord.s ;
|
||||
sp = \\_ => quant.sp ! num.n ! NNom ++ num.s ++ ord.s ;
|
||||
isNum = num.isNum ;
|
||||
isPoss = quant.isPoss ;
|
||||
isDef = True ;
|
||||
isPre = True
|
||||
} ;
|
||||
|
||||
DetNP det = {
|
||||
s = \\rc => det.sp ! rc ;
|
||||
n = Sg ;
|
||||
p = P3 ;
|
||||
isPron = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
|
||||
UseN,UseN2 = \noun -> {
|
||||
s = \\n,nc => noun.s ! SF n nc
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\_ => p.s ! PronCase Gen ;
|
||||
sp = \\_,nc => p.s ! PronPoss (toRCase nc Definite) ;
|
||||
isPoss = True ;
|
||||
isDef = True
|
||||
} ;
|
||||
|
||||
NumSg = {s = [] ; sp = \\_ => [] ; n = Sg ; isNum = False} ;
|
||||
NumPl = {s = [] ; sp = \\_ => [] ; n = Pl ; isNum = False} ;
|
||||
|
||||
NumCard n = n ** {isNum = True} ;
|
||||
|
||||
NumDigits,NumNumeral = \numeral -> {
|
||||
s = numeral.s ! NCard ;
|
||||
sp = \\_ => numeral.s ! NCard ;
|
||||
n = numeral.n
|
||||
} ;
|
||||
|
||||
OrdDigits, OrdNumeral = \d -> {s = d.s ! NOrd } ;
|
||||
|
||||
AdNum a card = {
|
||||
s = a.s ++ card.s ;
|
||||
sp = \\rc => a.s ++ card.sp ! rc ;
|
||||
n = card.n
|
||||
} ;
|
||||
|
||||
OrdSuperl a = {
|
||||
s = (variants {"хамгийн"|"туйлын"} ++ a.s)
|
||||
} ;
|
||||
|
||||
-- Mongolian shows a complex system of marking definiteness. Demonstrative, anaphoric and possessive
|
||||
-- determiners are used to indicate definiteness. The definite noun phrases are obligatorily accusative
|
||||
-- case marked as direct objects. (http://www.ilg.uni-stuttgart.de/projekte/C2/publications/Guntsetseg.pdf)
|
||||
DefArt = {
|
||||
s = \\n => case n of {
|
||||
Sg => "энэ" ;
|
||||
Pl => "эдгээр"
|
||||
} ;
|
||||
sp = \\n,nc => case n of {
|
||||
Sg => case nc of {
|
||||
NNom => "энэ" ;
|
||||
NInst => "үүгээр" ;
|
||||
_ => (regN "үүн").s ! SF Sg nc
|
||||
} ;
|
||||
Pl => (regN "эдгээр").s ! SF Sg nc
|
||||
} ;
|
||||
isPoss = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
-- the numeral neg for ‘one’ in the function as an indefinite article (Givon 1981)
|
||||
IndefArt = {
|
||||
s = \\n => case n of {
|
||||
Sg => "нэг" ;
|
||||
Pl => "нэжгээд"
|
||||
} ;
|
||||
sp = \\n,nc => case n of {
|
||||
Sg => (regN "аль нэг").s ! SF Sg nc ;
|
||||
Pl => (regN "нэжгээд").s ! SF Sg nc
|
||||
} ;
|
||||
isPoss = False ;
|
||||
isDef = False
|
||||
} ;
|
||||
|
||||
MassNP cn = {
|
||||
s = \\rc => cn.s ! Sg ! (toNCase rc Definite) ;
|
||||
n = Sg ;
|
||||
p = P3 ;
|
||||
isPron = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
|
||||
Use2N3 n3 = {
|
||||
s = n3.s ;
|
||||
c2 = n3.c2
|
||||
} ;
|
||||
|
||||
Use3N3 n3 = {
|
||||
s = n3.s ;
|
||||
c2 = n3.c3
|
||||
} ;
|
||||
|
||||
ComplN2 n2 compl = {
|
||||
s = \\n,nc => appCompl n2.c2 compl.s ++ n2.s ! SF n nc
|
||||
} ;
|
||||
|
||||
ComplN3 n3 compl = {
|
||||
s = \\sf => appCompl n3.c2 compl.s ++ n3.s ! sf ;
|
||||
c2 = n3.c3
|
||||
} ;
|
||||
|
||||
AdjCN ap cn = {
|
||||
s = \\n,nc => ap.s ++ cn.s ! n ! nc
|
||||
} ;
|
||||
|
||||
RelCN cn rs = {
|
||||
s = \\n,nc => rs.s ! Attributive ++ cn.s ! n ! nc
|
||||
} ;
|
||||
|
||||
AdvCN cn adv = {
|
||||
s = \\n,nc => adv.s ++ cn.s ! n ! nc
|
||||
} ;
|
||||
|
||||
SentCN cn s = {
|
||||
s = \\n,nc => s.s ++ cn.s ! n ! nc
|
||||
} ;
|
||||
|
||||
ApposCN cn np = {
|
||||
s = \\n,nc => np.s ! Nom ++ cn.s ! n ! nc
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
178
lib/src/mongolian/NumeralMon.gf
Normal file
178
lib/src/mongolian/NumeralMon.gf
Normal file
@@ -0,0 +1,178 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete NumeralMon of Numeral = CatMon ** open ResMon, MorphoMon in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lincat
|
||||
Digit = {s : Place => DForm => CardOrd => Str} ;
|
||||
Sub10 = {s : Place => DForm => CardOrd => Str ; n : Number} ;
|
||||
Sub100, Sub1000 = {s : Place => CardOrd => Str ; n : Number} ;
|
||||
Sub1000000 = {s : CardOrd => Str; n : Number} ;
|
||||
|
||||
oper
|
||||
mkCardOrd : Str -> CardOrd => Str = \unit ->
|
||||
let
|
||||
vt = MorphoMon.vowelType unit
|
||||
in
|
||||
table {
|
||||
NCard => unit ;
|
||||
NOrd => unit + dugaar2 ! vt
|
||||
} ;
|
||||
|
||||
mkNum : Str -> Str -> {s : Place => DForm => CardOrd => Str} = \unit,unitten ->
|
||||
let
|
||||
vt = MorphoMon.vowelType unit
|
||||
in {
|
||||
s = table {
|
||||
Indep => table {
|
||||
Unit => mkCardOrd unit ;
|
||||
Teen => mkCardOrd ("арван" ++ unit) ;
|
||||
Ten => mkCardOrd unitten ;
|
||||
Hundred => mkCardOrd (unitToattrUnit unit ++ "зуу")
|
||||
} ;
|
||||
Attr => table {
|
||||
Unit => table {
|
||||
NCard => unitToattrUnit unit ;
|
||||
NOrd => unit + dugaar2 ! vt
|
||||
} ;
|
||||
Teen => table {
|
||||
NCard => "арван" + (unitToattrUnit unit) ;
|
||||
NOrd => ("арван" ++ unit) + dugaar2 ! vt
|
||||
} ;
|
||||
Ten => table {
|
||||
NCard => tenToattrTen unitten ;
|
||||
NOrd => unitten + dugaar2 ! vt
|
||||
} ;
|
||||
Hundred => table {
|
||||
NCard => (unitToattrUnit unit ++ "зуу" + "н") ;
|
||||
NOrd => (unitToattrUnit unit ++ "зуу")+ dugaar2 ! vt
|
||||
}
|
||||
}
|
||||
}
|
||||
} ;
|
||||
|
||||
unitToattrUnit : Str -> Str = \unit -> case unit of {
|
||||
"нэг" => "нэгэн" ;
|
||||
"хоёр" => "хоёр" ;
|
||||
"гурав" => "гурван" ;
|
||||
"дөрөв" => "дөрвөн" ;
|
||||
"тав" => "таван" ;
|
||||
"зургаа" => "зургаан" ;
|
||||
"долоо" => "долоон" ;
|
||||
"найм" => "найман" ;
|
||||
"ес" => "есөн"
|
||||
} ;
|
||||
|
||||
tenToattrTen : Str -> Str = \ten -> case ten of {
|
||||
"арав" => "арван" ;
|
||||
"хорь" => "хорин" ;
|
||||
"гуч" => "гучин" ;
|
||||
"дөч" => "дөчин" ;
|
||||
"тавь" => "тавин" ;
|
||||
"жар" => "жаран" ;
|
||||
"дал" => "далан" ;
|
||||
"ная" => "наян" ;
|
||||
"ер" => "ерэн"
|
||||
} ;
|
||||
|
||||
lin
|
||||
num x = x ;
|
||||
n2 = mkNum "хоёр" "хорь" ;
|
||||
n3 = mkNum "гурав" "гуч" ;
|
||||
n4 = mkNum "дөрөв" "дөч" ;
|
||||
n5 = mkNum "тав" "тавь" ;
|
||||
n6 = mkNum "зургаа" "жар" ;
|
||||
n7 = mkNum "долоо" "дал" ;
|
||||
n8 = mkNum "найм" "ная" ;
|
||||
n9 = mkNum "ес" "ер" ;
|
||||
|
||||
pot01 = mkNum "нэг" "арав" ** {n = Sg} ;
|
||||
|
||||
pot0 d = d ** {n = Pl} ;
|
||||
|
||||
pot110 = {
|
||||
s = \\p,co => pot01.s ! p ! Ten ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
pot111 = {
|
||||
s = \\p,co => pot01.s ! p ! Teen ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
pot1to19 d = {
|
||||
s = \\p => d.s ! p ! Teen
|
||||
} ** {n = Pl} ;
|
||||
|
||||
pot0as1 n = {
|
||||
s = \\p => n.s ! p ! Unit ; n = n.n
|
||||
} ;
|
||||
|
||||
pot1 d = {
|
||||
s = \\p => d.s ! p ! Ten ; n = Pl
|
||||
} ;
|
||||
|
||||
pot1plus d e = {
|
||||
s = \\p,co => d.s ! Attr ! Ten ! NCard ++ e.s ! Indep ! Unit ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
pot1as2 n = n ;
|
||||
pot2 d = {
|
||||
s = \\p => d.s ! p ! Hundred ; n = Pl
|
||||
} ;
|
||||
|
||||
pot2plus d e = {
|
||||
s = \\p,co => d.s ! Attr ! Hundred ! NCard ++ e.s ! Indep ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
pot2as3 n = {
|
||||
s = n.s ! Indep ; n = n.n
|
||||
} ;
|
||||
|
||||
pot3 n = {
|
||||
s = \\co => n.s ! Attr ! NCard ++ mkCardOrd "мянга" ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
pot3plus n m = {
|
||||
s = \\co => n.s ! Attr ! NCard ++ "мянга" ++ m.s ! Indep ! co ; n = Pl
|
||||
} ;
|
||||
|
||||
lincat
|
||||
Dig = TDigit ;
|
||||
|
||||
lin
|
||||
IDig d = d ;
|
||||
|
||||
IIDig d i = {
|
||||
s = \\co => d.s ! NCard ++ i.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
D_0 = mkDig "0" ;
|
||||
D_1 = mk3Dig "1" "1-р" Sg ;
|
||||
D_2 = mkDig "2" ;
|
||||
D_3 = mkDig "3" ;
|
||||
D_4 = mkDig "4" ;
|
||||
D_5 = mkDig "5" ;
|
||||
D_6 = mkDig "6" ;
|
||||
D_7 = mkDig "7" ;
|
||||
D_8 = mkDig "8" ;
|
||||
D_9 = mkDig "9" ;
|
||||
|
||||
oper
|
||||
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
|
||||
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "-р") ;
|
||||
mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
|
||||
s = table {
|
||||
NCard => c ;
|
||||
NOrd => o
|
||||
} ;
|
||||
n = n
|
||||
} ;
|
||||
|
||||
TDigit = {
|
||||
s : CardOrd => Str ;
|
||||
n : Number
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
76
lib/src/mongolian/NumeralTransferMon.gf
Normal file
76
lib/src/mongolian/NumeralTransferMon.gf
Normal file
@@ -0,0 +1,76 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete NumeralTransferMon of NumeralTransfer = NumeralMon ** open ResMon, MorphoMon, CatMon in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lin
|
||||
digits2numeral d = {
|
||||
s = d.s ;
|
||||
sp = \\rc => d.sp ! rc ;
|
||||
n = d.n
|
||||
} ;
|
||||
|
||||
digits2num d = d ;
|
||||
|
||||
num2digits n = n ;
|
||||
|
||||
dn10 d = {
|
||||
s = \\_,_,co => d.s ! co ;
|
||||
n = d.n
|
||||
} ;
|
||||
|
||||
dn100 d1 d2 = {
|
||||
s = \\_,co => d1.s ! co ++ d2.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
dn1000 d1 d2 d3 = {
|
||||
s = \\_,co => d1.s ! co ++ d2.s ! co ++ d3.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
dn1000000a d1 d2 d3 d4 = {
|
||||
s = \\co => d1.s ! co ++ d2.s ! co ++ d3.s ! co ++ d4.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
dn1000000b d1 d2 d3 d4 d5 = dn1000000a d1 d2 d3 d4 ** {
|
||||
s = \\co => d5.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
dn1000000c d1 d2 d3 d4 d5 d6 = dn1000000b d1 d2 d3 d4 d5 ** {
|
||||
s = \\co => d6.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
dn d = {
|
||||
s = \\_,_,co => d.s ! co
|
||||
} ;
|
||||
|
||||
nd10 d = {
|
||||
s = \\co => d.s ! Indep ! Unit ! co ;
|
||||
n = Sg
|
||||
} ;
|
||||
|
||||
nd100 d = {
|
||||
s = \\co => d.s ! Indep ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
nd1000 = nd100 ;
|
||||
|
||||
nd1000000 d = d ;
|
||||
|
||||
dconcat d1 d2 = {
|
||||
s = \\co => d1.s ! co ++ d2.s ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
nd d = {
|
||||
s = \\co => d.s ! Indep ! Unit ! co ;
|
||||
n = Pl
|
||||
} ;
|
||||
|
||||
}
|
||||
137
lib/src/mongolian/ParadigmsMon.gf
Normal file
137
lib/src/mongolian/ParadigmsMon.gf
Normal file
@@ -0,0 +1,137 @@
|
||||
--# -path=.:../abstract:../prelude:../common
|
||||
|
||||
|
||||
-- Mongolian Lexical Paradigms - implementations
|
||||
|
||||
instance ParadigmsMon of ParadigmsMonI = ParadigmsMonO ** open Prelude, MorphoMon, CatMon, ResMon in {
|
||||
|
||||
-- NOTE: regV and mkN,mk2N etc. cannot be compiled with optimize=all/value, because
|
||||
-- addSuf in regV and mkDecl in mkN would horribly increase the code size by inserting
|
||||
-- many copies of dropVowel, plSuffix, vowelType, which cannot yet be evaluated as
|
||||
-- stem is unknown. So it's important to not expand the let-declarartions.
|
||||
|
||||
-- With optimize=noexpanding, ParadigmsMon can be compiled, but building LexiconMon
|
||||
-- is slow (200 sec); improved by reorganization of mkN-functions (to 70 sec).
|
||||
|
||||
flags optimize=noexpand ; coding=utf8 ; -- see NOTE!
|
||||
|
||||
oper
|
||||
|
||||
-- Noun definitions:
|
||||
|
||||
mkN = overload { mkN : Str -> Noun = regN ;
|
||||
mkN : (_,_ : Str) -> Noun = reg2N } ;
|
||||
|
||||
mk2N : (adj : Str) -> Noun -> Noun = \adj,n -> {
|
||||
s = table {
|
||||
sf => adj ++ (n.s ! sf)
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
mkLN = overload { mkLN : Str -> Noun = loanN ;
|
||||
mkLN : (_,_ : Str) -> Noun = loan2N } ;
|
||||
|
||||
regN : Str -> Noun = \nomSg -> mkDeclDrop (chooseDcl nomSg) nomSg ;
|
||||
loanN : Str -> Noun = \nomSg -> mkDeclNoDrop (chooseDcl nomSg) nomSg ;
|
||||
|
||||
mkPN = \pn -> lin PN {
|
||||
s = \\rc => (loanN pn).s ! (SF Sg (toNCase rc Definite))
|
||||
} ;
|
||||
|
||||
|
||||
modDecl : (Dcl -> Dcl) -> Str -> Noun =
|
||||
\mod,nomSg -> mkDeclDrop (mod (chooseDcl nomSg)) nomSg ;
|
||||
modDeclL : (Dcl -> Dcl) -> Str -> Noun =
|
||||
\mod,nomSg -> mkDeclNoDrop (mod (chooseDcl nomSg)) nomSg ;
|
||||
|
||||
mkN01a : Str -> Noun = \nomSg -> modDecl modDcl01a nomSg ;
|
||||
mkN01b : Str -> Noun = \nomSg -> modDecl modDcl01b nomSg ;
|
||||
mkN01c : Str -> Noun = \nomSg -> modDecl modDcl01c nomSg ;
|
||||
mkN01d : Str -> Noun = \nomSg -> modDecl modDcl01d nomSg ;
|
||||
mkN01e : Str -> Noun = \nomSg -> modDecl modDcl01e nomSg ;
|
||||
mkN01f : Str -> Noun = \nomSg -> modDecl modDcl01f nomSg ;
|
||||
mkN01g : Str -> Noun = \nomSg -> modDecl modDcl01g nomSg ;
|
||||
mkN01h : Str -> Noun = \nomSg -> modDecl modDcl01h nomSg ;
|
||||
mkLN01c : Str -> Noun = \nomSg -> modDeclL modDcl01c nomSg ;
|
||||
|
||||
modDecl2 : (Dcl -> Dcl) -> Str -> Str -> Noun =
|
||||
\mod,nomSg,nomPl -> mkDecl2Drop (mod (chooseDcl nomSg)) nomSg nomPl ;
|
||||
modDecl2L : (Dcl -> Dcl) -> Str -> Str -> Noun =
|
||||
\mod,nomSg,nomPl -> mkDecl2NoDrop (mod (chooseDcl nomSg)) nomSg nomPl ;
|
||||
|
||||
reg2N : (nomSg,nomPl : Str) -> Noun = modDecl2 modDcl2N ;
|
||||
loan2N : (nomSg,nomPl : Str) -> Noun = modDecl2L modDcl2N ;
|
||||
|
||||
mkN02a : (nomSg,nomPl : Str) -> Noun = modDecl2 modDcl02a ;
|
||||
mkN02b : (nomSg,nomPl : Str) -> Noun = modDecl2 modDcl02b ;
|
||||
mkN02c : Str -> Str -> Noun = \nomSg,ablSg ->
|
||||
(mkDeclDrop (modDcl02c (chooseDcl nomSg) ablSg)) nomSg ;
|
||||
mkN02d : (nomSg,nomPl : Str) -> Noun = modDecl2 modDcl02d ;
|
||||
mkN02e : (nomSg,nomPl : Str) -> Noun = modDecl2 modDcl02e ;
|
||||
|
||||
|
||||
-- On the top level, maybe $NP$ is used rather than $PN$.
|
||||
|
||||
mkNP : Str -> Def -> NP = \x,d -> lin NP {
|
||||
s = \\rc => (regN x).s ! (SF Sg (toNCase rc d)) ;
|
||||
p = P3 ;
|
||||
n = Sg ;
|
||||
isPron = False ;
|
||||
isDef = case d of {
|
||||
Definite => True ;
|
||||
_ => False } ;
|
||||
} ;
|
||||
|
||||
-- Verb definitions
|
||||
|
||||
regV : Str -> Verb = \inf ->
|
||||
let
|
||||
vt = vowelType inf ;
|
||||
stem = stemVerb inf ;
|
||||
VoiceSuffix = chooseVoiceSuffix stem ;
|
||||
VoiceSubSuffix = chooseVoiceSubSuffix stem ;
|
||||
CoordinationSuffix = chooseAnterioritySuffix stem ;
|
||||
ParticipleSuffix = chooseParticipleSuffix stem ;
|
||||
SubordinationSuffix = chooseSubordinationSuffix stem
|
||||
in {
|
||||
s = table {
|
||||
VFORM vc asp te => addSuf stem (combineVAT VoiceSuffix ! vc ! asp ! te) ;
|
||||
VIMP direct imp => addSuf stem ((combineDI stem) ! direct ! imp) ;
|
||||
SVDS vc so => addSuf stem (combineVS VoiceSubSuffix SubordinationSuffix ! vc ! so) ;
|
||||
CVDS anter => addSuf stem (CoordinationSuffix ! anter) ;
|
||||
VPART part rc => addSuf stem (combinePRc ParticipleSuffix ! part ! rc)
|
||||
} ;
|
||||
vtype = VAct ;
|
||||
vt = vt ; -- vowelType stem ;
|
||||
} ;
|
||||
|
||||
verbToAux : Verb -> Aux = \verb -> {
|
||||
s = table {
|
||||
VVTense t => verb.s ! VFORM Act Simpl t ;
|
||||
VVImp direct imp => verb.s ! VIMP direct imp ;
|
||||
VVSubordination sub => verb.s ! SVDS ActSub sub ;
|
||||
VVCoordination ant => verb.s ! CVDS ant ;
|
||||
VVParticiple part rc => verb.s ! VPART part rc
|
||||
} ;
|
||||
vt = verb.vt
|
||||
} ;
|
||||
|
||||
auxToVerb : Aux -> Verb = \aux -> {
|
||||
s = table {
|
||||
VFORM _ _ t => aux.s ! VVTense t ;
|
||||
VIMP direct imp => aux.s ! VVImp direct imp ;
|
||||
SVDS _ sub => aux.s ! VVSubordination sub ;
|
||||
CVDS ant => aux.s ! VVCoordination ant ;
|
||||
VPART part rc => aux.s ! VVParticiple part rc
|
||||
} ;
|
||||
vtype = VAct ;
|
||||
vt = aux.vt
|
||||
} ;
|
||||
|
||||
mkV : Str -> Verb = regV ;
|
||||
auxBe : Aux = verbToAux (regV "байх") ;
|
||||
|
||||
-- remaining functions mkV2,mkV3,...,mkVA in ParadigmsMonO.gf
|
||||
|
||||
}
|
||||
187
lib/src/mongolian/ParadigmsMonI.gf
Normal file
187
lib/src/mongolian/ParadigmsMonI.gf
Normal file
@@ -0,0 +1,187 @@
|
||||
--# -path=.:../abstract:../prelude:../common
|
||||
|
||||
--1 Mongolian Lexical Paradigms
|
||||
|
||||
-- This is an API for the user of the resource grammar for adding lexical
|
||||
-- items. It gives functions for forming expressions of open categories:
|
||||
-- nouns, adjectives, verbs.
|
||||
|
||||
-- Closed categories (determiners, pronouns, conjunctions) are accessed
|
||||
-- through the resource syntax API, $Structural.gf$.
|
||||
|
||||
-- The main difference with $MorphoMon.gf$ is that the result types referred
|
||||
-- to are compiled resource grammar types, i.e. wrapped with $lin Cat$.
|
||||
|
||||
interface ParadigmsMonI = open Prelude, MorphoMon, CatMon in {
|
||||
|
||||
flags coding=utf8 ; optimize=all ;
|
||||
|
||||
oper
|
||||
regV : Str -> Verb ;
|
||||
-- Auxiliary categories not in abstract/Cat.gf
|
||||
|
||||
-- Categories $V0, AS, A2S, AV, A2V$ are just $A$, $V0$ is just $V$;
|
||||
-- the second argument is treated as adverb.
|
||||
|
||||
V0, AS, AV, A2S, A2V : Type ;
|
||||
|
||||
-- Parameters
|
||||
|
||||
-- To abstract over case names, we define the following case names, following
|
||||
-- the case order standard for Mongolian textbooks.
|
||||
|
||||
RCase : Type ;
|
||||
nominative : RCase ;
|
||||
genitive : RCase ;
|
||||
dative : RCase ;
|
||||
accusative : RCase ;
|
||||
ablative : RCase ;
|
||||
instrumental : RCase ;
|
||||
comitative : RCase ;
|
||||
directive : RCase ;
|
||||
|
||||
-- To abstract over number names, we define the following.
|
||||
|
||||
Number : Type ;
|
||||
singular : Number ;
|
||||
plural : Number ;
|
||||
|
||||
-- Preposition
|
||||
|
||||
mkPrep : RCase -> Str -> Prep ;
|
||||
noPrep : RCase -> Prep ;
|
||||
|
||||
-- Conjunctions
|
||||
|
||||
mkConj : Str -> ConjType -> Conj ;
|
||||
|
||||
mkSubj : Str -> Subj ;
|
||||
|
||||
-- Nouns
|
||||
|
||||
mkN : overload { mkN : (nNomSg : Str) -> Noun ;
|
||||
mkN : (nNomSg,nNomPl : Str) -> Noun } ;
|
||||
-- Foreign nouns, which are inflected differently.
|
||||
|
||||
mkLN : overload { mkLN : Str -> Noun ;
|
||||
mkLN : (_,_ : Str) -> Noun } ;
|
||||
|
||||
-- Compound nouns constructed with an adjective; only the noun part is inflected.
|
||||
|
||||
mk2N : (adj : Str) -> Noun -> Noun ;
|
||||
|
||||
mkN2 : N -> N2 ;
|
||||
|
||||
mkN3 : Noun -> Prep -> Prep -> N3 ;
|
||||
|
||||
-- Proper names and Noun Phrases.
|
||||
|
||||
mkPN : Str -> PN ;
|
||||
mkNP : Str -> Def -> NP ;
|
||||
|
||||
-- Adjectives
|
||||
|
||||
-- Mongolian adjectives have only a positive form.
|
||||
|
||||
mkA : (positive : Str) -> A ;
|
||||
|
||||
-- Two-place adjectives need a case as an extra argument.
|
||||
|
||||
mkA2 : A -> RCase -> A2 ;
|
||||
|
||||
-- Adverbs
|
||||
|
||||
-- Adverbs are not inflected.
|
||||
|
||||
mkAdv : Str -> Adv ;
|
||||
|
||||
-- Verbs
|
||||
|
||||
-- In our lexicon description there are so far 120 forms:
|
||||
-- 5 Voice * 4 Aspect * 6 indicative tensed Mood
|
||||
|
||||
Voice: Type;
|
||||
active : Voice ;
|
||||
causative : Voice ;
|
||||
passive : Voice ;
|
||||
communal : Voice ;
|
||||
adversative : Voice ;
|
||||
|
||||
Aspect: Type;
|
||||
simple : Aspect ;
|
||||
quick : Aspect ;
|
||||
complete : Aspect ;
|
||||
collective : Aspect ;
|
||||
|
||||
Imperative : Type ;
|
||||
intention : Imperative ;
|
||||
decision : Imperative ;
|
||||
command : Imperative ;
|
||||
request : Imperative ;
|
||||
demand : Imperative ;
|
||||
admonition : Imperative ;
|
||||
appeal : Imperative ;
|
||||
permission : Imperative ;
|
||||
hope : Imperative ;
|
||||
blessing : Imperative ;
|
||||
|
||||
Subordination : Type ;
|
||||
conditional : Subordination ;
|
||||
concessive : Subordination ;
|
||||
immediatsucceeding : Subordination ;
|
||||
logicalsucceeding : Subordination ;
|
||||
intending : Subordination ;
|
||||
limiting : Subordination ;
|
||||
progressive : Subordination ;
|
||||
succeeding : Subordination ;
|
||||
|
||||
Bool: Type;
|
||||
true : Bool;
|
||||
false : Bool;
|
||||
|
||||
-- One-place verbs.
|
||||
|
||||
mkV : Str -> Verb ;
|
||||
|
||||
-- Two-place and three-place verbs:
|
||||
|
||||
mkV2 : overload { mkV2 : Verb -> V2 ;
|
||||
mkV2 : Verb -> Prep -> V2 } ;
|
||||
|
||||
mkV3 : overload { mkV3 : Verb -> V3 ;
|
||||
mkV3 : Verb -> Prep -> Prep -> V3 } ;
|
||||
|
||||
-- Determiners and quantifiers
|
||||
|
||||
mkOrd : Str -> Ord ;
|
||||
|
||||
-- Other complement patterns
|
||||
|
||||
-- Verbs and adjectives can take complements such as sentences,
|
||||
-- questions, verb phrases, and adjectives.
|
||||
|
||||
mkVA : Verb -> VA ;
|
||||
mkV0 : Verb -> V0 ;
|
||||
mkVS : Verb -> VS ;
|
||||
mkVV : {s : VVVerbForm => Str} -> VV ;
|
||||
mkVQ : Verb -> VQ ;
|
||||
mkV2S : Verb -> Prep -> V2S ;
|
||||
mkV2V : Verb -> Prep -> V2V ;
|
||||
mkV2A : Verb -> Prep -> V2A ;
|
||||
mkV2Q : Verb -> Prep -> V2Q ;
|
||||
mkAS : Adjective -> AS ;
|
||||
mkA2S : Adjective -> Prep -> A2S ;
|
||||
mkAV : Adjective -> AV ;
|
||||
mkA2V : Adjective -> Prep -> A2V ;
|
||||
|
||||
-- Definitions of parameters and paradigms should not bother the user of the API.
|
||||
|
||||
-- We separate the definitions that should be compiled with optimize=all into
|
||||
-- ParadigmsMonO.gf, those which should be compiled with optimize=noexpand into
|
||||
-- ParadigmsMon.gf.
|
||||
|
||||
-- Implementation: Why is it much slower if the definitions that should be optimized
|
||||
-- are contained here?
|
||||
|
||||
} ;
|
||||
|
||||
388
lib/src/mongolian/ParadigmsMonO.gf
Normal file
388
lib/src/mongolian/ParadigmsMonO.gf
Normal file
@@ -0,0 +1,388 @@
|
||||
--# -path=.:../abstract:../prelude:../common
|
||||
|
||||
-- Mongolian Lexical Paradigms - implementations
|
||||
|
||||
-- This file contains the parts of ParadigmsMon which can be compiled with
|
||||
-- optimization=all; those which have to be compiled with optimize=noexpand
|
||||
-- are added in ParadigmsMon.gf
|
||||
|
||||
resource ParadigmsMonO = open Prelude, MorphoMon, CatMon in {
|
||||
|
||||
flags coding=utf8 ; optimize=all ;
|
||||
|
||||
-- Implementation of parameters
|
||||
|
||||
oper
|
||||
V0 = Verb ;
|
||||
AS,AV = A ;
|
||||
A2S,A2V = A2 ;
|
||||
|
||||
Bool = Prelude.Bool ;
|
||||
true = True;
|
||||
false = False ;
|
||||
|
||||
RCase = MorphoMon.RCase ;
|
||||
nominative = Nom ;
|
||||
genitive = Gen ;
|
||||
dative = Dat ;
|
||||
accusative = Acc ;
|
||||
ablative = Abl ;
|
||||
instrumental = Inst ;
|
||||
comitative = Com ;
|
||||
directive = Dir ;
|
||||
|
||||
Number = MorphoMon.Number ;
|
||||
singular = Sg ;
|
||||
plural = Pl ;
|
||||
|
||||
Voice = MorphoMon.Voice ;
|
||||
active = Act ;
|
||||
causative = Caus ;
|
||||
passive = Pass ;
|
||||
communal = Comm ;
|
||||
adversative = Advs ;
|
||||
|
||||
Aspect = MorphoMon.Aspect;
|
||||
simple = Simpl ;
|
||||
quick = Quick ;
|
||||
complete = Compl ;
|
||||
collective = Coll ;
|
||||
|
||||
VTense = MorphoMon.VTense ;
|
||||
presentperfect = VPresPerf ;
|
||||
pastcomplete = VPastComp ;
|
||||
pastindefinite = VPastIndef ;
|
||||
future = VFut ;
|
||||
|
||||
Imperative = MorphoMon.Imperative ;
|
||||
intention = Int ;
|
||||
decision = Dec ;
|
||||
command = Command ;
|
||||
request = Req ;
|
||||
demand = Demand ;
|
||||
admonition = Admon ;
|
||||
appeal = Appeal ;
|
||||
permission = Perm ;
|
||||
hope = Hope ;
|
||||
blessing = Bless ;
|
||||
|
||||
Subordination = MorphoMon.Subordination ;
|
||||
conditional = Condl ;
|
||||
concessive = Conc ;
|
||||
immediatsucceeding = ISucc ;
|
||||
logicalsucceeding = LSucc ;
|
||||
intending = Intend ;
|
||||
limiting = Limit ;
|
||||
progressive = Progr ;
|
||||
succeeding = Succ ;
|
||||
|
||||
-- Implementation of Verbs:
|
||||
|
||||
-- Many suffixes have variants for different vowel types.
|
||||
-- Since there are 3 causative and directness suffix alternatives (uul2/ul2, lga4 and ga4),
|
||||
-- we generate the tables depending on how the verb stem ends:
|
||||
|
||||
chooseCausativeSuffix : Str -> Suffix = \stem -> case stem of {
|
||||
_ + ("и"|("я"|"е"|"ё"|"ю")) => ul2 ;
|
||||
_ + #longVowel => lga4 ;
|
||||
_ + "ат" => aa4 ;
|
||||
_ + #consonant => uul2 ;
|
||||
_ => ga4
|
||||
} ;
|
||||
|
||||
-- Verb forms are build by attaching Voice, Aspect and Mood suffixes to the stem,
|
||||
-- in this order. The VoiceSuffix does not indicate a tense.
|
||||
|
||||
chooseVoiceSuffix : Str -> Voice => Suffix = \stem ->
|
||||
let
|
||||
caus = chooseCausativeSuffix stem
|
||||
in
|
||||
table {
|
||||
Act => table { _ => [] } ;
|
||||
Caus => caus ;
|
||||
Pass => table {_ => "гд"} ;
|
||||
Comm => table {_ => "лц"} ;
|
||||
Advs => table {_ => "лд"}
|
||||
} ;
|
||||
|
||||
AspectSuffix : Aspect => Suffix =
|
||||
table {
|
||||
Simpl => table {_ => []} ;
|
||||
Quick => table {_ => "схий"} ;
|
||||
Coll => tsgaa4 ;
|
||||
Compl => table {_ => "чих"}
|
||||
} ;
|
||||
|
||||
VTenseSuffix : VTense => Suffix =
|
||||
table {
|
||||
VPresPerf => laa4 ;
|
||||
VPastComp => table {_ => "в"} ;
|
||||
VPastIndef => table {_ => "жээ"} ;
|
||||
VFut => na4
|
||||
} ;
|
||||
|
||||
chooseSubordinationSuffix : Str -> Subordination => Suffix = \stem ->
|
||||
table {
|
||||
Condl => case stem of {
|
||||
_ + ("в"|"л"|"м"|"н") => bal4 ;
|
||||
_ => wal4
|
||||
} ;
|
||||
Conc => table {_ => "вч"} ;
|
||||
ISucc => magts4 ;
|
||||
LSucc => hlaar4 ;
|
||||
Intend => haar4 ;
|
||||
Limit => tal4 ;
|
||||
Progr => saar4 ;
|
||||
Succ => nguut2
|
||||
} ;
|
||||
|
||||
chooseDirectnessSuffix : Str -> Directness => Suffix = \stem ->
|
||||
table {
|
||||
Indirect => chooseCausativeSuffix stem ;
|
||||
Direct => table { _ => []}
|
||||
} ;
|
||||
|
||||
ImperativeSuffix : Imperative => Suffix =
|
||||
table {
|
||||
Int => ya3 ;
|
||||
Dec => sugai2 ;
|
||||
Command => table { _ => []} ;
|
||||
Req => aach4 ;
|
||||
Demand => aarai4 ;
|
||||
Admon => uuzai2 ;
|
||||
Appeal => gtun2 ;
|
||||
Perm => table { _ => "г"} ;
|
||||
Hope => aasai4 ;
|
||||
Bless => tugai2
|
||||
} ;
|
||||
|
||||
chooseAnterioritySuffix : Str -> Anteriority => Suffix = \stem ->
|
||||
let
|
||||
chooseSimulSuffix : Str -> Suffix = \stm -> case stm of {
|
||||
_ + ("б"|"н") => table {_ => "ч"} ;
|
||||
(?|"")+(#doubleVowel|(#shortVowel + "й")) + "р" => table {_ => "ч"} ;
|
||||
(_|"") + #basicVowel + _ + #basicVowel + _ + "р" => table {_ => "ч"} ;
|
||||
("ав"|"өг"|"хүр"|"гар"|"сур") => table {_ => "ч"} ;
|
||||
_ => table {_ => "ж"}
|
||||
} ;
|
||||
chooseAnterSuffix : Str -> Suffix = \stm -> case stm of {
|
||||
_ + ("и"|#yVowel) => ad4 ;
|
||||
_ + #longVowel => table {vt => "г" + aad4!vt} ;
|
||||
_ => aad4
|
||||
} ;
|
||||
in
|
||||
table {
|
||||
Simul => chooseSimulSuffix stem ;
|
||||
Anter => chooseAnterSuffix stem
|
||||
} ;
|
||||
|
||||
chooseParticipleSuffix : Str -> Participle => Suffix = \stem ->
|
||||
table {
|
||||
PPresIndef => dag4 ;
|
||||
PPresProgr => case stem of {
|
||||
_ + ("и"|#yVowel) => a4 ;
|
||||
_ + #longVowel => table {vt => "г" + aa4!vt} ;
|
||||
_ => aa4
|
||||
} ;
|
||||
PPast => san4 ;
|
||||
PFut => table {_ => "х"} ;
|
||||
PDoer => table {_ => "гч"}
|
||||
} ;
|
||||
|
||||
infSuffixes : RCase => Suffix = table {Dat => ad4 ;
|
||||
Acc => iig2 ;
|
||||
Abl => aas4 ;
|
||||
Inst => aar4 ;
|
||||
Com => tai3 ;
|
||||
_ => table { _ => [] }
|
||||
} ;
|
||||
|
||||
chooseVoiceSubSuffix : Str -> VoiceSub => Suffix = \stem ->
|
||||
let
|
||||
chVoice = chooseVoiceSuffix stem
|
||||
in
|
||||
table {
|
||||
ActSub => chVoice ! Act ;
|
||||
CausSub => chVoice ! Caus ;
|
||||
PassSub => chVoice ! Pass
|
||||
} ;
|
||||
|
||||
-- The combined suffixes do not quite regularly depend on the vowel type of the unknown stem,
|
||||
-- except that when one of the (causative or imperative) suffixes is uul2, the following ones
|
||||
-- take the vowel type of this suffix rather than of the verb stem.
|
||||
|
||||
modifyVT : (Voice => Suffix) -> Voice => VowelType => VowelType = \VoiceSuf ->
|
||||
table Voice {
|
||||
Caus => \\vt => case (VoiceSuf ! Caus ! vt) of {
|
||||
("уул"|"ул") => MascA ;
|
||||
("үүл"|"үл") => FemE ;
|
||||
_ => vt
|
||||
} ;
|
||||
_ => \\vt => vt
|
||||
} ;
|
||||
|
||||
-- To combine suffixes to an extended verb stem, (stem + suffix) is refined by MorphoMon.addSufVt,
|
||||
-- so that insertion of softness markers or vowels between stem and suffix is cared for.
|
||||
|
||||
-- Testing showed that ((... (stem + suffix1) + suffix2) ...) + suffixN) is much slower
|
||||
-- than (stem + (suffix1 + ... + suffixN)), because we can precompute the combination of
|
||||
-- all the suffixes for the 4 possible vowel types of stems.
|
||||
|
||||
-- In the following combine-functions, use table types rather than function types, since
|
||||
-- for function types like combineVAM : (Voice => Suffix) -> Voice -> Aspect -> VTense -> Suffix
|
||||
-- the compiler does not execute applications like !vc!asp!md, whereas these are executed
|
||||
-- via case distinction in tables when we use table types.
|
||||
|
||||
voiceToVoiceSub : (Voice => VoiceSub) =
|
||||
table {
|
||||
Caus => CausSub ;
|
||||
Pass => PassSub ;
|
||||
_ => ActSub
|
||||
} ;
|
||||
|
||||
voiceSubToVoice : (VoiceSub => Voice) =
|
||||
table {
|
||||
CausSub => Caus ;
|
||||
PassSub => Pass ;
|
||||
ActSub => Act
|
||||
} ;
|
||||
|
||||
voiceToDirectness : (Voice => Directness) =
|
||||
table {
|
||||
Caus => Indirect ;
|
||||
_ => Direct
|
||||
} ;
|
||||
|
||||
directnessToVoice : (Directness => Voice) =
|
||||
table {
|
||||
Indirect => Caus ;
|
||||
Direct => Act
|
||||
} ;
|
||||
|
||||
combineVAT : (Voice => Suffix) -> Voice => Aspect => VTense => Suffix = \VoiceSuf -> \\vc,asp,te =>
|
||||
let
|
||||
AspTe = case asp of {
|
||||
Quick => table VowelType { vt => addSufVt vt (AspectSuffix!asp!vt) (VTenseSuffix!te!FemE) } ;
|
||||
_ => table VowelType { vt => addSufVt vt (AspectSuffix!asp!vt) (VTenseSuffix!te!vt) } } ;
|
||||
ModVT = (modifyVT VoiceSuf) ! vc
|
||||
in
|
||||
table VowelType {vt => addSufVt (ModVT!vt) (VoiceSuf!vc!vt) (AspTe!(ModVT!vt))} ;
|
||||
|
||||
combineDI : Str -> Directness => Imperative => Suffix = \stem -> \\direct,imp =>
|
||||
let
|
||||
DirSuffix = chooseDirectnessSuffix stem ;
|
||||
ModVT = modifyVT (table Voice { vc => DirSuffix!(voiceToDirectness!vc) }) ! (directnessToVoice!direct)
|
||||
in
|
||||
table VowelType { vt => addSufVt (ModVT!vt) (DirSuffix!direct!vt) (ImperativeSuffix!imp!(ModVT!vt)) } ;
|
||||
|
||||
combineVS : (VoiceSub => Suffix) -> (Subordination => Suffix) -> VoiceSub => Subordination => Suffix =
|
||||
\VoiceSubSuf,SubordSuf -> \\vcs,so =>
|
||||
let
|
||||
ModVT = modifyVT (table Voice { vc => VoiceSubSuf ! (voiceToVoiceSub!vc) }) ! (voiceSubToVoice!vcs)
|
||||
in
|
||||
table VowelType { vt => addSufVt (ModVT!vt) (VoiceSubSuf!vcs!vt) (SubordSuf!so!(ModVT!vt)) } ;
|
||||
|
||||
combinePRc : (Participle => Suffix) -> Participle => RCase => Suffix = \PartSuf -> \\part,rc =>
|
||||
let
|
||||
modPart = chooseVtPart (table Participle { participle => PartSuf ! participle }) ! part
|
||||
in
|
||||
table VowelType {vt => addSufVt (modPart!vt) (PartSuf!part!vt) (infSuffixes!rc!(modPart!vt))} ;
|
||||
|
||||
chooseVtPart : (Participle => Suffix) -> Participle => VowelType => VowelType = \PartSuf -> table Participle {_ => \\vt => vt} ;
|
||||
|
||||
-- Prepositions: Mongolian has postpositions only.
|
||||
|
||||
mkPrep : RCase -> Str -> Prep = \rc,p -> lin Prep {rc = rc ; s = p} ;
|
||||
noPrep : RCase -> Prep = \rc -> mkPrep rc [] ;
|
||||
|
||||
-- Conjunctions
|
||||
|
||||
mkConj = overload {mkConj : Str -> Conj = mk1Conj ;
|
||||
mkConj : Str -> Str -> Conj = mk2Conj} ;
|
||||
|
||||
mk1Conj : Str -> Conj = \y -> mk2Conj [] y ;
|
||||
mk2Conj : Str -> Str -> Conj = \x,y -> lin Conj (sd2 x y) ;
|
||||
mkSubj : Str -> Bool -> Subj = \x,b -> lin Subj {s = x ; isPre = b} ;
|
||||
|
||||
-- Noun stem classification
|
||||
|
||||
chooseDcl : Str -> Dcl = \str -> case str of {
|
||||
_ + #longVowel => longDcl ;
|
||||
_ + #consonant + #consonant + #neuterVowel => iDcl ;
|
||||
_ + "л" + "ь" => lneuterConsDcl ;
|
||||
_ + "ь" => neuterConsDcl ;
|
||||
_ + "н" => nDcl ;
|
||||
_ + "в" => vDcl ;
|
||||
_ + ("с"|"х") => shDcl ;
|
||||
_ + "г" => gDcl ;
|
||||
_ + "г" + #shortVowel => gaDcl ;
|
||||
_ + #consonant + #shortVowel => shortDcl ;
|
||||
_ + ("д"|"з"|"т"|"ц") => c91Dcl ;
|
||||
_ + ("ж"|"ш"|"ч"|"к") => c92kDcl ;
|
||||
_ + ("е"|"я") => yeyaDcl ;
|
||||
_ + "р" => rDcl ;
|
||||
_ => nounDcl
|
||||
} ;
|
||||
|
||||
mkN2 : Noun -> N2 = \n -> mkNoun2 n (noPrep Gen) ;
|
||||
mkNoun2 : Noun -> Prep -> N2 ;
|
||||
mkNoun2 n p = lin N2 {
|
||||
s = n.s ;
|
||||
c2 = {s = p.s ; rc = p.rc}
|
||||
} ;
|
||||
|
||||
mkN3 : Noun -> Prep -> Prep -> N3 = \n,p1,p2 -> lin N3 {
|
||||
s = \\sf => n.s ! sf ;
|
||||
c2 = p1 ;
|
||||
c3 = p2
|
||||
} ;
|
||||
|
||||
-- Implementation of Adjectives
|
||||
|
||||
mkA : (positive : Str) -> Adjective = \a -> lin A (ss a) ;
|
||||
|
||||
mkA2 : Adjective -> Prep -> A2 = \a,p -> lin A2 a ** {c2 = p} ;
|
||||
|
||||
-- Definitions of determiners and quantifiers
|
||||
|
||||
mkOrd : Str -> Ord = \s -> lin Ord (ss s) ;
|
||||
|
||||
-- Adverb definitions
|
||||
|
||||
mkAdv : Str -> Adv = \x -> lin Adv (ss x) ;
|
||||
|
||||
-- Verb definitions (without type, these defs cause errors because argtype is unknown)
|
||||
|
||||
-- Transitive verbs are verbs with two argument places.
|
||||
|
||||
mkV2 = overload { mkV2 : Verb -> V2 = dirV2 ;
|
||||
mkV2 : Verb -> Prep -> V2 = mkV2P } ;
|
||||
|
||||
dirV2 : Verb -> V2 = \v -> mkV2P v (noPrep Acc) ;
|
||||
mkV2P : Verb -> Prep -> V2 = \v,p -> lin V2 (v ** {c2 = p}) ;
|
||||
|
||||
-- Ditransitive verbs are verbs with three argument places.
|
||||
|
||||
mkV3 = overload { mkV3 : Verb -> V3 = dirV3 ;
|
||||
mkV3 : Verb -> Prep -> Prep -> V3 = mkV3P } ;
|
||||
|
||||
mkV3P : Verb -> Prep -> Prep -> V3 = \v,p1,p2 -> lin V3 (v ** {c2 = p1 ; c3 = p2}) ;
|
||||
dirV3 : Verb -> V3 = \v -> mkV3P v (noPrep Acc) (noPrep Dat) ;
|
||||
|
||||
-- Other verbs
|
||||
|
||||
mkV0 : Verb -> V0 = \v -> lin V0 v ;
|
||||
mkVA : Verb -> VA = \v -> lin VA v ;
|
||||
mkVS : Verb -> VS = \v -> lin VS v ;
|
||||
mkVV : Aux -> VV = \v -> lin VV v ;
|
||||
mkVQ : Verb -> VQ = \v -> lin VQ v ;
|
||||
|
||||
mkV2S : Verb -> Prep -> V2S = \v,p -> lin V2S v ** {c2 = p} ;
|
||||
mkV2V : Verb -> Prep -> V2V = \v,p -> lin V2V (mkV2P v p) ;
|
||||
mkV2A : Verb -> Prep -> V2A = \v,p -> lin V2A v ** {c2 = p} ;
|
||||
mkV2Q : Verb -> Prep -> V2Q = \v,p -> lin V2Q v ** {c2 = p} ;
|
||||
|
||||
mkAS, mkAV : Adjective -> A = \a -> lin A a ;
|
||||
mkA2S, mkA2V : Adjective -> Prep -> A2 = \a,p -> mkA2 a p ;
|
||||
|
||||
}
|
||||
65
lib/src/mongolian/PhraseMon.gf
Normal file
65
lib/src/mongolian/PhraseMon.gf
Normal file
@@ -0,0 +1,65 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete PhraseMon of Phrase = CatMon ** open Prelude, ResMon in {
|
||||
|
||||
flags coding=utf8 ;
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {
|
||||
s = pconj.s ++ utt.s ++ voc.s
|
||||
} ;
|
||||
|
||||
UttS s = {s = s.s ! Main} ;
|
||||
|
||||
UttQS qs = {
|
||||
s = qs.s ! QDir
|
||||
} ;
|
||||
|
||||
UttImpSg pol imp = {
|
||||
s = pol.s ++ imp.s ! pol.p ! ImpF Sg False
|
||||
} ;
|
||||
|
||||
UttImpPl pol imp = {
|
||||
s = pol.s ++ imp.s ! pol.p ! ImpF Pl False
|
||||
} ;
|
||||
|
||||
UttImpPol pol imp = {
|
||||
s = pol.s ++ imp.s ! pol.p ! ImpF Sg True
|
||||
} ;
|
||||
|
||||
UttIP ip = {
|
||||
s = ip.s ! Nom
|
||||
} ;
|
||||
|
||||
UttIAdv iadv = iadv ;
|
||||
|
||||
UttNP np = {
|
||||
s = np.s ! Nom
|
||||
} ;
|
||||
|
||||
UttVP vp = {
|
||||
s = infVP vp Nom
|
||||
} ;
|
||||
|
||||
UttAdv adv = adv ;
|
||||
UttCN cn = {
|
||||
s = cn.s ! Sg ! NNom
|
||||
} ;
|
||||
|
||||
UttCard card = card ;
|
||||
|
||||
UttAP ap = ap ;
|
||||
|
||||
UttInterj i = i ;
|
||||
|
||||
NoPConj = {s = []} ;
|
||||
|
||||
PConjConj conj = ss conj.s2 ;
|
||||
|
||||
NoVoc = {s = []} ;
|
||||
|
||||
VocNP np = {
|
||||
s = "," ++ np.s ! Nom
|
||||
} ;
|
||||
|
||||
}
|
||||
94
lib/src/mongolian/QuestionMon.gf
Normal file
94
lib/src/mongolian/QuestionMon.gf
Normal file
@@ -0,0 +1,94 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete QuestionMon of Question = CatMon ** open ResMon, (P=ParadigmsMon), Prelude in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
QuestCl cl = {
|
||||
s = \\t,ant,pol =>
|
||||
let
|
||||
cls = cl.s ! t ! ant ! pol
|
||||
in
|
||||
table {
|
||||
QDir => cls ! (Quest yesNoQuest) ;
|
||||
QIndir => cls ! (Quest yesNoQuest) ++ "гэж"
|
||||
}
|
||||
} ;
|
||||
|
||||
QuestVP ip vp =
|
||||
let
|
||||
cl = mkClause ip.s Sg vp.vt Nom vp
|
||||
in {
|
||||
s = \\t,ant,pol,_ => cl.s ! t ! ant ! pol ! Quest wQuest
|
||||
} ;
|
||||
|
||||
QuestSlash ip slash = {
|
||||
s = \\t,ant,pol,_ =>
|
||||
slash.c2.s ++ ip.s ! slash.c2.rc ++ slash.s ! t ! ant ! pol ! Quest wQuest
|
||||
} ;
|
||||
|
||||
QuestIAdv iadv cl = {
|
||||
s = \\t,ant,pol,_ =>
|
||||
let
|
||||
cls = cl.s ! t ! ant ! pol ! Quest wQuest ;
|
||||
wh = iadv.s
|
||||
in
|
||||
wh ++ cls
|
||||
} ;
|
||||
|
||||
QuestIComp icomp np = {
|
||||
s = \\t,ant,pol,_ =>
|
||||
let
|
||||
vp = predV (P.auxToVerb P.auxBe) ;
|
||||
cls = (mkClause np.s np.n vp.vt Nom vp).s ! t ! ant ! pol ! Quest wQuest
|
||||
in
|
||||
icomp.s ++ cls
|
||||
} ;
|
||||
|
||||
PrepIP p ip = {
|
||||
s = appCompl p ip.s
|
||||
} ;
|
||||
|
||||
AdvIP ip adv = {
|
||||
s = \\rc => adv.s ++ ip.s ! rc
|
||||
} ;
|
||||
|
||||
AdvIAdv iadv adv = {
|
||||
s = iadv.s ++ adv.s
|
||||
} ;
|
||||
|
||||
IdetCN idet cn = {
|
||||
s = \\rc => idet.s ! Nom ++ cn.s ! Sg ! toNCase rc Definite
|
||||
} ;
|
||||
|
||||
IdetIP idet = {
|
||||
s = \\rc => idet.s ! rc
|
||||
} ;
|
||||
|
||||
IdetQuant iquant num = {
|
||||
s = \\rc => iquant.s ! Nom ++ num.sp ! rc ;
|
||||
n = num.n
|
||||
} ;
|
||||
|
||||
CompIAdv a = a ;
|
||||
|
||||
CompIP ip = {
|
||||
s = ip.s ! Nom
|
||||
} ;
|
||||
|
||||
lincat
|
||||
QVP = ResMon.VerbPhrase ;
|
||||
|
||||
lin
|
||||
ComplSlashIP vp ip = insertObj (\\_ => vp.c2.s ++ ip.s ! Acc) vp ;
|
||||
|
||||
AdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ;
|
||||
|
||||
AddAdvQVP vp adv = insertObjPost (\\_ => adv.s) vp ;
|
||||
|
||||
QuestQVP ip vp = {
|
||||
s = \\t,ant,pol,_ => (mkClause ip.s Sg vp.vt Nom vp).s ! t ! ant ! pol ! Quest yesNoQuest
|
||||
} ;
|
||||
|
||||
}
|
||||
35
lib/src/mongolian/RelativeMon.gf
Normal file
35
lib/src/mongolian/RelativeMon.gf
Normal file
@@ -0,0 +1,35 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete RelativeMon of Relative = CatMon ** open ResMon, MorphoMon, Prelude in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
RelCl cl = {
|
||||
s = \\t,ant,pol,_ => cl.s ! t ! ant ! pol ! Part Rel ;
|
||||
existSubject = True
|
||||
} ;
|
||||
|
||||
RelVP rp vp = {
|
||||
s = \\t,ant,pol,_ =>
|
||||
let
|
||||
cl = (mkClause (\\_ => []) Sg vp.vt Acc vp)
|
||||
in
|
||||
cl.s ! t ! ant ! pol ! Part Object ;
|
||||
existSubject = False
|
||||
} ;
|
||||
|
||||
RelSlash rp slash = {
|
||||
s = \\t,ant,pol,_ => slash.s ! t ! ant ! pol ! Part Object ++ slash.c2.s ;
|
||||
existSubject = False
|
||||
} ;
|
||||
|
||||
IdRP = {s = []} ;
|
||||
|
||||
FunRP p np rp = {
|
||||
s = np.s ! Nom ++ "нь"
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
24
lib/src/mongolian/ResFoodsMon.gf
Normal file
24
lib/src/mongolian/ResFoodsMon.gf
Normal file
@@ -0,0 +1,24 @@
|
||||
resource ResFoodsMon {
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
oper
|
||||
Noun : Type = {s : Number => Str} ;
|
||||
NounPhrase : Type = {s : Str ; n : Number} ;
|
||||
Adjective : Type = {s : Str} ;
|
||||
|
||||
det : Number -> Str -> Noun -> NounPhrase = \n,d,cn -> {
|
||||
s = d ++ cn.s ! n ;
|
||||
n = n
|
||||
} ;
|
||||
regNoun : Str -> Noun = \x -> {
|
||||
s = table { Sg => x ;
|
||||
Pl => case x of {
|
||||
_ + "c" => x + "нууд" ;
|
||||
_ => x + "ууд"
|
||||
}
|
||||
}
|
||||
} ;
|
||||
mkAdj : Str -> Adjective = \adj -> {s = adj} ;
|
||||
} ;
|
||||
|
||||
|
||||
426
lib/src/mongolian/ResMon.gf
Normal file
426
lib/src/mongolian/ResMon.gf
Normal file
@@ -0,0 +1,426 @@
|
||||
--# -path=.:../abstract:../common:../prelude
|
||||
|
||||
-- Mongolian auxiliary operations.
|
||||
|
||||
-- This module contains operations that are needed to make the
|
||||
-- resource syntax work. To define everything that is needed to
|
||||
-- implement $Test$, it moreover contains regular lexical
|
||||
-- patterns needed for $Lex$.
|
||||
|
||||
resource ResMon = ParamX ** open Prelude in {
|
||||
|
||||
flags optimize=all ; coding=utf8 ;
|
||||
|
||||
param
|
||||
VowelType = MascA | MascO | FemOE | FemE ;
|
||||
|
||||
-- Suffixes:
|
||||
|
||||
-- Some suffixes have variants with different vowels; in adding the suffix
|
||||
-- to a stem, the variant that fits to the vowel type of the stem is used.
|
||||
|
||||
oper
|
||||
Suffix = (VowelType => Str) ;
|
||||
|
||||
-- Some of the suffixes with variants, used in noun and verb inflection, are:
|
||||
|
||||
a4 = table { MascA => "а" ; MascO => "о" ; FemE => "э" ; FemOE => "ө" } ;
|
||||
a3 = table { MascA => "а" ; MascO => "о" ; FemE | FemOE => "э" } ;
|
||||
a2 = table { MascA | MascO => "а" ; FemE | FemOE => "э" } ;
|
||||
i2 = table { MascA | MascO => "ы" ; FemE | FemOE => "ий" } ;
|
||||
u2 = table { MascA | MascO => "у" ; FemE | FemOE => "ү" } ;
|
||||
|
||||
aa4 : Suffix = \\vt => a4!vt + a4!vt ;
|
||||
uu2 : Suffix = \\vt => u2!vt + u2!vt ;
|
||||
ai3 : Suffix = \\vt => a3!vt + "й" ;
|
||||
|
||||
-- Pluralsuffixes
|
||||
uud2 : Suffix = \\vt => uu2!vt + "д" ;
|
||||
iud2 : Suffix = \\vt => "и" + u2!vt + "д" ;
|
||||
nuud2 : Suffix = \\vt => "н" + uu2!vt + "д" ;
|
||||
guud2 : Suffix = \\vt => "г" + uu2!vt + "д" ;
|
||||
|
||||
-- Declinationsuffixes
|
||||
iin2 : Suffix = \\vt => i2!vt + "н" ;
|
||||
nii2 : Suffix = \\vt => "н" + i2!vt ;
|
||||
ii2 : Suffix = \\vt => i2!vt ;
|
||||
ad4 : Suffix = \\vt => a4!vt + "д" ;
|
||||
and4 : Suffix = \\vt => a4!vt + "нд" ;
|
||||
iig2 : Suffix = \\vt => i2!vt + "г" ;
|
||||
aas4 : Suffix = \\vt => aa4!vt + "с" ;
|
||||
ias3 : Suffix = \\vt => "и" + a3!vt + "с" ;
|
||||
as4 : Suffix = \\vt => a4!vt + "с" ;
|
||||
naas4 : Suffix = \\vt => "н" + aa4!vt + "с" ;
|
||||
gaas4 : Suffix = \\vt => "г" + aa4!vt + "с" ;
|
||||
aar4 : Suffix = \\vt => aa4!vt + "р" ;
|
||||
iar3 : Suffix = \\vt => "и" + a3!vt + "р" ;
|
||||
ar4 : Suffix = \\vt => a4!vt + "р" ;
|
||||
gaar4 : Suffix = \\vt => "г" + aa4!vt + "р" ;
|
||||
tai3 : Suffix = \\vt => "т" + a3!vt + "й" ;
|
||||
ruu2 : Suffix = \\vt => "р" + uu2!vt ;
|
||||
luu2 : Suffix = \\vt => "л" + uu2!vt ;
|
||||
gaa4 : Suffix = \\vt => "г" + aa4!vt ;
|
||||
|
||||
-- Conjugationsuffixes
|
||||
uul2 : Suffix = \\vt => uu2!vt + "л" ;
|
||||
ul2 : Suffix = \\vt => u2!vt + "л" ;
|
||||
ga4 : Suffix = \\vt => "г" + a4!vt ;
|
||||
lga4 : Suffix = \\vt => "лг" + a4!vt ;
|
||||
tsgaa4 : Suffix = \\vt => "цг" + aa4!vt ;
|
||||
na4 : Suffix = \\vt => "н" + a4!vt ;
|
||||
dag4 : Suffix = \\vt => "д" + a4!vt + "г" ;
|
||||
laa4 : Suffix = \\vt => "л" + aa4!vt ;
|
||||
san4 : Suffix = \\vt => "с" + a4!vt + "н" ;
|
||||
ya3 : Suffix = table { MascA => "я" ; MascO => "ё" ; FemE | FemOE => "е" } ;
|
||||
sugai2 : Suffix = table { MascA | MascO => "сугай" ; FemE | FemOE => "сүгэй" } ;
|
||||
aach4 : Suffix = \\vt => aa4!vt + "ч" ;
|
||||
aarai4 : Suffix = \\vt => aa4!vt + "р" + ai3!vt ;
|
||||
uuzai2 : Suffix = table { MascA | MascO => "уузай" ; FemE | FemOE => "үүзэй" } ;
|
||||
gtun2 : Suffix = \\vt => "гт" + u2!vt + "н" ;
|
||||
saar4 : Suffix = \\vt => "с" + aa4!vt + "р" ;
|
||||
aasai4 : Suffix = \\vt => aa4!vt + "с" + ai3!vt ;
|
||||
tugai2 : Suffix = table {MascA | MascO => "тугай" ; FemE | FemOE => "түгэй"} ;
|
||||
bal4 : Suffix = \\vt => "б" + a4!vt + "л" ;
|
||||
wal4 : Suffix = \\vt => "в" + a4!vt + "л" ;
|
||||
magts4 : Suffix = \\vt => "м" + a4!vt + "гц" ;
|
||||
hlaar4 : Suffix = \\vt => "хл" + aa4!vt + "р" ;
|
||||
haar4 : Suffix = \\vt => "х" + aa4!vt + "р" ;
|
||||
tal4 : Suffix = \\vt => "т" + a4!vt + "л" ;
|
||||
saar4 : Suffix = \\vt => "с" + aa4!vt + "р" ;
|
||||
nguut2 : Suffix = table {MascA | MascO => "нгуут" ; FemE | FemOE => "нгүүт"} ;
|
||||
ngaa4 : Suffix = \\vt => "нг" + aa4!vt ;
|
||||
aad4 : Suffix = \\vt => aa4!vt + "д" ;
|
||||
dugaar2 : Suffix = \\vt => "д" + u2!vt + "г" + a2!vt + a2!vt + "р" ;
|
||||
|
||||
-- Word endings added in Mongolian inflection (of nouns, verbs, adjectives) depend on
|
||||
-- the vowel type of the stem.
|
||||
|
||||
vowelType : Str -> VowelType = \stem -> case stem of {
|
||||
(_ + ("а"|"я"|"у") + ?)|(_ + ? + ("а"|"я"|"у")) => MascA ;
|
||||
(_ + ("ё"|"о") + ?)|(_ + ? + ("ё"|"о")) => MascO ;
|
||||
(_ + "ө" + ?)|(_ + ? + "ө") => FemOE ;
|
||||
(_ + ("э"|"ү"|"е"|"и") + ?)|(_ + ? + ("э"|"ү"|"е")) => FemE ;
|
||||
(("А"|"Я"|"У"|"Ю")+_)|(_+("а"|"я"|"у"|"ю")+_) => MascA ;
|
||||
(("Ё"|"О")+_)|(_+("ё"|"о")+_) => MascO ;
|
||||
("Ө"+_)|(_+"ө"+_) => FemOE ;
|
||||
(("Э"|"Ү"|"Е"|"И")+_)|(_+("э"|"ү"|"е"|"и")+_) => FemE ;
|
||||
_ => Predef.error (["vowelType does not apply to: "] ++ stem)
|
||||
} ;
|
||||
|
||||
-- For $Noun$
|
||||
|
||||
-- Mongolian nouns do not have an inherent Gender parameter. Number is used
|
||||
-- rarely. Nouns decline according to number and case.
|
||||
-- $Number$ is inherited from $ParamX$.
|
||||
-- This is the $Case$ (8 cases in Mongolian) as needed for nouns and $NP$s.
|
||||
|
||||
param
|
||||
RCase = Nom | Gen | Dat | Acc | Abl | Inst | Com | Dir ;
|
||||
NCase = NNom | NGen | NDat | NAcc Def | NAbl | NInst | NCom | NDir ;
|
||||
Def = Definite | Indefinite ;
|
||||
Poss = Possess| NonPoss ;
|
||||
|
||||
-- For the sake of shorter description number and case are
|
||||
-- combined in the type SubstForm.
|
||||
|
||||
SubstForm = SF Number NCase ;
|
||||
|
||||
oper
|
||||
Noun : Type = {s : SubstForm => Str} ;
|
||||
NounPhrase : Type = {s : RCase => Str; n : Number ; p : Person ; isPron : Bool ; isDef : Bool} ;
|
||||
|
||||
param
|
||||
PronForm = PronCase RCase | PronPoss RCase ;
|
||||
|
||||
oper
|
||||
Pron = {s : PronForm => Str ; n : Number ; p : Person } ;
|
||||
mkCbP : Number -> Person -> Str = \n,p -> case <n,p> of {
|
||||
<Sg,P1> => "минь" ; <Pl,P1> => "маань" ;
|
||||
<Sg,P2> => "чинь" ; <Pl,P2> => "тань" ;
|
||||
<_,P3> => "нь"
|
||||
} ;
|
||||
|
||||
reflPron : Number => RCase => Str = table {
|
||||
Sg => table RCase ["өөрөө";"өөрийнхөө";"өөртөө";"өөрийгөө";"өөрөөсөө";"өөрөөрөө";"өөртэйгээ";"өөр лүүгээ"] ;
|
||||
Pl => table RCase ["өөрсдөө";"өөрсдийнхөө";"өөрсөддөө";"өөрсдийгээ";
|
||||
"өөрсдөөсөө";"өөрсдөөрөө";"өөрсөдтэйгээ";"өөрсөд рүүгээ"]
|
||||
} ;
|
||||
|
||||
-- For $Numeral$
|
||||
|
||||
param
|
||||
CardOrd = NCard | NOrd ;
|
||||
DForm = Unit | Teen | Ten | Hundred ;
|
||||
Place = Indep | Attr ;
|
||||
|
||||
-- For $Verb$
|
||||
|
||||
-- The verb mood can be indicative (Tense-bound terminating suffixes (TTS)) and
|
||||
-- imperative (Person-bound terminating suffixes (PTS)).
|
||||
-- Indicative have tenses; but there are no person and (almost) no number suffixes.
|
||||
-- Special forms are used for building coordination (Coordinating verb determining
|
||||
-- suffixes (CVDS)) and subordination (Subordinating verb determining suffixes (SVDS))
|
||||
-- of sentences. Participles (Noun determining suffixes (NDS)) should be part of
|
||||
-- the adjectives.
|
||||
|
||||
Voice = Act | Caus | Pass | Comm | Advs ;
|
||||
Aspect = Simpl | Quick | Coll | Compl ;
|
||||
VTense = VPresPerf | VPastComp | VPastIndef | VFut ;
|
||||
|
||||
-- special parameter used for imperative
|
||||
|
||||
Directness = Direct | Indirect ;
|
||||
Imperative = Int | Dec | Command | Req | Demand
|
||||
| Admon | Appeal | Perm | Hope | Bless ;
|
||||
|
||||
-- Different verb forms are needed in subordinating clauses:
|
||||
|
||||
Subordination = Condl | Conc | ISucc | LSucc | Intend | Limit | Progr | Succ ;
|
||||
VoiceSub = ActSub | CausSub | PassSub ;
|
||||
Participle = PPresIndef | PPresProgr | PPast | PFut | PDoer ;
|
||||
|
||||
-- Tense in ParamX does not fit well to Mongolian; therefore:
|
||||
|
||||
Pastform = Perf | PresPerf | IndefPast ; -- в Perfect, лаа4 Presens Perfect, жээ Indefinite Past
|
||||
ClTense = ClPres | ClPast Pastform | ClFut ;
|
||||
|
||||
-- The VFORM verb forms, which we build on morphological level
|
||||
-- combine voice, aspect and mood (TTS), where mood contains indicative tensed forms.
|
||||
-- Subordinate forms can be combined with some values of Voice and Aspect, while
|
||||
-- participles, imperative and coordinating forms do not depend on Voice and Aspect:
|
||||
|
||||
VerbForm = VFORM Voice Aspect VTense
|
||||
| VIMP Directness Imperative
|
||||
| SVDS VoiceSub Subordination
|
||||
| CVDS Anteriority
|
||||
| VPART Participle RCase
|
||||
;
|
||||
|
||||
VType = VAct | VRefl ;
|
||||
Passform = Passive | Causative ;
|
||||
|
||||
VVVerbForm = VVTense VTense
|
||||
| VVImp Directness Imperative
|
||||
| VVSubordination Subordination
|
||||
| VVCoordination Anteriority
|
||||
| VVParticiple Participle RCase
|
||||
;
|
||||
|
||||
SType = Main | Sub Subordination | Coord | Quest Style | Part SubType ;
|
||||
SubType = Subject | Object | Adverbiale | Rel | emptySubject ;
|
||||
ComplType = ComplSubj | ComplObj | ComplAdv | Attributive | NoSubj ;
|
||||
Style = wQuest | yesNoQuest ;
|
||||
|
||||
VPForm = VPFin ClTense Anteriority Polarity
|
||||
| VPImper Polarity Bool
|
||||
| VPPass Passform ClTense
|
||||
| VPPart ClTense Polarity RCase
|
||||
| VPSub Polarity Subordination
|
||||
| VPCoord Anteriority
|
||||
;
|
||||
oper
|
||||
Verb : Type = {
|
||||
s : VerbForm => Str ;
|
||||
vtype : VType ;
|
||||
vt : VowelType
|
||||
} ;
|
||||
|
||||
Aux : Type = {
|
||||
s : VVVerbForm => Str ;
|
||||
vt : VowelType
|
||||
} ;
|
||||
|
||||
VerbPhrase : Type = {
|
||||
s : VPForm => {fin,aux : Str} ;
|
||||
compl : RCase => Str ;
|
||||
adv : Str ; -- optional group of adverbial modifiers
|
||||
embedCompl : RCase => Str ; -- object sentence of the verb phrase
|
||||
vt : VowelType
|
||||
} ;
|
||||
|
||||
vFin : ClTense -> VTense = \t -> case t of {
|
||||
ClPast pf => case pf of {
|
||||
Perf => VPastComp ;
|
||||
PresPerf => VPresPerf ;
|
||||
IndefPast => VPastIndef
|
||||
} ;
|
||||
ClPres | ClFut => VFut
|
||||
} ;
|
||||
|
||||
vSub : Subordination -> VerbForm = \sub -> SVDS ActSub sub ;
|
||||
|
||||
vCoord : Anteriority -> VerbForm = \ant -> CVDS ant ;
|
||||
|
||||
vPart : ClTense -> RCase -> VerbForm = \t,rc -> case t of {
|
||||
ClPres => VPART PPresIndef rc;
|
||||
ClPast _ => VPART PPast rc;
|
||||
ClFut => VPART PFut rc
|
||||
} ;
|
||||
|
||||
predV : Verb -> VerbPhrase = \verb ->
|
||||
let
|
||||
vfin : ClTense -> Str = \t -> verb.s ! VFORM Act Simpl (vFin t) ;
|
||||
vaux : ClTense -> Str = \t -> case t of {
|
||||
ClPast pf => case pf of {
|
||||
Perf => "байв" ;
|
||||
PresPerf => "байлаа" ;
|
||||
IndefPast => "байжээ" } ;
|
||||
ClPres | ClFut => "байна" } ;
|
||||
vsub : Subordination -> Str = \sub -> verb.s ! vSub sub ;
|
||||
vcoord : Anteriority -> Str = \ant -> verb.s ! vCoord ant ;
|
||||
vpart : ClTense -> RCase -> Str = \t,rc -> verb.s ! vPart t rc ;
|
||||
vpast = verb.s ! VPART PPast Nom ;
|
||||
ppart = ((verb.s! VPART PPresProgr Nom) ++ BIND ++ "гүй") ;
|
||||
vf : Str -> Str -> {fin,aux : Str} = \x,y -> {fin = x ; aux = y} ;
|
||||
in {
|
||||
s = table {
|
||||
VPFin t Simul Pos => vf (vfin t) [] ;
|
||||
VPFin t Simul Neg => vf ((vpart t Nom) ++ BIND ++ "гүй") [] ;
|
||||
VPFin t Anter Pos => vf vpast (vaux t) ;
|
||||
VPFin t Anter Neg => vf ppart (vaux t) ;
|
||||
VPImper _ False => vf (verb.s ! VIMP Direct Command) [] ;
|
||||
VPImper pol True => case pol of {
|
||||
Neg => vf (verb.s ! VIMP Direct Demand) [] ;
|
||||
Pos => let
|
||||
w = (verb.s ! VFORM Act Simpl VFut) ;
|
||||
vvt = verb.vt
|
||||
in
|
||||
vf (w ++ uu2!vvt) [] } ;
|
||||
VPPass passform t => case passform of {
|
||||
Passive => vf (verb.s ! VFORM Pass Simpl (vFin t)) [] ;
|
||||
Causative => vf (verb.s ! VFORM Caus Simpl (vFin t)) []
|
||||
} ;
|
||||
VPPart t pol rc => case pol of {
|
||||
Pos => vf (vpart t rc) [] ;
|
||||
Neg => vf ((vpart t Nom) ++ BIND ++ "гүй") []} ;
|
||||
VPSub pol sub => case pol of {
|
||||
Pos => vf (vsub sub) [] ;
|
||||
Neg => vf ppart "байвал" } ;
|
||||
VPCoord ant => vf (vcoord ant) [] } ;
|
||||
compl = \\_ => [] ;
|
||||
adv = [] ;
|
||||
embedCompl = \\_ => [] ;
|
||||
vt = verb.vt
|
||||
} ;
|
||||
|
||||
Clause : Type = {s : ClTense => Anteriority => Polarity => SType => Str} ;
|
||||
|
||||
mkClause : (RCase => Str) -> Number -> VowelType -> RCase -> VerbPhrase -> Clause = \subj,n,vt,rc,vp -> {
|
||||
s = \\t,ant,pol,stype =>
|
||||
let
|
||||
verb = (vp.s ! VPFin t ant pol) ;
|
||||
verbCoord = (vp.s ! VPCoord ant) ;
|
||||
verbQuest = (vp.s ! VPPart t pol Nom) ;
|
||||
verbPart = (vp.s ! VPPart t pol rc) ;
|
||||
compl = vp.compl ! rc ++ vp.adv
|
||||
in
|
||||
case stype of {
|
||||
Main => subj ! Nom ++ vp.compl ! rc ++ vp.embedCompl ! rc ++ vp.adv ++ verb.fin ++ verb.aux ;
|
||||
Sub sub => subj ! Acc ++ compl ++ (vp.s ! VPSub pol sub).fin ;
|
||||
Coord => subj ! Nom ++ vp.compl ! rc ++ vp.embedCompl ! rc ++ vp.adv ++ verbCoord.fin ;
|
||||
Quest style => case style of {
|
||||
wQuest => subj ! Nom ++ vp.compl ! rc ++ vp.embedCompl ! rc ++ vp.adv ++ verbQuest.fin ++ (wQuestPart (VPPart t pol Nom)) ;
|
||||
yesNoQuest => subj ! Nom ++ vp.compl ! rc ++ vp.embedCompl ! rc ++ vp.adv ++ verbQuest.fin ++ (yesNoQuestPart vp.vt) } ;
|
||||
Part subtype => case subtype of {
|
||||
Subject => subj ! Gen ++ compl ++ verbQuest.fin ++ "нь";
|
||||
Object => subj ! Gen ++ compl ++ verbPart.fin ;
|
||||
Adverbiale => subj ! Acc ++ compl ++ verbPart.fin ;
|
||||
Rel => subj ! Gen ++ compl ++ verbPart.fin ;
|
||||
emptySubject => "" ++ compl ++ verbPart.fin
|
||||
}
|
||||
} } ;
|
||||
|
||||
wQuestPart : VPForm -> Str = \vpf -> case vpf of {
|
||||
VPPart t pol _ => case t of {
|
||||
ClPast _ => "бэ" ;
|
||||
_ => "вэ"} ;
|
||||
_ => "" } ;
|
||||
|
||||
yesNoQuestPart : VowelType -> Str = \vt -> case vt of {
|
||||
(MascA|MascO) => "уу" ;
|
||||
_ => "үү" } ;
|
||||
|
||||
-- Kullmann 371: the subject linked to the predicate.
|
||||
-- Coord: A combined sentence always consists of two or more predicates. The last predicate takes a verb with a TS; the other verbs ned a CVDS.
|
||||
-- The tense is expressed with the last predicate only.
|
||||
-- Sub: dominated by the main clause, has the function of one part of the main sentence, is placed before the main sentence
|
||||
-- Main: can exist independently of other clause, verbal predicate always takes a TS.
|
||||
|
||||
insertObj : (RCase => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
compl = \\rc => obj ! rc ++ vp.compl ! rc ;
|
||||
adv = vp.adv ;
|
||||
embedCompl = \\rc => vp.embedCompl ! rc ;
|
||||
vt = vp.vt
|
||||
} ;
|
||||
|
||||
insertObjPost : (RCase => Str) -> VerbPhrase -> VerbPhrase = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
compl = \\rc => vp.compl ! rc ++ obj ! rc ;
|
||||
adv = vp.adv ;
|
||||
embedCompl = \\rc => vp.embedCompl ! rc ;
|
||||
vt = vp.vt
|
||||
} ;
|
||||
|
||||
insertAdv : Str -> VerbPhrase -> VerbPhrase = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
compl = vp.compl ;
|
||||
adv = vp.adv ++ adv ;
|
||||
embedCompl = \\_ => vp.embedCompl ! Dat ;
|
||||
vt = vp.vt
|
||||
} ;
|
||||
|
||||
insertEmbedCompl : Str -> VerbPhrase -> VerbPhrase = \ext,vp -> {
|
||||
s = vp.s ;
|
||||
compl = vp.compl ;
|
||||
adv = vp.adv ;
|
||||
embedCompl = \\rc => vp.embedCompl ! rc ++ ext ;
|
||||
vt = vp.vt
|
||||
} ;
|
||||
|
||||
infVP : VerbPhrase -> RCase -> Str = \vp,rc ->
|
||||
let
|
||||
obj = vp.compl ! rc ;
|
||||
verb = vp.s ! VPPart ClFut Pos Nom
|
||||
in
|
||||
obj ++ vp.adv ++ verb.fin ;
|
||||
|
||||
-- For $Adjective$
|
||||
|
||||
-- Mongolian adjectives have not comparative forms, only AP's have.
|
||||
|
||||
Adjective : Type = {s : Str} ;
|
||||
|
||||
Complement = {s : Str ; rc : RCase} ;
|
||||
|
||||
appCompl : Complement -> (RCase => Str) -> Str = \compl,arg ->
|
||||
compl.s ++ arg ! compl.rc ;
|
||||
|
||||
toNCase : RCase -> Def -> NCase = \rc,d -> case rc of {
|
||||
Nom => NNom ;
|
||||
Gen => NGen ;
|
||||
Dat => NDat ;
|
||||
Acc => (NAcc d) ;
|
||||
Abl => NAbl ;
|
||||
Inst => NInst ;
|
||||
Com => NCom ;
|
||||
Dir => NDir } ;
|
||||
|
||||
toRCase : NCase -> Def -> RCase = \nc,d -> case nc of {
|
||||
NNom => Nom ;
|
||||
NGen => Gen ;
|
||||
NDat => Dat ;
|
||||
NAcc d => Acc ;
|
||||
NAbl => Abl ;
|
||||
NInst => Inst ;
|
||||
NCom => Com ;
|
||||
NDir => Dir } ;
|
||||
|
||||
-- Transformations between parameter types
|
||||
|
||||
numSF: SubstForm -> Number = \sf -> case sf of { SF n _ => n } ;
|
||||
|
||||
caseSF: SubstForm -> NCase = \sf -> case sf of { SF _ nc => nc } ;
|
||||
|
||||
}
|
||||
|
||||
110
lib/src/mongolian/SentenceMon.gf
Normal file
110
lib/src/mongolian/SentenceMon.gf
Normal file
@@ -0,0 +1,110 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete SentenceMon of Sentence = CatMon ** open Prelude, ResMon in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
-- Clauses
|
||||
|
||||
PredVP np vp = (mkClause np.s np.n vp.vt Nom vp) ;
|
||||
|
||||
PredSCVP sc vp = (mkClause (\\_ => sc.s) Sg vp.vt Nom vp) ;
|
||||
|
||||
-- Imperatives
|
||||
|
||||
ImpVP vp = {s = \\pol,f =>
|
||||
let
|
||||
neg = case pol of {
|
||||
Neg => (variants {"битгий" ; "бүү"}) ;
|
||||
_ => []
|
||||
}
|
||||
in
|
||||
case f of {
|
||||
ImpF n False => case n of {
|
||||
Sg => "чи" ++ neg ++ (vp.s ! VPImper pol False).fin ;
|
||||
_ => "та нар" ++ neg ++ (vp.s ! VPImper pol False).fin } ;
|
||||
ImpF _ True => "та" ++ neg ++ (vp.s ! VPImper pol True).fin
|
||||
}
|
||||
} ;
|
||||
|
||||
-- Clauses missing object noun phrases
|
||||
|
||||
SlashVP np vp = (mkClause np.s np.n vp.vt Nom vp) ** {c2 = vp.c2} ;
|
||||
|
||||
AdvSlash slash adv = {
|
||||
s = \\t,ant,pol,styp => slash.s ! t ! ant ! pol ! styp ++ adv.s ;
|
||||
c2 = slash.c2
|
||||
} ;
|
||||
|
||||
SlashPrep cl prep = cl ** {c2 = prep} ;
|
||||
|
||||
SlashVS np vs slash =
|
||||
(mkClause np.s np.n vs.vt Nom
|
||||
(insertEmbedCompl (slash.s ++ "") (predV vs))) ** {c2 = slash.c2} ;
|
||||
|
||||
-- Sentences
|
||||
|
||||
-- The particle "нь" is used often as a subject indicator.
|
||||
-- It sets off what precedes it as the subject (Hangin 1968:46).
|
||||
|
||||
EmbedS s = {
|
||||
s = s.s ! Part Subject
|
||||
} ;
|
||||
|
||||
EmbedQS qs = {
|
||||
s = qs.s ! QIndir ++ "гэдэг нь"
|
||||
} ;
|
||||
|
||||
EmbedVP vp = {
|
||||
s = infVP vp Nom ++ "нь"
|
||||
} ;
|
||||
|
||||
UseCl t p cl = {
|
||||
s = \\_ => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! Part Subject
|
||||
} ;
|
||||
|
||||
UseQCl t p cl = {
|
||||
s = \\q => t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! q
|
||||
} ;
|
||||
|
||||
UseRCl t p rcl = {
|
||||
s = table {
|
||||
ComplSubj => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! (Part Subject) ;
|
||||
ComplObj => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! (Part Object) ;
|
||||
ComplAdv => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! (Part Adverbiale) ;
|
||||
Attributive => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! (Part Rel) ;
|
||||
NoSubj => t.s ++ p.s ++ rcl.s ! t.t ! t.a ! p.p ! (Part emptySubject)
|
||||
} ;
|
||||
existSubject = rcl.existSubject
|
||||
} ;
|
||||
|
||||
UseSlash t p cl = {
|
||||
s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p ! Main ;
|
||||
c2 = cl.c2
|
||||
} ;
|
||||
|
||||
-- An adverb can be added to the beginning of a sentence.
|
||||
|
||||
AdvS a s = {
|
||||
s = \\_ => a.s ++ s.s ! Main
|
||||
} ;
|
||||
ExtAdvS a s = {s = \\stype => a.s ++ "," ++ s.s ! stype} ;
|
||||
|
||||
-- A sentence can be modified by a relative clause referring to its contents.
|
||||
|
||||
RelS s rs = case rs.existSubject of {
|
||||
True => {s = \\_ => rs.s ! ComplSubj ++ s.s ! Main} ;
|
||||
False => {s = \\_ => rs.s ! NoSubj ++ s.s ! Main}
|
||||
} ;
|
||||
|
||||
-- Subjunctive clauses
|
||||
|
||||
SSubjS xs subj ys = case subj.isPre of {
|
||||
True => {s = \\_ => subj.s ++ xs.s ! (Sub Condl) ++ ys.s ! Main} ;
|
||||
False => {s = \\_ => xs.s ! Main ++ subj.s ++ ys.s ! Main}
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
211
lib/src/mongolian/StructuralMon.gf
Normal file
211
lib/src/mongolian/StructuralMon.gf
Normal file
@@ -0,0 +1,211 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete StructuralMon of Structural = CatMon ** open ResMon, MorphoMon, ParadigmsMon, Prelude, NounMon in {
|
||||
|
||||
flags optimize=all ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
|
||||
above_Prep = mkPrep Gen "дээгүүр" ;
|
||||
after_Prep = mkPrep Gen "дараа" ;
|
||||
all_Predet = {
|
||||
s = "бүх" ;
|
||||
isPre = True ;
|
||||
isDef = False
|
||||
} ;
|
||||
almost_AdA, almost_AdN = ss "бараг" ;
|
||||
although_Subj = {s = "боловч" ; isPre = False} ;
|
||||
always_AdV = ss "үргэлж" ;
|
||||
and_Conj = mkConj "ба" ;
|
||||
because_Subj = {s = "яагаад гэвэл" ; isPre = False} ;
|
||||
before_Prep = mkPrep Abl "өмнө" ;
|
||||
behind_Prep = mkPrep Gen "ард" ;
|
||||
between_Prep = mkPrep Gen "хооронд" ;
|
||||
both7and_DConj = mkConj "" "мөн" ;
|
||||
but_PConj = ss "гэвч" ;
|
||||
by8agent_Prep = mkPrep Gen "ачаар" ;
|
||||
by8means_Prep = noPrep Inst ;
|
||||
can8know_VV = verbToAux (regV "чадах") ;
|
||||
can_VV = verbToAux (regV "чадах") ;
|
||||
during_Prep = mkPrep Gen "үеэр" ;
|
||||
either7or_DConj = mkConj "эсвэл" "эсвэл" ;
|
||||
every_Det = {
|
||||
s = "бүр" ;
|
||||
sp = \\rc => (regN "бүр").s ! (SF Sg (toNCase rc Definite)) ;
|
||||
isNum, isPoss, isPre = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
everybody_NP = mkNP "хүн бүр" Definite ;
|
||||
everything_NP = mkNP "бүгд" Definite ;
|
||||
everywhere_Adv = ss "хаа сайгүй" ;
|
||||
few_Det = {
|
||||
s = "багагүй" ;
|
||||
sp = \\rc => (regN "багагүй").s ! (SF Sg (toNCase rc Indefinite)) ;
|
||||
isNum, isPoss, isDef = False ;
|
||||
isPre = True
|
||||
} ;
|
||||
for_Prep = noPrep Dat ;
|
||||
from_Prep = noPrep Abl ;
|
||||
he_Pron = mkPron "тэр" "түүний" "түүнд" "түүнийг" "түүнээс" "түүнээр" "түүнтэй" "түүн рүү" Sg P3 ;
|
||||
here_Adv = ss "энд" ;
|
||||
here7to_Adv = ss "ийшээ" ;
|
||||
here7from_Adv = ss "эндээс" ;
|
||||
how_IAdv = ss "яаж" ;
|
||||
how8many_IDet = {
|
||||
s = \\_ => "хэдэн" ;
|
||||
n = Pl
|
||||
} ;
|
||||
how8much_IAdv = ss "хэд" ;
|
||||
i_Pron = mkPron "би" "миний" "надад" "намайг" "надаас" "надаар" "надтай" "над руу" Sg P1 ;
|
||||
if_Subj = {s = "хэрэв" ; isPre = True} ;
|
||||
in8front_Prep = mkPrep Gen "урд" ;
|
||||
in_Prep = noPrep Dat ;
|
||||
it_Pron = mkPron "тэр" "түүний" "түүнд" "түүнийг" "түүнээс" "түүнээр" "түүнтэй" "түүн рүү" Sg P3 ;
|
||||
less_CAdv = lin CAdv {s = "бага" ; c2 = noPrep Abl} ;
|
||||
many_Det = {
|
||||
s = "олон" ;
|
||||
sp = \\rc => (regN "олон").s ! (SF Sg (toNCase rc Indefinite)) ;
|
||||
isNum, isPoss, isDef = False ;
|
||||
isPre = True
|
||||
} ;
|
||||
more_CAdv = lin CAdv {s = "илүү" ; c2 = noPrep Abl};
|
||||
most_Predet = {
|
||||
s = "ихэнх" ;
|
||||
isPre = True ;
|
||||
isDef = False
|
||||
} ;
|
||||
much_Det = {
|
||||
s = "нилээд" ;
|
||||
sp = \\rc => (regN "нилээд").s ! (SF Sg (toNCase rc Indefinite)) ;
|
||||
isNum, isPoss, isDef = False ;
|
||||
isPre = True
|
||||
} ;
|
||||
must_VV = verbToAux (regV ("хэрэгтэй байх")) ;
|
||||
no_Utt = ss "үгүй" ;
|
||||
on_Prep = mkPrep Gen "дээрх" ;
|
||||
only_Predet = {
|
||||
s = "зөвхөн" ;
|
||||
isPre = True ;
|
||||
isDef = True
|
||||
} ;
|
||||
or_Conj = mkConj "эсвэл" ;
|
||||
otherwise_PConj = ss "үгүй бол" ;
|
||||
part_Prep = noPrep Gen ;
|
||||
please_Voc = ss [] ;
|
||||
possess_Prep = noPrep Gen ;
|
||||
quite_Adv = ss "бүрэн" ;
|
||||
she_Pron = mkPron "тэр" "түүний" "түүнд" "түүнийг" "түүнээс" "түүнээр" "түүнтэй" "түүн рүү" Sg P3 ;
|
||||
so_AdA = ss "ийм" ;
|
||||
somebody_NP = mkNP "хэн нэгэн" Indefinite ;
|
||||
someSg_Det = {
|
||||
s = "зарим нэг" ;
|
||||
sp = \\rc => (regN "зарим нэг").s ! (SF Sg (toNCase rc Indefinite)) ;
|
||||
isNum, isPoss, isDef = False ;
|
||||
isPre = True
|
||||
} ;
|
||||
somePl_Det = {
|
||||
s = "зарим" ;
|
||||
sp = \\rc => (regN "зарим").s ! (SF Sg (toNCase rc Indefinite)) ;
|
||||
isNum, isPoss, isDef = False ;
|
||||
isPre = True
|
||||
} ;
|
||||
something_NP = mkNP "ямар нэгэн юм" Indefinite ;
|
||||
somewhere_Adv = ss "хаа нэгтээ" ;
|
||||
that_Quant = {
|
||||
s = table (ParadigmsMon.Number) {
|
||||
Sg => "тэр" ;
|
||||
Pl => "тэдгээр"
|
||||
} ;
|
||||
sp = \\n,nc => case n of {
|
||||
Sg => case nc of {
|
||||
NNom => "тэр" ;
|
||||
NInst => "түүгээр" ;
|
||||
_ => (regN "түүн").s ! SF Sg nc
|
||||
} ;
|
||||
Pl => (regN "тэдгээр").s ! SF Sg nc
|
||||
};
|
||||
isPoss = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
that_Subj = {s = [] ; isPre = True} ;
|
||||
there_Adv = ss "тэнд" ;
|
||||
there7to_Adv = ss "цаашаа" ;
|
||||
there7from_Adv = ss "цаанаас" ;
|
||||
therefore_PConj = ss "тийм учраас" ;
|
||||
they_Pron = mkPron "тэд" "тэдний" "тэднийд" "тэднийг" "тэднээс" "тэднээр" "тэдэнтэй" "тэдэн рүү" Pl P3 ;
|
||||
this_Quant = {
|
||||
s = table (ParadigmsMon.Number) {
|
||||
Sg => "энэ" ;
|
||||
Pl => "эдгээр"
|
||||
} ;
|
||||
sp = \\n,nc => case n of {
|
||||
Sg => case nc of {
|
||||
NNom => "энэ" ;
|
||||
NInst => "үүгээр" ;
|
||||
_ => (regN "үүн").s ! SF Sg nc
|
||||
} ;
|
||||
Pl => (regN "эдгээр").s ! SF Sg nc
|
||||
} ;
|
||||
isPoss = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
through_Prep = noPrep Inst ;
|
||||
to_Prep = mkPrep Acc "хүртэл" ;
|
||||
too_AdA = ss "дэндүү" ;
|
||||
under_Prep = mkPrep Gen "доор" ;
|
||||
very_AdA = ss "маш" ;
|
||||
want_VV = verbToAux (regV "хүсэх") ;
|
||||
we_Pron = mkPron "бид" "бидний" "бидэнд" "биднийг" "биднээс" "биднээр" "бидэнтэй" "бидэн рүү" Pl P1 ;
|
||||
whatPl_IP = {
|
||||
s = \\rc => (regN "юу").s ! SF Sg (toNCase rc Definite) ;
|
||||
n = Pl
|
||||
} ;
|
||||
whatSg_IP = {
|
||||
s = \\rc => (regN "юу").s ! SF Sg (toNCase rc Definite) ;
|
||||
n = Sg
|
||||
} ;
|
||||
when_IAdv = ss "хэзээ" ;
|
||||
when_Subj = {s = "хэрэв" ; isPre = True} ;
|
||||
where_IAdv = ss "хаана" ;
|
||||
which_IQuant = {
|
||||
s = \\rc => (regN "ямар").s ! SF Sg (toNCase rc Definite)
|
||||
} ;
|
||||
whoPl_IP = {
|
||||
s = \\rc => (regN "хэн").s ! SF Sg (toNCase rc Definite) ;
|
||||
n = Pl
|
||||
} ;
|
||||
whoSg_IP = {
|
||||
s = \\rc => (regN "хэн").s ! SF Sg (toNCase rc Definite) ;
|
||||
n = Sg
|
||||
} ;
|
||||
why_IAdv = ss "яагаад" ;
|
||||
with_Prep = noPrep Com ;
|
||||
without_Prep = mkPrep Nom "-гүй" ;
|
||||
yes_Utt = ss "За" ;
|
||||
youSg_Pron = mkPron "чи" "чиний" "чамд" "чамайг" "чамаас" "чамаар" "чамтай" "чам руу" Sg P2 ;
|
||||
youPl_Pron = mkPron "та нар" "та нарын" "та нарт" "та нарыг" "та нараас" "та нараар" "та нартай" "та нар луу" Pl P2 ;
|
||||
youPol_Pron = mkPron "та" "таны" "танд" "таныг" "танаас" "танаар" "тантай" "тан руу" Sg P2 ;
|
||||
no_Quant = {
|
||||
s = \\_ => "ямар ч" ;
|
||||
sp = \\_,nc => (regN "ямар ч").s ! SF Sg nc ;
|
||||
isPoss = False ;
|
||||
isDef = False
|
||||
} ;
|
||||
not_Predet = {
|
||||
s = "биш" ;
|
||||
isPre = False ;
|
||||
isDef = True
|
||||
} ;
|
||||
if_then_Conj = mkConj "хэрэв" "" ;
|
||||
at_least_AdN = ss "хамгийн багадаа" ;
|
||||
at_most_AdN = ss "хамгийн ихдээ" ;
|
||||
nobody_NP = mkNP "хэн ч" Definite ;
|
||||
nothing_NP = mkNP "юу ч" Definite ;
|
||||
except_Prep = mkPrep Abl "гадна" ;
|
||||
as_CAdv = lin CAdv {s = "шиг" ; c2 = noPrep Nom} ;
|
||||
have_V2 = mkV2 (mkV "байх") ;
|
||||
|
||||
lin language_title_Utt = ss "Монгол" ;
|
||||
|
||||
}
|
||||
|
||||
14
lib/src/mongolian/TenseMon.gf
Normal file
14
lib/src/mongolian/TenseMon.gf
Normal file
@@ -0,0 +1,14 @@
|
||||
concrete TenseMon of Tense =
|
||||
CatMon [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] ** open ResMon in {
|
||||
|
||||
lin
|
||||
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a} ;
|
||||
|
||||
TPres = {s = [] ; t = ClPres } ;
|
||||
TPast = {
|
||||
s = [] ;
|
||||
t = ClPast (variants {Perf;PresPerf;IndefPast})
|
||||
} ; --# notpresent
|
||||
TFut,TCond = {s = [] ; t = ClFut} ; --# notpresent
|
||||
|
||||
}
|
||||
10
lib/src/mongolian/TextMon.gf
Normal file
10
lib/src/mongolian/TextMon.gf
Normal file
@@ -0,0 +1,10 @@
|
||||
concrete TextMon of Text = CatMon ** {
|
||||
flags coding=utf8 ;
|
||||
|
||||
lin
|
||||
TEmpty = {s = []} ;
|
||||
TFullStop p t = {s = p.s ++ "." ++ t.s} ;
|
||||
TQuestMark p t = {s = p.s ++ "?" ++ t.s} ;
|
||||
TExclMark p t = {s = p.s ++ "!" ++ t.s} ;
|
||||
|
||||
}
|
||||
70
lib/src/mongolian/VerbMon.gf
Normal file
70
lib/src/mongolian/VerbMon.gf
Normal file
@@ -0,0 +1,70 @@
|
||||
--# -path=.:../abstract:../common:../../prelude
|
||||
|
||||
concrete VerbMon of Verb = CatMon ** open ResMon, ParadigmsMon, Prelude in {
|
||||
|
||||
flags optimize=all_subs ; coding=utf8 ;
|
||||
|
||||
lin
|
||||
UseV = predV ;
|
||||
|
||||
ComplVV v vp = insertObj (\\_ => infVP vp Nom) (predV (auxToVerb v)) ;
|
||||
|
||||
ComplVS v s = insertEmbedCompl (s.s ! Main ++ "гэж") (predV v) ;
|
||||
|
||||
ComplVQ v qs = insertEmbedCompl (qs.s ! QIndir) (predV v) ;
|
||||
|
||||
ComplVA v ap = insertObj (\\_ => ap.s) (predV v) ;
|
||||
|
||||
SlashV2a v = predV v ** {c2 = v.c2} ;
|
||||
|
||||
Slash2V3 v np = insertObj (\\_ => appCompl v.c2 np.s) (predV v) ** {c2 = v.c3} ;
|
||||
|
||||
Slash3V3 v np = insertObj (\\_ => appCompl v.c3 np.s) (predV v) ** {c2 = v.c2} ;
|
||||
|
||||
SlashV2V v vp = insertObj (\\_ => infVP vp Gen) (predV v) ** {c2 = v.c2} ;
|
||||
|
||||
SlashV2S v s = insertEmbedCompl (s.s ! Main ++ "гэж") (predV v) ** {c2 = v.c2} ;
|
||||
|
||||
SlashV2Q v qs = insertEmbedCompl (qs.s ! QIndir) (predV v) ** {c2 = v.c2} ;
|
||||
|
||||
SlashV2A v ap = insertObj (\\_ => ap.s) (predV v) ** {c2 = v.c2} ;
|
||||
|
||||
ComplSlash v np = insertObj (\\_ => appCompl v.c2 np.s) v ;
|
||||
|
||||
SlashVV v vp = insertObj (\\_ => infVP vp Acc) (predV (auxToVerb v)) ** {c2 = vp.c2} ;
|
||||
|
||||
SlashV2VNP v np vp = insertObj (\\_ => appCompl v.c2 np.s) (
|
||||
insertObjPost (\\_ => (infVP vp Acc)) (predV v)) ** {c2 = vp.c2} ;
|
||||
|
||||
VPSlashPrep vp prep = vp ** {c2 = prep} ;
|
||||
|
||||
ReflVP vp = insertObj (\\_ => appCompl vp.c2 (reflPron ! Sg)) vp ;
|
||||
|
||||
UseComp comp = insertObj (\\_ => comp.s ! Nom) (predV (auxToVerb auxBe)) ;
|
||||
|
||||
PassV2 v =
|
||||
let
|
||||
vp = predV v
|
||||
in {
|
||||
s = \\_ => vp.s ! VPPass Passive ClPres ;
|
||||
compl = \\_ => [] ;
|
||||
adv = [] ;
|
||||
embedCompl = \\_ => [] ;
|
||||
vt = v.vt
|
||||
} ;
|
||||
|
||||
AdvVP vp adv = insertAdv adv.s vp ;
|
||||
AdVVP adv vp = insertAdv adv.s vp ;
|
||||
AdvVPSlash vp adv = insertAdv adv.s vp ** {c2 = vp.c2} ;
|
||||
AdVVPSlash adv vp = insertAdv adv.s vp ** {c2 = vp.c2} ;
|
||||
|
||||
-- Complements of copula
|
||||
|
||||
CompAP ap = {s = \\_ => ap.s} ;
|
||||
CompNP np = {s = \\_ => np.s ! Nom} ;
|
||||
CompAdv adv = {s = \\_ => adv.s} ;
|
||||
CompCN cn = {s = \\_ => cn.s ! Sg ! (toNCase Nom Definite)} ;
|
||||
UseCopula = predV (auxToVerb auxBe) ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user