1
0
forked from GitHub/gf-rgl

Merge remote-tracking branch 'upstream/master' into por-ter-aux

This commit is contained in:
odanoburu
2019-02-21 12:02:05 -03:00
34 changed files with 85568 additions and 206 deletions

View File

@@ -29,7 +29,7 @@ concrete IdiomAra of Idiom = CatAra ** open
-- : NP -> Cl ; -- there is a house
ExistNP np =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (UseComp (CompNP np)) ; -- IL
predVP (indeclNP "هُنَاكَ" Sg) (UseComp (CompNP np)) ; -- IL
-- : IP -> QCl ; -- which houses are there
ExistIP ip = let cl = ExistNP (ip2np ip False) in {
@@ -40,7 +40,7 @@ concrete IdiomAra of Idiom = CatAra ** open
-- : NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv =
predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (AdvVP (UseComp (CompNP np)) adv) ; -- IL
predVP (indeclNP "هُنَاكَ" Sg) (AdvVP (UseComp (CompNP np)) adv) ; -- IL
-- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris

View File

@@ -393,8 +393,8 @@ oper
mkPN : N -> PN = \x -> lin PN {s = x.s ! Sg ; g = x.g} ;
} ;
mk4A a b c d = mk5A a a b c d ;
mk5A a b c d e = compADeg {s = \\_ => (mkAdj' a b c d e).s ; isPre = False ; copTyp = serCopula ; lock_A = <>} ;
mk4A masc fem mascpl aa = mk5A masc masc fem mascpl aa ;
mk5A masc masc fem mascpl aa = compADeg {s = \\_ => (mkAdj' masc masc mascpl fem aa).s ; isPre = False ; copTyp = serCopula ; lock_A = <>} ;
regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; copTyp = serCopula ; lock_A = <>} ;
prefA a = {s = a.s ; isPre = True ; copTyp = a.copTyp ; lock_A = <>} ;
adjCopula a cop = a ** {copTyp = cop} ;

View File

@@ -7,14 +7,14 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseComparA a = a;
ComparA a np = {
s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! NPC bEzafa ;
s =\\ez => a.s ! ez ++ "تر" ++ "از" ++ np.s ! Bare ;
adv = a.adv
} ;
---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ;
s =\\ez => np.s ! Bare ++ a.c2 ++ a.s ! ez ;
adv = a.adv
} ;
@@ -36,7 +36,7 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseA2 a = a ;
CAdvAP cadv ap np = {
s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ;
s =\\ez => cadv.s ++ np.s ! Bare ++ ap.s ! ez ;
adv = ap.adv
};

View File

@@ -2,16 +2,16 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
flags coding = utf8;
lin
-- PositAdvAdj a = {s = a.s ! bEzafa } ;
-- PositAdvAdj a = {s = a.s ! Bare } ;
PositAdvAdj a = {s = a.adv } ;
ComparAdvAdj cadv a np = {
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ;
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! Bare ;
} ;
ComparAdvAdjS cadv a s = {
s = a.adv ++ cadv.p ++ cadv.s ++ s.s;
} ;
PrepNP prep np = {s = prep.s ++ np.s ! NPC bEzafa } ;
PrepNP prep np = {s = prep.s ++ np.s ! Bare } ;
AdAdv ada adv = { s = ada.s ++ adv.s} ;

View File

@@ -1,4 +1,4 @@
--# -path=.:../abstract:../common:../prelude
--# -path=.:alltenses:prelude:../api:../common
concrete AllPes of AllPesAbs =
LangPes,

View File

@@ -62,7 +62,7 @@ concrete CatPes of Cat = CommonX - [Adv] ** open ResPes, Prelude in {
Num = {s : Str ; n : Number ; isNum : Bool} ;
Card = {s : Str; n : Number} ;
Ord = {s : Str; n : Number ; isNum : Bool} ;
Quant = {s: Number => Str ; a:Agr ; fromPron : Bool};
Quant = {s: Number => Str ; a:Agr ; mod : Mod};
Art = {s : Str} ;
---- Numeral

View File

@@ -12,12 +12,12 @@ concrete ConjunctionPes of Conjunction =
ConjAdv = conjunctDistrSS ;
-- ConjAdv conj advs = conjunctDistrTable Gender conj advs ;
ConjNP conj ss = ss ** conjunctDistrTable NPCase conj ss ** {
ConjNP conj ss = ss ** conjunctDistrTable Mod conj ss ** {
a = conjAgr (agrP3 conj.n) ss.a ;
animacy = ss.animacy ;
} ;
ConjAP conj ss = conjunctDistrTable Ezafa conj ss ** {adv = ss.adv};
ConjAP conj ss = conjunctDistrTable Mod conj ss ** {adv = ss.adv};
ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c};
---- These fun's are generated from the list cat's.
@@ -28,19 +28,19 @@ concrete ConjunctionPes of Conjunction =
-- BaseAdv x y = twoTable Gender x y ;
ConsAdv = consrSS comma ;
-- ConsAdv xs x = consrTable Gender comma xs x ;
BaseNP x y = y ** twoTable NPCase x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy
BaseNP x y = y ** twoTable Mod x y ** {a = conjAgr x.a y.a ; animacy = y.animacy } ; -- check animacy
BaseRS x y = twoTable Agr x y ** {c = x.c};
ConsNP xs x = xs ** consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ;
ConsNP xs x = xs ** consrTable Mod comma xs x ** {a = conjAgr xs.a x.a ; animacy = xs.animacy } ; -- InaandB xs.animacy x.animacy} ;
ConsRS xs x = consrTable Agr comma xs x ** { c = xs.c};
-- BaseAP x y = twoTable3 Number Gender Case x y ; -- ** {isPre = andB x.isPre y.isPre} ;
BaseAP x y = twoTable Ezafa x y ** {adv = x.adv};
ConsAP xs x = consrTable Ezafa comma xs x ** {adv = x.adv}; -- Table3 Number Gender Case comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ;
BaseAP x y = twoTable Mod x y ** {adv = x.adv};
ConsAP xs x = consrTable Mod comma xs x ** {adv = x.adv}; -- Table3 Number Gender Case comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NPCase => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
[AP] = {s1,s2 : Ezafa => Str ; adv : Str} ;
[NP] = {s1,s2 : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
[AP] = {s1,s2 : Mod => Str ; adv : Str} ;
[RS] = {s1,s2 : Agr => Str };
}

View File

@@ -0,0 +1,88 @@
--# -path=.:abstract:prelude:api:common
concrete ConstructionPes of Construction = CatPes ** open
Prelude,
ParadigmsPes,
(P=ParadigmsPes),
SyntaxPes,
(S=SyntaxPes),
SymbolicPes,
StructuralPes,
(E=ExtendPes),
(R=ResPes),
(L=LexiconPes) in {
lincat
Timeunit = N ;
Weekday = N ;
Monthday = NP ;
Month = N ;
Year = NP ;
Language = N ;
lin
weekdayN w = w ;
monthN m = m ;
-- weekdayPN w = mkPN w ;
-- monthPN m = mkPN m ;
timeunitAdv n time =
let n_card : Card = n ;
n_hours_NP : NP = mkNP n_card time ;
in S.mkAdv during_Prep n_hours_NP ; ---- /IL
weekdayPunctualAdv w = lin Adv (S.mkUtt (mkNP w)) ; -- on Sunday
-- TODO
weekdayHabitualAdv, -- on Sundays
weekdayNextAdv, -- next Sunday
weekdayLastAdv = weekdayPunctualAdv ; -- last Sunday
monthAdv january =
let january_NP : NP = mkNP january ;
in S.mkAdv in_Prep january_NP ;
yearAdv y = S.mkAdv in_Prep y ;
intYear = symb ;
intMonthday = symb ;
languageCN l = mkCN l ;
languageNP l = mkNP l ;
InLanguage l = S.mkAdv in_Prep (mkNP l) ;
english_Language = mkLanguage "انگلیسی" ;
finnish_Language = mkLanguage "فنلاند" ;
swedish_Language = mkLanguage "سوئدی" ;
arabicLanguage = mkLanguage "عربی" ;
finnishLanguage = mkLanguage "فنلاندی" ;
frenchLanguage = mkLanguage "فرانسوی" ;
persianLanguage = mkLanguage "فارسی" ;
romanianLanguage = mkLanguage "رومانیایی" ;
polishLanguage = mkLanguage "لهستانی" ;
bulgarianLanguage = mkLanguage "بلغاری" ;
somaliLanguage = mkLanguage "سومالیایی" ;
turkishLanguage = mkLanguage "ترکی" ;
kurdishLanguage = mkLanguage "کردی" ;
-- : Card -> CN -> A -> AP
n_units_AP card cn a =
let ap = mkAP a in ap ** {
s = \\ez =>
ap.s ! ez
++ (mkUtt (mkNP card cn)).s ---- just guessing /IL
} ;
hungry_VP = mkVP (mkA "گرسنه") ;
thirsty_VP = mkVP (mkA "تشنه") ;
have_name_Cl p n = mkCl (mkNP (E.GenNP p) L.name_N) n ;
what_name_QCl p = mkQCl what_IAdv (mkNP (E.GenNP p) L.name_N) ;
how_old_QCl p = mkQCl howMuchAge_IAdv (mkNP (mkNP (E.GenNP p)) (P.mkAdv "سال")) ;
oper
howMuchAge_IAdv = lin IAdv {s = "چند"} ;
what_IAdv = lin IAdv {s = "چه چیزی"} ;
mkLanguage : Str -> N = mkN ;
}

View File

@@ -10,8 +10,8 @@ concrete ExtendPes of Extend =
lin
-- NP -> Quant ; -- this man's
GenNP np = np ** {
s = \\num => np.s ! NPC bEzafa ; -- the possessed will get aEzafa, possesser is just unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/
fromPron = True -- not necessarily from Pron, but it should come after the noun, and if fromPron=True, then DetCN places determiner after cn.
mod = Ezafe ; -- the possessed will get Ezafe
s = \\num => np.s ! Bare -- possesser is unmarked; https://sites.la.utexas.edu/persian_online_resources/language-specific-grammar/ezfe/
} ;
}

View File

@@ -4,7 +4,7 @@ concrete ExtraPes of ExtraPesAbs = CatPes **
flags coding = utf8;
lin
GenNP np = {s = \\_ => np.s ! NPC aEzafa ; a = np.a ; fromPron = True} ; -- changed from fromPron=False for Phrasebook
GenNP np = {s = \\_ => np.s ! Ezafe ; a = np.a ; mod = Ezafe} ; -- changed from mod=False for Phrasebook
-- each_Det = mkDet "هر کwی" "هر کwی" "هر کwی" "هر کwی" Sg ;
-- have_V = mkV "رکh-ن";

View File

@@ -9,7 +9,7 @@ lin
GenericCl vp = mkSClause "آدم" (agrP3 Sg) vp ;
CleftNP np rs =
let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe);
let cl = mkSClause (np.s ! Bare) (np.a) (predAux auxBe);
in
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
@@ -17,7 +17,7 @@ lin
ExistNP np =
mkSClause " " (agrP3 (fromAgr np.a).n)
(insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ;
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
ExistIP ip =
let cl = mkSClause ( ip.s ) (agrP3 ip.n) (predAux auxBe);
@@ -32,7 +32,7 @@ lin
ProgrVP vp = predProg vp ;
ImpPl1 vp = {s = "بیایید" ++ vp.s ! VVForm (agrP1 Pl)} ;
ImpP3 np vp = {s = "بگذارید" ++ np.s!NPC bEzafa ++ vp.s ! VVForm np.a};
ImpP3 np vp = {s = "بگذارید" ++ np.s!Bare ++ vp.s ! VVForm np.a};
}

