1
0
forked from GitHub/gf-rgl
This commit is contained in:
Inari Listenmaa
2018-09-20 10:11:32 +02:00
10 changed files with 110 additions and 100 deletions

View File

@@ -1,7 +1,7 @@
Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility
Afr,afrikaans,,,,,,n,
Amh,amharic,,,,,n,n,
Ara,arabic,,,,,n,n,
Ara,arabic,,,,,,y,
Eus,basque,,,,,,,
Bul,bulgarian,,,y,,,,
Cat,catalan,Romance,,y,,,,y
1 Code Directory Functor Unlexer Present All Try Symbolic Compatibility
2 Afr afrikaans n
3 Amh amharic n n
4 Ara arabic n n y
5 Eus basque
6 Bul bulgarian y
7 Cat catalan Romance y y

View File

@@ -20,10 +20,9 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in {
--
-- $SuperlA$ belongs to determiner syntax in $Noun$.
--
-- ComplA2 a np = {
-- s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ;
-- isPre = False
-- } ;
ComplA2 a np = {
s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2 ++ np.s ! Gen ;
} ;
--
-- ReflA2 a = {
-- s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ;

View File

@@ -16,16 +16,18 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Sentence
Cl = {s : ResAra.Tense => Polarity => Order => Str} ;
-- Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ;
Cl = ResAra.Cl ; -- {s : ResAra.Tense => Polarity => Order => Str} ;
ClSlash = ResAra.ClSlash ;
Imp = {s : Polarity => Gender => ResAra.Number => Str} ;
-- Question
QCl = {s : ResAra.Tense => Polarity => QForm => Str} ;
IP = {s : Str ; n : ResAra.Number} ;
-- IAdv = {s : Str} ;
IDet = {s : Case => Str ; n : ResAra.Number} ; ---- AR add Case
QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ;
IP,
IDet,
IComp = ResAra.IP ; -- {s : Gender => State => Case => Str ; n : ResAra.Number} ;
-- IAdv = {s : Str} ;
IQuant = {s : State => Case => Str} ;
--
---- Relative
--
@@ -35,7 +37,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
-- Verb
VP = ResAra.VP ;
VPSlash = ResAra.VP ** {c2 : Str} ;
VPSlash = ResAra.VPSlash ; -- VP ** {c2:Str}
Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ;
-- SC = {s : Str} ;
--
@@ -47,18 +49,11 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in {
CN = ResAra.Noun ** {adj : NTable};
NP, Pron = ResAra.NP; --{s : Case => Str ; a : Agr } ;
Num, Ord, Card = ResAra.NumOrdCard ;
Ord,
Num,
Card = ResAra.NumOrdCard ;
Predet = ResAra.Predet ;
-- DEPRECATED
-- QuantSg, QuantPl =
-- {s : Species => Gender => Case => Str;
-- n : ResAra.Number;
-- d : State;
-- isNum : Bool;
-- isPron : Bool} ;
Det = ResAra.Det ;
-- {s : Species => Gender => Case => Str ;
-- d : State; n : Size; isNum : Bool } ;

View File

@@ -9,8 +9,6 @@ oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ;
oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ;
oper AdvIP : IP -> Adv -> IP = notYet "AdvIP" ;
oper AdvS : Adv -> S -> S = notYet "AdvS" ;
oper AdvSlash : ClSlash -> Adv -> ClSlash = notYet "AdvSlash" ;
oper ApposCN : CN -> NP -> CN = notYet "ApposCN" ;
oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ;
oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ;
oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ;
@@ -19,12 +17,8 @@ oper BaseS : S -> S -> ListS = notYet "BaseS" ;
oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ;
oper CleftAdv : Adv -> S -> Cl = notYet "CleftAdv" ;
oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ;
oper CompCN : CN -> Comp = notYet "CompCN" ;
oper CompIAdv : IAdv -> IComp = notYet "CompIAdv" ;
oper CompIP : IP -> IComp = notYet "CompIP" ;
oper ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ;
oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ;
oper ComplA2 : A2 -> NP -> AP = notYet "ComplA2" ;
oper ComplN2 : N2 -> NP -> CN = notYet "ComplN2" ;
oper ComplN3 : N3 -> NP -> N2 = notYet "ComplN3" ;
oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ;
@@ -54,12 +48,8 @@ oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
oper PConjConj : Conj -> PConj = notYet "PConjConj" ;
oper PPartNP : NP -> V2 -> NP = notYet "PPartNP" ;
oper PassV2 : V2 -> VP = notYet "PassV2" ;
oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ;
oper PrepIP : Prep -> IP -> IAdv = notYet "PrepIP" ;
oper ProgrVP : VP -> VP = notYet "ProgrVP" ;
oper QuestIComp : IComp -> NP -> QCl = notYet "QuestIComp" ;
oper QuestSlash : IP -> ClSlash -> QCl = notYet "QuestSlash" ;
oper ReflA2 : A2 -> AP = notYet "ReflA2" ;
oper ReflVP : VPSlash -> VP = notYet "ReflVP" ;
oper RelCN : CN -> RS -> CN = notYet "RelCN" ;
@@ -70,13 +60,11 @@ oper RelVP : RP -> VP -> RCl = notYet "RelVP" ;
oper SentAP : AP -> SC -> AP = notYet "SentAP" ;
oper SentCN : CN -> SC -> CN = notYet "SentCN" ;
oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ;
oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ;
oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ;
oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ;
oper SlashV2S : V2S -> S -> VPSlash = notYet "SlashV2S" ;
oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ;
oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ;
oper SlashVP : NP -> VPSlash -> ClSlash = notYet "SlashVP" ;
oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ;
oper SlashVV : VV -> VPSlash -> VPSlash = notYet "SlashVV" ;
oper SubjS : Subj -> S -> Adv = notYet "SubjS" ;
@@ -86,15 +74,10 @@ oper UseComparA : A -> AP = notYet "UseComparA" ;
oper UseN2 : N2 -> CN = notYet "UseN2" ;
oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ;
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
oper UttAP : AP -> Utt = notYet "UttAP" ;
oper UttCN : CN -> Utt = notYet "UttCN" ;
oper UttCard : Card -> Utt = notYet "UttCard" ;
oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ;
oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
oper UttVP : VP -> Utt = notYet "UttVP" ;
oper VocNP : NP -> Voc = notYet "VocNP" ;
oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ;
oper which_IQuant : IQuant = notYet "which_IQuant" ;
}
}

View File

@@ -11,7 +11,7 @@ concrete PhraseAra of Phrase = CatAra ** open
UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg ++ pol.s} ;
UttImpPl,UttImpPol = \pol,imp -> {s = \\g => imp.s ! pol.p ! g ! ResAra.Pl ++ pol.s} ;
UttIP ip = {s = \\_ => ip.s} ; ---- AR
UttIP ip = {s = \\g => ip.s ! g ! Def ! Nom} ; --IL
UttAP ap = {s = ResAra.uttAP ap} ; --IL
UttCard c = {s = ResAra.uttNum c} ; --IL

