Merge pull request #76 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2018-11-16 17:35:17 +01:00
committed by GitHub
12 changed files with 94 additions and 76 deletions

View File

@@ -11,7 +11,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Tensed/Untensed -- Tensed/Untensed
SSlash, SSlash,
S = {s : Str} ; S = {s : Order => Str} ; -- subordinate clause has nominal word order and subject in acc
QS = {s : QForm => Str} ; QS = {s : QForm => Str} ;
RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case

View File

@@ -3,20 +3,22 @@ concrete ConjunctionAra of Conjunction =
lincat lincat
[S], [S] = {s1,s2 : Order => Str} ;
[Adv] = {s1,s2 : Str} ; [Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ; [NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ;
[AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ; [AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ;
lin lin
BaseS,
BaseAdv = twoSS ; BaseAdv = twoSS ;
ConsS,
ConsAdv = consrSS comma ; ConsAdv = consrSS comma ;
ConjS,
ConjAdv = conjunctSS ; ConjAdv = conjunctSS ;
BaseS = twoTable Order ;
ConsS = consrTable Order comma ;
ConjS = conjunctTable Order ;
BaseNP x y = twoTable Case x y ** { BaseNP x y = twoTable Case x y ** {
a = conjAgr x.a y.a ; a = conjAgr x.a y.a ;
empty = [] empty = []
@@ -31,9 +33,9 @@ lin
empty = [] empty = []
} ; } ;
BaseAP x y = twoTable5 Species Gender Number State Case x y ; BaseAP = twoTable5 Species Gender Number State Case ;
ConsAP xs x = consrTable5 Species Gender Number State Case comma xs x ; ConsAP = consrTable5 Species Gender Number State Case comma ;
ConjAP conj ss = conjunctTable5 Species Gender Number State Case conj ss ; ConjAP = conjunctTable5 Species Gender Number State Case ;
oper oper

View File

@@ -1,6 +1,7 @@
concrete IdiomAra of Idiom = CatAra ** open concrete IdiomAra of Idiom = CatAra ** open
Prelude, Prelude,
ResAra, ResAra,
VerbAra,
ParadigmsAra ParadigmsAra
in { in {
@@ -8,34 +9,32 @@ concrete IdiomAra of Idiom = CatAra ** open
lin lin
-- : VP -> Cl ; -- it is hot -- : VP -> Cl ; -- it is hot
ImpersCl vp = ImpersCl vp =
let it : ResAra.NP = pron2np (pgn2pron vp.obj.a.pgn) ; -- if no obj, Per3 Masc Sg chosen by default let it : ResAra.NP = pron2np (pgn2pron vp.obj.a.pgn) ; -- if no obj, Per3 Masc Sg chosen by default
in predVP it vp ; in predVP it vp ;
-- : VP -> Cl ; -- one sleeps -- : VP -> Cl ; -- one sleeps
GenericCl = predVP (regNP "المَرْء" Sg) ; GenericCl = predVP (regNP "المَرْء" Sg) ;
-- : NP -> RS -> Cl ; -- it is I who did it -- : NP -> RS -> Cl ; -- it is I who did it
--CleftNP np rs = --CleftNP np rs =
-- TODO: check page 61 for existentials and clefts /IL
-- : Adv -> S -> Cl ; -- it is here she slept -- : Adv -> S -> Cl ; -- it is here she slept
CleftAdv adv s = CleftAdv adv s =
let comp : Comp = {s = \\_,_ => adv.s ++ s.s} in ---- let comp : Comp = CompAdv adv in
predVP he_Pron (kaan comp) ; predVP he_Pron (UseComp comp) ;
-- : NP -> Cl ; -- there is a house -- : NP -> Cl ; -- there is a house
ExistNP np = ExistNP np =
predVP emptyNP (insertObj np (predV copula ** {c2=noPrep})) ; -- dummy /IL predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (UseComp (CompNP np)) ; -- IL
-- ExistIP : IP -> QCl ; -- which houses are there -- ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these -- 7/12/2012 generalizations of these
-- : NP -> Adv -> Cl ; -- there is a house in Paris -- : NP -> Adv -> Cl ; -- there is a house in Paris
ExistNPAdv np adv = ExistNPAdv np adv =
predVP emptyNP (insertStr adv.s (insertObj np (predV copula ** {c2=noPrep}))) ; predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (AdvVP (UseComp (CompNP np)) adv) ; -- IL
-- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris -- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
@@ -48,18 +47,16 @@ concrete IdiomAra of Idiom = CatAra ** open
-- 3/12/2013 non-reflexive uses of "self" -- 3/12/2013 non-reflexive uses of "self"
-- : VP -> VP ; -- is at home himself; is himself at home -- : VP -> VP ; -- is at home himself; is himself at home
SelfAdvVP, SelfAdvVP,
SelfAdVVP = \vp -> vp ** { SelfAdVVP = \vp -> vp ** {
s = \\pgn,vf => let pron : ResAra.NP = pgn2pron pgn in s = \\pgn,vf => let pron : ResAra.NP = pgn2pron pgn in
vp.s ! pgn ! vf ++ refl ! Nom ++ pron.s ! Gen vp.s ! pgn ! vf ++ refl ! Nom ++ pron.s ! Gen
} ; } ;
-- : NP -> NP ; -- the president himself (is at home) -- : NP -> NP ; -- the president himself (is at home)
SelfNP np = np ** { SelfNP np = np ** {
s = let pron : ResAra.NP = np2pron np ; s = let pron : ResAra.NP = np2pron np ;
in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen
} ; } ;
} }

View File

@@ -25,7 +25,7 @@ lin
++ adj c ++ adj c
++ cn.np ! c ; ++ cn.np ! c ;
True => noun (cas c) -- deal with possessive suffix True => noun (cas c) -- deal with possessive suffix
++ determiner c ++ determiner c -- (nounCase c det.n det.d) --??
++ adj c ++ adj c
++ cn.np ! c ++ cn.np ! c
}; };
@@ -42,6 +42,8 @@ lin
UsePron p = p ; UsePron p = p ;
DetNP det = emptyNP ** {s = det.s ! NoHum ! Masc} ; ----
PredetNP pred np = np ** { PredetNP pred np = np ** {
s = \\c => case pred.isDecl of { s = \\c => case pred.isDecl of {
True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi
@@ -64,26 +66,15 @@ lin
AdvNP np adv = np ** { AdvNP np adv = np ** {
s = \\c => np.s ! c ++ adv.s s = \\c => np.s ! c ++ adv.s
}; };
{-
DetSg quant ord = {
s = \\h,g,c =>
quant.s ! Sg ! h ! g ! c ++ ord.s ! g ! quant.d ! c ;
n = One;
d = quant.d;
isPron = quant.isPron;
isNum =
case ord.n of {
None => False;
_ => True
}
} ;
-}
DetQuantOrd quant num ord = quant ** { DetQuantOrd quant num ord = quant ** {
s = \\h,g,c => quant.s ! Pl ! h ! g ! c s = \\h,g,c => let d = toDef quant.d num.n in
++ num.s ! g ! (toDef quant.d num.n) ! c quant.s ! Pl ! h ! g ! c
++ num.s ! g ! d ! c
--FIXME check this: --FIXME check this:
++ ord.s ! g ! (toDef quant.d num.n) ! c ; ++ ord.s ! g
! case d of {Poss => Def ; _ => d}
! c ;
n = num.n; n = num.n;
isNum = orB num.isNum ord.isNum ; isNum = orB num.isNum ord.isNum ;
-- ord may come from OrdDigits or OrdNumeral -- ord may come from OrdDigits or OrdNumeral
@@ -172,8 +163,6 @@ lin
a = {pgn = Per3 cn.g Sg ; isPron = False} ; a = {pgn = Per3 cn.g Sg ; isPron = False} ;
empty = []} ; empty = []} ;
-- MassDet = {s = \\_,_,_,_ => [] ; d = Indef;
-- isNum = False; isPron = False} ;
UseN, UseN,
UseN2 = useN ; UseN2 = useN ;

View File

@@ -76,7 +76,7 @@ resource ParadigmsAra = open
--- = sdfN ; --- = sdfN ;
} ; } ;
dualN : N -> N ; dualN : N -> N ; -- Force the plural of the N into dual (e.g. "twins")
--This is used for loan words or anything that has untreated irregularities --This is used for loan words or anything that has untreated irregularities
--in the interdigitization process of its words --in the interdigitization process of its words
@@ -130,16 +130,15 @@ resource ParadigmsAra = open
-- Overloaded operator for main cases -- Overloaded operator for main cases
mkA = overload { mkA = overload {
mkA : (root,patt : Str) -> A mkA : (root,sg : Str) -> A -- adjective with sound plural; takes root string and sg. pattern string
= \r,p -> lin A (sndA r p); = \r,p -> lin A (sndA r p);
mkA : (root : Str) -> A -- forms adjectives with positive form aFCal mkA : (root : Str) -> A -- adjective with positive form aFCal
= \r -> lin A (clrA r); = \r -> lin A (clrA r);
mkA : (root,sg,pl : Str) -> A mkA : (root,sg,pl : Str) -> A -- adjective with broken plural
= \r,s,p -> lin A (brkA r s p) ; = \r,s,p -> lin A (brkA r s p) ;
-- mkA : (posit,compar,plur : Str) -> A
-- = degrA ;
} ; } ;
degrA : (posit,compar,plur : Str) -> A ;
--Takes a root string and a pattern string --Takes a root string and a pattern string
sndA : (root,patt : Str) -> Adj ; sndA : (root,patt : Str) -> Adj ;
@@ -147,6 +146,8 @@ resource ParadigmsAra = open
--Takes a root string only --Takes a root string only
clrA : (root : Str) -> Adj ; -- forms adjectives of type aFCal clrA : (root : Str) -> Adj ; -- forms adjectives of type aFCal
nisbaA : Str -> Adj ; -- forms relative adjectives by adding the suffix ِيّ
--3 Two-place adjectives --3 Two-place adjectives
-- --
-- Two-place adjectives need a preposition for their second argument. -- Two-place adjectives need a preposition for their second argument.
@@ -637,6 +638,14 @@ resource ParadigmsAra = open
} }
}; };
nisbaA : Str -> Adj = \Haal ->
let Haaliyy = Haal + "ِيّ" in {
s = table {
APosit g n d c => positAdj Haaliyy ! g ! n ! d ! c ;
AComp d c => "أَكْثَر" ++ indeclN Haaliyy ! d ! c
}
} ;
clrA root = clrA root =
let { eaHmar = mkWord "أَفعَل" root; let { eaHmar = mkWord "أَفعَل" root;
HamrA' = mkWord "فَعلاء" root; HamrA' = mkWord "فَعلاء" root;

View File

@@ -19,7 +19,7 @@ concrete PhraseAra of Phrase = CatAra ** open
UttCN cn = {s = ResAra.uttCN cn } ; --IL UttCN cn = {s = ResAra.uttCN cn } ; --IL
UttNP np = {s = \\_ => np.s ! Nom} ; UttNP np = {s = \\_ => np.s ! Nom} ;
UttVP vp = {s = uttVP vp} ; --IL UttVP vp = {s = uttVP vp} ; --IL
UttS, UttS s = {s = \\_ => s.s ! Verbal} ;
UttAdv, UttAdv,
UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR
-- --

View File

@@ -71,7 +71,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
IdetCN idet cn = { IdetCN idet cn = {
s = \\isPred,g,s,c s = \\isPred,g,s,c
=> idet.s ! cn.g ! s ! c ++ => idet.s ! cn.g ! s ! c ++
cn2str cn idet.n Indef Gen ; --idaafa cn2str cn idet.n idet.d Gen ;
a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False }
} ; } ;
@@ -80,6 +80,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
s = \\g,s,c => s = \\g,s,c =>
let gend = detGender g num.n -- gender flips with some numbers let gend = detGender g num.n -- gender flips with some numbers
in iquant.s ! s ! c ++ num.s ! gend ! s ! c ; in iquant.s ! s ! c ++ num.s ! gend ! s ! c ;
n = sizeToNumber num.n n = sizeToNumber num.n ;
d = Indef ---- TODO check
} ; } ;
} }