View File

@@ -1,10 +1,7 @@
--# -path=.:../abstract:../common
--# -path=.:alltenses:prelude:../api:../common
concrete LangPes of Lang =
GrammarPes
,LexiconPes
** {
flags startcat = Phr ; unlexer=unwords ; lexer=words ;
}
,ConstructionPes
** {} ;

View File

@@ -188,7 +188,7 @@ concrete LexiconPes of Lexicon = CatPes **
switch8off_V2 = mkV2 (compoundV "خاموش" doVerb) "را";
switch8on_V2 = mkV2 (compoundV "روشن" doVerb) "را";
table_N = mkN01 "میز" inanimate;
talk_V3 = mkV3 (compoundV "حرف" hitVerb) "با" [" درباره ی"];
talk_V3 = mkV3 (compoundV "حرف" hitVerb) "با" "دربارۀ";
teacher_N = mkN02 "معلم" animate;
teach_V2 = mkV2 (compoundV "آموزش" giveVerb) "را";
television_N = mkN01 "تلوزیون" inanimate;
@@ -202,18 +202,18 @@ concrete LexiconPes of Lexicon = CatPes **
understand_V2 = mkV2 (mkV_1 "فهمیدن") "را";
university_N = mkN01 "دانشگاه" inanimate;
village_N = mkN01 "روستا" inanimate;
-- wait_V2 = mkV2 (compoundV "منتظر" (mkVToBe "بودن" "باش"));
wait_V2 = mkV2 (compoundV "منتظر" beVerb);
walk_V = compoundV "راه" (mkV "رفتن" "رو");
warm_A = mkA "گرم" ;
war_N = mkN01 "جنگ" inanimate;
-- watch_V2 = mkV2 (compoundV "مراقب" (mkVToBe "بودن" "باش")); -- check harfe rabt!!!
watch_V2 = mkV2 (compoundV "مراقب" beVerb); -- check harfe rabt!!!
water_N = mkN01 "آب" inanimate;
white_A = mkA "سفید" ;
window_N = mkN01 "پنجره" inanimate;
wine_N = mkN01 "شراب" inanimate;
win_V2 = mkV2 (compoundV "برنده" (mkV "شدن" "شو")) "را"; -- also possible with simple verb: mkV_2 "بردن"
woman_N = mkN02 "زن" animate;
-- wonder_VQ = compoundV "متعجب" (mkVToBe "بودن" "باش") ;
wonder_VQ = compoundV "متعجب" beVerb ;
wood_N = mkN01 "چوب" inanimate;
write_V2 = mkV2 (mkV "نوشتن" "نویس") "را" ;
yellow_A = mkA "زرد" ;

View File

