1
0
forked from GitHub/gf-rgl

Merge pull request #229 from inariksit/persian

Fixes in Persian: Prep, Subj, N2, N3, typos
This commit is contained in:
Inari Listenmaa
2019-04-26 12:57:12 +02:00
committed by GitHub
8 changed files with 53 additions and 25 deletions

View File

@@ -16,7 +16,12 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
AdAdv ada adv = { s = ada.s ++ adv.s} ;
-- SubjS = cc2 ;
SubjS sub snt = {s = sub.s ++ conjThat ++ snt.s ! sub.compl} ;
SubjS sub snt = {
s = case sub.relpron of {
Ke => sub.s ++ conjThat ++ snt.s ! sub.compl ;
Ance => "آنچه" ++ snt.s ! sub.compl }
} ;
AdnCAdv cadv = {s = cadv.s ++ "از"} ;
}

View File

@@ -71,8 +71,12 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
Conj = {s1,s2 : Str ; n : Number} ;
-----b Conj = {s : Str ; n : Number} ;
-----b DConj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str ; compl : VVForm} ; -- subjunctive or indicative
VS = ResPes.Verb ** {compl : VVForm} ; -- subjunctive or indicative
Subj = {
s : Str ;
compl : VVForm ; -- subjunctive or indicative
relpron : RelPron -- choose between که and آنچه
} ;
VS = ResPes.Verb ** {compl : VVForm} ; -- subjunctive or indicative
Prep = Compl ;
---- Open lexical classes, e.g. Lexicon
V, VQ = ResPes.Verb ;
@@ -86,8 +90,8 @@ concrete CatPes of Cat = CommonX ** open ResPes, Prelude in {
N = ResPes.Noun ;
N2 = ResPes.Noun ** {c2 : Str ; compl : Str}; -- when N3 is made to N2, need to retain compl
N3 = ResPes.Noun ** {c2 : Str ; c3 : Str} ;
N2 = ResPes.Noun ** {c2 : Compl ; compl : Str}; -- when N3 is made to N2, need to retain compl
N3 = ResPes.Noun ** {c2 : Compl ; c3 : Compl} ;
PN = {s : Str ; animacy : Animacy} ;
}

View File

@@ -65,7 +65,7 @@ concrete LexiconPes of Lexicon = CatPes **
cow_N = mkN01 "گاو" animate;
die_V = mkV "مردن" "میر" ;
dirty_A = mkA "کثیف" ;
distance_N3 = (mkN "فاصله" "فواصل" inanimate ) ** {c2="از" ; c3 = "تا"};
distance_N3 = mkN3 (mkN "فاصله" "فواصل" inanimate ) "از" "تا" ;
doctor_N = mkN01 "دکتر" animate; -- has variant "پزشک", but only a doctor in medicine
dog_N = mkN01 "سگ" animate;
door_N = mkN01 "در" inanimate;

View File

@@ -25,6 +25,10 @@ oper
-- fatha : Str = "َ" ;
kasre,fatha : Str = [] ;
-- for appComp
-- runtimeKasre : Str -> Str = \s -> glue s kasre ;
runtimeKasre : Str -> Str = \s -> s ;
---- Nouns
param
@@ -316,7 +320,7 @@ oper
haveVerb : Verb = haveRegV ** {s = table {
ImpPrefix _ => [] ;
VAor Neg agr => imperfectSuffix agr (addN "دار") ;
VAor Neg agr => imperfectSuffixD agr (addN "دار") ;
VSubj pol agr => haveRegV.s ! VPerf pol agr ;
vf => haveRegV.s ! vf }
} where { haveRegV = mkVerb "داشتن" "دار" } ;

View File

@@ -119,14 +119,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ;
ComplN2 n2 np = n2 ** {
s = \\n,m => n2.s ! n ! Ezafe ;
compl = \\_ => n2.compl ++ n2.c2 ++ np2str np ;
s = \\n,m => n2.s ! n ! n2.c2.mod ;
compl = \\_ => n2.compl ++ n2.c2.s ++ np2str np ;
hasAdj = False
};
ComplN3 n3 np = n3 ** {
s = \\n,m => n3.s ! n ! Ezafe ;
compl = n3.c2 ++ np2str np ;
s = \\n,m => n3.s ! n ! n3.c2.mod ;
compl = n3.c2.s ++ np2str np ;
c = n3.c3;
} ;

View File

@@ -72,7 +72,7 @@ lin pot3plus n m = {
} ;
-}
D_0 = mkDig "0" ;
D_1 = mk3Dig "1" "" Pl;
D_1 = mk3Dig "1" "" Sg ;
D_2 = mk2Dig "2" "";
D_3 = mk2Dig "3" "سوم" ;
D_4 = mkDig "4" ;

View File