View File

@@ -27,7 +27,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
Mood = Ind | Cnj | Jus ; Mood = Ind | Cnj | Jus ;
Voice = Act | Pas ; Voice = Act | Pas ;
Order = Verbal | Nominal Order = Verbal | Nominal
| VOS ; -- Relative clauses with resumptive pronouns | VOS -- Relative clauses with resumptive pronouns
| Subord ; -- Nominal word order but subject in accusative
oper oper
@@ -966,9 +967,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- determine the declension and gives the corresponding inf table -- determine the declension and gives the corresponding inf table
sing : Str -> State => Case => Str = \word -> sing : Str -> State => Case => Str = \word ->
\\s,c => defArt s (case word of { \\s,c => defArt s (case word of {
lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ;
_ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ;
lemma + "ة" => case s of { _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ;
lemma + "ة" => case s of {
Poss => lemma + "ت" + dec1sg ! s ! c ; Poss => lemma + "ت" + dec1sg ! s ! c ;
_ => word + dec1sg ! s ! c _ => word + dec1sg ! s ! c
} ; } ;
@@ -1046,6 +1048,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => "ِي" _ => "ِي"
}; };
--declension 3 (ending in alif) --declension 3 (ending in alif)
dec3sg : State => Case => Str = \\s,c => dec3sg : State => Case => Str = \\s,c =>
case <s,c> of { case <s,c> of {
@@ -1054,6 +1057,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
_ => [] _ => []
}; };
--declension 2 (ends in yaa')
decNisba : State => Case => Str = \\s,c =>
case <s,c> of {
<_, Bare> => [] ;
<Indef,Acc> => "اً" ;
<Indef> => "ٍ" ;
<_, Acc> => "َ" ;
_ => []
};
--dual suffixes --dual suffixes
dl : State => Case => Str = dl : State => Case => Str =
@@ -1282,7 +1294,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
proDrop : NP -> NP = \np -> proDrop : NP -> NP = \np ->
case np.a.isPron of { case np.a.isPron of {
True => np ** {s = \\_ => []}; True => np ** {s = table {Nom => [] ; x => np.s ! x}};
_ => np _ => np
} ; } ;
@@ -1368,8 +1380,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
IDet : Type = { IDet : Type = {
s : Gender -- IdetCN needs to choose the gender of the CN s : Gender -- IdetCN needs to choose the gender of the CN
=> State => Case => Str ; => State -- Needs to be retained variable for IP; PrepIP chooses the state of IP
n : Number => Case => Str ;
n : Number ;
d : State -- in IdetCN, chooses the state of the CN
} ; } ;
IQuant : Type = { IQuant : Type = {
@@ -1461,10 +1475,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc <True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
}; };
subj = np.empty sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; Dir => vp.sc} ;
++ case <vp.isPred,np.a.isPron> of { subj = np.empty ++ sc.s
<False,True> => [] ; -- prodrop if it's not predicative ++ case vp.isPred of {
_ => vp.sc.s ++ np.s ! vp.sc.c False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative
True => np.s ! sc.c
} ; } ;
} in } in
@@ -1473,9 +1488,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb
False => subj ++ vp.obj.s } False => subj ++ vp.obj.s }
++ vp.s2 ++ pred t p ; ++ vp.s2 ++ pred t p ;
Nominal => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ; VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj ;
VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ subj Nominal|Subord => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p
} }
} ; } ;