View File

@@ -1,4 +1,4 @@
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude in {
concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra in {
flags optimize=all_subs ; coding = utf8 ;
@@ -12,13 +12,16 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude in {
}
};
-- ComplSlashIP vps ip = {} ;
-- AR copied from PredVP
QuestVP qp vp =
{ s =\\t,p,_ =>
let {
---- o = Verbal ; ---- AR
np = {s = table Case {_ => qp.s} ; a ={pgn = Per3 Masc qp.n ; isPron = False}} ;
---- o = Verbal ; ---- AR
objgn = pgn2gn vp.obj.a.pgn ;
np = {s = qp.s ! objgn.g ! Def ; ----IL just guessing state
a ={pgn = Per3 Masc qp.n ; isPron = False}} ;
pgn = np.a.pgn ;
gn = pgn2gn pgn;
kataba = vp.s ! pgn ! VPPerf ;
@@ -60,47 +63,48 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude in {
; ---- };
-- QuestSlash ip slash = {
-- s = \\t,a,p =>
-- let
-- cls = slash.s ! t ! a ! p ;
-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtAra
-- in table {
-- QDir => who ++ cls ! OQuest ;
-- QIndir => who ++ cls ! ODir
-- }
-- } ;
--
---- AR guessed
QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ;
QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ;
-- s = \\t,a,p =>
-- let
-- cls = cl.s ! t ! a ! p ;
-- why = iadv.s
-- in table {
-- QDir => why ++ cls ! OQuest ;
-- QIndir => why ++ cls ! ODir
-- }
-- } ;
--
-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ;
--
-- AdvIP ip adv = {
-- s = \\c => ip.s ! c ++ adv.s ;
-- n = ip.n
-- } ;
--
---- IL guessed
QuestIComp icomp np =
let vp = kaan (CompNP np) in
QuestVP icomp vp ;
---- AR guesses
IdetCN idet cn = {
s = idet.s ! Nom ++ cn.s ! idet.n ! Indef ! Nom ;
n = idet.n
CompIP ip = ip ;
-- old, when IComp = Comp { s = \\{g=g ; n=_},c => ip.s ! g ! Def ! c } ; ----
CompIAdv iadv = mkIP iadv.s ResAra.Sg ;
-- QCl = {s : R.Tense => Polarity => QForm => Str} ;
QuestSlash ip cl = { ----IL just guessing
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! Verbal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom ; --VSO (purely guessing)
QIndir => cl.s ! t ! p ! Nominal ++ cl.c2 ++ ip.s ! Masc ! Def ! Nom } --SVO (purely guessing)
} ;
IdetQuant idet num = {
s = \\c => idet.s ++ num.s ! Masc ! Indef ! c;
n = ResAra.Sg ---- size of Num
} ;
--
PrepIP p ip = {s = p.s ++ ip.s ! Masc ! Def ! Acc} ; ----IL
AdvIP ip adv = ip ** {
s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ;
n = ip.n
} ;
----IL guessed with help of L and Google translate
-- : IDet -> IP
IdetIP idet = idet ; -- Gender still matters if turned into IComp
-- : IDet -> CN -> IP
IdetCN idet cn = idet ** {
s = \\g,s,c => idet.s ! cn.g ! s ! c ++ -- gender is determined by the CN
cn.s ! idet.n ! Indef ! Gen ; --idaafa
} ;
-- : IQuant -> Num -> IDet
IdetQuant iquant num = {
s = \\g,s,c =>
let gend = detGender g num.n -- gender flips with some numbers
in iquant.s ! s ! c ++ num.s ! gend ! s ! c ;
n = sizeToNumber num.n
} ;
}

View File

@@ -7,7 +7,7 @@
---- implement $Test$, it moreover contains regular lexical
---- patterns needed for $Lex$.
--
resource ResAra = PatternsAra ** open Prelude, Predef in {
resource ResAra = PatternsAra ** open Prelude, Predef, ParamX in {
flags optimize=noexpand ; coding=utf8 ;
@@ -114,7 +114,11 @@ resource ResAra = PatternsAra ** open Prelude, Predef in {
uttAP : AP -> (Gender => Str) ;
uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL
NumOrdCard : Type = {s : Gender => State => Case => Str ; n : Size };
NumOrdCard : Type = {
s : Gender => State => Case => Str ;
n : Size ;
} ;
uttNum : NumOrdCard -> (Gender => Str) ;
uttNum n = \\g => n.s ! g ! Def ! Nom ; ----IL
@@ -980,8 +984,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
};
mkIP : Str -> Number -> {s : Str ; n : Number} =
\s,n -> {s = s ; n = n} ;
mkIP : Str -> Number -> IP =
\s,n -> {s = \\_g,_s,_c => s ; n = n} ;
mkOrd : (_,_ : Str) -> NumOrdCard =
\aysar,yusra ->
@@ -1027,7 +1031,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
s : Case => Str ;
a : Agr
} ;
IP : Type = {
s : Gender -- because of CompIP
=> State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative
=> Str ;
n : Number
} ;
param VPForm =
VPPerf
| VPImpf Mood
@@ -1089,6 +1100,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf ->
kaan : {s : AAgr => Case => Str} -> VP = \xabar ->
insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) );
-- Slash categories
VPSlash : Type = VP ** {c2 : Str} ;
ClSlash : Type = Cl ** {c2 : Str} ;
Cl : Type = {s : Tense => Polarity => Order => Str} ;
QCl : Type = {s : Tense => Polarity => QForm => Str} ;
--TODO: slashRCl : ClSlash -> RP -> RCl ;
param
Size = One | Two | ThreeTen | Teen | NonTeen | Hundreds | None ;

