mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-28 01:18:57 -06:00
Noun stemchanges for the Lav remake.
This commit is contained in:
@@ -80,7 +80,8 @@ oper
|
|||||||
mkNounByDeclPal : Str -> Declension -> Bool -> Noun = \lemma,decl,pal ->
|
mkNounByDeclPal : Str -> Declension -> Bool -> Noun = \lemma,decl,pal ->
|
||||||
case decl of {
|
case decl of {
|
||||||
D0|D1|D2|D3 => mkNounByGendDeclPal lemma Masc decl pal ;
|
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
|
-- Specified gender and declension; default palatalization
|
||||||
@@ -97,7 +98,8 @@ oper
|
|||||||
D4 => mkNoun_D4 lemma gend ;
|
D4 => mkNoun_D4 lemma gend ;
|
||||||
D5 => mkNoun_D5 lemma gend pal ;
|
D5 => mkNoun_D5 lemma gend pal ;
|
||||||
D6 => mkNoun_D6 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
|
-- Indeclinable noun
|
||||||
|
|||||||
@@ -43,13 +43,15 @@ oper
|
|||||||
mkRegVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
|
mkRegVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
|
||||||
case conj of {
|
case conj of {
|
||||||
C2 => mkVerb_C2 lemma ;
|
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 ->
|
mkReflVerb : Str -> Conjugation -> Verb_TMP = \lemma,conj ->
|
||||||
case conj of {
|
case conj of {
|
||||||
C2 => mkVerb_C2_Refl lemma ;
|
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 -> {
|
filter_Neg : Verb_TMP -> Verb_TMP = \full -> {
|
||||||
|
|||||||
5
src/latvian/PortedMorphoDictLav.gf
Normal file
5
src/latvian/PortedMorphoDictLav.gf
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
--# -path=.:abstract:common:prelude
|
||||||
|
|
||||||
|
-- Here goes authomatically exported lexicon from tezaurs.lv
|
||||||
|
|
||||||
|
resource PortedMorphoDictLav = open Prelude, Predef in {}
|
||||||
6
src/latvian/PortedMorphoParadigmsLav.gf
Normal file
6
src/latvian/PortedMorphoParadigmsLav.gf
Normal file
@@ -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 {}
|
||||||
71
src/latvian/PortedMorphoStemchangesLav.gf
Normal file
71
src/latvian/PortedMorphoStemchangesLav.gf
Normal file
@@ -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 <stem, countSyllables stem > of { -- shortened vocative for fem nouns
|
||||||
|
<s + ("īt"|"iņ"), _ > => 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 <word,wasVowel> of {
|
||||||
|
<#v + s, False> => Predef.plus (f True s) 1 ;
|
||||||
|
<#v + s, True> => f True s ;
|
||||||
|
<? + 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)))))))))))))))))))))))))))))))))))))))
|
||||||
|
} ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -13,12 +13,12 @@ param
|
|||||||
|
|
||||||
Case = Nom | Gen | Dat | Acc | Loc | Voc ;
|
Case = Nom | Gen | Dat | Acc | Loc | Voc ;
|
||||||
Gender = Masc | Fem ;
|
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
|
-- Adjectives
|
||||||
|
|
||||||
Definiteness = Indef | Def ;
|
Definiteness = Indef | Def ;
|
||||||
AType = AQual | ARel | AIndecl ;
|
AType = AQual | ARel | AIndecl ; -- Doesn't exactly fit with Tēzaurs system - AIndecl is not needed.
|
||||||
|
|
||||||
AForm =
|
AForm =
|
||||||
AAdj Degree Definiteness Gender Number Case
|
AAdj Degree Definiteness Gender Number Case
|
||||||
@@ -27,7 +27,7 @@ param
|
|||||||
-- Verbs
|
-- Verbs
|
||||||
|
|
||||||
Voice = Act | Pass ;
|
Voice = Act | Pass ;
|
||||||
Conjugation = C2 | C3 ; -- C1 - "irregular" verbs
|
Conjugation = C2 | C3 | C1 | CI ; -- C1 - "irregular" verbs ; ammended for Tēzaurs.
|
||||||
|
|
||||||
-- Verb moods:
|
-- Verb moods:
|
||||||
-- Ind - indicative
|
-- Ind - indicative
|
||||||
|
|||||||
@@ -18,7 +18,8 @@ lin
|
|||||||
|
|
||||||
ImpVP vp = { s = \\pol,num => vp.v.s ! pol ! (VImp num) ++ vp.compl ! (AgrP2 num Masc) } ;
|
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 = {
|
AdvSlash slash adv = {
|
||||||
s = \\m,p => slash.s ! m ! p ++ adv.s ;
|
s = \\m,p => slash.s ! m ! p ++ adv.s ;
|
||||||
|
|||||||
@@ -182,18 +182,17 @@ lin
|
|||||||
|
|
||||||
-- VPSlash -> NP -> VP
|
-- VPSlash -> NP -> VP
|
||||||
-- e.g. 'love it'
|
-- e.g. 'love it'
|
||||||
ComplSlash vpslash np =
|
{- ComplSlash vpslash np =
|
||||||
let agr : Agreement = np.agr in {
|
let agr : Agreement = np.agr in {
|
||||||
v = vpslash.v ;
|
v = vpslash.v ;
|
||||||
{-
|
-- compl = \\agr => case vpslash.voice of {
|
||||||
compl = \\agr => case vpslash.voice of {
|
-- Act => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ;
|
||||||
Act => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ;
|
-- Pass => case vpslash.rightVal.c ! (fromAgr agr).num of {
|
||||||
Pass => case vpslash.rightVal.c ! (fromAgr agr).num of {
|
-- Nom => np.s ! (vpslash.rightVal.c ! Sg) ;
|
||||||
Nom => np.s ! (vpslash.rightVal.c ! Sg) ;
|
-- _ => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num)
|
||||||
_ => vpslash.rightVal.s ++ np.s ! (vpslash.rightVal.c ! (fromAgr agr).num)
|
-- }
|
||||||
}
|
-- } ++ vpslash.compl ! agr ;
|
||||||
} ++ vpslash.compl ! agr ;
|
|
||||||
-}
|
|
||||||
compl = \\agr => vpslash.rightVal.s ++
|
compl = \\agr => vpslash.rightVal.s ++
|
||||||
np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ++
|
np.s ! (vpslash.rightVal.c ! (fromAgr agr).num) ++
|
||||||
vpslash.compl ! agr ;
|
vpslash.compl ! agr ;
|
||||||
@@ -203,7 +202,7 @@ lin
|
|||||||
rightPol = np.pol ;
|
rightPol = np.pol ;
|
||||||
objPron = np.isPron ;
|
objPron = np.isPron ;
|
||||||
rightVal = vpslash.rightVal
|
rightVal = vpslash.rightVal
|
||||||
} ;
|
} ; -} -- FIX ME tmp comment
|
||||||
|
|
||||||
-- VV -> VPSlash -> VPSlash
|
-- VV -> VPSlash -> VPSlash
|
||||||
-- e.g. 'want to buy'
|
-- e.g. 'want to buy'
|
||||||
@@ -220,7 +219,7 @@ lin
|
|||||||
|
|
||||||
-- V2V -> NP -> VPSlash -> VPSlash
|
-- V2V -> NP -> VPSlash -> VPSlash
|
||||||
-- e.g. '-- beg me to buy'
|
-- 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))
|
(\\_ => v2v.rightVal.s ++ np.s ! (v2v.rightVal.c ! (fromAgr np.agr).num))
|
||||||
{
|
{
|
||||||
v = v2v ;
|
v = v2v ;
|
||||||
@@ -231,7 +230,7 @@ lin
|
|||||||
rightPol = np.pol ;
|
rightPol = np.pol ;
|
||||||
objPron = np.isPron ;
|
objPron = np.isPron ;
|
||||||
rightVal = v2v.rightVal
|
rightVal = v2v.rightVal
|
||||||
} ;
|
} ; -} -- FIX ME tmp comment
|
||||||
|
|
||||||
-- Other ways of forming verb phrases
|
-- Other ways of forming verb phrases
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user