View File

@@ -66,11 +66,11 @@ concrete SentenceAra of Sentence = CatAra ** open
-- --
UseCl t p cl = UseCl t p cl =
{s = t.s ++ p.s ++ {s = \\o => t.s ++ p.s ++
case <t.t,t.a> of { --- IL guessed tenses case <t.t,t.a> of { --- IL guessed tenses
<Pres,Simul> => cl.s ! Pres ! p.p ! Nominal ; <Pres,Simul> => cl.s ! Pres ! p.p ! o ;
<Pres,Anter> => cl.s ! Past ! p.p ! Nominal ; <Pres,Anter> => cl.s ! Past ! p.p ! o ;
<x ,_ > => cl.s ! x ! p.p ! Nominal <x ,_ > => cl.s ! x ! p.p ! o
} }
}; };

View File

@@ -40,7 +40,11 @@ concrete StructuralAra of Structural = CatAra **
-- here7to_Adv = ss ["تْ هري"] ; -- here7to_Adv = ss ["تْ هري"] ;
-- here7from_Adv = ss ["فرْم هري"] ; -- here7from_Adv = ss ["فرْم هري"] ;
how_IAdv = ss "كَيفَ" ; how_IAdv = ss "كَيفَ" ;
-- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ; how8many_IDet = {
s = \\g,s,c => "كَمْ عَدَد" + caseTbl ! c ;
n = Pl ; d = Def
} ; -- IL
-- if_Subj = ss "ِف" ; -- if_Subj = ss "ِف" ;
in8front_Prep = mkPrep "مُقَابِلَ" ; in8front_Prep = mkPrep "مُقَابِلَ" ;
i_Pron = ResAra.i_Pron ; i_Pron = ResAra.i_Pron ;
@@ -74,6 +78,7 @@ concrete StructuralAra of Structural = CatAra **
something_NP = regNP "شَيْء" Sg ; something_NP = regNP "شَيْء" Sg ;
-- somewhere_Adv = ss "سْموهري" ; -- somewhere_Adv = ss "سْموهري" ;
that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def; that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def;
that_Subj = ss "أنَّ" ;
----b that_NP = indeclNP "ذَلِكَ" Sg ; ----b that_NP = indeclNP "ذَلِكَ" Sg ;
there_Adv = ss "هُناك" ; there_Adv = ss "هُناك" ;
-- there7to_Adv = ss "تهري" ; -- there7to_Adv = ss "تهري" ;

View File

@@ -25,7 +25,7 @@ lin
empty = [] empty = []
} ; } ;
SymbS sy = sy ; SymbS sy = {s = \\_ => sy.s} ;
SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ; SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ;

View File

@@ -28,7 +28,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
-- : VS -> S -> VP ; -- say that she runs -- : VS -> S -> VP ; -- say that she runs
ComplVS vs s = predV vs ** { -- IL ComplVS vs s = predV vs ** { -- IL
obj = emptyObj ** s } ; obj = emptyObj ** {s = s.s ! Subord}
} ;
-- : VQ -> QS -> VP ; -- wonder who runs -- : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = predV vq ** { -- IL ComplVQ vq qs = predV vq ** { -- IL