View File

@@ -71,7 +71,6 @@ concrete SentenceAra of Sentence = CatAra ** open
np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p)
}
};
-- PredVP np vp = mkClause (np.s ! Nom) np.a vp ;
-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ;
@@ -91,14 +90,16 @@ concrete SentenceAra of Sentence = CatAra ** open
-- mkClause (np.s ! Nom) np.a
-- (insertObj (\\a => infVP vv.isAux (predV v2) a) (predVV vv)) **
-- {c2 = v2.c2} ;
--
-- AdvSlash slash adv = {
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
-- c2 = slash.c2
-- } ;
--
-- SlashPrep cl prep = cl ** {c2 = prep.s} ;
--
-- ClSlash
SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ;
AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ;
SlashPrep cl prep = cl ** {c2 = prep.s} ;
-- SlashVS np vs sslash = TODO
-- EmbedS s = {s = conjThat ++ s.s} ;
-- EmbedQS qs = {s = qs.s ! QIndir} ;
-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr

View File

@@ -95,8 +95,16 @@ concrete StructuralAra of Structural = CatAra **
when_IAdv = ss "مَتَى" ;
-- when_Subj = ss "وهن" ;
where_IAdv = ss "أَينَ" ;
-- whichPl_IDet = mkDeterminer Pl ["وهِعه"] ;
-- whichSg_IDet = mkDeterminer Sg ["وهِعه"] ;
which_IQuant = {
s = \\s,c => case <c,s> of {
<Nom,Indef> => "أيٌّ" ;
<Nom,_> => "أيُّ" ;
<Acc,Indef> => "أيّاً" ;
<Acc,_> => "أيَّ" ;
<Gen,Indef> => "أيٍّ" ;
<Gen,_> => "أيِّ"
}
} ;
whoSg_IP = mkIP "مَنْ" Sg ;
whoPl_IP = mkIP "مَنْ" Pl ;
-- why_IAdv = ss "وهي" ;

View File

@@ -35,7 +35,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in {
--
-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ;
--
-- PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ;
PassV2 v = kaan {s = \\_,_ => v.s ! VPPart} ; ---- IL guessed
--
-- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no