mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-11 04:02:52 -06:00
Latvian: parameter optimisation, code clean-up and formatting, renaming
This commit is contained in:
@@ -3,102 +3,87 @@
|
||||
resource ResLav = ParamX ** open Prelude in {
|
||||
|
||||
flags
|
||||
|
||||
optimize = all ;
|
||||
coding = utf8 ;
|
||||
|
||||
param
|
||||
|
||||
-- Nouns
|
||||
|
||||
Case = Nom | Gen | Dat | Acc | Loc | Voc ;
|
||||
Gender = Masc | Fem ;
|
||||
NounDecl = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR ;
|
||||
Declension = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR ;
|
||||
|
||||
-- Adjectives
|
||||
Definite = Indef | Def ;
|
||||
AdjType = AdjQual | AdjRel | AdjIndecl ;
|
||||
|
||||
-- TODO: pārveidot uz šādu formu lai ir arī apstākļa vārdi kas atvasināti no īpašības vārdiem
|
||||
AForm = AAdj Degree Definite Gender Number Case | AAdv Degree ;
|
||||
Definiteness = Indef | Def ;
|
||||
AType = AQual | ARel | AIndecl ;
|
||||
|
||||
-- Participles
|
||||
PartType = IsUsi | TsTa ; -- TODO: šo jāmet ārā - pārklājas ar Voice, kas attiecas ne tikai uz divdabjiem
|
||||
Voice = Act | Pass ;
|
||||
AForm =
|
||||
AAdj Degree Definiteness Gender Number Case
|
||||
| AAdv Degree ;
|
||||
|
||||
-- Verbs
|
||||
-- Ind = Indicative
|
||||
-- Rel = Relative (Latvian specific: http://www.isocat.org/rest/dc/3836)
|
||||
-- Deb = Debitive (Latvian specific: http://www.isocat.org/rest/dc/3835)
|
||||
-- Condit = Conditional
|
||||
-- DebitiveRelative = the relative subtype of debitive
|
||||
VerbForm =
|
||||
Infinitive
|
||||
| Indicative Person Number Tense
|
||||
| Relative Tense
|
||||
| Debitive
|
||||
| Imperative Number
|
||||
| DebitiveRelative
|
||||
| Participle PartType Gender Number Case
|
||||
;
|
||||
-- TODO: divdabim noteiktā forma un arī pārākā / vispārākā pakāpe
|
||||
|
||||
VerbMood =
|
||||
Ind Anteriority Tense
|
||||
| Rel Anteriority Tense --# notpresent
|
||||
| Deb Anteriority Tense --# notpresent
|
||||
| Condit Anteriority --# notpresent
|
||||
;
|
||||
Voice = Act | Pass ;
|
||||
Conjugation = C2 | C3 ; -- C1 - "irregular" verbs
|
||||
|
||||
VerbConj = C2 | C3 ;
|
||||
-- Verb mood:
|
||||
-- Ind - indicative
|
||||
-- Rel - relative (http://www.isocat.org/rest/dc/3836)
|
||||
-- Deb - debitive (http://www.isocat.org/rest/dc/3835)
|
||||
-- Condit - conditional
|
||||
VMood =
|
||||
Ind Anteriority Tense
|
||||
| Rel Anteriority Tense --# notpresent
|
||||
| Deb Anteriority Tense --# notpresent
|
||||
| Condit Anteriority --# notpresent
|
||||
;
|
||||
|
||||
-- Verb agreement
|
||||
-- Number depends on the person
|
||||
-- Gender has to be taken into accunt because of predicative nominals and participles
|
||||
-- Polarity may depend on the subject/object NP (double negation, if subject/object has a negated determiner)
|
||||
Agr = AgP1 Number Gender | AgP2 Number Gender | AgP3 Number Gender Polarity ;
|
||||
VForm =
|
||||
VInf
|
||||
| VInd Person Number Tense
|
||||
| VRel Tense
|
||||
| VDeb
|
||||
| VImp Number
|
||||
| VDebRel -- the relative subtype of debitive
|
||||
| VPart Voice Gender Number Case ;
|
||||
|
||||
-- Clause agreement
|
||||
-- TODO: jāpāriet uz vienotu TopicFocus (=> ieraksta tips)
|
||||
--ClAgr = Topic Case Voice | TopicFocus Case Case Agr Voice ;
|
||||
--ClAgr = NomAcc Agr Voice | DatNom Agr Voice | DatGen Agr Voice ;
|
||||
-- Verb agreement:
|
||||
-- Number depends on Subject.Person
|
||||
-- Subject.Gender has to be agreed in predicative nominal clauses, and in participle forms
|
||||
-- Polarity - double negation, if the subject/object NP has a negated determiner
|
||||
Agr =
|
||||
AgP1 Number Gender
|
||||
| AgP2 Number Gender
|
||||
| AgP3 Number Gender Polarity ;
|
||||
|
||||
-- Other
|
||||
|
||||
ThisOrThat = This | That ;
|
||||
|
||||
CardOrd = NCard | NOrd ;
|
||||
DForm = unit | teen | ten ;
|
||||
DForm = DUnit | DTeen | DTen ;
|
||||
|
||||
oper
|
||||
vowel : pattern Str = #("a"|"ā"|"e"|"ē"|"i"|"ī"|"o"|"u"|"ū") ;
|
||||
|
||||
simpleCons : pattern Str = #("c"|"d"|"l"|"n"|"s"|"t"|"z") ;
|
||||
labialCons : pattern Str = #("b"|"m"|"p"|"v") ;
|
||||
sonantCons : pattern Str = #("l"|"m"|"n"|"r"|"ļ"|"ņ") ;
|
||||
doubleCons : pattern Str = #("ll"|"ln"|"nn"|"sl"|"sn"|"st"|"zl"|"zn") ;
|
||||
Verb : Type = { s : Polarity => VForm => Str } ;
|
||||
|
||||
prefix : pattern Str = #("aiz"|"ap"|"at"|"ie"|"iz"|"no"|"pa"|"pār"|"pie"|"sa"|"uz") ;
|
||||
|
||||
NON_EXISTENT : Str = "NON_EXISTENT" ;
|
||||
|
||||
Verb : Type = { s : Polarity => VerbForm => Str } ;
|
||||
|
||||
-- TODO: voice ir jāliek pa tiešo zem VP (?)
|
||||
ClAgr : Type = { c_topic : Case ; c_focus : Case ; agr : Agr ; voice : Voice } ;
|
||||
|
||||
-- TODO: topic un focus jāapvieno vienā (jaunā) agr parametrā (?), jo
|
||||
-- ne vienmēr ir abi un ne visas kombinācijas ir vajadzīgas
|
||||
--
|
||||
-- TODO: lai varētu spēlēties ar vārdu secību, compl vēlāk būs jāskalda pa daļām
|
||||
VP = { v : Verb ; compl : Agr => Str ; agr : ClAgr ; objNeg : Polarity } ;
|
||||
-- compl: objects, complements, adverbial modifiers
|
||||
-- topic: typically - subject
|
||||
-- focus: typically - objects, complements, adverbial modifiers
|
||||
|
||||
VPSlash = VP ** { p : Prep } ; -- TODO: p pārklājas ar agr
|
||||
-- principā rekur ir objekts kuram jau kaut kas ir bet ir vēl viena brīva valence...
|
||||
Valence : Type = { subj : Case ; obj : Case ; agr : Agr } ;
|
||||
-- TODO: jāpāriet uz vienotu TopicFocus parametru
|
||||
-- TODO: ieraksta tips (c:CaseCase, p:Prep; kam ir agr?) vai algebr. param.?
|
||||
|
||||
Prep : Type = { s : Str ; c : Number => Case } ;
|
||||
-- In the case of case-based valences, the preposition is empty ([])
|
||||
-- For simple case-based valences, the preposition is empty ([])
|
||||
-- TODO: position of prepositions (pre or post)
|
||||
|
||||
--Valence : Type = { p : Prep ; c : Number => Case } ;
|
||||
-- e.g. 'ar' + Sg-Acc or Pl-Dat; Preposition may be skipped for simple case-baced valences
|
||||
VP = { v : Verb ; compl : Agr => Str ; val : Valence ; objNeg : Polarity ; voice : Voice } ;
|
||||
-- compl: objects, complements, adverbial modifiers
|
||||
-- TODO: lai varētu spēlēties ar vārdu secību, compl vēlāk būs jāskalda pa daļām
|
||||
|
||||
VPSlash = VP ** { p : Prep } ;
|
||||
-- TODO: p pārklājas ar val.obj un val.agr / vai vp.p = v.p?
|
||||
|
||||
toAgr : Person -> Number -> Gender -> Polarity -> Agr = \pers,num,gend,pol ->
|
||||
case pers of {
|
||||
@@ -107,15 +92,6 @@ oper
|
||||
P3 => AgP3 num gend pol
|
||||
} ;
|
||||
|
||||
toClAgr : Case -> Case -> Agr -> Voice -> ClAgr = \c_topic,c_focus,agr,voice -> {
|
||||
c_topic = c_topic ;
|
||||
c_focus = c_focus ;
|
||||
agr = agr ;
|
||||
voice = voice
|
||||
} ;
|
||||
|
||||
toClAgr_Reg : Case -> ClAgr = \c_topic -> toClAgr c_topic Nom (AgP3 Sg Masc Pos) Act ;
|
||||
|
||||
fromAgr : Agr -> { pers : Person ; num : Number ; gend : Gender ; pol : Polarity } = \agr ->
|
||||
case agr of {
|
||||
AgP1 num gend => { pers = P1 ; num = num ; gend = gend ; pol = Pos } ;
|
||||
@@ -146,6 +122,23 @@ oper
|
||||
_ => pol2
|
||||
} ;
|
||||
|
||||
--agrP3 : Number -> Gender -> Polarity -> Agr = \num,gend,pol -> toAgr P3 num gend pol ;
|
||||
toVal : Case -> Case -> Agr -> Valence = \subj,obj,agr -> {
|
||||
subj = subj ;
|
||||
obj = obj ;
|
||||
agr = agr
|
||||
} ;
|
||||
|
||||
toVal_Reg : Case -> Valence = \subj -> toVal subj Nom (AgP3 Sg Masc Pos) ;
|
||||
|
||||
vowel : pattern Str = #("a"|"ā"|"e"|"ē"|"i"|"ī"|"o"|"u"|"ū") ;
|
||||
|
||||
simpleCons : pattern Str = #("c"|"d"|"l"|"n"|"s"|"t"|"z") ;
|
||||
labialCons : pattern Str = #("b"|"m"|"p"|"v") ;
|
||||
sonantCons : pattern Str = #("l"|"m"|"n"|"r"|"ļ"|"ņ") ;
|
||||
doubleCons : pattern Str = #("ll"|"ln"|"nn"|"sl"|"sn"|"st"|"zl"|"zn") ;
|
||||
|
||||
prefix : pattern Str = #("aiz"|"ap"|"at"|"ie"|"iz"|"no"|"pa"|"pār"|"pie"|"sa"|"uz") ;
|
||||
|
||||
NON_EXISTENT : Str = "NON_EXISTENT" ;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user