@@ -24,7 +24,7 @@ oper
---- Nouns
param
Animacy = Animate | Inanimate ;
Ezafa = bEzafa | aEzafa | enClic ;
Mod = Bare | Ezafe | Clitic | Poss ;
Agr = Ag Number Person ;
------------------------------------------
@@ -50,17 +50,30 @@ oper
agrP1 : Number -> Agr = \n -> Ag n P1 ;
-------------------------
-- Ezafa construction
-- Ezafe construction
------------------------
oper
mkEzafa : Str -> Str = \str ->
mkPossStem : Str -> Str = \str ->
case str of {
_+ "اه" => str ;
_+ "او" => str ;
_+ "وه" => str ;
_+ ("ا"|"و") => str + "ی" ;
_+ "ه" => zwnj str "ا" ;
_ => str } ;
mkEzafe : Str -> Str = \str ->
--let kasre = "ِ" in -- TODO: Eventually use this
let kasre = "" in
case str of {
st + "اه" => str + kasre ;
st + "وه" => str + kasre ;
st + "ه" => st + "ۀ" ; -- str ++ "ی" ;
st + "ه" => zwnj str "ی" ;-- alt. st + "ۀ" ;
st + "او" => str + kasre ;
st + "وو" => str + kasre ;
st + "و" => str + "ی" ;
@@ -76,21 +89,19 @@ oper
_ => str + "ی" -- any other case: just a single ی
} ;
Noun = {s : Ezafa => Number => Str ; animacy : Animacy ; definitness : Bool } ;
Noun = {s : Number => Mod => Str ; animacy : Animacy} ;
mkN : (x1,x2 : Str) -> Animacy -> Noun = \sg,pl,ani -> {
s = table {
bEzafa => table { Sg => sg ;
Pl => pl
Sg => table {Bare => sg ;
Ezafe => mkEzafe sg ;
Clitic => mkEnclic sg ;
Poss => mkPossStem sg } ;
Pl => table {Bare => pl ;
Ezafe => mkEzafe pl ;
Clitic => mkEnclic pl ;
Poss => mkPossStem pl }
} ;
aEzafa => table { Sg => mkEzafa sg ;
Pl => mkEzafa pl
} ;
enClic => table { Sg => mkEnclic sg ;
Pl => mkEnclic pl
}
};
animacy = ani ;
definitness = True
animacy = ani
} ;
-- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e)
@@ -99,29 +110,30 @@ oper
---------------------
--Determiners
--------------------
Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; fromPron : Bool} ;
Determiner : Type = {s : Str ; n :Number ; isNum : Bool ; mod : Mod} ;
makeDet : Str -> Number -> Bool -> Determiner = \str,n,b -> {
s = str;
isNum = b;
fromPron = False ;
mod = Bare ;
n = n
};
makeQuant : Str -> Str -> {s : Number => Str ; a : Agr; fromPron : Bool } = \sg,pl -> {
makeQuant : Str -> Str -> {s : Number => Str ; a : Agr; mod : Mod } = \sg,pl -> {
s = table {Sg => sg ; Pl => pl} ;
fromPron = False ;
mod = Bare ;
a = agrP3 Sg
};
---------------------------
-- Adjectives
--------------------------
Adjective : Type = {s : Ezafa => Str ; adv : Str} ;
Adjective : Type = {s : Mod => Str ; adv : Str} ;
mkAdj : Str -> Str -> Adjective = \adj,adv -> {
s = table { bEzafa => adj;
aEzafa => mkEzafa adj ;
enClic => mkEnclic adj
s = table { Bare => adj;
Ezafe => mkEzafe adj ;
Clitic => mkEnclic adj ;
Poss => mkPossStem adj
} ;
adv = adv
};

View File

@@ -3,12 +3,12 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn = cn ** {s = \\npc =>
case <det.isNum,det.fromPron,npc> of {
<False,False,NPC ez> => det.s ++ cn.s ! ez ! det.n ; -- det is not from Pron, retain NPForm.
<False,True> => cn.s ! aEzafa ! det.n ++ det.s ; -- det is from Pron, cn is in aEzafa.
<True,False,NPC ez> => det.s ++ cn.s ! ez ! Sg ; -- noun modified by a number is invariably singular
<True,True> => cn.s ! aEzafa ! Sg ++ det.s
DetCN det cn = cn ** {s = \\mod =>
case <det.isNum,det.mod> of {
<False,Bare> => det.s ++ cn.s ! det.n ! mod ; -- det is not from Pron, retain NPForm.
<False,X> => cn.s ! det.n ! X ++ det.s ; -- det is from Pron, cn is in Ezafe.
<True,Bare> => det.s ++ cn.s ! Sg ! mod ; -- noun modified by a number is invariably singular
<True,X> => cn.s ! Sg ! X ++ det.s
} ;
a = agrP3 det.n ;
} ;
@@ -29,20 +29,20 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ;
AdvNP np adv = np ** {
s = \\ez => np.s ! NPC aEzafa ++ adv.s
s = \\ez => np.s ! Ezafe ++ adv.s
} ;
DetQuantOrd quant num ord = {
s = quant.s ! num.n ++ num.s ++ ord.s ;
isNum = orB num.isNum ord.isNum ;
fromPron = quant.fromPron ;
mod = quant.mod ;
n = num.n
} ;
DetQuant quant num = {
s = quant.s ! num.n ++ num.s;
isNum = num.isNum;
fromPron = quant.fromPron ;
mod = quant.mod ;
n = num.n
} ;
@@ -53,7 +53,7 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
animacy = Inanimate
} ;
PossPron p = {s = \\_ => p.ps ; a = p.a ; fromPron = True} ;
PossPron p = {s = \\_ => BIND ++ p.ps ; a = p.a ; mod = Poss} ;
NumSg = {s = [] ; n = Sg ; isNum = False} ;
NumPl = {s = [] ; n = Pl ; isNum = False} ;
@@ -68,17 +68,14 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
-- to here
AdNum adn num = num ** {s = adn.s ++ num.s} ;
OrdSuperl a = {s = a.s ! bEzafa ++ taryn; n = Sg ; isNum=False} ; -- check the form of adjective
OrdSuperl a = {s = a.s ! Bare ++ taryn; n = Sg ; isNum=False} ; -- check the form of adjective
DefArt = {s = \\_ => [] ; a = defaultAgr ; fromPron = False} ;
IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; fromPron = False} ;
DefArt = {s = \\_ => [] ; a = defaultAgr ; mod = Bare} ;
IndefArt = {s = table { Sg => IndefArticle ; Pl => []} ; a =defaultAgr ; mod = Bare} ;
MassNP cn = cn ** {s =\\c => case c of {
NPC bEzafa => cn.s ! bEzafa ! Sg ;
NPC aEzafa => cn.s ! aEzafa ! Sg ;
NPC enClic => cn.s ! enClic ! Sg
};
a = agrP3 Sg ;
MassNP cn = cn ** {
s = cn.s ! Sg ;
a = agrP3 Sg
} ;
UseN n = n ** {hasAdj=False};
@@ -95,29 +92,29 @@ concrete NounPes of Noun = CatPes ** open ResPes, Prelude in {
} ;
ComplN2 f x = f ** {
s = \\ez,n => f.s ! ez ! n ++ f.c ++ x.s ! NPC ez ;
s = \\n,ez => f.s ! n ! Ezafe ++ f.c ++ x.s ! ez ;
definitness = True ;
hasAdj = False ;
};
ComplN3 f x = f ** {
s = \\ez,n => f.s ! ez ! n ++ f.c2 ++ x.s ! NPC ez ;
s = \\n,ez => f.s ! n ! Ezafe ++ f.c2 ++ x.s ! ez ;
c = f.c3;
definitness = True;
} ;
AdjCN ap cn = cn ** {
s = \\ez,n => cn.s ! aEzafa ! n ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!aEzafa!n to have correct enclicitic form other wise it creats wrong enclictic form of old man
s = \\n,ez => cn.s! n! Ezafe ++ ap.s ! ez ; -- check the form of adjective and also cn.s!ez!n changed from cn.s!Ezafe!n to have correct enclicitic form other wise it creats wrong enclictic form of old man
hasAdj = True
} ;
RelCN cn rs = cn ** {
s = \\ez,n => cn.s ! enClic ! n ++ rs.s ! agrP3 n ;
s = \\n,ez => cn.s ! n! Clitic ++ rs.s ! agrP3 n ;
} ;
AdvCN cn ad = cn ** {s = \\ez,n => cn.s ! aEzafa ! n ++ ad.s} ;
AdvCN cn ad = cn ** {s = \\n,ez => cn.s ! n ! Ezafe ++ ad.s} ;
SentCN cn sc = cn ** {s = \\ez,n => cn.s ! ez ! n ++ sc.s} ;
SentCN cn sc = cn ** {s = \\n,ez => cn.s ! n ! ez ++ sc.s} ;
ApposCN cn np = cn ** {s = \\ez,n => cn.s ! ez ! n ++ np.s ! NPC aEzafa ; definitness = True} ; -- ezafa form of city to be used
ApposCN cn np = cn ** {s = \\n,ez => cn.s ! n ! ez ++ np.s ! Ezafe ; definitness = True} ; -- ezafa form of city to be used
}

View File

@@ -17,26 +17,24 @@ resource ParadigmsPes = open
oper
Animacy : Type ; -- Argument to mkN
animate : Animacy ;
inanimate : Animacy ;
animate : Animacy ; -- e.g. /mkN "خواهر" animate/ to get the plural خواهران.
inanimate : Animacy ; -- default animacy for mkN, not needed unless you want to make the animacy explicit or force a plural with ها.
Number : Type ; -- Argument to
singular : Number ;
plural : Number ;
Number : Type ; -- Argument to mkDet and mkConj
singular : Number ; -- e.g. mkConj "یا" singular
plural : Number ; -- e.g. mkConj "و" plural
--2 Nouns
mkN = overload {
mkN : (sg : Str) -> N -- Takes singular form, returns an inanimate noun with ها as the plural form
mkN : (sg : Str) -> N -- Takes singular form, returns an inanimate noun with ها as the plural form.
= \sg -> mkN01 sg inanimate ;
mkN : (sg : Str) -> Animacy -> N -- Takes singular form and animacy. Inaminate plural ها. Animate plural ان or an allomorph of it (یان or گان) depending on the singular form.
mkN : (sg : Str) -> Animacy -> N -- Takes singular form and animacy. Inanimate plural ها. Animate plural ان or an allomorph of it (یان or گان) depending on the singular form.
= \sg,ani -> case ani of {
Inanimate => mkN01 sg ani ;
Animate => mkN02 sg ani } ;
-- mkN : (sg,pl : Str) -> N -- Takes singular and plural form, returns an inanimate noun
-- = \sg,pl -> M.mkN sg pl inanimate ;
mkN : (sg,pl : Str) -> Animacy -> N -- Worst-case constructor: takes singular and plural forms and animacy. Use for e.g. loanwords with Arabic plural.
mkN : (sg,pl : Str) -> Animacy -> N -- Worst-case constructor: takes singular and plural forms and animacy. Use for e.g. loanwords with Arabic plural, or animate nouns with ها as plural.
= \sg,pl,ani -> M.mkN sg pl ani
} ;
@@ -93,9 +91,10 @@ oper
= \s1, s2 -> lin V (mkVerb s1 s2)
} ;
haveVerb : V = lin V M.haveVerb ; -- The verb "have", to be used for light verb constructions: e.g. compoundV "دوست" haveVerb. NB. this has different imperative and VV forms from StructuralPes.have_V2.
beVerb : V = lin V M.beVerb ; -- The verb "be", to be used for light verb constructions: e.g. compoundV "عاشق" beVerb.
haveVerb : V -- The verb "have", to be used for light verb constructions: e.g. compoundV "دوست" haveVerb. NB. this has different imperative and VV forms from StructuralPes.have_V2.
= lin V M.haveVerb ;
beVerb : V -- The verb "be", to be used for light verb constructions: e.g. compoundV "عاشق" beVerb.
= lin V M.beVerb ;
mkV2 : overload {
mkV2 : Str -> V2 ; -- Predictable V2 out of string. No preposition, را for direct object.
mkV2 : V -> V2 ; -- V2 out of V. No preposition, را for direct object.
@@ -103,10 +102,10 @@ oper
} ;
mkV3 : V -> Str -> Str -> V3 ; -- Takes a verb and two prepositions (can be empty), e.g. speak, with, about
mkV3 : V -> (dir,indir : Str) -> V3 ; -- Takes a verb and two prepositions as strings (can be empty). If the verb takes را for direct object, it's the first Str argument. e.g. talk, با, دربارۀ
mkV3 v p q = lin V3 (v ** {c2 = p ; c3 = q}) ;
mkV2V : V -> (cV : Str) -> (cN : Str) -> (isAux : Bool) -> V2V ; -- Verb, complementiser for the verb, complementiser for the noun, whether it's auxiliary.
mkV2V : V -> (cV, cN : Str) -> (isAux : Bool) -> V2V ; -- Verb, complementiser for the verb, complementiser for the noun, whether it's auxiliary.
mkV2V v s1 s2 b = lin V2V (v ** {isAux = b ; c1 = s1 ; c2 = s2}) ;
-- compund verbs
@@ -114,11 +113,12 @@ oper
compoundV : Str -> V -> V -- Invariable prefix to a verb, e.g. compoundV "دوست" haveVerb
} ;
invarV : Str -> V -- for verbs like " بایستن " ("must"), which don't inflect
invarV : Str -> V -- for verbs like بایستن ('must'), which don't inflect
= \s -> lin V {s = \\_ => s} ;
----2 Adverbs
mkAdv : Str -> Adv = \str -> lin Adv {s = str} ; -- Takes a string, returns an adverb.
mkAdv : Str -> Adv -- Takes a string, returns an adverb.
= \str -> lin Adv {s = str} ;
----2 Prepositions
@@ -171,7 +171,9 @@ oper
mkN01 : (sg : Str) -> Animacy -> Noun ; -- Takes singular form and animacy, forms plural with ها
mkN01 sg ani =
let pl = zwnj sg "ها" ; -- Using zero-width non-joiner, defined in ResPes
let pl : Str = case last sg of {
--"د"|"ذ"|"ر"|"ز"|"ژ" => sg + "ها" ; -- these letters are separated by default
_ => zwnj sg "ها" } ; -- Using zero-width non-joiner, defined in MorphoPes
in M.mkN sg pl ani ;
mkN02 : (sg : Str) -> Animacy -> Noun ; -- Takes singular form and animacy, pattern matches singular and forms plural with either گان, یان or ان
@@ -195,8 +197,8 @@ oper
-- Personal Pronouns
personalPN : Str -> Number -> Person -> Pron -- Hidden from public API, confusing naming. /IL
= \str,nn,p -> lin Pron {s = str ; a = Ag nn p ; ps = str};
personalPron : (nom:Str) -> (poss:Str) -> Number -> Person -> Pron -- Hidden from public API, confusing naming. /IL
= \nom,poss,nn,p -> lin Pron {s = nom ; a = Ag nn p ; ps = poss};
{-
-- Demonstrative Pronouns
demoPN : Str -> Str -> Str -> Quant =

View File

@@ -11,17 +11,17 @@ concrete PhrasePes of Phrase = CatPes ** open Prelude, ResPes in {
UttIP ip = {s = ip.s } ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! NPC bEzafa} ;
UttNP np = {s = np.s ! Bare} ;
UttVP vp = {s = vp.ad ++ vp.comp ! Ag Sg P3 ++ vp.obj.s ++ vp.inf ++ vp.vComp ! Ag Sg P3 ++ vp.embComp} ;
UttAdv adv = {s = adv.s } ;
UttCN cn = {s = cn.s ! bEzafa ! Sg };
UttCN cn = {s = cn.s ! Sg ! Bare };
UttCard n = n ;
UttAP ap = {s = ap.s ! bEzafa} ;
UttAP ap = {s = ap.s ! Bare} ;
NoPConj = {s = []} ;
PConjConj conj = {s = conj.s2} ; ---
NoVoc = {s = []} ;
VocNP np = {s = np.s ! NPC bEzafa} ;
VocNP np = {s = np.s ! Bare} ;
}

