1
0
forked from GitHub/gf-rgl

Merge pull request #81 from inariksit/arabic

Arabic
This commit is contained in:
Inari Listenmaa
2018-11-21 16:35:32 +01:00
committed by GitHub
8 changed files with 67 additions and 32 deletions

View File

@@ -73,7 +73,7 @@ flags
door_N = brkN "بوب" "فاع" "أَفعَال" Masc NoHum ;
drink_V2 = dirV2 (regV "شَرِب") ;
-- drink_V2 = dirV2 (v1 "شرب" i a) ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") datPrep ;
easy_A2V = mkA2 (sndA "سهل" "فَعل") liPrep ;
eat_V2 = dirV2 (mkV "ءكل" FormI) ;
empty_A = sndA "فرغ" "فاعِل" ;
enemy_N = brkN "عدو" "فَعُلّ" "أَفعَاء" Masc Hum ;
@@ -203,7 +203,7 @@ flags
switch8off_V2 = dirV2 (v4 "طفء") ;
switch8on_V2 = dirV2 (v4 "شعل") ;
table_N = sdfN "طول" "فاعِلة" Fem NoHum ;
talk_V3 = mkV3 (v5 "حدث") datPrep (mkPrep "عَن") ;
talk_V3 = mkV3 (v5 "حدث") liPrep (mkPrep "عَن") ;
teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö
teach_V2 = dirV2 (v2 "علم") ;
television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ;

View File

@@ -6,7 +6,12 @@ lin
DetCN det cn = let {
cas : Case -> Case = if_then_else Case det.is1sg Bare ;
number = case cn.isDual of {True => Dl ; _ => sizeToNumber det.n} ;
number = case cn.isDual of {
True =>
case sizeToNumber det.n of {
Sg => Sg ;
_ => Dl } ;
False => sizeToNumber det.n } ;
determiner : Case -> Str = \c ->
det.s ! cn.h ! (detGender cn.g det.n) ! c ;
noun : Case -> Str = \c ->

View File

@@ -28,7 +28,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA
---- IL guessed
-- : IComp -> NP -> QCl
QuestIComp ic np =
let vp = UseComp (CompNP np) ;
let vp = UseComp (CompNP np) ; -- puts NP in nominative
ip : ResAra.IP = np ** { -- NP's s is already present in VP, we only want its agr
s = \\_,_,_,_ => ic.s ! pgn2gn np.a.pgn } ;
in QuestVP ip vp ;

View File

@@ -13,7 +13,7 @@ concrete RelativeAra of Relative = CatAra **
s = \\t,p,agr,c =>
let
npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ;
np : NP = agrNP agr ** {s = npS} ;
np : ResAra.NP = agrNP agr ** {s = npS} ;
cl = predVP np vp ;
in
cl.s ! t ! p ! Nominal

View File

@@ -127,7 +127,15 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in {
} ;
noPrep : Preposition = mkPreposition [] Nom ;
datPrep : Preposition = mkPreposition ("لِ" ++ BIND) Dat ;
liPrep : Preposition = mkPreposition (
pre { #pronSuffAndOther => "لِ" ;
#pronSuff => "لَ" ;
_ => "لِ"
} ++ BIND) Dat ;
biPrep : Preposition = mkPreposition ("بِ"++BIND) ;
pronSuff : pattern Str = #("كَ"|"كِ"|"كُمَا"|"كُمْ"|"كُنَّ"|"هُ"|"ها"|"هُمَا"|"هُمْ"|"هُنَّ") ;
pronSuffAndOther : pattern Str = #( "كَم" ) ; -- TODO list words that begin like pron.suff. but aren't
Adj : Type = {s : AForm => Str} ;
Adj2 : Type = Adj ** {c2 : Preposition} ;
@@ -1341,9 +1349,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
{ s =
table {
(Nom|Bare) => ana;
Acc => BIND ++ nI; -- object suffix
Gen => BIND ++ I; -- possessive suffix
Dat => I -- will only be used with preposition لِ, which already has a BIND
Acc => nI ; -- object suffix
Gen => I ; -- possessive suffix
Dat => I -- will only be used with preposition لِ
};
a = {pgn = pgn; isPron = True };
empty = []
@@ -1545,24 +1553,40 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
<True, Pres, Pos> => vp.pred.s ! gn ! Nom; --xabar marfooc
_ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob
};
sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; Dir => vp.sc} ;
sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; _ => vp.sc} ;
subj = np.empty ++ sc.s
++ case vp.isPred of {
False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative
True => np.s ! sc.c
} ;
} in wordOrder o
vp.obj.a.isPron np.a.isPron
(vStr t p)
subj
(case <vp.isPred,vp.obj.a.isPron> of {
<False,True> => BIND ++ vp.obj.s ;
_ => vp.obj.s })
(pred t p)
vp.s2
} in
case o of {
Verbal => vStr t p ++ case vp.obj.a.isPron of {
True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb
False => subj ++ vp.obj.s }
++ vp.s2 ++ pred t p ;
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
}
} ;
-- seems complicated, but this is to share code between PredVP and ClSlash-using funs
wordOrder : Order -> (objIsPron,subjIsPron : Bool) -> (verb,subj,obj,pred,adv : Str) -> Str =
\o,objIsPron,subjIsPron,verb,subj,obj,pred,adv ->
case o of {
VOS => verb ++ obj ++ pred ++ adv ++ subj ;
Verbal => verb ++
case objIsPron of {
True => obj ++ subj ; -- obj. clitic attaches directly to the verb
False => subj ++ obj } ++ adv ++ pred ;
Nominal => subj ++ verb ++ obj ++ adv ++ pred ;
Subord => if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb
++ subj ++ verb ++ obj ++ adv ++ pred
} ;
-- in verbal sentences, the verb agrees with the subject
-- in Gender but not in number
verbalAgr : PerGenNum -> PerGenNum = \pgn ->
@@ -1580,9 +1604,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
Obj : Type = {
s : Str ;
a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg
};
a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg.
}; -- need isPron for word order in predVP, and pgn for ImpersCl
Subj : Type = {s : Case => Str ; isPron : Bool} ;
np2subj : NP -> Subj = \np -> np ** {isPron = np.a.isPron} ;
subj2np : Subj -> NP = \su -> su ** {a = {pgn = emptyNP.a.pgn ; isPron = su.isPron} ; empty=[]} ;
emptyObj : Obj = emptyNP ** {s=[]} ;
insertObj : NP -> VPSlash -> VP = \np,vp -> vp **
@@ -1608,7 +1636,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- Slash categories
VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ;
ClSlash : Type = VPSlash ** {subj : NP} ;
ClSlash : Type = VPSlash ** {subj : Subj} ;
slashV2 : Verb2 -> VPSlash = \v ->
predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ;
@@ -1617,14 +1645,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
-- but keep the structure as VP, because later on
-- we might need different word orders for the ClSlash.
predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** {
subj = np
subj = np2subj np ;
s = \\_pgn,vf => v.s ! np.a.pgn ! vf -- so we can throw away subject's pgn
} ;
complClSlash = overload {
complClSlash : NP -> ClSlash -> Cl = \obj,cls ->
predVP cls.subj (insertObj obj cls) ;
predVP (subj2np cls.subj) (insertObj obj cls) ;
complClSlash : ClSlash -> Cl = \cls ->
predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object
predVP (subj2np cls.subj) (insertObj emptyNP cls) -- Empty subject and object
} ;
Cl : Type = {s : Tense => Polarity => Order => Str} ;

