forked from GitHub/gf-rgl
(Ara) Supporting possessive suffixes, WIP
This commit is contained in:
@@ -57,10 +57,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
|
||||
Det = ResAra.Det ;
|
||||
-- {s : Species => Gender => Case => Str ;
|
||||
-- d : State; n : Size; isNum : Bool } ;
|
||||
Quant = {s : ResAra.Number => Species => Gender => Case => Str;
|
||||
d : State;
|
||||
isNum : Bool;
|
||||
isPron: Bool} ;
|
||||
Quant = ResAra.Quant ;
|
||||
Art = {s : ResAra.Number => Species => Gender => Case => Str;
|
||||
d : State} ;
|
||||
|
||||
|
||||
@@ -7,9 +7,10 @@ flags optimize = all ;--noexpand;
|
||||
|
||||
mkDet : Str -> Number -> State -> Det
|
||||
= \word,num,state ->
|
||||
{ s = \\_,_,c => word + vowel ! c ;
|
||||
{ s = \\_,_,c => word + caseTbl ! c ;
|
||||
n = numberToSize num;
|
||||
d = state; --only Const is used now. check StructuralAra
|
||||
is1sg = False;
|
||||
isNum = False;
|
||||
isPron = False
|
||||
};
|
||||
@@ -18,7 +19,7 @@ flags optimize = all ;--noexpand;
|
||||
= \word,decl ->
|
||||
{ s = \\c =>
|
||||
case decl of {
|
||||
True => word + vowel!c;
|
||||
True => word + caseTbl!c;
|
||||
False => word
|
||||
};
|
||||
isDecl = decl
|
||||
@@ -40,11 +41,4 @@ flags optimize = all ;--noexpand;
|
||||
isNum = True
|
||||
};
|
||||
|
||||
vowel : Case => Str =
|
||||
table {
|
||||
Nom => "ُ";
|
||||
Acc => "َ";
|
||||
Gen => "ِ"
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -6,18 +6,26 @@ lin
|
||||
|
||||
DetCN det cn = let {
|
||||
number = sizeToNumber det.n;
|
||||
state = possState det.d;
|
||||
determiner : Case -> Str = \c ->
|
||||
det.s ! cn.h ! (detGender cn.g det.n) ! c;
|
||||
noun : Case -> NTable -> Str = \c,nt -> nt !
|
||||
number ! (nounState det.d number) ! (nounCase c det.n det.d)
|
||||
noun : Case -> NTable -> Str = \c,nt ->
|
||||
let cas = if_then_else Case det.is1sg Bare c -- no case vowel with 1sg poss. suff.
|
||||
in nt ! number
|
||||
! nounState det.d number
|
||||
! nounCase cas det.n det.d
|
||||
} in {
|
||||
s = \\c =>
|
||||
case cnB4det det.isPron det.isNum det.n det.d of {
|
||||
False => determiner c ++ noun c cn.s ++ noun c cn.adj ;
|
||||
--FIXME use the adj -> cn -> cn rule from below instead of
|
||||
--repeating code
|
||||
True => cn.s ! number ! det.d ! c ++ det.s ! cn.h ! cn.g ! c
|
||||
++ cn.adj ! number ! det.d ! c
|
||||
False => determiner c
|
||||
++ noun c cn.s -- deal with poss. suffix
|
||||
++ cn.adj ! number ! state ! c -- normal case+state
|
||||
++ cn.np ! c ;
|
||||
True => noun c cn.s -- deal with poss. suffix
|
||||
-- ++ determiner c -- or this?
|
||||
++ det.s ! cn.h ! cn.g ! c
|
||||
++ cn.adj ! number ! state ! c -- normal case+state
|
||||
++ cn.np ! c
|
||||
};
|
||||
a = { pgn = agrP3 cn.h cn.g number;
|
||||
isPron = False }
|
||||
@@ -70,36 +78,33 @@ lin
|
||||
} ;
|
||||
-}
|
||||
|
||||
DetQuantOrd quant num ord = {
|
||||
DetQuantOrd quant num ord = quant ** {
|
||||
s = \\h,g,c => quant.s ! Pl ! h ! g ! c
|
||||
++ num.s ! g ! (toDef quant.d num.n) ! c
|
||||
--FIXME check this:
|
||||
++ ord.s ! g ! (toDef quant.d num.n) ! c ;
|
||||
n = num.n;
|
||||
d = quant.d;
|
||||
isPron = quant.isPron;
|
||||
isNum = case num.n of {
|
||||
None => ord.isNum ; -- ord may come from OrdDigits or OrdNumeral
|
||||
_ => True
|
||||
}
|
||||
isNum = orB num.isNum ord.isNum ;
|
||||
-- ord may come from OrdDigits or OrdNumeral
|
||||
-- num may come from NumCard : Card -> Num
|
||||
|
||||
} ;
|
||||
|
||||
DetQuant quant num = {
|
||||
DetQuant quant num = quant ** {
|
||||
s = \\h,g,c => quant.s ! Pl ! h ! g ! c
|
||||
++ num.s ! g ! (toDef quant.d num.n) ! c ;
|
||||
n = num.n;
|
||||
d = quant.d;
|
||||
isPron = quant.isPron;
|
||||
isNum = -- Num may come from NumCard : Card -> Num
|
||||
case num.n of {
|
||||
None => False;
|
||||
_ => True
|
||||
_ => num.isNum
|
||||
}
|
||||
} ;
|
||||
|
||||
PossPron p = {
|
||||
s = \\_,_,_,_ => p.s ! Gen;
|
||||
d = Const;
|
||||
d = Poss;
|
||||
is1sg = case p.a.pgn of { Per1 _ => True ; _ => False } ;
|
||||
isPron = True;
|
||||
isNum = False } ;
|
||||
|
||||
@@ -152,13 +157,13 @@ lin
|
||||
DefArt = {
|
||||
s = \\_,_,_,_ => [];
|
||||
d = Def ;
|
||||
isNum,isPron = False
|
||||
isNum,isPron,is1sg = False
|
||||
} ;
|
||||
|
||||
IndefArt = {
|
||||
s = \\_,_,_,_ => [];
|
||||
d = Indef ;
|
||||
isNum,isPron = False
|
||||
isNum,isPron,is1sg = False
|
||||
} ;
|
||||
|
||||
MassNP cn = ---- AR
|
||||
|
||||
@@ -428,9 +428,9 @@ resource ParadigmsAra = open
|
||||
mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn ->
|
||||
{ s =
|
||||
table {
|
||||
Nom => ana;
|
||||
Acc => nI;
|
||||
Gen => I
|
||||
Gen => I;
|
||||
_ => ana
|
||||
};
|
||||
a = {pgn = pgn; isPron = True };
|
||||
lock_NP = <>
|
||||
@@ -451,7 +451,7 @@ resource ParadigmsAra = open
|
||||
};
|
||||
|
||||
mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant =
|
||||
\hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det ->
|
||||
\hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det -> lin Quant (baseQuant **
|
||||
{ s = \\n,s,g,c =>
|
||||
case <s,g,c,n> of {
|
||||
<_,Masc,_,Sg> => hava;
|
||||
@@ -463,14 +463,11 @@ resource ParadigmsAra = open
|
||||
<Hum,_,_,Pl> => hA'ulA;
|
||||
_ => havihi
|
||||
};
|
||||
d = Def;
|
||||
isPron = False;
|
||||
isNum = False;
|
||||
lock_Quant = <>
|
||||
};
|
||||
d = det
|
||||
});
|
||||
|
||||
mkQuant3 : (_,_,_ : Str) -> State -> Quant =
|
||||
\dalika,tilka,ula'ika,det ->
|
||||
\dalika,tilka,ula'ika,det -> lin Quant (baseQuant **
|
||||
{ s = \\n,s,g,c =>
|
||||
case <s,g,c,n> of {
|
||||
<_,Masc,_,Sg> => dalika;
|
||||
@@ -478,11 +475,8 @@ resource ParadigmsAra = open
|
||||
<Hum,_,_,_> => ula'ika;
|
||||
_ => tilka
|
||||
};
|
||||
d = det;
|
||||
isPron = False;
|
||||
isNum = False;
|
||||
lock_Quant = <>
|
||||
};
|
||||
d = det
|
||||
});
|
||||
|
||||
degrA : (posit,compar,plur : Str) -> A
|
||||
= \posit,compar,plur -> lin A {s = clr posit compar plur} ;
|
||||
|
||||
@@ -17,10 +17,14 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
|
||||
Vowel = u | a | i ;
|
||||
Number = Sg | Dl | Pl;
|
||||
Gender = Masc | Fem ;
|
||||
Case = Nom | Acc | Gen ;
|
||||
Case = Nom | Acc | Gen
|
||||
| Bare ; -- 1st person poss. suff. overrides case
|
||||
Person = P1 | P2 | P3 ;
|
||||
Species = NoHum | Hum ;
|
||||
State = Def | Indef | Const ;
|
||||
State = Def | Indef | Const
|
||||
| Poss ; -- ة turns into ت
|
||||
-- sound masculine plural drops ن
|
||||
-- case vowel retained
|
||||
Mood = Ind | Cnj | Jus ;
|
||||
Voice = Act | Pas ;
|
||||
Tense = Pres | Past | Fut ;
|
||||
@@ -783,6 +787,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
|
||||
--Nominal Morphology
|
||||
|
||||
caseTbl : Case => Str =
|
||||
table {
|
||||
Bare => [] ;
|
||||
Nom => "ُ";
|
||||
Acc => "َ";
|
||||
Gen => "ِ"
|
||||
};
|
||||
|
||||
--takes the adjective lemma and gives the Posit table
|
||||
positAdj : Str -> Gender => NTable =
|
||||
\kabIr ->
|
||||
@@ -848,20 +860,22 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
\\s,c => defArt s (case word of {
|
||||
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
|
||||
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
|
||||
lemma + "ة" => case s of {
|
||||
Poss => lemma + "ت" + dec1sg ! s ! c ;
|
||||
_ => word + dec1sg ! s ! c
|
||||
} ;
|
||||
_ => fixShd word (dec1sg ! s ! c)
|
||||
}) ;
|
||||
|
||||
|
||||
-- takes a singular word and tests the ending to
|
||||
-- determine the declension and gives the corresponding dual inf table
|
||||
dual : Str -> State => Case => Str =
|
||||
\caSaA ->
|
||||
case caSaA of {
|
||||
lemma + ("ا"|"ى") => \\s,c => defArt s lemma + "ي" + dl ! s ! c ;
|
||||
lemma + "ة" =>
|
||||
\\s,c => defArt s (lemma + "ت") + dl ! s ! c ;
|
||||
_ => \\s,c => defArt s caSaA + dl ! s ! c
|
||||
};
|
||||
dual : Str -> State => Case => Str = \caSaA ->
|
||||
\\s,c => defArt s (case caSaA of {
|
||||
lemma + ("ا"|"ى") => lemma + "ي" + dl ! s ! c ;
|
||||
lemma + "ة" => lemma + "ت" + dl ! s ! c ;
|
||||
_ => fixShd caSaA (dl ! s ! c)
|
||||
});
|
||||
|
||||
-- takes a singular word and gives the corresponding sound
|
||||
--plural feminine table
|
||||
@@ -898,52 +912,39 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
table {
|
||||
Indef =>
|
||||
table {
|
||||
Bare => [];
|
||||
Nom => "ٌ";
|
||||
Acc => "ً";
|
||||
Gen => "ٍ"
|
||||
};
|
||||
_ =>
|
||||
table { --think of ?axU, ?axA, (the five nouns)
|
||||
Nom => "ُ";
|
||||
Acc => "َ";
|
||||
Gen => "ِ"
|
||||
}
|
||||
_ => caseTbl --think of ?axU, ?axA, (the five nouns)
|
||||
|
||||
};
|
||||
|
||||
--indeclinables (mamnuu3 mina S-Sarf)
|
||||
indecl : Case => Str =
|
||||
table {
|
||||
Nom => "ُ";
|
||||
_ => "َ"
|
||||
Gen => "َ" ;
|
||||
x => caseTbl ! x
|
||||
};
|
||||
|
||||
|
||||
--declection 2 (ends in yaa')
|
||||
dec2sg : State => Case => Str =
|
||||
table {
|
||||
Indef =>
|
||||
table {
|
||||
Acc => "ِياً";
|
||||
_ => "ٍ"
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
Acc => "ِيَ";
|
||||
_ => "ِي"
|
||||
}
|
||||
--declension 2 (ends in yaa')
|
||||
dec2sg : State => Case => Str = \\s,c =>
|
||||
case <s,c> of {
|
||||
<_, Bare> => [] ;
|
||||
<Indef,Acc> => "ِياً" ;
|
||||
<Indef> => "ٍ" ;
|
||||
<_, Acc> => "ِيَ" ;
|
||||
_ => "ِي"
|
||||
};
|
||||
|
||||
--declention 3 (ending in alif)
|
||||
dec3sg : State => Case => Str =
|
||||
table {
|
||||
Indef =>
|
||||
table {
|
||||
_ => "ً"
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
_ => ""
|
||||
}
|
||||
--declension 3 (ending in alif)
|
||||
dec3sg : State => Case => Str = \\s,c =>
|
||||
case <s,c> of {
|
||||
<Indef,Bare> => [] ;
|
||||
<Indef> => "ً" ;
|
||||
_ => []
|
||||
};
|
||||
|
||||
|
||||
@@ -957,12 +958,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
Nom => "َانِ";
|
||||
_ => "َيْنِ"
|
||||
Nom => "َانِ";
|
||||
Bare => "َيْن";
|
||||
_ => "َيْنِ"
|
||||
}
|
||||
};
|
||||
|
||||
--sound mascualine plural suffixes
|
||||
--sound masculine plural suffixes
|
||||
m_pl : State => Case => Str =
|
||||
table {
|
||||
Const =>
|
||||
@@ -972,6 +974,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
Bare => "ِين";
|
||||
Nom => "ُونَ";
|
||||
_ => "ِينَ"
|
||||
}
|
||||
@@ -982,11 +985,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
table {
|
||||
Indef =>
|
||||
table {
|
||||
Bare => [];
|
||||
Nom => "ٌ";
|
||||
_ => "ٍ"
|
||||
};
|
||||
_ =>
|
||||
table {
|
||||
Bare => [];
|
||||
Nom => "ُ";
|
||||
_ => "ِ"
|
||||
}
|
||||
@@ -1030,11 +1035,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
case <s,n> of {
|
||||
<Const,Pl> => Def; --kullu l-kutubi, bacDu l-kutubi
|
||||
<Const,Sg> => Indef; --kullu kitaabin
|
||||
<Indef,_> => Indef; --kitaabun
|
||||
_ => Def --Lkitaabu
|
||||
<Indef> => Indef; --kitaabun
|
||||
<Poss> => Poss;
|
||||
_ => Def --Lkitaabu
|
||||
};
|
||||
|
||||
|
||||
possState : State -> State = \s ->
|
||||
case s of { Poss => Def ;
|
||||
x => x } ;
|
||||
--FIXME needs testing
|
||||
nounCase : Case -> Size -> State -> Case =
|
||||
\c,size,s ->
|
||||
@@ -1112,14 +1120,24 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
|
||||
|
||||
oper
|
||||
|
||||
Det : Type = {
|
||||
s : Species => Gender => Case => Str ;
|
||||
BaseQuant : Type = {
|
||||
d : State;
|
||||
n : Size;
|
||||
is1sg : Bool; -- To force no case marker for 1st person poss. suff.
|
||||
isNum : Bool;
|
||||
-- for genitive pronouns (suffixes). if true, then "cn ++ det"
|
||||
--should be used instead of "det ++ cn" when constructing the NP
|
||||
isPron : Bool
|
||||
isPron: Bool} ;
|
||||
|
||||
baseQuant = { d = Indef ;
|
||||
is1sg,isNum,isPron = False } ;
|
||||
|
||||
Quant : Type = BaseQuant ** {
|
||||
s : ResAra.Number => Species => Gender => Case => Str
|
||||
} ;
|
||||
|
||||
Det : Type = BaseQuant ** {
|
||||
s : Species => Gender => Case => Str ;
|
||||
n : Size
|
||||
} ;
|
||||
|
||||
Predet : Type = {
|
||||
|
||||
@@ -98,6 +98,7 @@ concrete StructuralAra of Structural = CatAra **
|
||||
where_IAdv = ss "أَينَ" ;
|
||||
which_IQuant = {
|
||||
s = \\s,c => case <c,s> of {
|
||||
<Bare,_> => "أيّ" ;
|
||||
<Nom,Indef> => "أيٌّ" ;
|
||||
<Nom,_> => "أيُّ" ;
|
||||
<Acc,Indef> => "أيّاً" ;
|
||||
|
||||
Reference in New Issue
Block a user