View File

@@ -32,7 +32,7 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in {
};
QuestIComp icomp np =
let cl = mkSClause (np.s ! NPC bEzafa ++ icomp.s) np.a (predAux auxBe);
let cl = mkSClause (np.s ! Bare ++ icomp.s) np.a (predAux auxBe);
in {
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! ODir;
@@ -48,7 +48,9 @@ concrete QuestionPes of Question = CatPes ** open ResPes, Prelude in {
} ;
IdetCN idet cn = {
s = case idet.isNum of {False => idet.s ++ cn.s ! bEzafa ! idet.n ; True => idet.s ++ cn.s ! bEzafa ! Sg} ;
s = case idet.isNum of {
False => idet.s ++ cn.s ! idet.n ! Bare ;
True => idet.s ++ cn.s ! Sg ! Bare} ;
n = idet.n;
} ;

View File

@@ -42,7 +42,7 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
} ;
FunRP p np rp = {
s = np.s ! NPC enClic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
s = np.s ! Clitic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
a = RAg np.a
} ;

View File

@@ -14,7 +14,6 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
Order = ODir | OQuest ;
PMood = Del | Imper | PCond ;
NPCase = NPC Ezafa ;
CardOrd = NCard | NOrd ;
RAgr = RNoAg | RAg Agr ;
-- RCase = RC Number Case ;
@@ -26,7 +25,7 @@ resource ResPes = MorphoPes ** open Prelude,Predef in {
Compl : Type = {s : Str ; ra : Str ; c : VType} ;
CN : Type = Noun ** {hasAdj : Bool} ; -- for getting the right form when NP/CN is a predicate
NP : Type = {s : NPCase => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
NP : Type = {s : Mod => Str ; a : Agr ; animacy : Animacy ; hasAdj : Bool} ;
VPHSlash : Type = VPH ** {c2 : Compl} ;
oper
@@ -191,8 +190,8 @@ oper
conjThat : Str = "که" ;
{- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of {
True => np.s ! NPC Obl;
False => np.s ! NPC Obl ++ str} ;
True => np.s ! Obl;
False => np.s ! Obl ++ str} ;
insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> vp ** {
embComp = vp.embComp ++ emb;
@@ -248,7 +247,7 @@ oper
quest = table
{ ODir => [];
OQuest => "آیا" } ;
subj = np.s ! NPC bEzafa ;
subj = np.s ! Bare ;
vp = \\vt,b,ord =>
let vps = clTable vp ! np.a ! vt ! b
in vp.ad ++ vp.comp ! np.a ++ vp.obj.s ++ vps ++ vp.vComp ! np.a ++ vp.embComp
@@ -361,8 +360,8 @@ taryn = "ترین" ;
-----------------------------
-- Noun Phrase
-----------------------------
{-toNP : Str -> Str = \pn, npc -> case npc of {
NPC c => pn ! c ;
{-toNP : Str -> Str = \pn, -> case of {
c => pn ! c ;
NPObj => pn ! Dir ;
NPErg => pn ! Obl
} ;

View File

@@ -32,7 +32,7 @@ concrete StructuralPes of Structural = CatPes **
-- first_Ord = {s = "اولین" ; n = Sg} ; --DEPRECATED
for_Prep = ss "برای" ;
from_Prep = ss "از" ;
he_Pron = personalPN "او" Sg P3 ;
he_Pron = personalPron "او" "ش" Sg P3 ;
here_Adv = ss "اینجا" ;
here7to_Adv = ss "اینجا" ;
here7from_Adv = ss "اینجا" ;
@@ -41,9 +41,9 @@ concrete StructuralPes of Structural = CatPes **
how8much_IAdv = ss "چقدر" ;
if_Subj = ss "اگر" ;
in8front_Prep = ss "جلوی" ;
i_Pron = personalPN "من" Sg P1;
i_Pron = personalPron "من" "م" Sg P1;
in_Prep = ss "در" ;
it_Pron = personalPN "آن" Sg P3;
it_Pron = personalPron "آن" "ش" Sg P3;
less_CAdv = {s = "کمتر" ; p = ""} ;
many_Det = mkDet ["تعداد زیادی"] Pl True; -- check
more_CAdv = {s = "بیشتر" ; p = "" } ;
@@ -75,7 +75,7 @@ concrete StructuralPes of Structural = CatPes **
please_Voc = ss "لطفاً" ;
possess_Prep = ss "" ; -- will be handeled in Ezafeh
quite_Adv = ss "کاملاً" ;
she_Pron = personalPN "او" Sg P3 ;
she_Pron = personalPron "او" "ش" Sg P3 ;
so_AdA = ss "بسیار" ;
-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "کwی" ));
someSg_Det = mkDet "مقداری" Sg True ;
@@ -88,7 +88,7 @@ concrete StructuralPes of Structural = CatPes **
there7to_Adv = ss "آنجا" ;
there7from_Adv = ss "آنجا" ;
therefore_PConj = ss ["به همین دلیل"] ;
they_Pron = personalPN ["آن ها"] Pl P3 ;
they_Pron = personalPron "آن ها" "شان" Pl P3 ;
this_Quant = mkQuant "این" "این" ;
through_Prep = ss ["از طریق"] ;
too_AdA = ss "خیلی" ;
@@ -96,7 +96,7 @@ concrete StructuralPes of Structural = CatPes **
under_Prep = ss "زیر" ** {lock_Prep = <>};
very_AdA = ss "خیلی" ;
want_VV = mkV "خواستن" "خواه" ** { isAux = False} ;
we_Pron = personalPN "ما" Pl P1 ;
we_Pron = personalPron "ما" "مان" Pl P1 ;
whatSg_IP = {s = ["چه چیزی"] ; n = Sg } ;
whatPl_IP = {s = ["چه چیزهایی"] ; n = Pl } ;
when_IAdv = ss "کی" ;
@@ -112,9 +112,9 @@ concrete StructuralPes of Structural = CatPes **
with_Prep = ss "با";
-- yes_Phr = ss "بله" ;
yes_Utt = ss "بله" ;
youSg_Pron = personalPN "تو" Sg P2 ;
youPl_Pron = personalPN "شما" Pl P2 ;
youPol_Pron = personalPN "شما" Pl P2 ;
youSg_Pron = personalPron "تو" "ت" Sg P2 ;
youPl_Pron = personalPron "شما" "تان" Pl P2 ;
youPol_Pron = personalPron "شما" "تان" Pl P2 ;
-- no_Quant = demoPN "هیچ" ;
not_Predet = {s="نه"} ;
if_then_Conj = sd2 "اگر" "آنگاه" ** {n = Sg} ;

View File

@@ -11,15 +11,15 @@ concrete SymbolPes of Symbol = CatPes ** open Prelude, ResPes in {
FloatPN i = {s = i.s ; animacy = Inanimate} ;
NumPN i = {s = i.s ; animacy = Inanimate} ;
CNIntNP cn i = cn ** {
s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ;
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
a = agrP3 Sg
} ;
CNSymbNP det cn xs = cn ** {
s = \\ez => det.s ++ cn.s ! aEzafa ! det.n ++ xs.s ;
s = \\ez => det.s ++ cn.s ! det.n ! Ezafe ++ xs.s ;
a = agrP3 det.n
} ;
CNNumNP cn i = cn ** {
s = \\ez => cn.s ! aEzafa ! Sg ++ i.s ;
s = \\ez => cn.s ! Sg ! Ezafe ++ i.s ;
a = agrP3 Sg
} ;

View File

@@ -7,28 +7,28 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
UseV v = predV v ;
SlashV2a v = predV v ** {c2 = {s = v.c2.s ; ra = v.c2.ra ; c = VTrans}} ;
Slash2V3 v np =
insertObjc (\\_ => np.s ! NPC bEzafa ++ v.c2 ) (predV v ** {c2 = {s = [] ; ra = v.c3 ; c = VTrans}}) ;
insertObjc (\\_ => np.s ! Bare ++ v.c2 ) (predV v ** {c2 = {s = [] ; ra = v.c3 ; c = VTrans}}) ;
Slash3V3 v np =
insertObjc (\\_ => v.c3 ++ np.s ! NPC bEzafa) (predV v ** {c2 = {s = [] ; ra = v.c2 ; c = VTrans}}) ;
insertObjc (\\_ => v.c3 ++ np.s ! Bare) (predV v ** {c2 = {s = [] ; ra = v.c2 ; c = VTrans}}) ;
ComplVV v vp = insertVV (infVV v.isAux vp).s (predV v) ;
ComplVS v s = insertObj2 (conjThat ++ s.s) (predV v) ;
ComplVQ v q = insertObj2 (conjThat ++ q.s ! QIndir) (predV v) ;
ComplVA v ap = insertObj (\\_ => ap.s ! bEzafa) (predV v) ; -- check form of adjective
ComplVA v ap = insertObj (\\_ => ap.s ! Bare) (predV v) ; -- check form of adjective
SlashV2V v vp = insertVV (infVV v.isAux vp).s (predV v) **{c2 = {s = v.c1 ; ra = [] ; c = VTransPost}} ;
SlashV2S v s = insertObjc2 (conjThat ++ s.s) (predV v ** {c2 = {s = v.c2.s ;ra = [] ; c = VTransPost}}) ;
SlashV2Q v q = insertObjc2 ( q.s ! QIndir) (predV v ** {c2 = {s = v.c2.s ; ra = [] ;c = VTransPost}}) ;
SlashV2A v ap = insertObjc3 ( ap.s ! bEzafa) (predV v ** {c2 = {s = [] ; ra = v.c2.ra ;c = VTransPost}}) ; ---- paint it red , check form of adjective
SlashV2A v ap = insertObjc3 ( ap.s ! Bare) (predV v ** {c2 = {s = [] ; ra = v.c2.ra ;c = VTransPost}}) ; ---- paint it red , check form of adjective
ComplSlash vp np = insertObjPre (\\_ => np.s ! NPC bEzafa ) vp ;
ComplSlash vp np = insertObjPre (\\_ => np.s ! Bare ) vp ;
SlashVV vv vp =
-- insertObj (infVV vv.isAux vp).s (predV vv) **
insertVV (infVV vv.isAux vp).s (predV vv) **
{c2 = vp.c2} ;
SlashV2VNP vv np vp =
insertObjPre (\\_ => np.s ! NPC bEzafa )
insertObjPre (\\_ => np.s ! Bare )
-- (insertObjc (infVV vv.isAux vp).s (predVc vv)) **
(insertVVc (infVV vv.isAux vp).s (predVc vv)) **
{c2 = vp.c2} ;
@@ -40,21 +40,22 @@ concrete VerbPes of Verb = CatPes ** open ResPes,Prelude in {
AdVVP adv vp = insertAdV adv.s vp ;
ReflVP v = insertObjPre (\\a => reflPron ! a) v ;
PassV2 v = predV v ; -- need to be fixed
CompAP ap ={s = \\_ => ap.s ! bEzafa} ; -- check form of adjective
CompAP ap ={s = \\_ => ap.s ! Bare} ; -- check form of adjective
CompAdv adv = {s = \\_ => adv.s } ;
-- see https://sites.la.utexas.edu/persian_online_resources/nouns/noun-in-a-predicative-position/
CompCN cn = {
s = \\a => cn.s ! case cn.hasAdj of {
False => bEzafa ;
True => enClic }
! giveNumber a
s = \\a => cn.s ! giveNumber a
! case cn.hasAdj of {
False => Bare ;
True => Clitic }
} ;
CompNP np = {
s = \\a => np.s ! case np.hasAdj of {
False => NPC bEzafa ;
True => NPC enClic }
False => Bare ;
True => Clitic }
} ;
}

View File

@@ -7,14 +7,14 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseComparA a = a;
ComparA a np = {
s =\\ez => a.s ! ez ++ "tr" ++ "Az" ++ np.s ! NPC bEzafa ;
s =\\ez => a.s ! ez ++ "tr" ++ "Az" ++ np.s ! Bare ;
adv = a.adv
} ;
---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s =\\ez => np.s ! NPC bEzafa ++ a.c2 ++ a.s ! ez ;
s =\\ez => np.s ! Bare ++ a.c2 ++ a.s ! ez ;
adv = a.adv
} ;
@@ -36,7 +36,7 @@ concrete AdjectivePes of Adjective = CatPes ** open ResPes, Prelude in {
UseA2 a = a ;
CAdvAP cadv ap np = {
s =\\ez => cadv.s ++ np.s ! NPC bEzafa ++ ap.s ! ez ;
s =\\ez => cadv.s ++ np.s ! Bare ++ ap.s ! ez ;
adv = ap.adv
};

View File

@@ -2,16 +2,16 @@ concrete AdverbPes of Adverb = CatPes ** open ResPes, Prelude in {
flags coding = utf8;
lin
-- PositAdvAdj a = {s = a.s ! bEzafa } ;
-- PositAdvAdj a = {s = a.s ! Bare } ;
PositAdvAdj a = {s = a.adv } ;
ComparAdvAdj cadv a np = {
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! NPC bEzafa ;
s = a.adv ++ cadv.p ++ cadv.s ++ np.s ! Bare ;
} ;
ComparAdvAdjS cadv a s = {
s = a.adv ++ cadv.p ++ cadv.s ++ s.s;
} ;
PrepNP prep np = {s = prep.s ++ np.s ! NPC bEzafa } ;
PrepNP prep np = {s = prep.s ++ np.s ! Bare } ;
AdAdv ada adv = { s = ada.s ++ adv.s} ;

View File

@@ -9,7 +9,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
GenericCl vp = mkSClause "A:dm" (agrPesP3 Sg) vp ;
CleftNP np rs =
let cl = mkSClause (np.s ! NPC bEzafa) (np.a) (predAux auxBe);
let cl = mkSClause (np.s ! Bare) (np.a) (predAux auxBe);
in
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
@@ -17,7 +17,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
ExistNP np =
mkSClause " " (agrPesP3 (fromAgr np.a).n)
(insertObj (\\_ => np.s ! NPC bEzafa) (predAux auxBe)) ;
(insertObj (\\_ => np.s ! Bare) (predAux auxBe)) ;
ExistIP ip =
let cl = mkSClause ( ip.s ) (agrPesP3 ip.n) (predAux auxBe);
@@ -33,7 +33,7 @@ concrete IdiomPes of Idiom = CatPes ** open Prelude,Predef, ResPes in {
ImpPl1 vp = {s = "byAyyd" ++ (vp.s ! VVForm (agrPesP1 Pl)).inf} ;
ImpP3 np vp = {s = "bgWAryd" ++ np.s!NPC bEzafa ++ (vp.s ! VVForm (AgPes (fromAgr np.a).n (fromAgr np.a).p)).inf};
ImpP3 np vp = {s = "bgWAryd" ++ np.s!Bare ++ (vp.s ! VVForm (AgPes (fromAgr np.a).n (fromAgr np.a).p)).inf};
}

View File

@@ -20,10 +20,10 @@ oper
mkN : (x1,x2 : Str) -> Animacy -> Noun =
\sg,pl,ani -> {
s = table {
bEzafa => table { Sg => sg ;
Bare => table { Sg => sg ;
Pl => pl
} ;
aEzafa => table { Sg => mkEzafa sg ;
Ezafe => table { Sg => mkEzafa sg ;
Pl => mkEzafa pl
} ;
enClic => table { Sg => mkEnclic sg ;
@@ -483,23 +483,23 @@ addBh str =
--Determiners
--------------------
makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; fromPron : Bool} =\str,n,b -> {
makeDet : Str -> Number -> Bool -> {s: Str ; n : Number ; isNum : Bool ; mod : Bool} =\str,n,b -> {
s = str;
isNum = b;
fromPron = False ;
mod = False ;
n = n
};
makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; fromPron : Bool } = \sg,pl -> {
makeQuant : Str -> Str -> {s : Number => Str ; a : AgrPes ; mod : Bool } = \sg,pl -> {
s = table {Sg => sg ; Pl => pl} ;
fromPron = False ;
mod = False ;
a = agrPesP3 Sg
};
---------------------------
-- Adjectives
--------------------------
mkAdj : Str -> Str -> Adjective = \adj,adv -> {
s = table { bEzafa => adj;
aEzafa => mkEzafa adj ;
s = table { Bare => adj;
Ezafe => mkEzafa adj ;
enClic => mkEnclic adj
} ;
adv = adv

View File

@@ -57,7 +57,7 @@ oper
-- Personal Pronouns
personalPN : Str -> Number -> PPerson -> Pron =
personalPron : Str -> Number -> PPerson -> Pron =
\str,nn,p -> {s = str ; a = AgPes nn p ; ps = str ; lock_Pron = <>};
{-
-- Demonstration Pronouns

View File

@@ -42,7 +42,7 @@ concrete RelativePes of Relative = CatPes ** open ResPes in {
} ;
FunRP p np rp = {
s = np.s ! NPC enClic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
s = np.s ! enClic ++ rp.s ++ p.s ++ getPron np.animacy (fromAgr np.a).n ; -- need to make a special form of relative np by addY
a = RAg np.a
} ;

View File

@@ -32,8 +32,8 @@ resource ResPes = ParamX ** open Prelude,Predef in {
InfrAspect = InfrPerf | InfrImperf ;
AgrPes = AgPes Number PPerson;
Ezafa = bEzafa | aEzafa | enClic;
NPCase = NPC Ezafa ;
Ezafa = Bare | Ezafe | enClic;
NPCase = Ezafa ;
CardOrd = NCard | NOrd ;
RAgr = RNoAg | RAg AgrPes ;
-- RCase = RC Number Case ;
@@ -53,7 +53,7 @@ resource ResPes = ParamX ** open Prelude,Predef in {
Adjective = {s:Ezafa => Str ; adv : Str} ;
NP : Type = {s : NPCase => Str ; a : AgrPes ; animacy : Animacy } ;
Determiner = {s : Str ; n :Number ; isNum : Bool ; fromPron : Bool} ;
Determiner = {s : Str ; n :Number ; isNum : Bool ; mod : Bool} ;
VPHSlash = VPH ** {c2 : Compl} ;
oper
@@ -260,8 +260,8 @@ oper
conjThat : Str = "kh" ;
{- checkPron : NP -> Str -> Str = \np,str -> case (np.isPron) of {
True => np.s ! NPC Obl;
False => np.s ! NPC Obl ++ str} ;
True => np.s ! Obl;
False => np.s ! Obl ++ str} ;
insertEmbCompl : VPH -> Str -> VPH = \vp,emb -> {
s = vp.s ;
@@ -292,7 +292,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
mkClause : NP -> VPH -> Clause = \np,vp -> {
s = \\vt,b,ord =>
let
subj = np.s ! NPC bEzafa;
subj = np.s ! Bare;
agr = np.a ;
n = (fromAgr agr).n;
p = (fromAgr agr).p;
@@ -795,7 +795,7 @@ addBh2 str1 =
-- Noun Phrase
-----------------------------
{-toNP : Str -> Str = \pn, npc -> case npc of {
NPC c => pn ! c ;
c => pn ! c ;
NPObj => pn ! Dir ;
NPErg => pn ! Obl
} ;

View File

@@ -31,7 +31,7 @@ concrete StructuralPes of Structural = CatPes **
-- first_Ord = {s = "Avlyn" ; n = Sg} ; --DEPRECATED
for_Prep = ss "brAy" ;
from_Prep = ss "Az" ;
he_Pron = personalPN "Av" Sg PPers3 ;
he_Pron = personalPron "Av" Sg PPers3 ;
here_Adv = ss "AynjA" ;
here7to_Adv = ss "AynjA" ;
here7from_Adv = ss "AynjA" ;
@@ -40,9 +40,9 @@ concrete StructuralPes of Structural = CatPes **
how8much_IAdv = ss "c^qdr" ;
if_Subj = ss "Agr" ;
in8front_Prep = ss "jlvy" ;
i_Pron = personalPN "mn" Sg PPers1;
i_Pron = personalPron "mn" Sg PPers1;
in_Prep = ss "dr" ;
it_Pron = personalPN "A:n" Sg PPers3;
it_Pron = personalPron "A:n" Sg PPers3;
less_CAdv = {s = "kmtr" ; p = ""} ;
many_Det = mkDet ["tcdAd zyAdy"] Pl True; -- check
more_CAdv = {s = "byCtr" ; p = "" } ;
@@ -73,7 +73,7 @@ concrete StructuralPes of Structural = CatPes **
please_Voc = ss "lTfAa." ;
possess_Prep = ss "" ; -- will be handeled in Ezafeh
quite_Adv = ss "kAmlAa." ;
she_Pron = personalPN "Av" Sg PPers3 ;
she_Pron = personalPron "Av" Sg PPers3 ;
so_AdA = ss "bsyAr" ;
-- somebody_NP = MassNP (UseN (MorphoPnb.mkN11 "kwy" ));
someSg_Det = mkDet "mqdAry" Sg True ;
@@ -86,7 +86,7 @@ concrete StructuralPes of Structural = CatPes **
there7to_Adv = ss "A:njA" ;
there7from_Adv = ss "A:njA" ;
therefore_PConj = ss ["bh hmyn dlyl"] ;
they_Pron = personalPN ["A:n hA"] Pl PPers3 ;
they_Pron = personalPron ["A:n hA"] Pl PPers3 ;
this_Quant = mkQuant "Ayn" "Ayn" ;
through_Prep = ss ["Az Tryq"] ;
too_AdA = ss "Kyly" ;
@@ -94,7 +94,7 @@ concrete StructuralPes of Structural = CatPes **
under_Prep = ss "zyr" ** {lock_Prep = <>};
very_AdA = ss "Kyly" ;
want_VV = mkV "KvAstn" "KvAh" ** { isAux = False} ;
we_Pron = personalPN "mA" Pl PPers1 ;
we_Pron = personalPron "mA" Pl PPers1 ;
whatSg_IP = {s = ["c^h c^yzy"] ; n = Sg } ;
whatPl_IP = {s = ["c^h c^yzhAyy"] ; n = Pl } ;
when_IAdv = ss "ky" ;
@@ -110,9 +110,9 @@ concrete StructuralPes of Structural = CatPes **
with_Prep = ss "bA";
-- yes_Phr = ss "blh" ;
yes_Utt = ss "blh" ;
youSg_Pron = personalPN "tv" Sg PPers2 ;
youPl_Pron = personalPN "CmA" Pl PPers2 ;
youPol_Pron = personalPN "CmA" Pl PPers2 ;
youSg_Pron = personalPron "tv" Sg PPers2 ;
youPl_Pron = personalPron "CmA" Pl PPers2 ;
youPol_Pron = personalPron "CmA" Pl PPers2 ;
-- no_Quant = demoPN "hyc^" ;
not_Predet = {s="nh"} ;
if_then_Conj = sd2 "Agr" "A:ngAh" ** {n = Sg} ;

42601
src/spanish/DictSpa.gf Normal file

File diff suppressed because it is too large Load Diff

42561
src/spanish/DictSpaAbs.gf Normal file

File diff suppressed because it is too large Load Diff

102
src/spanish/README.md Normal file
View File

@@ -0,0 +1,102 @@
# Spanish
## Language information
* English name: Spanish
* Autonym: español
* ISO code: Spa
## Authors
* Aarne Ranta
With contributions from Inger Andersson, Bruno Cuconato, Inari Listenmaa, and Therese Söderberg.
## Implementation information
The Spanish Resource Grammar is built using the Romance functor at
[romance](../romance/), and it mostly follows Spanish spoken in Spain.
Romance instantiations differ mostly in their morphological modules
and in the constructions defined in the =Diff*= modules. Some relevant features:
* two copulas, ser and estar
* prepositions that contract with articles are *de* and *a*, called `genitive` and `dative` respectively. When forming new prepositions, e.g. *después de* use `mkPrep "después" genitive` to get correct contractions.
* no inversion in question clauses, except for `QuestIComp` and `QuestIAdv`.
### Known issues
* Verbs with dative subject don't actually have it. Example:
```
Lang> p "I like grammars" | l
I like grammars
yo gusto gramáticas
```
This is not a massive problem per se, the application grammarian just needs to know this is the case. If your application grammar has a function like the following:
```haskell
fun Like : NP -> NP -> Cl ;
```
then you just need to linearise it as follows:
```haskell
lin Like subj obj = mkCl obj like_V2 subj ;
```
(Why don't we have it? Verbs like *gustar* inflect according to the logical *object* of the sentence; this would mean we'd need 2-dimensional inflection tables for verbs, and while that's a cool thing, it's also expensive and not needed for anything else.)
* Contractions with *con* and pronouns: *con* + **/*ti*/… should be *conmigo*/*contigo*/…, but the contraction is not implemented.
* Clitic pronouns and their combinations:
```haskell
-- PredVP (UsePron i_Pron) (ComplSlash (SlashVV want_VV (Slash2V3 give_V3 (UsePron he_Pron))) (UsePron it_Pron))
LangEng: i want to give him it
LangSpa: yo lo quiero dar &+ le -- should be dárselo
-- PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (Slash3V3 give_V3 (UsePron it_Pron)) (UsePron he_Pron)))
LangEng: i want to give him it
LangSpa: yo quiero dar &+ lo le -- should be dárselo
```
* Accents in imperatives and infinitives with clitics
```haskell
--ImpVP (ComplSlash (Slash2V3 give_V3 (UsePron i_Pron)) (UsePron it_Pron))
LangEng: give me it
LangSpa: da &+ lo me
```
Ignoring the clitic combination (should be *dámelo*), the verb form *da* should get an accent ** to show the correct syllable stress.
## Data
### Besch & Irreg
The [BeschSpa](BeschSpa.gf) and [IrregSpa](IrregSpa.gf) modules contain the complete inflection tables for all different
Spanish verb types. Based on the Functional Morphology [implementation](http://www.cse.chalmers.se/alumni/markus/FM/download/FM_SPA_1.1.tgz) by Inger Andersson and Therese Söderberg.
### DictSpa
This module contains nouns, adjectives and verbs taken from
[Open Multilingual Wordnet](http://compling.hss.ntu.edu.sg/omw/) and [DictionarySpa](https://github.com/GrammaticalFramework/wide-coverage/blob/master/translator/DictionarySpa.gf) (mostly from Wiktionary).
#### Multiwords
Some thousands of multiwords are manually checked. As of February 2019, around 4000 are unchecked. Those are marked in [DictSpa](DictSpa.gf) with `-- to-check segmentation`.
#### Morphology
WIP.
* Where there was a non-1-arg paradigm in the old resources, that is retained.
* All verbs that overlap with IrregSpa use the IrregSpa definition.
* Most of the manually checked multiwords are also checked for morphology, but naturally, errors do occur.
## History and applications
Some applications include:
* [MOLTO phrasebook](http://www.molto-project.eu/sites/default/files/everyday.pdf)
* GF Mathematical Grammar Library ([paper](http://www.molto-project.eu/sites/default/files/gf-mgl.pdf), [demo](http://cloud.grammaticalframework.org/minibar/minibar.html))
* GF [Wide-Coverage translator](http://cloud.grammaticalframework.org/wc.html)
## Maintainers
Inari Listenmaa ([@inariksit](https://github.com/inariksit))
Bruno Cuconato ([@odanoburu](https://github.com/odanoburu))