View File

@@ -33,9 +33,9 @@ concrete SentenceAra of Sentence = CatAra ** open
ImpVP vp = {
s = \\p,g,n =>
case p of {
Pos => vp.s ! (Per2 g n) ! VPImp ++ vp.obj.s ++ vp.s2 ;
Neg => "لا" ++ vp.s ! (Per2 g n) ! (VPImpf Jus) ++ vp.obj.s ++ vp.s2
}
Pos => vp.s ! Per2 g n ! VPImp ;
Neg => "لَا" ++ vp.s ! Per2 g n ! VPImpf Jus
} ++ vp.obj.s ++ vp.pred.s ! {g=g;n=n} ! Acc ++ vp.s2
};
--

View File

@@ -18,8 +18,8 @@ concrete StructuralAra of Structural = CatAra **
between_Prep = mkPrep "بَيْنَ" ;
-- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ;
-- but_PConj = ss "بُت" ;
by8agent_Prep = mkPrep "بِ" ;
by8means_Prep = mkPrep "بِ" ;
by8agent_Prep,
by8means_Prep = biPrep ;
can_VV = mkVV (mkV "طوع" FormX) ;
-- can8know_VV = {
-- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ;
@@ -34,6 +34,7 @@ concrete StructuralAra of Structural = CatAra **
-- everywhere_Adv = ss "ثريوهري" ;
few_Det = mkDet "بَعض" Pl Const ;
-- first_Ord = ss "فِرست" ;
for_Prep = liPrep ;
from_Prep = mkPrep "مِنَ" ;
he_Pron = ResAra.he_Pron ;
here_Adv = ss "هُنا" ;
@@ -68,7 +69,7 @@ concrete StructuralAra of Structural = CatAra **
-- otherwise_PConj = ss "ْتهروِسي" ;
part_Prep = mkPrep "مِنَ" ;
-- please_Voc = ss "ةلَسي" ;
possess_Prep = mkPrep "ل" ;
possess_Prep = liPrep ;
-- quite_Adv = ss "قُِتي" ;
she_Pron = ResAra.she_Pron ;
-- so_AdA = ss "سْ" ;

View File

@@ -56,7 +56,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in {
} ;
-- : VA -> AP -> VP ; -- they become red
ComplVA v ap = predV v ** {comp = CompAP ap} ;
ComplVA v ap = predV v ** {pred = CompAP ap} ;
-- ComplV2A v np ap =
-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ;