diff --git a/src/latvian/ParadigmsNounsLav.gf b/src/latvian/ParadigmsNounsLav.gf index 5085dcca..b0338f32 100644 --- a/src/latvian/ParadigmsNounsLav.gf +++ b/src/latvian/ParadigmsNounsLav.gf @@ -80,7 +80,8 @@ oper mkNounByDeclPal : Str -> Declension -> Bool -> Noun = \lemma,decl,pal -> case decl of { D0|D1|D2|D3 => mkNounByGendDeclPal lemma Masc decl pal ; - D4|D5|D6|DR => mkNounByGendDeclPal lemma Fem decl pal + D4|D5|D6|DR => mkNounByGendDeclPal lemma Fem decl pal ; + DG => mkNounByGendDeclPal nonExist Fem decl pal -- FIX ME REMAKE } ; -- Specified gender and declension; default palatalization @@ -97,7 +98,8 @@ oper D4 => mkNoun_D4 lemma gend ; D5 => mkNoun_D5 lemma gend pal ; D6 => mkNoun_D6 lemma gend pal ; - DR => mkNoun_DR lemma + DR => mkNoun_DR lemma ; + DG => mkNoun_DR nonExist -- FIX ME REMAKE } ; -- Indeclinable noun diff --git a/src/latvian/ParadigmsVerbsLav.gf b/src/latvian/ParadigmsVerbsLav.gf index e387625e..dcb1e32d 100644 --- a/src/latvian/ParadigmsVerbsLav.gf +++ b/src/latvian/ParadigmsVerbsLav.gf @@ -43,13 +43,15 @@ oper mkRegVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj -> case conj of { C2 => mkVerb_C2 lemma ; - C3 => mkVerb_C3 lemma + C3 => mkVerb_C3 lemma ; + C1|CI => mkVerb_C3 nonExist -- FIX ME REMAKE } ; mkReflVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj -> case conj of { C2 => mkVerb_C2_Refl lemma ; - C3 => mkVerb_C3_Refl lemma + C3 => mkVerb_C3_Refl lemma ; + C1|CI => mkVerb_C3_Refl nonExist -- FIX ME REMAKE } ; filter_Neg : Verb_TMP -> Verb_TMP = \full -> { diff --git a/src/latvian/PortedMorphoDictLav.gf b/src/latvian/PortedMorphoDictLav.gf new file mode 100644 index 00000000..972f3ac1 --- /dev/null +++ b/src/latvian/PortedMorphoDictLav.gf @@ -0,0 +1,5 @@ +--# -path=.:abstract:common:prelude + +-- Here goes authomatically exported lexicon from tezaurs.lv + +resource PortedMorphoDictLav = open Prelude, Predef in {} diff --git a/src/latvian/PortedMorphoParadigmsLav.gf b/src/latvian/PortedMorphoParadigmsLav.gf new file mode 100644 index 00000000..c09593b5 --- /dev/null +++ b/src/latvian/PortedMorphoParadigmsLav.gf @@ -0,0 +1,6 @@ +--# -path=.:abstract:common:prelude + +-- Here goes authomatically ported paradigms from +-- https://github.com/PeterisP/morphology/blob/master/src/main/resources/Lexicon_v2.xml + +resource PortedMorphoParadigmsLav = open Prelude, Predef in {} \ No newline at end of file diff --git a/src/latvian/PortedMorphoStemchangesLav.gf b/src/latvian/PortedMorphoStemchangesLav.gf new file mode 100644 index 00000000..f0c4e9ae --- /dev/null +++ b/src/latvian/PortedMorphoStemchangesLav.gf @@ -0,0 +1,71 @@ +--# -path=.:abstract:common:prelude + +-- Here goes manually ported stemchanges from +-- https://github.com/PeterisP/morphology/blob/master/src/main/java/lv/semti/morphology/analyzer/Mijas.java + +resource PortedMorphoStemchangesLav = open Prelude, Predef in { + +flags coding = utf8 ; + +oper + + stemchange : Int -> Str -> Str = \parId,stem -> + case parId of { + 0 => stem; + 1 => case stem of { -- nouns + s + ("kst") => s + "kš"; + s + ("nst") => s + "nš"; + s + ("ll") => s + "ļļ"; + s + ("sl") => s + "šļ"; + s + ("zl") => s + "žļ"; + s + ("ln") => s + "ļņ"; + s + ("nn") => s + "ņņ"; + s + ("sn") => s + "šņ"; + s + ("zn") => s + "žņ"; + s + ("īt") => s + "īš"; + s + ("d") => s + "ž"; + s + ("t") => s + "š"; + s + ("n") => s + "ņ"; + s + ("s") => s + "š"; + s + ("z") => s + "ž"; + s + ("b"|"f"|"m"|"p"|"v") => stem + "j"; + + _ => stem + }; + + 17 => case of { -- shortened vocative for fem nouns + => stem; + --<_, 0|1> => variants {}; + <_, 0|1> => nonExist; -- Exception + <_, _> => stem + }; + + _ => error ("Unsupported stemchange") + }; + + + + -- Inari's trick for counting syllables https://inariksit.github.io/gf/2018/08/28/gf-gotchas.html#cute-way-to-count-syllables + -- pattern macro for vowels + v : pattern Str = #("a"|"ā"|"e"|"ē"|"i"|"ī"|"o"|"u"|"ū") ; + + -- type alias for the helper function + SylCnt : Type = Bool -> Str -> Ints 10 ; + + countSyllables : Str -> Ints 10 = go count False + where { + go : SylCnt -> SylCnt = \f,wasVowel,word -> + case of { + <#v + s, False> => Predef.plus (f True s) 1 ; + <#v + s, True> => f True s ; + => f False s ; + _ => 0 } ; + + -- end of recursion + scBase : SylCnt = \_,_ -> 0 ; + + -- the function given to countSyllables + count : SylCnt = go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go (go scBase))))))))))))))))))))))))))))))))))))))) + } ; + +} diff --git a/src/latvian/ResLav.gf b/src/latvian/ResLav.gf index fc96defe..f974e6ab 100644 --- a/src/latvian/ResLav.gf +++ b/src/latvian/ResLav.gf @@ -13,12 +13,12 @@ param Case = Nom | Gen | Dat | Acc | Loc | Voc ; Gender = Masc | Fem ; - Declension = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR ; + Declension = D0 | D1 | D2 | D3 | D4 | D5 | D6 | DR | DG; -- ammended for Tēzaurs. -- Adjectives Definiteness = Indef | Def ; - AType = AQual | ARel | AIndecl ; + AType = AQual | ARel | AIndecl ; -- Doesn't exactly fit with Tēzaurs system - AIndecl is not needed. AForm = AAdj Degree Definiteness Gender Number Case @@ -27,7 +27,7 @@ param -- Verbs Voice = Act | Pass ; - Conjugation = C2 | C3 ; -- C1 - "irregular" verbs + Conjugation = C2 | C3 | C1 | CI ; -- C1 - "irregular" verbs ; ammended for Tēzaurs. -- Verb moods: -- Ind - indicative diff --git a/src/latvian/SentenceLav.gf b/src/latvian/SentenceLav.gf index 8c7c8c57..53232b32 100644 --- a/src/latvian/SentenceLav.gf +++ b/src/latvian/SentenceLav.gf @@ -18,7 +18,8 @@ lin ImpVP vp = { s = \\pol,num => vp.v.s ! pol ! (VImp num) ++ vp.compl ! (AgrP2 num Masc) } ; - SlashVP np vp = mkClause np vp ** { prep = vp.rightVal } ; + -- SlashVP np vp = mkClause np vp ** { prep = vp.rightVal } ; + -- FIX ME tmp comment AdvSlash slash adv = { s = \\m,p => slash.s ! m ! p ++ adv.s ; diff --git a/src/latvian/VerbLav.gf b/src/latvian/VerbLav.gf index f936e78e..0bf012e3 100644 --- a/src/latvian/VerbLav.gf +++ b/src/latvian/VerbLav.gf @@ -182,18 +182,17 @@ lin -- VPSlash -> NP -> VP -- e.g. 'love it' - ComplSlash vpslash np = +{- ComplSlash vpslash np = let agr : Agreement = np.agr in { v = vpslash.v ; - {- - compl = \\agr => case vpslash.voice of { - Act => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ; - Pass => case vpslash.rightVal.c ! (fromAgr agr).num of { - Nom => np.s ! (vpslash.rightVal.c ! Sg) ; - _ => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) - } - } ++ vpslash.compl ! agr ; - -} + -- compl = \\agr => case vpslash.voice of { + -- Act => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ; + -- Pass => case vpslash.rightVal.c ! (fromAgr agr).num of { + -- Nom => np.s ! (vpslash.rightVal.c ! Sg) ; + -- _ => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) + -- } + -- } ++ vpslash.compl ! agr ; + compl = \\agr => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ++ vpslash.compl ! agr ; @@ -203,7 +202,7 @@ lin rightPol = np.pol ; objPron = np.isPron ; rightVal = vpslash.rightVal - } ; + } ; -} -- FIX ME tmp comment -- VV -> VPSlash -> VPSlash -- e.g. 'want to buy' @@ -220,7 +219,7 @@ lin -- V2V -> NP -> VPSlash -> VPSlash -- e.g. '-- beg me to buy' - SlashV2VNP v2v np vpslash = insertObjSlash +{- SlashV2VNP v2v np vpslash = insertObjSlash (\\_ => v2v.rightVal.s ++ np.s ! (v2v.rightVal.c ! (fromAgr np.agr).num)) { v = v2v ; @@ -231,7 +230,7 @@ lin rightPol = np.pol ; objPron = np.isPron ; rightVal = v2v.rightVal - } ; + } ; -} -- FIX ME tmp comment -- Other ways of forming verb phrases