@@ -42,11 +42,13 @@ oper
} ;
mkN2 : overload {
mkN2 : (key : N) -> (to : Str) -> N2 -- Takes a noun and a complementiser, returns a N2.
mkN2 : (key : N) -> (to : Str) -> N2 ; -- Takes a noun and a complementiser as a string, returns a N2.
mkN2 : (key : N) -> (to : Prep) -> N2 -- Takes a noun and a complementiser as a Prep, returns a N2.
} ;
mkN3 : overload {
mkN3 : (distance : N) -> (from,to : Str) -> N3 -- Takes a noun and two complementisers, returns a N3.
mkN3 : (distance : N) -> (from,to : Str) -> N3 ; -- Takes a noun and two complementisers as strings, returns a N3.
mkN3 : (distance : N) -> (from,to : Prep) -> N3 -- Takes a noun and two complementisers as Preps, returns a N3.
} ;
-- Compound Nouns
@@ -124,7 +126,7 @@ oper
mkV3 = overload {
mkV3 : Str -> V3 -- Predictable V3, را for direct object, no prepositions.
= \s -> lin V3 (regV s ** {c2 = prepOrRa "را" ; c3 = prepOrRa []}) ;
= \s -> lin V3 (regV s ** {c2 = prepOrRa "را" ; c3 = noPrep}) ;
mkV3 : V -> (dir,indir : Str) -> V3 -- Takes a verb and two prepositions or را as strings (can be empty).
= \v,p,q -> lin V3 (v ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ;
mkV3 : V -> (dir,indir : Prep) -> V3 -- Takes a verb and two prepositions
@@ -140,9 +142,9 @@ oper
mkVA = overload {
mkVA : Str -> VA -- predictable verb with adjective complement
= \s -> lin VA (regV s ** {c2 = prepOrRa []}) ;
= \s -> lin VA (regV s ** {c2 = noPrep}) ;
mkVA : V -> VA -- VA out of a verb
= \v -> lin VA (v ** {c2 = prepOrRa []}) ;
= \v -> lin VA (v ** {c2 = noPrep}) ;
mkVA : V -> Prep -> VA -- VA out of a verb and preposition
= \v,p -> lin VA (v ** {c2 = p}) ;
} ;
@@ -214,9 +216,9 @@ oper
mkSubj = overload {
mkSubj : Str -> Subj -- Takes its verbal complement in indicative.
= \s -> lin Subj {s=s ; compl=indicative} ;
= \s -> mkSubj' s ;
mkSubj : VVForm -> Str -> Subj -- Specify whether it takes complement in subjunctive or indicative.
= \vvf,s -> lin Subj {s=s ; compl=vvf}
= \vvf,s -> mkSubj' s ** {compl=vvf}
} ;
mkInterj : Str -> Interj
@@ -246,6 +248,13 @@ oper
Mod = ResPes.Mod ;
ezafe = ResPes.Ezafe ;
mkSubj' : Str -> Subj ;
mkSubj' s = lin Subj (case s of {
"آن" => {s = [] ; relpron = Ance ; compl = indicative} ;
_ => {s = s ; relpron = Ke ; compl = indicative}
}) ;
-- Removed mkV_1, mkV_2, mkN01 and mkN02 from public API, still available for
-- any applications that open ParadigmsPes. /IL 2019-02-08
mkV_1 : Str -> V
@@ -360,25 +369,29 @@ oper
"را" => {s = [] ; ra = "را" ; mod=Bare} ;
prep => {s = prep ; ra = []; mod=Bare}
} ;
noPrep = prepOrRa [] ;
ezafePrep = {s = [] ; ra = [] ; mod=Ezafe} ;
mkPost : Str -> Prep = \s -> lin Prep {s=[] ; ra=s ; mod=Bare} ;
mkN2 = overload {
mkN2 : Str -> N2 -- Predictable N2 without complement
= \s -> lin N2 (mkN01 s inanimate ** {c2,compl = []}) ;
= \s -> lin N2 (mkN01 s inanimate ** {c2 = ezafePrep ; compl = []}) ;
mkN2 : N -> N2 -- N2 from without complement
= \n -> lin N2 (n ** {c2,compl = []}) ;
= \n -> lin N2 (n ** {c2 = ezafePrep ; compl = []}) ;
mkN2 : N -> Str -> N2
= \n,c -> lin N2 (n ** {c2 = c ; compl = []}) ;
= \n,c -> lin N2 (n ** {c2 = prepOrRa c ; compl = []}) ;
mkN2 : N -> Prep -> Str -> N2 -- hidden from puclic API
= \n,p,c -> lin N2 (n ** {c2 = p.s; compl = []})
= \n,p,c -> lin N2 (n ** {c2 = p; compl = []})
} ;
mkN3 = overload {
mkN3 : N -> Str -> Str -> N3
= \n,p,q -> lin N3 (n ** {c2 = prepOrRa p ; c3 = prepOrRa q}) ;
mkN3 : N -> Prep -> Prep -> N3
= \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ;
mkN3 : N -> Prep -> Str -> Str -> N3 -- hidden from public API
= \n,p,q,r -> lin N3 (n ** {c2 = p.s ; c3 = q ; c4 = r}) -- there is no c4
= \n,p,q,r -> lin N3 (n ** {c2 = p ; c3 = prepOrRa q ; c4 = r}) -- there is no c4
} ;

View File

@@ -149,7 +149,9 @@ oper
-- VP complementation
---------------------
appComp : Compl -> (Mod=>Str) -> Str = \c2,obj ->
c2.s ++ obj ! c2.mod ++ c2.ra ;
case c2.mod of {
Ezafe => runtimeKasre c2.s ++ obj ! Bare ++ c2.ra ;
_ => c2.s ++ obj ! c2.mod ++ c2.ra } ;
insertComp : (Agr => Str) -> VPH -> VPH = \obj,vp -> vp ** {
comp = \\a => vp.comp ! a ++ obj ! a