From 7aa2837dd7ab7b94a4b0dae37290b111191a805b Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 29 Oct 2018 17:45:15 +0000 Subject: [PATCH 01/78] (Por) add lins - UttAdV, UttVPShort, PositAdVAdj, AdAdV, ComplSlashPartLast, CompVP to Extend - small fixes to Lexicon --- src/abstract/Extend.gf | 2 +- src/portuguese/ExtendPor.gf | 30 +++++++++++++++++++++++++++++- src/portuguese/LexiconPor.gf | 6 +++--- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/src/abstract/Extend.gf b/src/abstract/Extend.gf index 760114c2..3ee3b840 100644 --- a/src/abstract/Extend.gf +++ b/src/abstract/Extend.gf @@ -200,7 +200,7 @@ abstract Extend = Cat ** { -- Eng UncontractedNeg : Pol ; -- do not, etc, as opposed to don't UttVPShort : VP -> Utt ; -- have fun, as opposed to "to have fun" - ComplSlashPartLast : VPSlash -> NP -> VP ; + ComplSlashPartLast : VPSlash -> NP -> VP ; -- set it apart, as opposed to "set apart it" -- Romance DetNPMasc : Det -> NP ; diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 25da698e..12ab235b 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -3,13 +3,16 @@ concrete ExtendPor of Extend = CatPor ** ExtendFunctor - [ - ApposNP, + AdAdV, + ApposNP, BaseVPS, ByVP, CompBareCN, ComplBareVS, + ComplSlashPartLast, CompoundAP, CompoundN, + CompVP, ConsVPS, --EmptyRelSlash, ExistsNP, @@ -28,12 +31,15 @@ concrete ExtendPor of Extend = PassVPSlash, PastPartAP, PastPartAgentAP, + PositAdVAdj, PresPartAP, ProDrop, PurposeVP, VPS, iFem_Pron, theyFem_Pron, + UttAdV, + UttVPShort, weFem_Pron, WithoutVP, youFem_Pron, @@ -213,6 +219,28 @@ concrete ExtendPor of Extend = } ; } ; + AdAdV aa av = { + s = aa.s ++ av.s + } ; + + UttAdV av = av ; + + PositAdVAdj a = { + s = a.s ! Posit ! AA + } ; + + --TODO: actually use ant + CompVP ant p vp = let + neg = negation ! p.p + in { + s = \\agr => ant.s ++ p.s ++ "de" ++ neg.p1 ++ infVP vp agr ; + cop = serCopula + } ; + + UttVPShort = UttVP ; + + ComplSlashPartLast = ComplSlash ; + oper gerundStr : VP -> Str ; gerundStr vp = gerVP vp (Ag Masc Sg P3) ; diff --git a/src/portuguese/LexiconPor.gf b/src/portuguese/LexiconPor.gf index 6fbb22d4..96b9ee2a 100644 --- a/src/portuguese/LexiconPor.gf +++ b/src/portuguese/LexiconPor.gf @@ -23,7 +23,7 @@ lin clean_A = mkA "limpo" ; clever_A = mkA "inteligente" ; cold_A = mkA "frio" ; -- fria - correct_A = mkA "correto" | mkA "correcto" ; + correct_A = mkA "correto" ; dirty_A = mkA "sujo" ; dry_A = mkA "seco" ; dull_A = mkA "desafilado" ; @@ -47,7 +47,7 @@ lin short_A = mkA "curto" ; --- breve, pequeno, baixo small_A = prefA (mkA "pequeno") ; smooth_A = mkA "liso" ; -- suave - straight_A = mkA "direto" | mkA "directo" ; -- reto + straight_A = mkA "direto" ; -- reto stupid_A = mkA "estúpido" ; thick_A = mkA "grosso" ; thin_A = mkA "fino" ; -- delgado, magro @@ -337,7 +337,7 @@ lin flow_V = mkV "fluir" ; -- circular fly_V = mkV "voar" ; freeze_V = mkV "congelar" ; - go_V = (mkV "ir") ; + go_V = mkV (ir_Besch "ir") ; jump_V = mkV "saltar" ; laugh_V = mkV (rir_Besch "rir") ; lie_V = reflV (mkV "mentir") ; From 1427b1bbb888c52967350d4f4b200c308aa314c6 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Tue, 30 Oct 2018 13:48:26 +0000 Subject: [PATCH 02/78] (Por) change mk2A paradigm (such that the second argument is the adverb string, not the feminine form, which is easier to predict) - fix bug in adjVo paradigm - add two cases to mkAdjReg smart paradigm - update lexicon tbh, it is much more common to need to correct the adverbial form because it doesn't have the accents that the adjectival forms may have, so if there's a way of removing accents easily, that might be better. --- src/portuguese/LexiconPor.gf | 4 ++-- src/portuguese/MorphoPor.gf | 22 ++++++++++++---------- src/portuguese/ParadigmsPor.gf | 6 +++--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/portuguese/LexiconPor.gf b/src/portuguese/LexiconPor.gf index 6fbb22d4..c2393905 100644 --- a/src/portuguese/LexiconPor.gf +++ b/src/portuguese/LexiconPor.gf @@ -10,7 +10,7 @@ flags lin easy_A2V = mkA2V (mkA "fácil") dative genitive ; married_A2 = mkA2 (mkA "casado") dative ; - probable_AS = mkAS (mkA "provável" "provável" "prováveis" "prováveis" "provavelmente") ; + probable_AS = mkAS (mkA "provável" "provavelmente") ; fun_AV = mkAV (mkA "divertido") genitive ; -- A bad_A = prefA (mkA (mkA "mau") (mkA "pior")) ; @@ -58,7 +58,7 @@ lin white_A = compADeg (mkA "branco") ; wide_A = mkA "largo" ; -- extenso yellow_A = mkA "amarelo" ; - young_A = prefA (mkA "jovem" "jovem" "jovens" "jovens" "juvenilmente") ; + young_A = prefA (mkA "jovem" "juvenilmente") ; already_Adv = mkAdv "já" ; far_Adv = mkAdv "longe" ; ----? now_Adv = mkAdv "agora" ; diff --git a/src/portuguese/MorphoPor.gf b/src/portuguese/MorphoPor.gf index 54b31b10..e4c20604 100644 --- a/src/portuguese/MorphoPor.gf +++ b/src/portuguese/MorphoPor.gf @@ -124,16 +124,16 @@ oper } } ; - mkAdj2N : (_,_: N) -> Str -> Adj = \mascN, femN, burramente -> - {s = table { - AF Masc n => mascN.s ! n ; - AF Fem n => femN.s ! n ; - AA => burramente - } + mkAdj2 : (_,_: Str) -> Adj ; + mkAdj2 aj av = let + adj = mkAdjReg aj + in { + s = table { + AF g n => adj.s ! AF g n ; + AA => av + } } ; - mkAdjN : N -> Str -> Adj = \n, burramente -> mkAdj2N n n burramente ; - -- Then the regular and invariant patterns. adjPreto : Str -> Adj = \preto -> @@ -174,7 +174,7 @@ oper "ã" => "a" } ; alemvo : Str = alem + v + "o" ; - in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "amente") ; + in mkAdj alemão alemã (alemã + "s") (alemã + "es") (alemã + "mente") ; adjEuropeu : Str -> Adj = \europeu -> let europe = init europeu in mkAdj europeu (europe + "ia") (europeu + "s") (europe + "ias") @@ -183,11 +183,13 @@ oper mkAdjReg : Str -> Adj = \a -> case a of { pret + "o" => adjPreto a ; - anarquist + v@("e" | "a") => adjUtil (anarquist + v) (anarquist + v + "s") ; + anarquist + v@("e" | "a") => adjUtil a (a + "s") ; ouvido + "r" => adjOuvidor a (ouvido + "ra") ; chin + "ês" => adjFrances a ; europ + "eu" => adjEuropeu a ; alem + "ão" => adjVo a ; + provav + v@("e" | "i") + "l" => adjUtil a (provav + "eis") ; + jove + "m" => adjUtil a (jove + "ns") ; _ => adjUtil a (a + "s") } ; diff --git a/src/portuguese/ParadigmsPor.gf b/src/portuguese/ParadigmsPor.gf index 38de771b..6066a16b 100644 --- a/src/portuguese/ParadigmsPor.gf +++ b/src/portuguese/ParadigmsPor.gf @@ -203,9 +203,9 @@ oper regA a = compADeg {s = \\_ => (mkAdjReg a).s ; isPre = False ; lock_A = <>} ; - mk2A : (espanhol,espanhola : Str) -> A ; - mk2A a b = compADeg {s = \\_ => (mkAdj2N (mkN a) (mkN b) (b + "mente")).s ; isPre = False ; - lock_A = <>} ; + mk2A : (único,unicamente : Str) -> A ; + mk2A adj adv = compADeg {s = \\_ => (mkAdj2 adj adv).s ; isPre = False ; + lock_A = <>} ; mk5A : (preto,preta,pretos,pretas,pretamente : Str) -> A ; mk5A a b c d e = compADeg {s = \\_ => (mkAdj a b c d e).s ; From da129e40efc6590a53a27d4fc792c9899959d4d0 Mon Sep 17 00:00:00 2001 From: bruno cuconato Date: Thu, 1 Nov 2018 14:24:20 +0000 Subject: [PATCH 03/78] (Common) not all cats are linearized to SS see `CAdv`, for instance. --- src/abstract/Common.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/abstract/Common.gf b/src/abstract/Common.gf index 0e7a5763..3e852978 100644 --- a/src/abstract/Common.gf +++ b/src/abstract/Common.gf @@ -1,7 +1,7 @@ --1 Common: Structures with Common Implementations. --- This module defines the categories that uniformly have the --- linearization type ${s:Str}$ in all languages. +-- This module defines the categories that uniformly have the same +-- linearization type (usually ${s:Str}$) in all languages. abstract Common = { From a74460a0e166fb1b28531abe21006c6de8db77ee Mon Sep 17 00:00:00 2001 From: odanoburu Date: Thu, 1 Nov 2018 20:58:12 +0000 Subject: [PATCH 04/78] =?UTF-8?q?(BeschPor)=20correct=20come=C3=A7ar=20and?= =?UTF-8?q?=20peneirar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit also add documentation on verb paradigms --- src/portuguese/BeschPor.gf | 278 ++++++++++++++++++++++++++++--------- src/portuguese/DiffPor.gf | 2 +- 2 files changed, 216 insertions(+), 64 deletions(-) diff --git a/src/portuguese/BeschPor.gf b/src/portuguese/BeschPor.gf index cf3c5ea8..e8607591 100644 --- a/src/portuguese/BeschPor.gf +++ b/src/portuguese/BeschPor.gf @@ -71,7 +71,11 @@ oper -- or in =Ryan, M. A. Conjugação dos Verbos em Português. ática, -- 1991.= + -- the numbers in the comments below the oper declaration are the + -- verb's paradigm numbers in bescherelle and in Ryan + oper ter_Besch : Str -> Verbum = \ter -> +-- 1 | r3 let x_ = Predef.tk 3 ter in {s = table { VI Infn => x_ + "ter" ; @@ -141,6 +145,7 @@ oper ter_Besch : Str -> Verbum = \ter -> } ; oper haver_Besch : Str -> Verbum = \haver -> +-- 2 | r4 let x_ = Predef.tk 5 haver in {s = table { VI Infn => x_ + "haver" ; @@ -210,6 +215,7 @@ oper haver_Besch : Str -> Verbum = \haver -> } ; oper ser_Besch : Str -> Verbum = \ser -> +-- 3 | r1 let x_ = Predef.tk 3 ser in {s = table { VI Infn => x_ + "ser" ; @@ -279,6 +285,7 @@ oper ser_Besch : Str -> Verbum = \ser -> } ; oper comprar_Besch : Str -> Verbum = \comprar -> +-- 4 | r5 let compr_ = Predef.tk 2 comprar in {s = table { VI Infn => compr_ + "ar" ; @@ -348,6 +355,7 @@ oper comprar_Besch : Str -> Verbum = \comprar -> } ; oper vender_Besch : Str -> Verbum = \vender -> +-- 5 | r6 let vend_ = Predef.tk 2 vender in {s = table { VI Infn => vend_ + "er" ; @@ -417,6 +425,7 @@ oper vender_Besch : Str -> Verbum = \vender -> } ; oper garantir_Besch : Str -> Verbum = \garantir -> +-- 6 | r7 let garant_ = Predef.tk 2 garantir in {s = table { VI Infn => garant_ + "ir" ; @@ -486,6 +495,7 @@ oper garantir_Besch : Str -> Verbum = \garantir -> } ; oper estar_Besch : Str -> Verbum = \estar -> +-- 10 | r2 let est_ = Predef.tk 2 estar in {s = table { VI Infn => est_ + "ar" ; @@ -555,6 +565,7 @@ oper estar_Besch : Str -> Verbum = \estar -> } ; oper dar_Besch : Str -> Verbum = \dar -> +-- 11 | r59 let x_ = Predef.tk 3 dar in {s = table { VI Infn => x_ + "dar" ; @@ -624,6 +635,7 @@ oper dar_Besch : Str -> Verbum = \dar -> } ; oper ficar_Besch : Str -> Verbum = \ficar -> +-- 12 | r23 let x_ = Predef.tk 5 ficar in {s = table { VI Infn => x_ + "ficar" ; @@ -693,75 +705,77 @@ oper ficar_Besch : Str -> Verbum = \ficar -> } ; oper começar_Besch : Str -> Verbum = \começar -> - let x_ = Predef.tk 7 começar in +-- 13 | r24 + let come_ = Predef.tk 3 começar in {s = table { - VI Infn => x_ + "começar" ; - VI Ger => x_ + "começando" ; - VI Part => x_ + "começado" ; - VPB (Pres Ind Sg P1) => x_ + "começo" ; - VPB (Pres Ind Sg P2) => x_ + "começas" ; - VPB (Pres Ind Sg P3) => x_ + "começa" ; - VPB (Pres Ind Pl P1) => x_ + "começamos" ; - VPB (Pres Ind Pl P2) => x_ + "começais" ; - VPB (Pres Ind Pl P3) => x_ + "começam" ; - VPB (Pres Sub Sg P1) => x_ + "comece" ; - VPB (Pres Sub Sg P2) => x_ + "comeces" ; - VPB (Pres Sub Sg P3) => x_ + "comece" ; - VPB (Pres Sub Pl P1) => x_ + "comecemos" ; - VPB (Pres Sub Pl P2) => x_ + "comeceis" ; - VPB (Pres Sub Pl P3) => x_ + "comecem" ; - VPB (PretI Ind Sg P1) => x_ + "começava" ; --# notpresent - VPB (PretI Ind Sg P2) => x_ + "começavas" ; --# notpresent - VPB (PretI Ind Sg P3) => x_ + "começava" ; --# notpresent - VPB (PretI Ind Pl P1) => x_ + "começávamos" ; --# notpresent - VPB (PretI Ind Pl P2) => x_ + "começáveis" ; --# notpresent - VPB (PretI Ind Pl P3) => x_ + "começavam" ; --# notpresent - VPB (PretI Sub Sg P1) => x_ + "começasse" ; --# notpresent - VPB (PretI Sub Sg P2) => x_ + "começasses" ; --# notpresent - VPB (PretI Sub Sg P3) => x_ + "começasse" ; --# notpresent - VPB (PretI Sub Pl P1) => x_ + "começássemos" ; --# notpresent - VPB (PretI Sub Pl P2) => x_ + "começasseis" ; --# notpresent - VPB (PretI Sub Pl P3) => x_ + "começassem" ; --# notpresent - VPB (MQPerf Sg P1) => x_ + "começara" ; --# notpresent - VPB (MQPerf Sg P2) => x_ + "começaras" ; --# notpresent - VPB (MQPerf Sg P3) => x_ + "começara" ; --# notpresent - VPB (MQPerf Pl P1) => x_ + "começáramos" ; --# notpresent - VPB (MQPerf Pl P2) => x_ + "começáreis" ; --# notpresent - VPB (MQPerf Pl P3) => x_ + "começaram" ; --# notpresent - VPB (PretP Sg P1) => x_ + "comecei" ; --# notpresent - VPB (PretP Sg P2) => x_ + "começaste" ; --# notpresent - VPB (PretP Sg P3) => x_ + "começou" ; --# notpresent - VPB (PretP Pl P1) => x_ + vars "começamos" "começámos" ; --# notpresent - VPB (PretP Pl P2) => x_ + "começastes" ; --# notpresent - VPB (PretP Pl P3) => x_ + "começaram" ; --# notpresent - VPB (Fut Ind Sg P1) => x_ + "começarei" ; --# notpresent - VPB (Fut Ind Sg P2) => x_ + "começarás" ; --# notpresent - VPB (Fut Ind Sg P3) => x_ + "começará" ; --# notpresent - VPB (Fut Ind Pl P1) => x_ + "começaremos" ; --# notpresent - VPB (Fut Ind Pl P2) => x_ + "começareis" ; --# notpresent - VPB (Fut Ind Pl P3) => x_ + "começarão" ; --# notpresent - VPB (Fut Sub Sg P1) => x_ + "começar" ; --# notpresent - VPB (Fut Sub Sg P2) => x_ + "começares" ; --# notpresent - VPB (Fut Sub Sg P3) => x_ + "começar" ; --# notpresent - VPB (Fut Sub Pl P1) => x_ + "começarmos" ; --# notpresent - VPB (Fut Sub Pl P2) => x_ + "começardes" ; --# notpresent - VPB (Fut Sub Pl P3) => x_ + "começarem" ; --# notpresent - VPB (Cond Sg P1) => x_ + "começaria" ; --# notpresent - VPB (Cond Sg P2) => x_ + "começarias" ; --# notpresent - VPB (Cond Sg P3) => x_ + "começaria" ; --# notpresent - VPB (Cond Pl P1) => x_ + "começaríamos" ; --# notpresent - VPB (Cond Pl P2) => x_ + "começarieis" ; --# notpresent - VPB (Cond Pl P3) => x_ + "começariam" ; --# notpresent - VPB (Imper Sg P2) => x_ + "começa" ; - VPB (Imper Sg P3) => x_ + "comece" ; - VPB (Imper Pl P1) => x_ + "comecemos" ; - VPB (Imper Pl P2) => x_ + "começai" ; - VPB (Imper Pl P3) => x_ + "comecem" ; + VI Infn => come_ + "çar" ; + VI Ger => come_ + "çando" ; + VI Part => come_ + "çado" ; + VPB (Pres Ind Sg P1) => come_ + "ço" ; + VPB (Pres Ind Sg P2) => come_ + "ças" ; + VPB (Pres Ind Sg P3) => come_ + "ça" ; + VPB (Pres Ind Pl P1) => come_ + "çamos" ; + VPB (Pres Ind Pl P2) => come_ + "çais" ; + VPB (Pres Ind Pl P3) => come_ + "çam" ; + VPB (Pres Sub Sg P1) => come_ + "ce" ; + VPB (Pres Sub Sg P2) => come_ + "ces" ; + VPB (Pres Sub Sg P3) => come_ + "ce" ; + VPB (Pres Sub Pl P1) => come_ + "cemos" ; + VPB (Pres Sub Pl P2) => come_ + "ceis" ; + VPB (Pres Sub Pl P3) => come_ + "cem" ; + VPB (PretI Ind Sg P1) => come_ + "çava" ; --# notpresent + VPB (PretI Ind Sg P2) => come_ + "çavas" ; --# notpresent + VPB (PretI Ind Sg P3) => come_ + "çava" ; --# notpresent + VPB (PretI Ind Pl P1) => come_ + "çávamos" ; --# notpresent + VPB (PretI Ind Pl P2) => come_ + "çáveis" ; --# notpresent + VPB (PretI Ind Pl P3) => come_ + "çavam" ; --# notpresent + VPB (PretI Sub Sg P1) => come_ + "çasse" ; --# notpresent + VPB (PretI Sub Sg P2) => come_ + "çasses" ; --# notpresent + VPB (PretI Sub Sg P3) => come_ + "çasse" ; --# notpresent + VPB (PretI Sub Pl P1) => come_ + "çássemos" ; --# notpresent + VPB (PretI Sub Pl P2) => come_ + "çasseis" ; --# notpresent + VPB (PretI Sub Pl P3) => come_ + "çassem" ; --# notpresent + VPB (MQPerf Sg P1) => come_ + "çara" ; --# notpresent + VPB (MQPerf Sg P2) => come_ + "çaras" ; --# notpresent + VPB (MQPerf Sg P3) => come_ + "çara" ; --# notpresent + VPB (MQPerf Pl P1) => come_ + "çáramos" ; --# notpresent + VPB (MQPerf Pl P2) => come_ + "çáreis" ; --# notpresent + VPB (MQPerf Pl P3) => come_ + "çaram" ; --# notpresent + VPB (PretP Sg P1) => come_ + "cei" ; --# notpresent + VPB (PretP Sg P2) => come_ + "çaste" ; --# notpresent + VPB (PretP Sg P3) => come_ + "çou" ; --# notpresent + VPB (PretP Pl P1) => come_ + vars "çamos" "çámos" ; --# notpresent + VPB (PretP Pl P2) => come_ + "çastes" ; --# notpresent + VPB (PretP Pl P3) => come_ + "çaram" ; --# notpresent + VPB (Fut Ind Sg P1) => come_ + "çarei" ; --# notpresent + VPB (Fut Ind Sg P2) => come_ + "çarás" ; --# notpresent + VPB (Fut Ind Sg P3) => come_ + "çará" ; --# notpresent + VPB (Fut Ind Pl P1) => come_ + "çaremos" ; --# notpresent + VPB (Fut Ind Pl P2) => come_ + "çareis" ; --# notpresent + VPB (Fut Ind Pl P3) => come_ + "çarão" ; --# notpresent + VPB (Fut Sub Sg P1) => come_ + "çar" ; --# notpresent + VPB (Fut Sub Sg P2) => come_ + "çares" ; --# notpresent + VPB (Fut Sub Sg P3) => come_ + "çar" ; --# notpresent + VPB (Fut Sub Pl P1) => come_ + "çarmos" ; --# notpresent + VPB (Fut Sub Pl P2) => come_ + "çardes" ; --# notpresent + VPB (Fut Sub Pl P3) => come_ + "çarem" ; --# notpresent + VPB (Cond Sg P1) => come_ + "çaria" ; --# notpresent + VPB (Cond Sg P2) => come_ + "çarias" ; --# notpresent + VPB (Cond Sg P3) => come_ + "çaria" ; --# notpresent + VPB (Cond Pl P1) => come_ + "çaríamos" ; --# notpresent + VPB (Cond Pl P2) => come_ + "çarieis" ; --# notpresent + VPB (Cond Pl P3) => come_ + "çariam" ; --# notpresent + VPB (Imper Sg P2) => come_ + "ça" ; + VPB (Imper Sg P3) => come_ + "ce" ; + VPB (Imper Pl P1) => come_ + "cemos" ; + VPB (Imper Pl P2) => come_ + "çai" ; + VPB (Imper Pl P3) => come_ + "cem" ; VPB (Imper Sg P1) => nonExist } } ; oper chegar_Besch : Str -> Verbum = \chegar -> +-- 14 | r26 let cheg_ = Predef.tk 2 chegar in {s = table { VI Infn => cheg_ + "ar" ; @@ -831,6 +845,7 @@ oper chegar_Besch : Str -> Verbum = \chegar -> } ; oper recear_Besch : Str -> Verbum = \recear -> +-- 15 | r46 let rec_ = Predef.tk 3 recear in {s = table { VI Infn => rec_ + "ear" ; @@ -900,6 +915,7 @@ oper recear_Besch : Str -> Verbum = \recear -> } ; oper anunciar_Besch : Str -> Verbum = \anunciar -> +-- 16 | r46 let anunci_ = Predef.tk 2 anunciar in {s = table { VI Infn => anunci_ + "ar" ; @@ -969,6 +985,7 @@ oper anunciar_Besch : Str -> Verbum = \anunciar -> } ; oper odiar_Besch : Str -> Verbum = \odiar -> +-- 17 | r46 let od_ = Predef.tk 3 odiar in {s = table { VI Infn => od_ + "iar" ; @@ -1038,6 +1055,7 @@ oper odiar_Besch : Str -> Verbum = \odiar -> } ; oper comerciar_Besch : Str -> Verbum = \comerciar -> +-- 18 | r36 let comerc_ = Predef.tk 3 comerciar in {s = table { VI Infn => comerc_ + "iar" ; @@ -1107,6 +1125,7 @@ oper comerciar_Besch : Str -> Verbum = \comerciar -> } ; oper saudar_Besch : Str -> Verbum = \saudar -> +-- 19 | r16 let sa_ = Predef.tk 4 saudar in {s = table { VI Infn => sa_ + "udar" ; @@ -1176,6 +1195,7 @@ oper saudar_Besch : Str -> Verbum = \saudar -> } ; oper perdoar_Besch : Str -> Verbum = \perdoar -> +-- 20 | r38 let perd_ = Predef.tk 3 perdoar in {s = table { VI Infn => perd_ + "oar" ; @@ -1245,6 +1265,7 @@ oper perdoar_Besch : Str -> Verbum = \perdoar -> } ; oper averiguar_Besch : Str -> Verbum = \averiguar -> +-- 21 | r30 let averigu_ = Predef.tk 2 averiguar in {s = table { VI Infn => averigu_ + "ar" ; @@ -1314,6 +1335,7 @@ oper averiguar_Besch : Str -> Verbum = \averiguar -> } ; oper neviscar_Besch : Str -> Verbum = \neviscar -> +-- 22 | r23 let n_ = Predef.tk 7 neviscar in {s = table { VI Infn => n_ + "eviscar" ; @@ -1383,6 +1405,7 @@ oper neviscar_Besch : Str -> Verbum = \neviscar -> } ; oper adequar_Besch : Str -> Verbum = \adequar -> +-- 23 | r82 let adequ_ = Predef.tk 2 adequar in {s = table { VI Infn => adequ_ + "ar" ; @@ -1452,6 +1475,7 @@ oper adequar_Besch : Str -> Verbum = \adequar -> } ; oper relampaguear_Besch : Str -> Verbum = \relampaguear -> +-- 24 let relamp_ = Predef.tk 6 relampaguear in {s = table { VI Infn => relamp_ + "aguear" ; @@ -1521,6 +1545,7 @@ oper relampaguear_Besch : Str -> Verbum = \relampaguear -> } ; oper aquecer_Besch : Str -> Verbum = \aquecer -> +-- 25 | r25 let aque_ = Predef.tk 3 aquecer in {s = table { VI Infn => aque_ + "cer" ; @@ -1590,6 +1615,7 @@ oper aquecer_Besch : Str -> Verbum = \aquecer -> } ; oper proteger_Besch : Str -> Verbum = \proteger -> +-- 26 | r27 let prote_ = Predef.tk 3 proteger in {s = table { VI Infn => prote_ + "ger" ; @@ -1659,6 +1685,7 @@ oper proteger_Besch : Str -> Verbum = \proteger -> } ; oper erguer_Besch : Str -> Verbum = \erguer -> +-- 27 | r32 let erg_ = Predef.tk 3 erguer in {s = table { VI Infn => erg_ + "uer" ; @@ -1728,6 +1755,7 @@ oper erguer_Besch : Str -> Verbum = \erguer -> } ; oper moer_Besch : Str -> Verbum = \moer -> +-- 28 | r39 let m_ = Predef.tk 3 moer in {s = table { VI Infn => m_ + "oer" ; @@ -1797,6 +1825,7 @@ oper moer_Besch : Str -> Verbum = \moer -> } ; oper dizer_Besch : Str -> Verbum = \dizer -> +-- 29 | r60 let di_ = Predef.tk 3 dizer in {s = table { VI Infn => di_ + "zer" ; @@ -1866,6 +1895,7 @@ oper dizer_Besch : Str -> Verbum = \dizer -> } ; oper trazer_Besch : Str -> Verbum = \trazer -> +-- 30 | r73 let tr_ = Predef.tk 4 trazer in {s = table { VI Infn => tr_ + "azer" ; @@ -1935,6 +1965,7 @@ oper trazer_Besch : Str -> Verbum = \trazer -> } ; oper fazer_Besch : Str -> Verbum = \fazer -> +-- 31 | r61 let f_ = Predef.tk 4 fazer in {s = table { VI Infn => f_ + "azer" ; @@ -2004,6 +2035,7 @@ oper fazer_Besch : Str -> Verbum = \fazer -> } ; oper aprazer_Besch : Str -> Verbum = \aprazer -> +-- 32 | r55 let apr_ = Predef.tk 4 aprazer in {s = table { VI Infn => apr_ + "azer" ; @@ -2073,6 +2105,7 @@ oper aprazer_Besch : Str -> Verbum = \aprazer -> } ; oper jazer_Besch : Str -> Verbum = \jazer -> +-- 33 | r43 let jaz_ = Predef.tk 2 jazer in {s = table { VI Infn => jaz_ + "er" ; @@ -2142,6 +2175,7 @@ oper jazer_Besch : Str -> Verbum = \jazer -> } ; oper caber_Besch : Str -> Verbum = \caber -> +-- 34 | r56 let c_ = Predef.tk 4 caber in {s = table { VI Infn => c_ + "aber" ; @@ -2211,6 +2245,7 @@ oper caber_Besch : Str -> Verbum = \caber -> } ; oper saber_Besch : Str -> Verbum = \saber -> +-- 35 | r72 let s_ = Predef.tk 4 saber in {s = table { VI Infn => s_ + "aber" ; @@ -2280,6 +2315,7 @@ oper saber_Besch : Str -> Verbum = \saber -> } ; oper poder_Besch : Str -> Verbum = \poder -> +-- 36 | r66 let p_ = Predef.tk 4 poder in {s = table { VI Infn => p_ + "oder" ; @@ -2349,6 +2385,7 @@ oper poder_Besch : Str -> Verbum = \poder -> } ; oper crer_Besch : Str -> Verbum = \crer -> +-- 37 | r58 let cr_ = Predef.tk 2 crer in {s = table { VI Infn => cr_ + "er" ; @@ -2418,6 +2455,7 @@ oper crer_Besch : Str -> Verbum = \crer -> } ; oper querer_Besch : Str -> Verbum = \querer -> +-- 38 | r69 let qu_ = Predef.tk 4 querer in {s = table { VI Infn => qu_ + "erer" ; @@ -2487,6 +2525,7 @@ oper querer_Besch : Str -> Verbum = \querer -> } ; oper requerer_Besch : Str -> Verbum = \requerer -> +-- 39 | r70 let reque_ = Predef.tk 3 requerer in {s = table { VI Infn => reque_ + "rer" ; @@ -2556,6 +2595,7 @@ oper requerer_Besch : Str -> Verbum = \requerer -> } ; oper ver_Besch : Str -> Verbum = \ver -> +-- 40 | r25 let v_ = Predef.tk 2 ver in {s = table { VI Infn => v_ + "er" ; @@ -2625,6 +2665,7 @@ oper ver_Besch : Str -> Verbum = \ver -> } ; oper prover_Besch : Str -> Verbum = \prover -> +-- 41 | r68 let prov_ = Predef.tk 2 prover in {s = table { VI Infn => prov_ + "er" ; @@ -2694,6 +2735,7 @@ oper prover_Besch : Str -> Verbum = \prover -> } ; oper ler_Besch : Str -> Verbum = \ler -> +-- 42 | r58 let l_ = Predef.tk 2 ler in {s = table { VI Infn => l_ + "er" ; @@ -2763,6 +2805,7 @@ oper ler_Besch : Str -> Verbum = \ler -> } ; oper valer_Besch : Str -> Verbum = \valer -> +-- 43 | r74 let val_ = Predef.tk 2 valer in {s = table { VI Infn => val_ + "er" ; @@ -2832,6 +2875,7 @@ oper valer_Besch : Str -> Verbum = \valer -> } ; oper perder_Besch : Str -> Verbum = \perder -> +-- 44 | r65 let per_ = Predef.tk 3 perder in {s = table { VI Infn => per_ + "der" ; @@ -2901,6 +2945,7 @@ oper perder_Besch : Str -> Verbum = \perder -> } ; oper pôr_Besch : Str -> Verbum = \pôr -> +-- 45 | r67 let p_ = Predef.tk 2 pôr in {s = table { VI Infn => p_ + "ôr" ; @@ -2970,6 +3015,7 @@ oper pôr_Besch : Str -> Verbum = \pôr -> } ; oper acontecer_Besch : Str -> Verbum = \acontecer -> +-- 46 | r25 let aconte_ = Predef.tk 3 acontecer in {s = table { VI Infn => aconte_ + "cer" ; @@ -3039,6 +3085,7 @@ oper acontecer_Besch : Str -> Verbum = \acontecer -> } ; oper chover_Besch : Str -> Verbum = \chover -> +-- 47 | r6 let chov_ = Predef.tk 2 chover in {s = table { VI Infn => chov_ + "er" ; @@ -3108,6 +3155,7 @@ oper chover_Besch : Str -> Verbum = \chover -> } ; oper doer_Besch : Str -> Verbum = \doer -> +-- 48 | r83 let d_ = Predef.tk 3 doer in {s = table { VI Infn => d_ + "oer" ; @@ -3177,6 +3225,7 @@ oper doer_Besch : Str -> Verbum = \doer -> } ; oper prazer_Besch : Str -> Verbum = \prazer -> +-- 49 | r55 let pr_ = Predef.tk 4 prazer in {s = table { VI Infn => pr_ + "azer" ; @@ -3246,6 +3295,7 @@ oper prazer_Besch : Str -> Verbum = \prazer -> } ; oper precaver_Besch : Str -> Verbum = \precaver -> +-- 50 | r85 let precav_ = Predef.tk 2 precaver in {s = table { VI Infn => precav_ + "er" ; @@ -3315,6 +3365,7 @@ oper precaver_Besch : Str -> Verbum = \precaver -> } ; oper reaver_Besch : Str -> Verbum = \reaver -> +-- 51 | r86 let re_ = Predef.tk 4 reaver in {s = table { VI Infn => re_ + "aver" ; @@ -3384,6 +3435,7 @@ oper reaver_Besch : Str -> Verbum = \reaver -> } ; oper redigir_Besch : Str -> Verbum = \redigir -> +-- 52 | r28 let red_ = Predef.tk 4 redigir in {s = table { VI Infn => red_ + "igir" ; @@ -3453,6 +3505,7 @@ oper redigir_Besch : Str -> Verbum = \redigir -> } ; oper extinguir_Besch : Str -> Verbum = \extinguir -> +-- 53 | r33 let extin_ = Predef.tk 4 extinguir in {s = table { VI Infn => extin_ + "guir" ; @@ -3522,6 +3575,7 @@ oper extinguir_Besch : Str -> Verbum = \extinguir -> } ; oper servir_Besch : Str -> Verbum = \servir -> +-- 54 | r47 let s_ = Predef.tk 5 servir in {s = table { VI Infn => s_ + "ervir" ; @@ -3591,6 +3645,7 @@ oper servir_Besch : Str -> Verbum = \servir -> } ; oper seguir_Besch : Str -> Verbum = \seguir -> +-- 55 | r50 let s_ = Predef.tk 5 seguir in {s = table { VI Infn => s_ + "eguir" ; @@ -3660,6 +3715,7 @@ oper seguir_Besch : Str -> Verbum = \seguir -> } ; oper sentir_Besch : Str -> Verbum = \sentir -> +-- 56 | r47 let s_ = Predef.tk 5 sentir in {s = table { VI Infn => s_ + "entir" ; @@ -3729,6 +3785,7 @@ oper sentir_Besch : Str -> Verbum = \sentir -> } ; oper preferir_Besch : Str -> Verbum = \preferir -> +-- 57 | r47 let pref_ = Predef.tk 4 preferir in {s = table { VI Infn => pref_ + "erir" ; @@ -3798,6 +3855,7 @@ oper preferir_Besch : Str -> Verbum = \preferir -> } ; oper agredir_Besch : Str -> Verbum = \agredir -> +-- 58 | r48 let agr_ = Predef.tk 4 agredir in {s = table { VI Infn => agr_ + "edir" ; @@ -3867,6 +3925,7 @@ oper agredir_Besch : Str -> Verbum = \agredir -> } ; oper dormir_Besch : Str -> Verbum = \dormir -> +-- 59 | r51 let d_ = Predef.tk 5 dormir in {s = table { VI Infn => d_ + "ormir" ; @@ -3936,6 +3995,7 @@ oper dormir_Besch : Str -> Verbum = \dormir -> } ; oper polir_Besch : Str -> Verbum = \polir -> +-- 60 | r81 let p_ = Predef.tk 4 polir in {s = table { VI Infn => p_ + "olir" ; @@ -4005,6 +4065,7 @@ oper polir_Besch : Str -> Verbum = \polir -> } ; oper acudir_Besch : Str -> Verbum = \acudir -> +-- 61 | r53 let ac_ = Predef.tk 4 acudir in {s = table { VI Infn => ac_ + "udir" ; @@ -4074,6 +4135,7 @@ oper acudir_Besch : Str -> Verbum = \acudir -> } ; oper fugir_Besch : Str -> Verbum = \fugir -> +-- 62 | r54 let f_ = Predef.tk 4 fugir in {s = table { VI Infn => f_ + "ugir" ; @@ -4143,6 +4205,7 @@ oper fugir_Besch : Str -> Verbum = \fugir -> } ; oper frigir_Besch : Str -> Verbum = \frigir -> +-- 63 | r28 let fr_ = Predef.tk 4 frigir in {s = table { VI Infn => fr_ + "igir" ; @@ -4212,6 +4275,7 @@ oper frigir_Besch : Str -> Verbum = \frigir -> } ; oper divergir_Besch : Str -> Verbum = \divergir -> +-- 64 | r49 let div_ = Predef.tk 5 divergir in {s = table { VI Infn => div_ + "ergir" ; @@ -4281,6 +4345,7 @@ oper divergir_Besch : Str -> Verbum = \divergir -> } ; oper refletir_Besch : Str -> Verbum = \refletir -> +-- 65 | r47 let refl_ = Predef.tk 4 refletir in {s = table { VI Infn => refl_ + vars "etir" "ectir" ; @@ -4350,6 +4415,7 @@ oper refletir_Besch : Str -> Verbum = \refletir -> } ; oper ir_Besch : Str -> Verbum = \ir -> +-- 66 | r53 let x_ = Predef.tk 2 ir in {s = table { VI Infn => x_ + "ir" ; @@ -4419,6 +4485,7 @@ oper ir_Besch : Str -> Verbum = \ir -> } ; oper vir_Besch : Str -> Verbum = \vir -> +-- 67 | r63 let v_ = Predef.tk 2 vir in {s = table { VI Infn => v_ + "ir" ; @@ -4488,6 +4555,7 @@ oper vir_Besch : Str -> Verbum = \vir -> } ; oper sair_Besch : Str -> Verbum = \sair -> +-- 68 | r42 let sa_ = Predef.tk 2 sair in {s = table { VI Infn => sa_ + "ir" ; @@ -4557,6 +4625,7 @@ oper sair_Besch : Str -> Verbum = \sair -> } ; oper rir_Besch : Str -> Verbum = \rir -> +-- 69 | r48 let r_ = Predef.tk 2 rir in {s = table { VI Infn => r_ + "ir" ; @@ -4626,6 +4695,7 @@ oper rir_Besch : Str -> Verbum = \rir -> } ; oper pedir_Besch : Str -> Verbum = \pedir -> +-- 70 | r63 let pe_ = Predef.tk 3 pedir in {s = table { VI Infn => pe_ + "dir" ; @@ -4695,6 +4765,7 @@ oper pedir_Besch : Str -> Verbum = \pedir -> } ; oper ouvir_Besch : Str -> Verbum = \ouvir -> +-- 71 | r63 let ou_ = Predef.tk 3 ouvir in {s = table { VI Infn => ou_ + "vir" ; @@ -4764,6 +4835,7 @@ oper ouvir_Besch : Str -> Verbum = \ouvir -> } ; oper traduzir_Besch : Str -> Verbum = \traduzir -> +-- 72 | r44 let traduz_ = Predef.tk 2 traduzir in {s = table { VI Infn => traduz_ + "ir" ; @@ -4833,6 +4905,7 @@ oper traduzir_Besch : Str -> Verbum = \traduzir -> } ; oper distribuir_Besch : Str -> Verbum = \distribuir -> +-- 73 | r40 let distribu_ = Predef.tk 2 distribuir in {s = table { VI Infn => distribu_ + "ir" ; @@ -4902,6 +4975,7 @@ oper distribuir_Besch : Str -> Verbum = \distribuir -> } ; oper destruir_Besch : Str -> Verbum = \destruir -> +-- 74 | r57 let destr_ = Predef.tk 3 destruir in {s = table { VI Infn => destr_ + "uir" ; @@ -4971,6 +5045,7 @@ oper destruir_Besch : Str -> Verbum = \destruir -> } ; oper arguir_Besch : Str -> Verbum = \arguir -> +-- 75 | r31 let arg_ = Predef.tk 3 arguir in {s = table { VI Infn => arg_ + "uir" ; @@ -5040,6 +5115,7 @@ oper arguir_Besch : Str -> Verbum = \arguir -> } ; oper reunir_Besch : Str -> Verbum = \reunir -> +-- 76 | r18 let re_ = Predef.tk 4 reunir in {s = table { VI Infn => re_ + "unir" ; @@ -5109,6 +5185,7 @@ oper reunir_Besch : Str -> Verbum = \reunir -> } ; oper proibir_Besch : Str -> Verbum = \proibir -> +-- 77 | r20 let pro_ = Predef.tk 4 proibir in {s = table { VI Infn => pro_ + "ibir" ; @@ -5178,6 +5255,7 @@ oper proibir_Besch : Str -> Verbum = \proibir -> } ; oper imergir_Besch : Str -> Verbum = \imergir -> +-- 78 | r49 let imerg_ = Predef.tk 2 imergir in {s = table { VI Infn => imerg_ + "ir" ; @@ -5247,6 +5325,7 @@ oper imergir_Besch : Str -> Verbum = \imergir -> } ; oper falir_Besch : Str -> Verbum = \falir -> +-- 79 | r81 let fal_ = Predef.tk 2 falir in {s = table { VI Infn => fal_ + "ir" ; @@ -5316,6 +5395,7 @@ oper falir_Besch : Str -> Verbum = \falir -> } ; oper remir_Besch : Str -> Verbum = \remir -> +-- 80 | r49 let rem_ = Predef.tk 2 remir in {s = table { VI Infn => rem_ + "ir" ; @@ -5385,6 +5465,7 @@ oper remir_Besch : Str -> Verbum = \remir -> } ; oper viajar_Besch : Str -> Verbum = \viajar -> +-- r22 let viaj_ = Predef.tk 2 viajar in {s = table { VI Infn => viaj_ + "ar" ; @@ -5454,6 +5535,7 @@ oper viajar_Besch : Str -> Verbum = \viajar -> } ; oper suar_Besch : Str -> Verbum = \suar -> +-- r37 let su_ = Predef.tk 2 suar in {s = table { VI Infn => su_ + "ar" ; @@ -5522,4 +5604,74 @@ oper suar_Besch : Str -> Verbum = \suar -> } } ; +oper peneirar_Besch : Str -> Verbum = \peneirar -> +-- r10 + let peneir_ = Predef.tk 2 peneirar in + {s = table { + VI Infn => peneir_ + "ar" ; + VI Ger => peneir_ + "ando" ; + VI Part => peneir_ + "ado" ; + VPB (Pres Ind Sg P1) => peneir_ + "o" ; + VPB (Pres Ind Sg P2) => peneir_ + "as" ; + VPB (Pres Ind Sg P3) => peneir_ + "a" ; + VPB (Pres Ind Pl P1) => peneir_ + "amos" ; + VPB (Pres Ind Pl P2) => peneir_ + "ais" ; + VPB (Pres Ind Pl P3) => peneir_ + "am" ; + VPB (Pres Sub Sg P1) => peneir_ + "e" ; + VPB (Pres Sub Sg P2) => peneir_ + "es" ; + VPB (Pres Sub Sg P3) => peneir_ + "e" ; + VPB (Pres Sub Pl P1) => peneir_ + "emos" ; + VPB (Pres Sub Pl P2) => peneir_ + "eis" ; + VPB (Pres Sub Pl P3) => peneir_ + "em" ; + VPB (PretI Ind Sg P1) => peneir_ + "ava" ; --# notpresent + VPB (PretI Ind Sg P2) => peneir_ + "avas" ; --# notpresent + VPB (PretI Ind Sg P3) => peneir_ + "ava" ; --# notpresent + VPB (PretI Ind Pl P1) => peneir_ + "ávamos" ; --# notpresent + VPB (PretI Ind Pl P2) => peneir_ + "áveis" ; --# notpresent + VPB (PretI Ind Pl P3) => peneir_ + "avam" ; --# notpresent + VPB (PretI Sub Sg P1) => peneir_ + "asse" ; --# notpresent + VPB (PretI Sub Sg P2) => peneir_ + "asses" ; --# notpresent + VPB (PretI Sub Sg P3) => peneir_ + "asse" ; --# notpresent + VPB (PretI Sub Pl P1) => peneir_ + "ássemos" ; --# notpresent + VPB (PretI Sub Pl P2) => peneir_ + "ásseis" ; --# notpresent + VPB (PretI Sub Pl P3) => peneir_ + "assem" ; --# notpresent + VPB (MQPerf Sg P1) => peneir_ + "ara" ; --# notpresent + VPB (MQPerf Sg P2) => peneir_ + "aras" ; --# notpresent + VPB (MQPerf Sg P3) => peneir_ + "ara" ; --# notpresent + VPB (MQPerf Pl P1) => peneir_ + "áramos" ; --# notpresent + VPB (MQPerf Pl P2) => peneir_ + "áreis" ; --# notpresent + VPB (MQPerf Pl P3) => peneir_ + "aram" ; --# notpresent + VPB (PretP Sg P1) => peneir_ + "ei" ; --# notpresent + VPB (PretP Sg P2) => peneir_ + "aste" ; --# notpresent + VPB (PretP Sg P3) => peneir_ + "ou" ; --# notpresent + VPB (PretP Pl P1) => peneir_ + "amos" ; --# notpresent + VPB (PretP Pl P2) => peneir_ + "astes" ; --# notpresent + VPB (PretP Pl P3) => peneir_ + "aram" ; --# notpresent + VPB (Fut Ind Sg P1) => peneir_ + "arei" ; --# notpresent + VPB (Fut Ind Sg P2) => peneir_ + "arás" ; --# notpresent + VPB (Fut Ind Sg P3) => peneir_ + "ará" ; --# notpresent + VPB (Fut Ind Pl P1) => peneir_ + "aremos" ; --# notpresent + VPB (Fut Ind Pl P2) => peneir_ + "areis" ; --# notpresent + VPB (Fut Ind Pl P3) => peneir_ + "arão" ; --# notpresent + VPB (Fut Sub Sg P1) => peneir_ + "ar" ; --# notpresent + VPB (Fut Sub Sg P2) => peneir_ + "ares" ; --# notpresent + VPB (Fut Sub Sg P3) => peneir_ + "ar" ; --# notpresent + VPB (Fut Sub Pl P1) => peneir_ + "armos" ; --# notpresent + VPB (Fut Sub Pl P2) => peneir_ + "ardes" ; --# notpresent + VPB (Fut Sub Pl P3) => peneir_ + "arem" ; --# notpresent + VPB (Cond Sg P1) => peneir_ + "aria" ; --# notpresent + VPB (Cond Sg P2) => peneir_ + "aries" ; --# notpresent + VPB (Cond Sg P3) => peneir_ + "aria" ; --# notpresent + VPB (Cond Pl P1) => peneir_ + "aríamos" ; --# notpresent + VPB (Cond Pl P2) => peneir_ + "aríeis" ; --# notpresent + VPB (Cond Pl P3) => peneir_ + "ariam" ; --# notpresent + VPB (Imper Sg P2) => peneir_ + "a" ; + VPB (Imper Sg P3) => peneir_ + "e" ; + VPB (Imper Pl P1) => peneir_ + "emos" ; + VPB (Imper Pl P2) => peneir_ + "ai" ; + VPB (Imper Pl P3) => peneir_ + "em" ; + VPB (Imper Sg P1) => nonExist + } + } ; + } ; diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index 5cfcd7c6..c8cfc598 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -148,7 +148,7 @@ instance DiffPor of DiffRomance - [partAgr,vpAgrSubj,vpAgrClits] = open CommonRo subjIf = "se" ; oper - relPron : Bool => AAgr => Case => Str = \\b,a,c => + relPron : Bool => AAgr => Case => Str = \\_b,a,c => case c of { Nom | Acc => "que" ; CPrep P_a => "cujo" ; From 4b4a7ba9a4781f09f623328a216e4c369d3df5e8 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Thu, 1 Nov 2018 22:51:55 +0100 Subject: [PATCH 05/78] Improvements to Make.bat - Parsing of command line args - Redirecting output - mkdir only if not exists - revert back to copy --- Make.bat | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/Make.bat b/Make.bat index d7c77595..5f369a59 100644 --- a/Make.bat +++ b/Make.bat @@ -12,27 +12,20 @@ set modules_langs=All Symbol Compatibility set modules_api=Try Symbolic REM Defaults (may be overridden by options) -set gf=gf-default +set gf=gf set dest= set verbose=false REM Check command line options -set arg_gf_next=false -set arg_dest_next=false -for %%i in (%*) do ( - if !arg_gf_next!==true ( - set gf=%%i - set arg_gf_next=false - ) - if !arg_dest_next!==true ( - set dest=%%i - set arg_dest_next=false - ) - if %%i==-v set verbose=true - if %%i==--verbose set verbose=true - if %%i==--gf set arg_gf_next=true - if %%i==--dest set arg_dest_next=true -) +:Loop +if "%1"=="" goto Continue + if %1==-v set verbose=true + if %1==--verbose set verbose=true + if %1==--gf set gf=%2 + if %1==--dest set dest=%2 +shift +goto Loop +:Continue REM Try to determine install location if "%dest%"=="" ( @@ -52,17 +45,17 @@ if "%dest%"=="" ( REM A few more definitions before we get started set src=src set dist=dist -set gfc=gf --batch --gf-lib-path=%src% --quiet +set gfc=%gf% --batch --gf-lib-path=%src% --quiet REM Redirect stderr if not verbose if %verbose%==false ( - set gfc=2>NUL !gfc! + set gfc=!gfc! 2>NUL ) REM Make directories if not present -mkdir %dist%\prelude -mkdir %dist%\present -mkdir %dist%\alltenses +if not exist %dist%\prelude mkdir %dist%\prelude +if not exist %dist%\present mkdir %dist%\present +if not exist %dist%\alltenses mkdir %dist%\alltenses REM Build: prelude echo Building [prelude] @@ -99,4 +92,4 @@ for %%m in (%modules%) do ( REM Copy echo Copying to %dest% -xcopy %dist% %dest% /d +copy %dist% %dest% From a170539991414bcb5f826ce87e5ca4a8bde32b80 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Fri, 2 Nov 2018 08:50:31 +0100 Subject: [PATCH 06/78] More improvements to `Make.bat` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Fix syntax error in args loop - Building of modules list Maybe it actually works now? 😱 --- Make.bat | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Make.bat b/Make.bat index 5f369a59..921934ee 100644 --- a/Make.bat +++ b/Make.bat @@ -18,12 +18,12 @@ set verbose=false REM Check command line options :Loop -if "%1"=="" goto Continue + if '%1'=='' goto Continue if %1==-v set verbose=true if %1==--verbose set verbose=true if %1==--gf set gf=%2 if %1==--dest set dest=%2 -shift + shift goto Loop :Continue @@ -67,13 +67,15 @@ REM Gather all language modules for building set modules= for %%l in (%langs%) do ( for %%m in (%modules_langs%) do ( - for /r %src% %%m in (*%%m%%l.gf) do ( - set modules=!modules! %%m + set patt=%%m%%l.gf + for /r %src% %%n in (!patt!) do ( + if exist %%n set modules=!modules! %%n ) ) for %%m in (%modules_api%) do ( - for /r %src%\api %%m in (*%%m%%l.gf) do ( - set modules=!modules! %%m + set patt=%%m%%l.gf + for /r %src%\api %%n in (!patt!) do ( + if exist %%n set modules=!modules! %%n ) ) ) From 2d112e3a55343a1a967e5cfa7c79c1f11556ac8c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 2 Nov 2018 18:01:14 +0100 Subject: [PATCH 07/78] (Ara) diacritics --- src/arabic/LexiconAra.gf | 33 ++++++++++++++++----------------- src/arabic/OrthoAra.gf | 3 ++- src/arabic/PatternsAra.gf | 6 +++--- src/arabic/ResAra.gf | 3 +-- src/arabic/StructuralAra.gf | 10 +++++----- 5 files changed, 27 insertions(+), 28 deletions(-) diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 7d4e9507..8178ce9f 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -3,7 +3,6 @@ concrete LexiconAra of Lexicon = CatAra ** open ParadigmsAra, ResAra, - MorphoAra, --shouldn't open it here, only needed reg &sndf Prelude in { flags @@ -19,8 +18,8 @@ flags ask_V2Q = dirV2 (regV "يَسءَل") ; -- ask_V2Q = dirV2 (v1 "سءل" a a) ; baby_N = brkN "طفل" "فِعل" "أَفعَال" Masc Hum; --- bad_A = sndA "سوء" "فَيِّع" ; - bad_A = degrA "سَيِّئ" "سَيِّئَة" "سَيِّئِين" ; +-- bad_A = sndA "سوء" "فَيِّع" ; + bad_A = degrA "سَيِّئ" "سَيِّئَة" "سَيِّئِين" ; bank_N = brkN "بنك" "فَعل" "فُعُول" Masc NoHum ; beautiful_A = sndA "جمل" "فَعِيل" ; become_VA = mkVA (v4 "صبح") ; @@ -42,11 +41,11 @@ flags -- break_V2 = dirV2 (v1 "كسر" a u) ; broad_A = sndA "وسع" "فاعِل" ; brother_N2 = mkN2 (brkN "ءخو" "فَع" "فِعلة" Masc Hum) ; --FIXME dual - brown_A = sndA "بني" "فُعِّل"; + brown_A = sndA "بني" "فُعِّل"; butter_N = sdfN "سبد" "فُعلة" Fem NoHum ; buy_V2 = dirV2 (v8 "شري") ; camera_N = sdfN "كمر" "فاعِيلا" Fem NoHum ; -- |Alö taSwIr - cap_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; --qalnUsö + cap_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; --qalnUsö car_N = sdfN "سير" "فَعّالة" Fem NoHum ; carpet_N = sdfN "سجد" "فَعّالة" Fem NoHum ; cat_N = brkN "هرّ" "فِعّ" "فِعَلَة" Fem NoHum ; @@ -93,13 +92,13 @@ flags girl_N = brkN "بنت" "فِعل" "فَعَال" Fem Hum ; glove_N = sdfN "قفز" "فُعّال" Masc NoHum ; gold_N = sdfN "ذهب" "فَعَل" Masc NoHum ; - good_A = sndA "جود" "فَيِّع" ; -- Hasan, HisAn + good_A = sndA "جود" "فَيِّع" ; -- Hasan, HisAn go_V = regV "يَذهَب" ; -- go_V = v1 "ذهب" a a ; green_A = clrA "خضر" ; harbour_N = brkN "رفء" "مَفعَل" "مَفاعِل" Masc NoHum ; --mInA', marsaY hate_V2 = dirV2 (regV "كَرِه") ; - hat_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; + hat_N = sdfN "قبع" "فُعَّلة" Fem NoHum ; -- have_V2 = dirV2 (v1 "ملك" a i) ; hear_V2 = dirV2 (regV "سَمِع") ; -- hear_V2 = dirV2 (v1 "سمع" i a) ; @@ -130,14 +129,14 @@ flags love_N = brkN "حبّ" "فُعّ" "فُعّ" Masc NoHum ; -- no plur love_V2 = dirV2 (v1 "حبّ" a i) ; man_N = brkN "رجل" "فَعُل" "فِعَال" Masc Hum ; - married_A2 = mkA2 (sndA "زوج" "مُتَفَعِّل") "مِن" ; + married_A2 = mkA2 (sndA "زوج" "مُتَفَعِّل") "مِن" ; meat_N = brkN "لحم" "فَعلة" "فُعُول" Masc NoHum ; milk_N = brkN "حلب" "فَعِيل" "فَعِيل" Masc NoHum ; --no plur moon_N = brkN "قمر" "فَعَل" "أَفعَال" Masc NoHum ; - mother_N2 = mkN2 (sdfN "ءم" "فُعَّ" Fem Hum) ; + mother_N2 = mkN2 (sdfN "ءم" "فُعَّ" Fem Hum) ; mountain_N = brkN "جبل" "فَعَل" "فِعَال" Masc NoHum ; music_N = mkN (reg "مُوسِيقَى" "مُوسِيقَى") Fem NoHum ; --no plur - narrow_A = sndA "ضيق" "فَعِّل" ; + narrow_A = sndA "ضيق" "فَعِّل" ; new_A = mkA "جدد" "فَعِيل" "فُعُل" ; newspaper_N = brkN "صحف" "فَعِيلة" "فُعُل" Fem NoHum ; oil_N = brkN "زيت" "فَعل" "فُعُول" Masc NoHum ; @@ -155,7 +154,7 @@ flags play_V2 = dirV2 (regV "لَعِب") ; -- play_V2 = dirV2 (v1 "لعب" i a) ; policeman_N = sdmN "شرط" "فِعلِي" Masc Hum ; - priest_N = brkN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ; + priest_N = brkN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ; probable_AS = mkAS (sndA "مكن" "مُفعِل") ; queen_N = sdfN "ملك" "فَعِلة" Fem Hum ; radio_N = mkN (sndf "راديُو") Masc NoHum ; @@ -169,7 +168,7 @@ flags river_N = brkN "نهر" "فَعل" "أَفعَال" Masc NoHum ; rock_N = brkN "صخر" "فَعلة" "فُعُول" Fem NoHum ; roof_N = brkN "سطح" "فَعل" "أَفعُل" Masc NoHum ; - rubber_N = brkN "مطط" "فَعَّال" "فَعَّال" Masc NoHum ; -- no hum + rubber_N = brkN "مطط" "فَعَّال" "فَعَّال" Masc NoHum ; -- no hum run_V = regV "يَركُض" ; -- run_V = v1 "ركض" a u ; say_VS = mkVS (v1 "قول" a u) ; --check @@ -187,11 +186,11 @@ flags shoe_N = brkN "حذو" "فِعَاء" "أَفعِية" Masc NoHum ; shop_N = brkN "تجر" "مَفعَل" "مَفاعِل" Masc NoHum ; short_A = sndA "قصر" "فَعِيل" ; - silver_N = brkN "فضض" "فِعَّة" "فِعَل" Fem NoHum ; + silver_N = brkN "فضض" "فِعَّة" "فِعَل" Fem NoHum ; sister_N = brkN "ءخو" "فُعت" "فَعَوَات" Fem Hum ; --FIXME sleep_V = v1 "نوم" i a ; --check small_A = sndA "صغر" "فَعِيل" ; - snake_N = sdfN "حيّ" "فَعَّة" Fem NoHum ; + snake_N = sdfN "حيّ" "فَعَّة" Fem NoHum ; sock_N = brkN "جرب" "فَوعَل" "فَواعِل" Masc NoHum ; speak_V2 = dirV2 (v5 "كلم") ; star_N = brkN "نجم" "فَعل" "فُعُول" Masc NoHum ; --najmö @@ -205,7 +204,7 @@ flags switch8on_V2 = dirV2 (v4 "شعل") ; table_N = sdfN "طول" "فاعِلة" Fem NoHum ; talk_V3 = mkV3 (v5 "حدث") "لِ" "عَن" ; - teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö + teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö teach_V2 = dirV2 (v2 "علم") ; television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ; thick_A = sndA "سمك" "فَعِيل" ; @@ -261,7 +260,7 @@ flags heavy_A = sndA "ثقل" "فَعِيل" ; near_A = sndA "قرب" "فَعِيل" ; rotten_A = sndA "فسد" "فاعِل" ; - round_A = sndA "دور" "مُفَعَّل" ; + round_A = sndA "دور" "مُفَعَّل" ; sharp_A = sndA "حدّ" "فاعّ" ; smooth_A = sndA "نعم" "فاعِل" ; straight_A = sndA "قوم" "مُستَفِيع" ; @@ -277,7 +276,7 @@ flags bone_N = brkN "عظم" "فَعلة" "فِعَال" Fem NoHum; breast_N = brkN "صدر" "فَعل" "فُعُول" Masc NoHum; cloud_N = brkN "غيم" "فَعلة" "فُعُول" Fem NoHum; - day_N = brkN "يوم" "فَعل" "أَفَّاع" Masc NoHum; + day_N = brkN "يوم" "فَعل" "أَفَّاع" Masc NoHum; dust_N = brkN "غبر" "فُعَال" "أَفعِلة" Masc NoHum; ear_N = brkN "ءذن" "فُعل" "أَفعَال" Fem NoHum; earth_N = brkN "ترب" "فُعلة" "فُعَل" Fem NoHum; diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index a7dc5d66..0e5d7e19 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -12,7 +12,8 @@ flags coding=utf8 ; -- Shadda: https://www.unicode.org/L2/L2017/17253-arabic-ordering.pdf fixShd : Str -> Str -> Str = \word,suffix -> case of { - => x + v + "ّ" + y ; + -- => x + v + "ّ" + y ; + => x + "ّ" + v + y ; _ => word + suffix } ; diff --git a/src/arabic/PatternsAra.gf b/src/arabic/PatternsAra.gf index 26c5e8c5..1390d67a 100644 --- a/src/arabic/PatternsAra.gf +++ b/src/arabic/PatternsAra.gf @@ -48,7 +48,7 @@ flags coding=utf8 ; eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ; - euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII + euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; faccalo = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "ْ" } ; facal = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "" } ; @@ -78,8 +78,8 @@ flags coding=utf8 ; ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ; ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ; - ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII - ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII + ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII + ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII fuccAl = { h = "" ; m1 = "ُ" ; m2 = "َّا" ; t = "" } ; fuccil = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ; fuccilo = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "ْ" } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index d4f08f63..b0eca6e0 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -904,8 +904,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> case st of { Def => case stem of { - s@#sun + v@#vow + x => al + s + v + "ّ" + x ; -- vowel before shadda - s@#sun + x => al + s + "ّ" + x; + s@#sun + x => fixShd (al + s) ("ّ" + x) ; x => al + x } ; _ => stem }; diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 7931b813..136680f5 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -99,12 +99,12 @@ concrete StructuralAra of Structural = CatAra ** which_IQuant = { s = \\s,c => case of { => "أيّ" ; - => "أيٌّ" ; - => "أيُّ" ; + => "أيٌّ" ; + => "أيُّ" ; => "أيّاً" ; - => "أيَّ" ; - => "أيٍّ" ; - => "أيِّ" + => "أيَّ" ; + => "أيٍّ" ; + => "أيِّ" } } ; whoSg_IP = mkIP "مَنْ" Sg ; From e3f2469abe5760084d5c8fce53d76a280db497de Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 2 Nov 2018 18:01:33 +0100 Subject: [PATCH 08/78] (Ara) Add gender, species etc. into the API --- src/arabic/ParadigmsAra.gf | 92 ++++++++++++++++++++++++++++---------- 1 file changed, 69 insertions(+), 23 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 9dea1146..03590327 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -39,23 +39,31 @@ resource ParadigmsAra = open Preposition : Type ; + Gender : Type ; + masc : Gender ; + fem : Gender ; + + Species : Type ; + hum : Species ; + nohum : Species ; + + Vowel : Type ; + va : Vowel ; + vi : Vowel ; + vu : Vowel ; + --2 Nouns -- Overloaded operator for main cases - mkN = overload { - mkN : (sg : Str) -> N -- non-human regular nouns - = smartN ; - mkN : Species -> N -> N - = \p,n -> n ** {h = p} ; - mkN : (sg,pl : Str) -> Gender -> Species -> N - = \sg,pl -> mkFullN (reg sg pl) ; - mkN : NTable -> Gender -> Species -> N -- loan words, irregular - = mkFullN ; - mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural - = brkN ; - mkN : N -> (attr : Str) -> N -- Compound nouns - = \n,attr -> n ** { s = \\num,s,c => n.s ! num ! s ! c ++ attr } ; --- IL (TODO: all kinds of compounds) + + mkN : overload { + mkN : (sg : Str) -> N ; -- non-human regular nouns + mkN : Species -> N -> N ; + mkN : (sg,pl : Str) -> Gender -> Species -> N ; + mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular + mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural + mkN : N -> (attr : Str) -> N ; -- Compound nouns --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; } ; @@ -156,13 +164,11 @@ resource ParadigmsAra = open -- Overloaded operations - mkV = overload { - mkV : (imperfect : Str) -> V - = regV ; - mkV : (root : Str) -> (perf,impf : Vowel) -> V -- verb form I ; vowel = a|i|u - = v1 ; - mkV : (root : Str) -> VerbForm -> V -- FormI .. FormX (no VII, IX) ; default vowels a u for I - = formV ; + mkV : overload { + mkV : (imperfect : Str) -> V ; + mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u + mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I + mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb } ; -- The verb in the imperfect tense gives the most information @@ -261,6 +267,48 @@ resource ParadigmsAra = open -- The definitions should not bother the user of the API. So they are -- hidden from the document. + + Preposition = Str ; + + Gender = ResAra.Gender ; + masc = ResAra.Masc ; + fem = ResAra.Fem ; + + Species = ResAra.Species ; + hum = ResAra.Hum ; + nohum = ResAra.NoHum ; + + Vowel = ResAra.Vowel ; + va = ResAra.a ; + vu = ResAra.u ; + vi = ResAra.i ; + + mkN = overload { + mkN : (sg : Str) -> N -- non-human regular nouns + = smartN ; + mkN : Species -> N -> N + = \p,n -> n ** {h = p} ; + mkN : (sg,pl : Str) -> Gender -> Species -> N + = \sg,pl -> mkFullN (reg sg pl) ; + mkN : NTable -> Gender -> Species -> N -- loan words, irregular + = mkFullN ; + mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural + = brkN ; + mkN : N -> (attr : Str) -> N -- Compound nouns + = \n,attr -> n ** { s = \\num,s,c => n.s ! num ! s ! c ++ attr } ; --- IL (TODO: all kinds of compounds) + } ; + + mkV = overload { + mkV : (imperfect : Str) -> V + = regV ; + mkV : (root : Str) -> (perf,impf : Vowel) -> V -- verb form I ; vowel = a|i|u + = v1 ; + mkV : (root : Str) -> VerbForm -> V -- FormI .. FormX (no VII, IX) ; default vowels a u for I + = formV ; + mkV : V -> (particle : Str) -> V = \v,p -> + v ** { s = \\vf => v.s ! vf ++ p } ; + } ; + regV : Str -> V = \wo -> let rau : Str * Vowel * Vowel = case wo of { @@ -282,7 +330,7 @@ resource ParadigmsAra = open lock_V = <> } ; - va : Vowel = ResAra.a ; + v1' : Str -> Vowel -> Vowel -> Verb = \rootStr,vPerf,vImpf -> @@ -378,8 +426,6 @@ resource ParadigmsAra = open _ => v10sound } } in lin V (v10fun rbT) ; - Preposition = Str ; - mkFullN nsc gen spec = { s = nsc; --NTable g = gen; From 68c5cd74dd69505d3eff7c2ba2a18a4ab98474b3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 5 Nov 2018 17:13:06 +0100 Subject: [PATCH 09/78] (Ara) Question words and structures --- src/arabic/CatAra.gf | 7 ++- src/arabic/PhraseAra.gf | 2 +- src/arabic/QuestionAra.gf | 99 +++++++++++++------------------------ src/arabic/ResAra.gf | 34 +++++++++++-- src/arabic/StructuralAra.gf | 8 +-- 5 files changed, 73 insertions(+), 77 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 3a1ee258..d1fe2f49 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -23,10 +23,9 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { -- Question 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} ; + IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ; + IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ; + IComp = ResAra.IComp ; -- IQuant = {s : State => Case => Str} ; -- ---- Relative diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 9d24e689..5e11b5e5 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -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 = \\g => ip.s ! g ! Def ! Nom} ; --IL + UttIP ip = {s = \\_g => ip.s ! False ! Def ! Nom} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL UttCard c = {s = ResAra.uttNum c} ; --IL diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index 38b2296c..ecfa1f8c 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -1,4 +1,4 @@ -concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra in { +concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbAra, SentenceAra in { flags optimize=all_subs ; coding = utf8 ; @@ -14,90 +14,61 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA -- ComplSlashIP vps ip = {} ; --- AR copied from PredVP + --IL guessed QuestVP qp vp = - { s =\\t,p,_ => - let { - ---- 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 ; - yaktubu = vp.s ! pgn ! VPImpf Ind ; - yaktuba = vp.s ! pgn ! VPImpf Cnj ; - yaktub = vp.s ! pgn ! VPImpf Jus ; - vStr : ResAra.Tense -> Polarity -> Str = - \tn,pl -> case of { - => yaktubu ; - => "لَا" ++ yaktubu ; - => "" ; --no verb "to be" in present - => "لَيسَ" ;--same here, just add negation particle - <_, ResAra.Past, Pos> => kataba ; - <_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ; - <_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ; - <_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba - }; - pred : ResAra.Tense -> Polarity -> Str = - \tn,pl -> case of { - => vp.pred.s ! gn ! Nom; --xabar marfooc - _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob - } ; + let np = { s = qp.s ! vp.isPred ! Def ; + a = { pgn = Per3 Masc qp.n ; + isPron = False } + } ; + cl = PredVP np vp ; + in { s = \\t,p,_qf => cl.s ! t ! p ! Nominal } ; - } in ---- case o of { ----- _ => - case of { ----- AR workaround 18/12/2008 case of { - -- ya2kuluhu - => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p); - -- ya2kuluhu al-waladu, yakuluhu al-2awlaadu - => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p); - => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p); - => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) - }; - ---- Nominal => - ---- np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) - } - ; ---- }; ---- AR guessed QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ; ---- IL guessed - QuestIComp icomp np = - let vp = kaan (CompNP np) in - QuestVP icomp vp ; + -- : IComp -> NP -> QCl + QuestIComp ic np = + let vp = kaan (CompNP np) ; + ip = ic ** { s : Bool => State => Case => Str = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; + in QuestVP ip vp ; - CompIP ip = ip ; - -- old, when IComp = Comp { s = \\{g=g ; n=_},c => ip.s ! g ! Def ! c } ; ---- + -- : IP -> IComp ; + CompIP ip = { + s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence + ! Def ! Nom ; -- IP will be a subject + n = ip.n + } ; - CompIAdv iadv = mkIP iadv.s ResAra.Sg ; + CompIAdv iadv = { s = \\_ => iadv.s ; n = 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) + s = \\t,p,qf => + let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing + in cl.c2 ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o } ; - PrepIP p ip = {s = p.s ++ ip.s ! Masc ! Def ! Acc} ; ----IL + --IL guessed + PrepIP p ip = { + s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence + ! Def ! Gen + } ; - AdvIP ip adv = ip ** { - s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; - n = ip.n - } ; + AdvIP ip adv = ip ** { + s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; + } ; -----IL guessed with help of L and Google translate -- : IDet -> IP - IdetIP idet = idet ; -- Gender still matters if turned into IComp + IdetIP idet = idet ** { s = \\isPred => idet.s ! Masc } ; -- : 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 + s = \\isPred,s,c + => idet.s ! cn.g ! s ! c ++ + cn.s ! idet.n ! Indef ! Gen ; --idaafa } ; -- : IQuant -> Num -> IDet diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index b0eca6e0..73b423c2 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1102,8 +1102,17 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; - mkIP : Str -> Number -> IP = - \s,n -> {s = \\_g,_s,_c => s ; n = n} ; + mkIP = overload { + mkIP : Str -> Number -> IP = \maa,n -> { + s = \\_p,_s,_c => maa ; + n = n + } ; + mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { + s = table { True => \\_s,_c => maa ; + False => \\_s,_c => maadhaa } ; + n = n + } + } ; mkOrd : (_,_ : Str) -> Size -> NumOrdCard = \aysar,yusra,sz -> @@ -1151,6 +1160,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s : AAgr => Case => Str } ; + IComp : Type = { + s : AAgr -- "how old": masc or fem for adjective + -- no need for Case, IComp is only used by QuestIComp, as grammatical subject + => Str ; + n : Number + } ; + Obj : Type = { s : Str ; a : Agr @@ -1162,12 +1178,22 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } ; IP : Type = { - s : Gender -- because of CompIP - => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative + s : Bool -- different forms for "what is this" and "what do you do" + => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative => Str ; n : Number } ; + IDet : Type = { + s : Gender -- IdetCN needs to choose the gender of the CN + => State => Case => Str ; + n : Number + } ; + + IQuant : Type = { + s : State => Case => Str + } ; + param VPForm = VPPerf | VPImpf Mood diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 136680f5..505e6bc4 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -91,8 +91,8 @@ concrete StructuralAra of Structural = CatAra ** -- very_AdA = ss "ثري" ; -- want_VV = P.mkVV (P.regV "وَنت") ; we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; - whatPl_IP = mkIP "ماذا" Pl ; - whatSg_IP = mkIP "ماذا" Sg ; + whatPl_IP = mkIP "ما" "ماذا" Pl ; + whatSg_IP = mkIP "ما" "ماذا" Sg ; when_IAdv = ss "مَتَى" ; -- when_Subj = ss "وهن" ; where_IAdv = ss "أَينَ" ; @@ -107,8 +107,8 @@ concrete StructuralAra of Structural = CatAra ** => "أيِّ" } } ; - whoSg_IP = mkIP "مَنْ" Sg ; - whoPl_IP = mkIP "مَنْ" Pl ; + whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ; + whoPl_IP = mkIP "مَنْ" "مَنْ" Pl ; -- why_IAdv = ss "وهي" ; without_Prep = ss "بِدُونِ" ; with_Prep = ss "مَع" ; From 17bc505382b94efe18a9c00ff18b8ad9993156e4 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 5 Nov 2018 19:29:35 +0100 Subject: [PATCH 10/78] Make.bat: fix copy command, create dest folders if not present --- Make.bat | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Make.bat b/Make.bat index 921934ee..904a976a 100644 --- a/Make.bat +++ b/Make.bat @@ -92,6 +92,14 @@ for %%m in (%modules%) do ( %gfc% --no-pmcfg --gfo-dir=%dist%\alltenses %%m ) +REM Make destination directories if not present +if not exist %dest% mkdir %dest% +if not exist %dest%\prelude mkdir %dest%\prelude +if not exist %dest%\present mkdir %dest%\present +if not exist %dest%\alltenses mkdir %dest%\alltenses + REM Copy echo Copying to %dest% -copy %dist% %dest% +copy %dist%\prelude\*.gfo %dest%\prelude\ +copy %dist%\present\*.gfo %dest%\present\ +copy %dist%\alltenses\*.gfo %dest%\alltenses\ From ef2c348d3af374555f10cb9f5b1b81a1527bf904 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 5 Nov 2018 21:09:07 +0100 Subject: [PATCH 11/78] Make.bat: Collect modules in two stages For some reason second inner loop was never reached, this is a simple solution. Also remove stderr redirection as it didn't seem to work. --verbose now names each module individually --- Make.bat | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Make.bat b/Make.bat index 904a976a..8bb7c412 100644 --- a/Make.bat +++ b/Make.bat @@ -45,11 +45,11 @@ if "%dest%"=="" ( REM A few more definitions before we get started set src=src set dist=dist -set gfc=%gf% --batch --gf-lib-path=%src% --quiet +set gfc=%gf% --batch --gf-lib-path=%src% -REM Redirect stderr if not verbose +REM Add quiet flag if not verbose if %verbose%==false ( - set gfc=!gfc! 2>NUL + set gfc=%gfc% --quiet ) REM Make directories if not present @@ -72,6 +72,8 @@ for %%l in (%langs%) do ( if exist %%n set modules=!modules! %%n ) ) +) +for %%l in (%langs%) do ( for %%m in (%modules_api%) do ( set patt=%%m%%l.gf for /r %src%\api %%n in (!patt!) do ( @@ -83,12 +85,14 @@ for %%l in (%langs%) do ( REM Build: present echo Building [present] for %%m in (%modules%) do ( + if %verbose%==true echo %%m %gfc% --no-pmcfg --gfo-dir=%dist%\present --preproc=mkPresent %%m ) REM Build: alltenses echo Building [alltenses] for %%m in (%modules%) do ( + if %verbose%==true echo %%m %gfc% --no-pmcfg --gfo-dir=%dist%\alltenses %%m ) From ec9f74d56ec8501e7c6fd3eb1119dfc365987f35 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 6 Nov 2018 10:32:25 +0100 Subject: [PATCH 12/78] Add "Synopsis" column to `languages.csv`; use config everywhere I tried to remove all language lists from Haskell and Makefiles --- Config.hs | 68 ++++++++++++++++++++++++++++ Make.hs | 54 +---------------------- README.md | 10 ++--- doc/Makefile | 12 +++-- doc/MkExx.hs | 44 +------------------ doc/MkExxTable.hs | 19 ++++---- doc/MkSynopsis.hs | 100 ++++++++++++++++++++---------------------- doc/language-list.txt | 35 --------------- languages.csv | 90 ++++++++++++++++++------------------- 9 files changed, 182 insertions(+), 250 deletions(-) create mode 100644 Config.hs delete mode 100644 doc/language-list.txt diff --git a/Config.hs b/Config.hs new file mode 100644 index 00000000..d3b325fd --- /dev/null +++ b/Config.hs @@ -0,0 +1,68 @@ +-- | Reading language config file +module Config ( + LangInfo (..), + loadLangs, loadLangsFrom, configFile + ) where + +import Data.List (unfoldr) +import System.IO (hPutStrLn,stderr) +import System.Exit (exitFailure) + +-- | Path to language config file +configFile :: FilePath +configFile = "languages.csv" + +-- | Information about a language +data LangInfo = LangInfo + { langCode :: String -- ^ 3-letter ISO 639-2/B code + , langDir :: String -- ^ directory name + , langFunctor :: Maybe String -- ^ functor (not used) + , langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations + , langPresent :: Bool + , langAll :: Bool + , langTry :: Bool + , langSymbolic :: Bool + , langCompatibility :: Bool + , langSynopsis :: Bool -- ^ include in RGL synopsis + } deriving (Show,Eq) + +-- | Load language information from default config file +loadLangs :: IO [LangInfo] +loadLangs = loadLangsFrom configFile + +-- | Load language information from specified config file +loadLangsFrom:: FilePath -> IO [LangInfo] +loadLangsFrom configFile = do + lns <- readFile configFile >>= return . lines + mapM mkLangInfo (tail lns) + where + maybeBit bits n = if length bits >= (n+1) && length (bits !! n) > 0 then Just (bits !! n) else Nothing + boolBit bits n def = if length bits >= (n+1) && length (bits !! n) > 0 then (if def then bits !! n /= "n" else bits !! n == "y") else def + mkLangInfo s = + let bits = separateBy ',' s in + if length bits < 2 + then die $ "Invalid entry in " ++ configFile ++ ": " ++ s + else return $ LangInfo + { langCode = bits !! 0 + , langDir = bits !! 1 + , langFunctor = maybeBit bits 2 + , langUnlexer = maybeBit bits 3 + , langPresent = boolBit bits 4 False + , langAll = boolBit bits 5 True + , langTry = boolBit bits 6 True + , langSymbolic = boolBit bits 7 True + , langCompatibility = boolBit bits 8 False + , langSynopsis = boolBit bits 9 False + } + +-- | Separate a string on a character +-- Source: https://stackoverflow.com/a/4978733/98600 +separateBy :: Eq a => a -> [a] -> [[a]] +separateBy chr = unfoldr sep where + sep [] = Nothing + sep l = Just . fmap (drop 1) . break (== chr) $ l + +die :: String -> IO a +die s = do + hPutStrLn stderr s + exitFailure diff --git a/Make.hs b/Make.hs index 2a40e398..420d005c 100644 --- a/Make.hs +++ b/Make.hs @@ -2,7 +2,7 @@ -- | Main build script for RGL -import Data.List (find,isPrefixOf,isSuffixOf,(\\),unfoldr) +import Data.List (find,isPrefixOf,isSuffixOf,(\\)) import Data.Maybe (catMaybes) import System.IO (hPutStrLn,stderr) import System.IO.Error (catchIOError) @@ -15,6 +15,7 @@ import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents, import System.Directory (getModificationTime,setModificationTime) #endif import Control.Monad (when,unless) +import Config main :: IO () main = do @@ -347,57 +348,6 @@ verbose_switch_short = "-v" getFlag :: String -> [String] -> Maybe String getFlag flag args = fmap (drop (length flag)) $ find (isPrefixOf flag) args -------------------------------------------------------------------------------- --- Languages of the RGL - --- | Path to language config file -configFile :: FilePath -configFile = "languages.csv" - --- | Information about a language -data LangInfo = LangInfo - { langCode :: String -- ^ 3-letter ISO 639-2/B code - , langDir :: String -- ^ directory name - , langFunctor :: Maybe String -- ^ functor (not used) - , langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations - , langPresent :: Bool - , langAll :: Bool - , langTry :: Bool - , langSymbolic :: Bool - , langCompatibility :: Bool - } deriving (Show,Eq) - --- | Load language information from config file -loadLangs :: IO [LangInfo] -loadLangs = do - lns <- readFile configFile >>= return . lines - mapM mkLangInfo (tail lns) - where - maybeBit bits n = if length bits >= (n+1) && length (bits !! n) > 0 then Just (bits !! n) else Nothing - boolBit bits n def = if length bits >= (n+1) && length (bits !! n) > 0 then (if def then bits !! n /= "n" else bits !! n == "y") else def - mkLangInfo s = - let bits = separateBy ',' s in - if length bits < 2 - then die $ "Invalid entry in " ++ configFile ++ ": " ++ s - else return $ LangInfo - { langCode = bits !! 0 - , langDir = bits !! 1 - , langFunctor = maybeBit bits 2 - , langUnlexer = maybeBit bits 3 - , langPresent = boolBit bits 4 False - , langAll = boolBit bits 5 True - , langTry = boolBit bits 6 True - , langSymbolic = boolBit bits 7 True - , langCompatibility = boolBit bits 8 False - } - --- | Separate a string on a character --- Source: https://stackoverflow.com/a/4978733/98600 -separateBy :: Eq a => a -> [a] -> [[a]] -separateBy chr = unfoldr sep where - sep [] = Nothing - sep l = Just . fmap (drop 1) . break (== chr) $ l - ------------------------------------------------------------------------------- -- Executing GF diff --git a/README.md b/README.md index 4cd0b244..dda79ac4 100644 --- a/README.md +++ b/README.md @@ -41,8 +41,10 @@ Description of columns: - Try: languages for which to compile `Try` - Symbolic: languages for which to compile `Symbolic` - Compatibility: languages for which to complile `Compatibility` +- Synopsis: languages to include in the RGL synopsis document -Columns can be a string, just `y`'s (where nothing means `n`) or just (`n`'s where nothing means `y`). +Columns can be a string, just `y`'s (where nothing means `n`) or just (`n`'s where nothing means `y`), +or a mixture of both `y`'s and `n`'s. ## Haskell script: `Make.hs` @@ -108,11 +110,9 @@ You can pass the following flags: ## Windows batch file: `Make.bat` -**This script is still untested.** +This method is provided as an alternative for Windows users who don't have Haskell or Bash installed. -This method is provided as an alternative for Windows users who don't have Haskell installed. - -It is supposed to be a port of Make.sh and works in largely the same way. +It is supposed to be a port of `Make.sh` and works in largely the same way. In particular, it accepts the same flags (in the same format) as described above. However it currently tries to build all modules for all languages and doesn't consider the details of which modules should be compiled for each language (specified in `languages.csv`) diff --git a/doc/Makefile b/doc/Makefile index 556973dd..90133f78 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,4 +1,4 @@ -.PHONY: abstract synopsis index status +.PHONY: all index status synopsis abstract all: synopsis @@ -15,17 +15,17 @@ synopsis: synopsis.html S=../src -# List of languages extracted from MkSynopsis.hs -LANGS=Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd +# List of languages extracted from languages.csv, with 'Synopsis' column == y +LANGS=$(shell cat ../languages.csv | cut -d',' -f1,10 | grep ',y' | cut -d',' -f1) # This list was constructed by observing what files MkSynopsis.hs reads -SRC_FILES=$S/abstract/Common.gf $S/abstract/Cat.gf $S/api/Constructors.gf $S/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) +SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) EXAMPLES_OUT=$(patsubst %,api-examples-%.txt,$(LANGS)) INCLUDES=synopsis-intro.txt categories-intro.txt categories-imagemap.html synopsis-additional.txt synopsis-browse.txt synopsis-example.txt synopsis.html: MkSynopsis.hs MkExxTable.hs $(INCLUDES) $(EXAMPLES_OUT) $(SRC_FILES) - runghc MkSynopsis.hs + runghc -i.. MkSynopsis.hs categories.png: categories.dot dot -Tpng $^ > $@ @@ -37,11 +37,9 @@ abstract: $(GFDOC) -txthtml $S/abstract/*.gf mv $S/abstract/*.html abstract - api-examples.gfs: api-examples.txt MkExx.hs runghc MkExx.hs < $< > $@ - # Since .gfo files aren't self-contained, the dependencies given here are # incomplete. But I am thinking that the Try%.gfo file will always be newer # than any other files it depends on, so the rule will trigger when diff --git a/doc/MkExx.hs b/doc/MkExx.hs index 16eb38bf..0db35218 100644 --- a/doc/MkExx.hs +++ b/doc/MkExx.hs @@ -6,7 +6,7 @@ main = interact (unlines . concatMap mkScript . takeWhile (/="--.") . lines) mkScript l = case l of - ' ':_ -> + ' ':_ -> let ident = mkIdent $ unwords $ takeWhile (/="--") $ words l in [add $ psq ident] '-':_ -> [] @@ -30,45 +30,3 @@ mkIdent = concatMap unspec where ')' -> "" ':' -> "-" _ -> [c] - - - -langsCoding = [ - (("amharic", "Amh"),""), - (("arabic", "Ara"),""), - (("basque", "Eus"),""), - (("bulgarian","Bul"),""), - (("catalan", "Cat"),"Romance"), - (("danish", "Dan"),"Scand"), - (("dutch", "Dut"),""), - (("english", "Eng"),""), - (("finnish", "Fin"),""), - (("french", "Fre"),"Romance"), - (("hindi", "Hin"),"Hindustani"), - (("german", "Ger"),""), - (("interlingua","Ina"),""), - (("italian", "Ita"),"Romance"), - (("latin", "Lat"),""), - (("norwegian","Nor"),"Scand"), - (("polish", "Pol"),""), - (("punjabi", "Pnb"),""), - (("portuguese", "Por"), "Romance"), - (("romanian", "Ron"),""), - (("russian", "Rus"),""), - (("spanish", "Spa"),"Romance"), - (("swedish", "Swe"),"Scand"), - (("thai", "Tha"),""), - (("turkish", "Tur"),""), - (("urdu", "Urd"),"Hindustani") - ] - - -langs = map fst langsCoding - --- languagues for which Try is normally compiled -langsLang = langs `except` langsIncomplete - --- languages for which Lang can be compiled but which are incomplete -langsIncomplete = ["Amh","Ara","Hin","Lat","Pnb","Rus","Tha","Tur","Urd"] - -except ls es = filter (flip notElem es . snd) ls diff --git a/doc/MkExxTable.hs b/doc/MkExxTable.hs index a45effab..4cdab36c 100644 --- a/doc/MkExxTable.hs +++ b/doc/MkExxTable.hs @@ -4,10 +4,9 @@ module MkExxTable (getApiExx, ApiExx, prApiEx, mkEx) where import System.Environment(getArgs) import Control.Monad(when) import qualified Data.Map as M -import Data.Char main = do - xx <- getArgs + xx <- getArgs aexx <- getApiExx' True xx return () -- putStrLn $ prApiExx aexx @@ -16,7 +15,7 @@ getApiExx = getApiExx' False getApiExx' verbose xx = do s <- readFile (head xx) - let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s + let aet = getApiExxTrees $ filter validOutput $ mergeOutput $ lines s aeos <- mapM (readApiExxOne verbose) xx let aexx = mkApiExx $ ("API",aet) : aeos -- putStrLn $ prApiExx aexx @@ -57,7 +56,7 @@ cleanUp = dropWhile (flip elem " >") --- this makes txt2tags loop... mergeOutput ls = ls mergeOutputt ls = case ls of - l@('>':_):ll -> let (ll1,ll2) = span ((/=">") . take 1) ll in unwords (l : map (unwords . words) ll1) : mergeOutput ll2 + l@('>':_):ll -> let (ll1,ll2) = span ((/=">") . take 1) ll in unwords (l : map (unwords . words) ll1) : mergeOutput ll2 _:ll -> mergeOutput ll _ -> [] @@ -65,15 +64,15 @@ mergeOutputt ls = case ls of validOutput = (==">") . take 1 mkApiExx :: [(String,ApiExxOne)] -> ApiExx -mkApiExx ltes = - M.fromList [(t, - M.fromList [(l,maybe "NONE" id (M.lookup t te)) | (l,te) <- ltes]) +mkApiExx ltes = + M.fromList [(t, + M.fromList [(l,maybe "NONE" id (M.lookup t te)) | (l,te) <- ltes]) | t <- M.keys firstL] where firstL = snd (head ltes) prApiExx :: ApiExx -> String -prApiExx aexx = unlines +prApiExx aexx = unlines [unlines (t:prApiEx lexx) | (t,lexx) <- M.toList aexx] prApiEx :: M.Map String String -> [String] @@ -81,7 +80,7 @@ prApiEx apexx = case M.toList apexx of (a,e):lexx -> (a ++ ": ``" ++ unwords (words e) ++ "``"): [l ++ ": //" ++ mkEx l e ++ "//" | (l,e) <- lexx] -mkEx l = unws . bind . mkE . words where +mkEx l = unws . bind . mkE . words where unws = if elem l ["Chi","Jpn","Tha"] then concat else unwords -- remove spaces mkE e = case e of "atomic":"term":_ -> ["*"] @@ -101,6 +100,6 @@ bind ws = case ws of "&+":ws2 -> bind ws2 "Predef.BIND":ws2 -> bind ws2 "Predef.SOFT_BIND":ws2 -> bind ws2 - w : ws2 -> w : bind ws2 w : "++" : ws2 -> w : bind ws2 + w : ws2 -> w : bind ws2 _ -> ws diff --git a/doc/MkSynopsis.hs b/doc/MkSynopsis.hs index e2040fe4..777c3aad 100644 --- a/doc/MkSynopsis.hs +++ b/doc/MkSynopsis.hs @@ -1,27 +1,35 @@ import MkExxTable import System.Process(system) import System.Environment(getArgs) +import System.FilePath((),(<.>)) import Data.Char import Data.List -import qualified Data.ByteString.Char8 as BS import qualified Data.Map as M ----import Debug.Trace ---- +import Text.Printf +import Config type Cats = [(String,String,String)] type Rules = [(String,String,String)] -- the file generated +synopsis :: FilePath synopsis = "synopsis.txt" -- the language in which revealed examples are shown +revealedLang :: String revealedLang = "Eng" -- all languages shown (a copy of this list appears in Makefile) -apiExxFiles = ["api-examples-" ++ lang ++ ".txt" | lang <- words --- "Eng Chi" - "Afr Ara Bul Cat Chi Dan Dut Eng Est Eus Fin Fre Ger Gre Hin Ice Ita Jpn Lav Mlt Mon Nep Nor Nno Pes Pnb Pol Por Ron Rus Snd Spa Swe Tha Urd" - ] +apiExxFiles :: IO [FilePath] +apiExxFiles = do + langs <- loadLangsFrom (".." configFile) + return $ + [ "api-examples-" ++ (langCode lang) ++ ".txt" + | lang <- langs + , langSynopsis lang + ] +main :: IO () main = do xx <- getArgs let isLatex = case xx of @@ -31,7 +39,7 @@ main = do cs2 <- getCats catAPI let cs = sortCats (cs1 ++ cs2) writeFile synopsis "GF Resource Grammar Library: Synopsis" - append "B. Bringert, T. Hallgren, and A. Ranta" + -- append "B. Bringert, T. Hallgren, and A. Ranta" space append "%!Encoding:utf-8" append "%!style(html): ./revealpopup.css" @@ -66,7 +74,7 @@ main = do space link "Source 2:" structuralAPI space - apiExx <- getApiExx apiExxFiles + apiExx <- apiExxFiles >>= getApiExx rs <- getRules apiExx syntaxAPI --- putStrLn $ unlines ["p -cat=" ++ last (words t) ++ --- " \"" ++ e ++ "\"" | (_,t,e) <- rs, not (null e)] ---- @@ -83,7 +91,7 @@ main = do -- delimit rs space title "Lexical Paradigms" - mapM_ (putParadigms isLatex cs) paradigmFiles + paradigmFiles >>= mapM_ (putParadigms isLatex cs) space include "synopsis-additional.txt" space @@ -227,7 +235,6 @@ mkIdent = concatMap unspec where ':' -> "-" _ -> [c] - mkCatTable :: Bool -> Cats -> [String] mkCatTable isLatex cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs where @@ -236,49 +243,36 @@ mkCatTable isLatex cs = inChunks chsize (\rs -> header ++ map mk1 rs) cs mk1 (name,expl,ex) = unwords ["|", showCat cs name, "|", expl, "|", typo ex, "|"] typo ex = if take 1 ex == "\"" then itf (init (tail ex)) else ex -srcPath = ("../src" ++) +srcPath = (() "../src") -commonAPI = srcPath "/abstract/Common.gf" -catAPI = srcPath "/abstract/Cat.gf" -syntaxAPI = srcPath "/api/Constructors.gf" -structuralAPI = srcPath "/abstract/Structural.gf" -paradigmFiles = [ - ("Afrikaans", srcPath "/afrikaans/ParadigmsAfr.gf"), - ("Arabic", srcPath "/arabic/ParadigmsAra.gf"), - ("Basque", srcPath "/basque/ParadigmsEus.gf"), - ("Bulgarian", srcPath "/bulgarian/ParadigmsBul.gf"), - ("Catalan", srcPath "/catalan/ParadigmsCat.gf"), - ("Chinese", srcPath "/chinese/ParadigmsChi.gf"), - ("Danish", srcPath "/danish/ParadigmsDan.gf"), - ("Dutch", srcPath "/dutch/ParadigmsDut.gf"), - ("English", srcPath "/english/ParadigmsEng.gf"), - ("Estonian", srcPath "/estonian/ParadigmsEst.gf"), - ("Finnish", srcPath "/finnish/ParadigmsFin.gf"), - ("French", srcPath "/french/ParadigmsFre.gf"), - ("German", srcPath "/german/ParadigmsGer.gf"), - ("Greek", srcPath "/greek/ParadigmsGre.gf"), - ("Hindi", srcPath "/hindi/ParadigmsHin.gf"), - ("Icelandic", srcPath "/icelandic/ParadigmsIce.gf"), --- ("Interlingua", srcPath "/interlingua/ParadigmsIna.gf"), - ("Italian", srcPath "/italian/ParadigmsIta.gf"), - ("Japanese", srcPath "/japanese/ParadigmsJpn.gf"), - ("Latvian", srcPath "/latvian/ParadigmsLav.gf"), - ("Maltese", srcPath "/maltese/ParadigmsMlt.gf"), - ("Mongolian", srcPath "/mongolian/ParadigmsMon.gf"), - ("Nepali", srcPath "/nepali/ParadigmsNep.gf"), - ("Norwegian", srcPath "/norwegian/ParadigmsNor.gf"), - ("Nynorsk", srcPath "/nynorsk/ParadigmsNno.gf"), - ("Polish", srcPath "/polish/ParadigmsPol.gf"), - ("Punjabi", srcPath "/punjabi/ParadigmsPnb.gf"), - ("Portuguese", srcPath "/portuguese/ParadigmsPor.gf"), - ("Romanian", srcPath "/romanian/ParadigmsRon.gf"), - ("Russian", srcPath "/russian/ParadigmsRus.gf"), - ("Sindhi", srcPath "/sindhi/ParadigmsSnd.gf"), - ("Spanish", srcPath "/spanish/ParadigmsSpa.gf"), - ("Swedish", srcPath "/swedish/ParadigmsSwe.gf"), - ("Thai", srcPath "/thai/ParadigmsTha.gf"), - ("Urdu", srcPath "/urdu/ParadigmsUrd.gf") - ] +commonAPI = srcPath "abstract/Common.gf" +catAPI = srcPath "abstract/Cat.gf" +syntaxAPI = srcPath "api/Constructors.gf" +structuralAPI = srcPath "abstract/Structural.gf" + +paradigmFiles :: IO [(String,FilePath)] +paradigmFiles = do + langs <- loadLangsFrom (".." configFile) + return $ + [ (name, srcPath $ printf "%s/Paradigms%s.gf" (langDir lang) (langCode lang)) + | lang <- langs + , langSynopsis lang + , let name = formatName (langDir lang) + ] + +-- | Format language name from directory name +-- "ancient_greek -> Ancient Greek" +formatName :: String -> String +formatName = unwords . map (\(s:ss) -> toUpper s : ss) . splitOn (=='_') + +-- | Split a string at given character, similar to words +splitOn :: (Char -> Bool) -> String -> [String] +splitOn _ "" = [] +splitOn f s = takeWhile (not.f) s : splitOn f rest + where + rest = case dropWhile (not.f) s of + "" -> [] + _:xs -> xs append s = appendFile synopsis ('\n':s) title s = append $ "=" ++ s ++ "=" @@ -339,7 +333,7 @@ showTyp cs = unwords . map f . words -- to work around GHC 6.12 file input readFileC cod file = do - let tmp = file ++ ".tmp" + let tmp = file <.> "tmp" case cod of "utf8" -> readFile file _ -> do diff --git a/doc/language-list.txt b/doc/language-list.txt deleted file mode 100644 index 486353b6..00000000 --- a/doc/language-list.txt +++ /dev/null @@ -1,35 +0,0 @@ -Afrikaans -Amharic -Arabic -Bulgarian -Catalan -Chinese -Danish -Dutch -English -Finnish -French -German -Greek -Hebrew -Hindi -Interlingua -Japanese -Italian -Latin -Latvian -
  • Maltese -Nepali -Norwegian -Persian -Polish -Punjabi -Romanian -Russian -Sindhi -Spanish -Swahili -Swedish -Thai -Turkish -Urdu diff --git a/languages.csv b/languages.csv index 5af6e0a1..4cddceaf 100644 --- a/languages.csv +++ b/languages.csv @@ -1,45 +1,45 @@ -Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility -Afr,afrikaans,,,,,,n, -Amh,amharic,,,,,n,n, -Ara,arabic,,,,,,y, -Eus,basque,,,,,,, -Bul,bulgarian,,,y,,,, -Cat,catalan,Romance,,y,,,,y -Chi,chinese,,,,,,, -Dan,danish,Scand,,y,,,, -Dut,dutch,,,y,,,, -Eng,english,,,y,,,,y -Est,estonian,,,,,,, -Fin,finnish,,,y,,,,y -Fre,french,Romance,,y,,,,y -Grc,ancient_greek,,,y,,n,n, -Gre,greek,,,,,,, -Heb,hebrew,,,,,n,n, -Hin,hindi,Hindustani,to_devanagari,y,,,, -Hun,hungarian,,,y,n,n,n, -Ger,german,,,,,,, -Ice,icelandic,,,,,,n, -Ina,interlingua,,,y,,n,n, -Ita,italian,Romance,,y,,,,y -Jpn,japanese,,,,,,, -Lat,latin,,,y,,n,n, -Lav,latvian,,,,,,,y -Mlt,maltese,,,,,,, -Mon,mongolian,,,,,,n, -Nep,nepali,,,,,,n, -Nor,norwegian,Scand,,y,,,, -Nno,nynorsk,,,y,,,, -Pes,persian,,,,,,, -Pol,polish,,,,,,, -Por,portuguese,Romance,,y,,,,y -Pnb,punjabi,,,y,,,, -Ron,romanian,,,y,,,, -Rus,russian,,,y,,,, -Snd,sindhi,,,,,,, -Spa,spanish,Romance,,y,,,,y -Swa,swahili,,,,n,n,n,y -Swe,swedish,Scand,,y,,,,y -Tel,telugu,,,y,n,n,n, -Tha,thai,,to_thai,,,,, -Tur,turkish,,,,,n,n, -Urd,urdu,Hindustani,,,,,, +Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis +Afr,afrikaans,,,,,,n,,y +Amh,amharic,,,,,n,n,,n +Ara,arabic,,,,,,y,,y +Bul,bulgarian,,,y,,,,,y +Cat,catalan,Romance,,y,,,,y,y +Chi,chinese,,,,,,,,y +Dan,danish,Scand,,y,,,,,y +Dut,dutch,,,y,,,,,y +Eng,english,,,y,,,,y,y +Est,estonian,,,,,,,,y +Eus,basque,,,,,,,,y +Fin,finnish,,,y,,,,y,y +Fre,french,Romance,,y,,,,y,y +Ger,german,,,,,,,,y +Grc,ancient_greek,,,y,,n,n,,n +Gre,greek,,,,,,,,y +Heb,hebrew,,,,,n,n,,n +Hin,hindi,Hindustani,to_devanagari,y,,,,,y +Hun,hungarian,,,y,n,n,n,,n +Ice,icelandic,,,,,,n,,y +Ina,interlingua,,,y,,n,n,,n +Ita,italian,Romance,,y,,,,y,y +Jpn,japanese,,,,,,,,y +Lat,latin,,,y,,n,n,,n +Lav,latvian,,,,,,,y,y +Mlt,maltese,,,,,,,,y +Mon,mongolian,,,,,,n,,y +Nep,nepali,,,,,,n,,y +Nno,nynorsk,,,y,,,,,y +Nor,norwegian,Scand,,y,,,,,y +Pes,persian,,,,,,,,y +Pnb,punjabi,,,y,,,,,y +Pol,polish,,,,,,,,y +Por,portuguese,Romance,,y,,,,y,y +Ron,romanian,,,y,,,,,y +Rus,russian,,,y,,,,,y +Snd,sindhi,,,,,,,,y +Spa,spanish,Romance,,y,,,,y,y +Swa,swahili,,,,n,n,n,y,n +Swe,swedish,Scand,,y,,,,y,y +Tel,telugu,,,y,n,n,n,,n +Tha,thai,,to_thai,,,,,,y +Tur,turkish,,,,,n,n,,n +Urd,urdu,Hindustani,,,,,,,y From 6e8f92a9c52d5986398d89c3f5e509b8c0311822 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 6 Nov 2018 10:37:54 +0100 Subject: [PATCH 13/78] Remove generated categories-imagemap.html from version control There are many other things which should not be under version control... --- doc/categories-imagemap.html | 53 ------------------------------------ 1 file changed, 53 deletions(-) delete mode 100644 doc/categories-imagemap.html diff --git a/doc/categories-imagemap.html b/doc/categories-imagemap.html deleted file mode 100644 index 31f01eef..00000000 --- a/doc/categories-imagemap.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 41ec90c3fe1128ec07b4e96647609bc4e552cb28 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Wed, 31 Oct 2018 09:03:42 -0300 Subject: [PATCH 14/78] (travis) refactor travis CI - add ubuntu, mac, and windows builds add travis build with mac and ubuntu - fix signature in Make.hs for compatibility with ghc<8 add windows build to travis using haskell and bash scripts (travis) use env variable Make.bat works (Make.bar) [temporary] comment some Langs merge upstream and uncomment langs --- .travis.yml | 25 ++++++++++++++++++------- Make.hs | 2 +- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7f2c3d43..1e4a560b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,14 +1,25 @@ sudo: required - language: c -services: - - docker +os: + - linux + - osx + - windows + +addons: + apt: + packages: + - ghc before_install: - - docker pull odanoburu/haskell-gf:3.9 - - mkdir rgl + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update && brew install ghc@8.2 && export PATH="/usr/local/opt/ghc@8.2/bin:$PATH" ; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then curl http://www.grammaticalframework.org/download/gf-3.9-bin-intel-mac.tar.gz > gf.tar.gz && sudo tar --no-same-owner --no-same-permissions -C /usr/local -zxf gf.tar.gz && rm gf.tar.gz; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl http://www.grammaticalframework.org/download/gf_3.9.1-1_amd64-trusty.deb > gf.deb && sudo dpkg -i gf.deb && rm gf.deb ; fi + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then choco install ghc --version=8.4.4 && export PATH="/c/ProgramData/chocolatey/lib/ghc/tools/ghc-8.4.4/bin:$PATH"; fi + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then curl http://www.grammaticalframework.org/download/gf-3.9-bin-windows.zip > gf.zip && unzip gf.zip && rm gf.zip && export PATH="$TRAVIS_BUILD_DIR/gf-3.9/bin:$PATH"; fi + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then alias gf='gf.exe' && alias runghc='runghc.exe' ; fi script: - - docker run --mount src="$(pwd)",target=/home,type=bind odanoburu/haskell-gf:3.9 /bin/bash -c "cd /home/; export GF_LIB_PATH=/home/rgl ; runghc Make.hs build prelude all --verbose ;" - - docker run --mount src="$(pwd)",target=/home,type=bind odanoburu/haskell-gf:3.9 /bin/bash -c "cd /home/; export GF_LIB_PATH=/home/rgl; bash Make.sh --dest=rgl --verbose ;" + - runghc Make.hs build prelude all --verbose ; rm -rf dist + - bash Make.sh --dest=dist-bash --verbose ; rm -rf dist + - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmd //c Make.bat --dest=dist-bat --verbose ; fi diff --git a/Make.hs b/Make.hs index 2a40e398..434040bd 100644 --- a/Make.hs +++ b/Make.hs @@ -444,7 +444,7 @@ execute command args = do -- | For parallel RGL module compilation -- Unfortunately, this has no effect unless compiled with -threaded -parallel_ :: (Foldable t, Monad m) => t (m a) -> m () +--parallel_ :: (Foldable t, Monad m) => t (m a) -> m () parallel_ ms = sequence_ ms -- do c <- newChan -- ts <- sequence [ forkIO (m >> writeChan c ()) | m <- ms] From 2888073c44d0dbb6a467adcb161be58011416a1c Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 11:30:00 +0100 Subject: [PATCH 15/78] (Ara) Minor fixes --- src/arabic/NounAra.gf | 2 +- src/arabic/QuestionAra.gf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index d20b3e78..d0b0c5c8 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -90,7 +90,7 @@ lin } ; DetQuant quant num = quant ** { - s = \\h,g,c => quant.s ! Pl ! h ! g ! c + s = \\h,g,c => quant.s ! sizeToNumber num.n ! h ! g ! c ++ num.s ! g ! (toDef quant.d num.n) ! c ; n = num.n; isNum = -- Num may come from NumCard : Card -> Num diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index ecfa1f8c..c0667450 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -8,7 +8,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA s = \\t,p => table { QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ; - QDir => "هَل" ++ cl.s ! t ! p ! Verbal + QDir => "هَلْ" ++ cl.s ! t ! p ! Verbal } }; From 5c5cd125c9e591a5f74652c0d158111ea15a94ec Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 11:31:07 +0100 Subject: [PATCH 16/78] (Ara) Add paradigm for doubly weak FormIV + remove hamza from imperative prefix --- src/arabic/OrthoAra.gf | 8 ++++ src/arabic/ParadigmsAra.gf | 18 ++++----- src/arabic/ResAra.gf | 77 +++++++++++++++++++++++--------------- 3 files changed, 61 insertions(+), 42 deletions(-) diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index 0e5d7e19..c5968270 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -6,6 +6,8 @@ flags coding=utf8 ; vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ; + weak : pattern Str = #("و"|"ي") ; + -- "Sun letters": assimilate with def. article sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ; @@ -17,6 +19,12 @@ flags coding=utf8 ; _ => word + suffix } ; + -- IL: using this to reuse patterns for weak verbs, might be strange/wrong + rmSukun : Str -> Str = \s -> case s of { + x + "ْ" + y => x + y ; + _ => s + } ; + -- Hamza hamza : pattern Str = #("ء"|"؟") ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 03590327..aa2b9a46 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -351,7 +351,7 @@ resource ParadigmsAra = open } in { s = case root.l of { - "و"|"ي" => (v2defective root).s; + #weak => (v2defective root).s; _ => (v2sound root).s }; lock_V = <> @@ -368,16 +368,12 @@ resource ParadigmsAra = open v4 = \rootStr -> - let { - root = mkRoot3 rootStr - } in { - s = - case root.l of { - "و"|"ي" => (v4defective root).s; - _ => (v4sound root).s - }; - lock_V = <> - }; + let root : Root3 = mkRoot3 rootStr ; + verb : Verb = case rootStr of { + ? + #hamza + #weak => v4doubleweak root ; + _ + #weak => v4defective root ; + _ => v4sound root } ; + in lin V verb ; v5 = diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 73b423c2..6949e16d 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -127,7 +127,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { isNum : Bool } ; - uttNum : NumOrdCard -> (Gender => Str) ; uttNum n = \\g => n.s ! g ! Def ! Nom ; ----IL @@ -263,8 +262,11 @@ oper } ; --macro for defective verbs: - verbDef : DefForms -> Vowel -> Verb = - \vforms,vowImpf -> + verbDef : DefForms -> Vowel -> Verb = verbDefBool False ; + verbDoubleDef : DefForms -> Vowel -> Verb = verbDefBool True ; + + verbDefBool : Bool -> DefForms -> Vowel -> Verb = + \isDoubleDef,vforms,vowImpf -> let { rama = vforms ! 0 ; -- VPerf Act (Per3 Masc Sg) ramay = vforms ! 1 ; -- VPerf Act (Per3 Fem Pl) @@ -280,13 +282,14 @@ oper patPerf = patDefPerf rama ramay rumi rumu rumiy ; patImpfAct = patDefImpfAct armi armu ; - patImp = patDefImp Irmi Irmu + patImp = patDefImp Irmi Irmu ; + suffixImpf = case isDoubleDef of {True => suffixImpfDoubleDef ; _ => suffixImpfDef} } in { s = table { - VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ; - VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpfDef Act vowImpf ! m ! pgn ; - VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpfDef Pas vowImpf ! m ! pgn ; - VImp g n => patImp ! g ! n + suffixImpfDef Act vowImpf ! Jus ! Per2 g n ; + VPerf v pgn => patPerf ! v ! pgn + suffixPerfDef v ! pgn ; + VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + suffixImpf Act vowImpf ! m ! pgn ; + VImpf m Pas pgn => prefixImpf ! pgn + urma + suffixImpf Pas vowImpf ! m ! pgn ; + VImp g n => patImp ! g ! n + suffixImpf Act vowImpf ! Jus ! Per2 g n ; VPPart => ppart } } ; @@ -352,7 +355,6 @@ oper Per1 Plur => "نَا" } ; - suffixImpfDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> let { default : Mood -> Str = \m -> @@ -389,6 +391,10 @@ oper } } ; + -- does this even happen other than with رءي? /IL + suffixImpfDoubleDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> + \\m,p => rmSukun (suffixImpfDef vc vw ! m ! p) ; + --now is used for the sound, assimilated (weak C1), and when C1 = hamza: v1sound : Root3 -> Vowel -> Vowel -> Verb = @@ -406,8 +412,8 @@ v1sound : Root3 -> Vowel -> Vowel -> Verb = }; uktab = mkStrong ufcal fcl ; euktub = case fcl.f of { - "؟"|"و"|"ي" => qif ; - _ => prefixImp ! vowImpf + ktub + "ء"|"و"|"ي" => qif ; + _ => prefixImp ! vowImpf + ktub }; maktUb = mkStrong mafcUl fcl } in @@ -506,7 +512,7 @@ toDefForms : (x1,_,_,_,_,_,_,_,_,_,x11 : Str) -> DefForms = 7 => h ; 8 => i ; 9 => j ; 10 => k } ; -def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> +v1DefForms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> let { _rmi = mkDefective (patDef1 ! vowImpf) rmy ; _rmu = mkDefective (patDef2 ! vowImpf) rmy ; @@ -524,11 +530,11 @@ def1Forms_perfA : Root3 -> Vowel -> DefForms = \rmy,vowImpf -> } in toDefForms rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy ; v1defective_a : Root3 -> Vowel -> Verb = \rmy,vowImpf -> - let vforms = def1Forms_perfA rmy vowImpf + let vforms = v1DefForms_perfA rmy vowImpf in verbDef vforms vowImpf ; v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4) - let vforms_a = def1Forms_perfA bqy vowImpf ; + let vforms_a = v1DefForms_perfA bqy vowImpf ; baqI = mkDefective facIl bqy ; baqiy = mkDefective facil bqy ; vforms_i = table { 0 => baqI ; @@ -599,23 +605,32 @@ v4sound : Root3 -> Verb = verb eaqnac euqnic uqnic uqnac eaqnic muqnac; -v4defective : Root3 -> Verb = \cTy -> + v4DefForms : Root3 -> DefForms = \cTy -> let { - cTa = mkDefective fca cTy; - cTu = mkDefective fcu cTy; - cTi = mkDefective fci cTy; - eacTa = "أَ" + cTa; - eacTay = mkStrong eafcal cTy ; - ucTi = "ُ" + cTi; - eucTi = "أُ" + cTi; - ucTu = "ُ" + cTu; - eucTu = "أُ" + cTu; - eucTiy = mkStrong eufcil cTy ; - ucTa = "ُ" + cTa; - eacTi = "أَ" + cTi; - eacTu = "أَ" + cTu; + _cTa = mkDefective fca cTy; + _cTu = mkDefective fcu cTy; + _cTi = mkDefective fci cTy; + eacTa = "أَ" + _cTa; -- VPerf Act (Per3 Masc Sg) + eacTay = mkStrong eafcal cTy ; -- VPerf Act (Per3 Fem Pl) + eucTi = "أُ" + _cTi; -- VPerf Pas (Per3 _ Sg) + eucTu = "أُ" + _cTu; -- VPerf Pas (Per3 Masc Pl) + eucTiy = mkStrong eufcil cTy ; -- VPerf Pas (Per3 Fem Pl) + ucTi = "ُ" + _cTi; -- VImpf Act + ucTu = "ُ" + _cTu; -- VImpf Act (Per2/3 Masc Pl) + ucTa = "ُ" + _cTa; -- VImpf Pas + eacTi = "أَ" + _cTi; -- VImp (Masc Sg / Fem _) + eacTu = "أَ" + _cTu; -- VImp Masc Pl mucTaY = "م" + ucTa +"ى" - } in verbDef (toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY) i; + } in toDefForms eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY ; + +v4defective : Root3 -> Verb = \cTy -> + verbDef (v4DefForms cTy) i ; + +v4doubleweak : Root3 -> Verb = \r'y -> + let ry = r'y ** {c = ""} ; + vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun + in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef + v5sound : Root3 -> Verb = \nfs -> @@ -723,8 +738,8 @@ endVowel : Mood => Str = prefixImp : Vowel => Str = table { - u => "أُ" ; - _ => "إِ" + u => "اُ" ; + _ => "اِ" } ; patHollowPerf : (_,_,_,_ :Str) -> Voice => PerGenNum => Str = \xAf,xif,xIf,xuf -> From 36b827bcc2153fdb4c51786dbc0b986a25b3d4d4 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 7 Nov 2018 13:19:54 +0100 Subject: [PATCH 17/78] Clarify default values of columns in languages.csv --- README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index dda79ac4..7d784ae1 100644 --- a/README.md +++ b/README.md @@ -27,24 +27,24 @@ It will look for, in this order: ## Language config -A list of all languages and their properties is maintained centrally in `languages.csv`. +A list of all languages and their properties is maintained centrally in [`languages.csv`](languages.csv). This file should be kept up-to-date and all build methods should read this config file. **If you see something wrong, please report/fix it.** -Description of columns: -- Code, e,g, `Eng` -- Directory, e.g. `english` -- Functor (not used) -- Unlexer (not used) -- Present: languages that have `--# notpresent` marked -- All: languages for which to compile `All` -- Try: languages for which to compile `Try` -- Symbolic: languages for which to compile `Symbolic` -- Compatibility: languages for which to complile `Compatibility` -- Synopsis: languages to include in the RGL synopsis document +| Column | Description | Default | +|:--------------|:-----------------------------------------|:-------:| +| Code | e.g. `Eng` | - | +| Directory | folder name under `src`, e.g. `english` | - | +| Functor | (not used) | - | +| Unlexer | (not used) | - | +| Present | language is marked with `--# notpresent` | n | +| All | compile `All` module | y | +| Try | compile `Try` module | y | +| Symbolic | compile `Symbolic` module | y | +| Compatibility | complile `Compatibility` module | n | +| Synopsis | include language in the RGL synopsis | n | -Columns can be a string, just `y`'s (where nothing means `n`) or just (`n`'s where nothing means `y`), -or a mixture of both `y`'s and `n`'s. +If default is `y` then anything other than `n`, including the empty string, is treated as true (and vice versa when default is `n`). ## Haskell script: `Make.hs` From bf28bf1e5642fb9969ad566e60757102b5ba69ce Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 14:30:38 +0100 Subject: [PATCH 18/78] (Ara) Prepositions + improve Paradigms API functions --- src/arabic/AdjectiveAra.gf | 2 +- src/arabic/AdverbAra.gf | 2 +- src/arabic/CatAra.gf | 16 ++-- src/arabic/LexiconAra.gf | 2 +- src/arabic/NounAra.gf | 2 +- src/arabic/ParadigmsAra.gf | 179 ++++++++++++++++++++++++++---------- src/arabic/QuestionAra.gf | 2 +- src/arabic/ResAra.gf | 22 ++++- src/arabic/SentenceAra.gf | 2 +- src/arabic/StructuralAra.gf | 38 ++++---- src/arabic/VerbAra.gf | 7 +- 11 files changed, 185 insertions(+), 89 deletions(-) diff --git a/src/arabic/AdjectiveAra.gf b/src/arabic/AdjectiveAra.gf index baae0935..ec15d535 100644 --- a/src/arabic/AdjectiveAra.gf +++ b/src/arabic/AdjectiveAra.gf @@ -21,7 +21,7 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in { -- $SuperlA$ belongs to determiner syntax in $Noun$. -- ComplA2 a np = { - s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2 ++ np.s ! Gen ; + s = \\sp,g,n,st,c => a.s ! APosit g n st c ++ a.c2.s ++ np.s ! a.c2.c ; } ; -- -- ReflA2 a = { diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index d7a90387..d6f8eb9f 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -10,7 +10,7 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { -- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s -- } ; - PrepNP prep np = {s = prep.s ++ np.s ! Gen} ; + PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ; -- AdAdv = cc2 ; -- diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index d1fe2f49..13cd0773 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -36,7 +36,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { -- Verb VP = ResAra.VP ; - VPSlash = ResAra.VPSlash ; -- VP ** {c2:Str} + VPSlash = ResAra.VPSlash ; -- VP ** {c2:Preposition} Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ; -- SC = {s : Str} ; -- @@ -72,21 +72,21 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { Conj = {s : Str ; n : ResAra.Number} ; -- DConj = {s1,s2 : Str ; n : ResAra.Number} ; -- Subj = {s : Str} ; - Prep = {s : Str} ; + Prep = ResAra.Preposition ; -- Open lexical classes, e.g. Lexicon V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ; - V2, V2A = ResAra.Verb ** {c2 : Str} ; - VV, V2V, V2S, V2Q = ResAra.Verb ** {c2 : Str} ; --- AR - V3 = ResAra.Verb ** {c2, c3 : Str} ; + V2, V2A = ResAra.Verb2 ; + VV, V2S, V2Q = ResAra.Verb2 ; + V2V, V3 = ResAra.Verb3 ; A = ResAra.Adj ; - A2 = ResAra.Adj ** {c2 : Str} ; + A2 = ResAra.Adj2 ; N = ResAra.Noun ; - N2 = ResAra.Noun ** {c2 : Str} ; - N3 = ResAra.Noun ** {c2, c3 : Str} ; + N2 = ResAra.Noun2 ; + N3 = ResAra.Noun3 ; PN = {s : Case => Str; g : Gender; h : Species} ; linref diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 8178ce9f..4f3cff58 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -24,7 +24,7 @@ flags beautiful_A = sndA "جمل" "فَعِيل" ; become_VA = mkVA (v4 "صبح") ; beer_N = sdfN "بير" "فِعلة" Fem NoHum ; - beg_V2V = dirV2 (v5 "وسل") ; + beg_V2V = mkV2V (mkVV (v5 "وسل")) noPrep ; big_A = sndA "كبر" "فَعِيل" ; bike_N = sdfN "درج" "فَعّالة" Fem NoHum ; bird_N = brkN "طير" "فَعل" "فُعُول" Masc NoHum; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index d0b0c5c8..aed22c99 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -180,7 +180,7 @@ lin Use3N3 n3 = n3 ** {c2 = n3.c3} ; ComplN2 n2 np = UseN n2 ** --- IL - {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2 ++ np.s ! Gen} ; + {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2.s ++ np.s ! n2.c2.c} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index aa2b9a46..962c0158 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -35,9 +35,16 @@ resource ParadigmsAra = open oper --- Prepositions are used in many-argument functions for rection. + Case : Type ; + nom : Case ; + acc : Case ; + gen : Case ; +-- Prepositions are used in many-argument functions for rection. Preposition : Type ; + noPrep : Preposition ; + casePrep : Case -> Preposition ; + --- TODO: continue, add all over the grammar Gender : Type ; masc : Gender ; @@ -100,13 +107,17 @@ resource ParadigmsAra = open --3 Relational nouns - mkN2 = overload { - mkN2 : N -> Preposition -> N2 = prepN2 ; - mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = []}) ; - mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = []}) + mkN2 : overload { + mkN2 : N -> Preposition -> N2 ; -- ready-made preposition + mkN2 : (mother : N) -> (of_ : Str) -> N2 ; -- preposition given as a string + mkN2 : N -> N2 ; -- no preposition + mkN2 : Str -> N2 ; -- no preposition, predictable inflection } ; - mkN3 : N -> Preposition -> Preposition -> N3 ; + mkN3 : overload { + mkN3 : N -> Preposition -> Preposition -> N3 ; -- ready-made prepositions + mkN3 : N -> Str -> Str -> N3 ; -- prepositions given as strings + } ; --2 Adjectives @@ -135,7 +146,10 @@ resource ParadigmsAra = open -- -- Two-place adjectives need a preposition for their second argument. - mkA2 : A -> Preposition -> A2 ; + mkA2 : overload { + mkA2 : A -> Preposition -> A2 ; + mkA2 : A -> Str -> A2 + } ; --2 Adverbs @@ -152,14 +166,12 @@ resource ParadigmsAra = open --2 Prepositions -- -- A preposition as used for rection in the lexicon, as well as to --- build $PP$s in the resource API, just requires a string. - - mkPrep : Str -> Prep - = \s -> lin Prep {s = mkPreposition s} ; -- preposition in the sense of RGL abstract syntax - - mkPreposition : Str -> Preposition ; -- just a string, for internal use - +-- build $PP$s in the resource API. Requires a string and a case. + mkPrep : overload { + mkPrep : Str -> Prep ; + mkPrep : Str -> Case -> Prep + } ; -- preposition in the sense of RGL abstract syntax --2 Verbs -- Overloaded operations @@ -212,10 +224,11 @@ resource ParadigmsAra = open -- Two-place verbs need a preposition, except the special case with direct object. -- (transitive verbs). Notice that a particle comes from the $V$. - mkV2 = overload { - mkV2 : V -> V2 = dirV2 ; - mkV2 : V -> Preposition -> V2 = prepV2 ; - mkV2 : Str -> V2 = strV2; + mkV2 : overload { + mkV2 : V -> V2 ; -- No preposition + mkV2 : V -> Str -> V2 ; -- Preposition as string, default case genitive + mkV2 : V -> Preposition -> V2 ; -- Ready-made preposition + mkV2 : Str -> V2 ; -- Predictable verb conjugation, no preposition } ; dirV2 : V -> V2 ; @@ -225,9 +238,15 @@ resource ParadigmsAra = open -- Three-place (ditransitive) verbs need two prepositions, of which -- the first one or both can be absent. - mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about - dirV3 : V -> Preposition -> V3 ; -- give,_,to - dirdirV3 : V -> V3 ; -- give,_,_ + mkV3 : overload { + mkV3 : V -> Preposition -> Preposition -> V3 ; -- speak, with, about + mkV3 : V -> (to : Str) -> (about:Str) -> V3 -- like above, but with strings as arguments (default complement case genitive) + } ; + dirV3 : overload { + dirV3 : V -> Preposition -> V3 ; -- give,_,to + dirV3 : V -> (to : Str) -> V3 -- like above, but with string as argument (default complement case genitive) + } ; + dirdirV3 : V -> V3 ; -- give,_,_ --3 Other complement patterns -- @@ -241,7 +260,11 @@ resource ParadigmsAra = open mkVV : V -> VV = regVV ; mkVV : V -> Str -> VV = c2VV } ; - mkV2V : V -> Str -> Str -> V2V ; + mkV2V : overload { + mkV2V : V -> Str -> Str -> V2V ; + mkV2V : V -> Preposition -> Preposition -> V2V ; + mkV2V : VV -> Preposition -> V2V + } ; mkVA : V -> VA ; mkV2A : V -> Str -> V2A ; mkVQ : V -> VQ ; @@ -266,9 +289,16 @@ resource ParadigmsAra = open -- The definitions should not bother the user of the API. So they are -- hidden from the document. + Case = ResAra.Case ; + nom = ResAra.Nom ; + acc = ResAra.Acc ; + gen = ResAra.Gen ; +-- Prepositions are used in many-argument functions for rection. - Preposition = Str ; + Preposition = ResAra.Preposition ; + noPrep = {s=[]; c=nom} ; + casePrep c = {s=[]; c=c} ; Gender = ResAra.Gender ; masc = ResAra.Masc ; @@ -283,6 +313,24 @@ resource ParadigmsAra = open vu = ResAra.u ; vi = ResAra.i ; + mkPrep = overload { + mkPrep : Str -> Prep = \s -> + lin Prep (mkPreposition s) ; + mkPrep : Str -> Case -> Prep = \s,c -> + lin Prep (mkPreposition s c) + } ; + + + mkV2 = overload { + mkV2 : V -> V2 = dirV2 ; + mkV2 : V -> Str -> V2 = \v,p -> prepV2 v (mkPreposition p); + mkV2 : V -> Preposition -> V2 = prepV2 ; + mkV2 : Str -> V2 = strV2; + } ; + + prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; + strV2 : Str -> V2 = \str -> dirV2 (mkV str) ; + mkN = overload { mkN : (sg : Str) -> N -- non-human regular nouns = smartN ; @@ -330,8 +378,6 @@ resource ParadigmsAra = open lock_V = <> } ; - - v1' : Str -> Vowel -> Vowel -> Verb = \rootStr,vPerf,vImpf -> let { root = mkRoot3 rootStr } in @@ -469,10 +515,21 @@ resource ParadigmsAra = open lock_PN = <> }; + mkN2 = overload { + mkN2 : N -> Preposition -> N2 = prepN2 ; + mkN2 : N -> Str -> N2 = \n,s -> prepN2 n (mkPreposition s); + mkN2 : N -> N2 = \n -> lin N2 (n ** {c2 = noPrep}) ; + mkN2 : Str -> N2 = \str -> lin N2 (smartN str ** {c2 = noPrep}) + } ; - prepN2 : N -> Str -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; + prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; - mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; + mkN3 = overload { + mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q -> + lin N3 (n ** {c2 = p ; c3 = q}) ; + mkN3 : N -> Str -> Str -> N3 = \n,p,q -> + lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; + } ; mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> { s = @@ -571,45 +628,67 @@ resource ParadigmsAra = open s = clr eaHmar HamrA' Humr; }; - mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ; + mkA2 = overload { + mkA2 : A -> Preposition -> A2 = prepA2 ; + mkA2 : A -> Str -> A2 = \a,p -> prepA2 a (mkPreposition p) + } ; - mkAdv x = ss x ** {lock_Adv = <>} ; - mkAdV x = ss x ** {lock_AdV = <>} ; - mkAdA x = ss x ** {lock_AdA = <>} ; + prepA2 : A -> Preposition -> A2 = \a,p -> lin A2 (a ** {c2 = p}) ; - mkPreposition p = p ; + mkAdv x = lin Adv (ss x) ; + mkAdV x = lin AdV (ss x) ; + mkAdA x = lin AdA (ss x) ; - prepV2 : V -> Preposition -> V2 = \v,p -> v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; - strV2 : Str -> V2 = \str -> dirV2 (mkV str) ; - dirV2 v = prepV2 v [] ; + dirV2 v = prepV2 v (casePrep acc) ; - mkV3 v p q = v ** {s = v.s ; c2 = p ; c3 = q ; lock_V3 = <>} ; - dirV3 v p = mkV3 v [] p ; - dirdirV3 v = dirV3 v [] ; + mkV3 = overload { + mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q -> + lin V3 (prepV3 v p q) ; + mkV3 : V -> Str -> Str -> V3 = \v,p,q -> + lin V3 (v ** {s = v.s ; c2 = mkPreposition p ; c3 = mkPreposition q}) + } ; + + prepV3 : V -> Preposition -> Preposition -> Verb3 = \v,p,q -> + v ** {s = v.s ; c2 = p ; c3 = q} ; + + dirV3 = overload { + dirV3 : V -> Preposition -> V3 = \v,p -> mkV3 v (casePrep acc) p ; + dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s) + } ; + + dirdirV3 v = dirV3 v (casePrep acc) ; mkVS v = v ** {lock_VS = <>} ; mkVQ v = v ** {lock_VQ = <>} ; - regVV : V -> VV = \v -> lin VV v ** {c2 = "أَنْ"} ; - c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = prep} ; + regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ"} ; + c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = noPrep} ; V0 : Type = V ; ---- V2S, V2V, V2Q, V2A : Type = V2 ; AS, A2S, AV : Type = A ; A2V : Type = A2 ; - mkV0 v = v ** {lock_V = <>} ; - mkV2S v p = mkV2 v p ** {lock_V2S = <>} ; - mkV2V v p t = mkV2 v p ** {s4 = t ; lock_V2V = <>} ; - mkVA v = v ** {lock_VA = <>} ; - mkV2A v p = mkV2 v p ** {lock_V2A = <>} ; - mkV2Q v p = mkV2 v p ** {lock_V2Q = <>} ; + mkV0 v = v ; + mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ; + mkV2V = overload { + mkV2V : V -> Str -> Str -> V2V = \v,p,q -> + lin V2V (prepV3 v (mkPreposition p) (mkPreposition q)) ; + mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q -> + lin V2V (prepV3 v p q) ; + mkV2V : VV -> Preposition -> V2V = \vv,p -> + lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ; + } ; + mkVA v = v ** {lock_VA = <>} ; + mkV2A v p = lin V2A (prepV2 v (mkPreposition p)); + mkV2Q v p = lin V2Q (prepV2 v (mkPreposition p)); + + mkAS, + mkAV = \a -> a ; + mkA2S, + mkA2V = \a,p -> prepA2 a (mkPreposition p) ; - mkAS v = v ** {lock_A = <>} ; - mkA2S v p = mkA2 v p ** {lock_A = <>} ; - mkAV v = v ** {lock_A = <>} ; - mkA2V v p = mkA2 v p ** {lock_A2 = <>} ; smartN : Str -> N = \s -> case s of { diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index c0667450..a0af36df 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -48,7 +48,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA QuestSlash ip cl = { ----IL just guessing s = \\t,p,qf => let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing - in cl.c2 ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o + in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o } ; --IL guessed diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 6949e16d..79d28e97 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -108,10 +108,22 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { NTable = Number => State => Case => Str; + Preposition : Type = {s : Str ; c : Case} ; Noun : Type = {s : NTable ; g : Gender; h : Species} ; --- Adj : Type = {s : Gender => NTable} ; + Noun2 : Type = Noun ** {c2 : Preposition} ; + Noun3 : Type = Noun2 ** {c3 : Preposition} ; + + mkPreposition = overload { + mkPreposition : Str -> Case -> Preposition = \s,c -> {s=s;c=c} ; + mkPreposition : Str -> Preposition = \s -> {s=s;c=Gen} ; + } ; + Adj : Type = {s : AForm => Str} ; + Adj2 : Type = Adj ** {c2 : Preposition} ; + Verb : Type = {s : VForm => Str} ; + Verb2 : Type = Verb ** {c2 : Preposition} ; + Verb3 : Type = Verb2 ** {c3 : Preposition} ; AP : Type = {s : Species => Gender => NTable } ; uttAP : AP -> (Gender => Str) ; @@ -1252,7 +1264,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> isPred = False }; - predVSlash : Verb ** {c2 : Str} -> VPSlash = \v -> + predVSlash : Verb2 -> VPSlash = \v -> predV v ** {c2 = v.c2} ; -- in verbal sentences, the verb agrees with the subject @@ -1264,7 +1276,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** - { obj = {s = vp.obj.s ++ vp.c2 ++ np.s ! Acc ; a = np.a} }; + { obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} }; insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> vp ** { pred = p; @@ -1278,8 +1290,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) ); -- Slash categories - VPSlash : Type = VP ** {c2 : Str} ; - ClSlash : Type = Cl ** {c2 : Str} ; + VPSlash : Type = VP ** {c2 : Preposition} ; + ClSlash : Type = Cl ** {c2 : Preposition} ; Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 1a26da8c..34d60888 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -102,7 +102,7 @@ concrete SentenceAra of Sentence = CatAra ** open 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} ; + SlashPrep cl prep = cl ** {c2 = prep} ; -- SlashVS np vs sslash = TODO diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 505e6bc4..59bdce40 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -4,8 +4,8 @@ concrete StructuralAra of Structural = CatAra ** flags optimize=all ; coding=utf8 ; lin - above_Prep = ss "فَوْقَ" ; - after_Prep = ss "بَعْدَ" ; + above_Prep = mkPrep "فَوْقَ" ; + after_Prep = mkPrep "بَعْدَ" ; all_Predet = mkPredet "كُلّ" True ; almost_AdA = ss "تَقْرِيباً"; almost_AdN = ss "حَوَالي" ; -- or "تَقرِيبا" @@ -13,20 +13,20 @@ concrete StructuralAra of Structural = CatAra ** -- always_AdV = ss "َلوَيس" ; and_Conj = ss "وَ" ** {n = Pl} ; -- because_Subj = ss "بعَُسي" ; - before_Prep = ss "قَبْلَ" ; - behind_Prep = ss "خَلْفَ" ; - between_Prep = ss "بَيْنَ" ; + before_Prep = mkPrep "قَبْلَ" ; + behind_Prep = mkPrep "خَلْفَ" ; + between_Prep = mkPrep "بَيْنَ" ; -- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ; -- but_PConj = ss "بُت" ; - by8agent_Prep = ss "بِ" ; - by8means_Prep = ss "بِ" ; + by8agent_Prep = mkPrep "بِ" ; + by8means_Prep = mkPrep "بِ" ; can_VV = mkVV (mkV "طوع" FormX) ; -- can8know_VV = { -- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ; -- ["بّن َبلي تْ"] ; ["بِنغ َبلي تْ"] ; "عَنءت" ; "عُْلدنءت"] ; -- isAux = True -- } ; - during_Prep = ss "خِلَالَ" ; + during_Prep = mkPrep "خِلَالَ" ; -- either7or_DConj = sd2 "ِتهر" "ْر" ** {n = Sg} ; everybody_NP = regNP "الجَمِيع" Pl ; every_Det = mkDet "كُلّ" Sg Const ; @@ -34,7 +34,7 @@ concrete StructuralAra of Structural = CatAra ** -- everywhere_Adv = ss "ثريوهري" ; few_Det = mkDet "بَعض" Pl Const ; -- first_Ord = ss "فِرست" ; - from_Prep = ss "مِنَ" ; + from_Prep = mkPrep "مِنَ" ; he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; here_Adv = ss "هُنا" ; -- here7to_Adv = ss ["تْ هري"] ; @@ -42,9 +42,9 @@ concrete StructuralAra of Structural = CatAra ** how_IAdv = ss "كَيفَ" ; -- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ; -- if_Subj = ss "ِف" ; - in8front_Prep = ss "مُقَابِلَ" ; + in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing); - in_Prep = ss "فِي" ; + in_Prep = mkPrep "فِي" ; it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- less_CAdv = ss "لسّ" ; many_Det = mkDet "جَمِيع" Pl Const ; @@ -57,14 +57,14 @@ concrete StructuralAra of Structural = CatAra ** -- isAux = True -- } ; no_Utt = {s = \\_ => "لا"} ; - on_Prep = ss "عَلى" ; + on_Prep = mkPrep "عَلى" ; --- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ; only_Predet = mkPredet "فَقَط" False; -- or_Conj = ss "ْر" ** {n = Sg} ; -- otherwise_PConj = ss "ْتهروِسي" ; - part_Prep = ss "مِنَ" ; + part_Prep = mkPrep "مِنَ" ; -- please_Voc = ss "ةلَسي" ; - possess_Prep = ss "ل" ; + possess_Prep = mkPrep "ل" ; -- quite_Adv = ss "قُِتي" ; she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; -- so_AdA = ss "سْ" ; @@ -84,10 +84,10 @@ concrete StructuralAra of Structural = CatAra ** this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def; ----b this_NP = indeclNP "هَذا" Sg ; ----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ; - through_Prep = ss "عَبْرَ" ; + through_Prep = mkPrep "عَبْرَ" ; -- too_AdA = ss "تّْ" ; - to_Prep = ss "إِلى" ; - under_Prep = ss "تَحْتَ" ; + to_Prep = mkPrep "إِلى" ; + under_Prep = mkPrep "تَحْتَ" ; -- very_AdA = ss "ثري" ; -- want_VV = P.mkVV (P.regV "وَنت") ; we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; @@ -110,8 +110,8 @@ concrete StructuralAra of Structural = CatAra ** whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ; whoPl_IP = mkIP "مَنْ" "مَنْ" Pl ; -- why_IAdv = ss "وهي" ; - without_Prep = ss "بِدُونِ" ; - with_Prep = ss "مَع" ; + without_Prep = mkPrep "بِدُونِ" ; + with_Prep = mkPrep "مَع" ; yes_Utt = {s = \\_ => "نَعَم"} ; youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 23878f9b..6c98e5b8 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -6,6 +6,11 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { UseV = predV ; SlashVV vv vps = vps ** predV vv ; ----IL + + -- TODO: --c3 is for verb, c2 is for dir.obj + --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go + --SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2a v = predVSlash v ; Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3}; @@ -20,7 +25,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { ComplVV vv vp = let vvVP = predV vv in --- IL vp ** { s = \\pgn,vpf => vvVP.s ! pgn ! vpf - ++ vv.c2 -- أَنْ + ++ vv.c2.s -- أَنْ ++ vp.s ! pgn ! VPImpf Cnj } ; From f4cec11f723d6f46be50bd06cce0bd7c5d3e948d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 16:26:52 +0100 Subject: [PATCH 19/78] (Ara) Add relative clauses --- src/arabic/CatAra.gf | 14 ++++----- src/arabic/NounAra.gf | 3 +- src/arabic/RelativeAra.gf | 64 ++++++++++++++++++++++----------------- src/arabic/ResAra.gf | 28 +++++++++++++++++ src/arabic/SentenceAra.gf | 2 +- 5 files changed, 75 insertions(+), 36 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 13cd0773..1a341855 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -12,7 +12,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { S = {s : Str} ; QS = {s : QForm => Str} ; --- RS = {s : Agr => Str} ; + RS = {s : Agr => Case => Str} ; -- Sentence @@ -27,12 +27,12 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ; IComp = ResAra.IComp ; -- IQuant = {s : State => Case => Str} ; --- ----- Relative --- --- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; --- RP = {s : Case => Str ; a : RAgr} ; --- + +-- Relative + + RCl = ResAra.RCl ; + RP = ResAra.RP ; + -- Verb VP = ResAra.VP ; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index aed22c99..834b9ad9 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -188,7 +188,8 @@ lin AdjCN ap cn = cn ** { adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c }; - -- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + + RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; -- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; -- -- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index 3cc0a9cd..f3a0645b 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -1,35 +1,45 @@ -concrete RelativeAra of Relative = CatAra ** open ResAra in { - flags coding=utf8; --- --- flags optimize=all_subs ; --- --- lin --- --- RelCl cl = { --- s = \\t,a,p,_ => "سُعه" ++ "تهَت" ++ cl.s ! t ! a ! p ! ODir --- } ; --- --- RelVP rp vp = { --- s = \\t,ant,b,ag => --- let --- agr = case rp.a of { --- RNoAg => ag ; --- RAg a => a --- } ; --- cl = mkClause (rp.s ! Nom) agr vp --- in --- cl.s ! t ! ant ! b ! ODir --- } ; --- +concrete RelativeAra of Relative = CatAra ** open ResAra, SentenceAra in { + flags coding=utf8; + + lin + + -- RelCl cl = { + -- s = \\t,p,agr,c => IdRP.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal + -- } ; + + -- : RP -> VP -> RCl ; -- who loves John + RelVP rp vp = { + s = \\t,p,agr,c => + let + npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; + np = {s = npS ; a = agr} ; + cl = PredVP np vp ; + in + cl.s ! t ! p ! Nominal + } ; + + -- : RP -> ClSlash -> RCl ; -- whom John loves + -- TODO: add resumptive pronouns -- RelSlash rp slash = { --- s = \\t,a,p,_ => slash.c2 ++ rp.s ! Acc ++ slash.s ! t ! a ! p ! ODir -- } ; -- -- FunRP p np rp = { -- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ; -- a = RAg np.a -- } ; --- --- IdRP = mkIP "وهِعه" "وهِعه" "وهْسي" Sg ** {a = RNoAg} ; --- + + IdRP = + { s = table { + RSg Masc => "اَلَّذِي" ; + RSg Fem => "اَلَّتِي" ; + RPl Masc => "اَلَّذِين" ; + RPl Fem => "اَللَّاتِي" ; + RDl Masc Bare => "اَللَّذَيْن" ; + RDl Masc Nom => "اَللَّذَانِ" ; + RDl Masc _ => "اَللَّذَيْنِ" ; + RDl Fem Bare => "اَللَّتَيْن" ; + RDl Fem Nom => "اَللَّتَانِ" ; + RDl Fem _ => "اَللَّتَيْنِ" + } + } ; } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 79d28e97..25df5cd2 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1296,6 +1296,34 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; + -- Relative + param + RAgr = RSg Gender | RPl Gender | RDl Gender Case ; + + oper + agr2ragr = overload { + agr2ragr : Agr -> Case -> RAgr = \a,c -> + let gn = pgn2gn a.pgn in case of { + => RSg x ; + => RPl x ; + => RDl x c ; + _ => Predef.error "agr2ragr"} ; + agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g -> + case n of { + Sg => RSg g ; + Dl => RDl g c ; + Pl => RPl g } + } ; + + -- ragr2agr : Number -> Case -> Gender -> RAgr = \ra -> + -- case ra of { + -- RSg x => Per3 Sg x ; + -- RPl x => Per3 Pl x ; + -- RDl x => Per3 Dl x } ; + + RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ; + RP : Type = {s : RAgr => Str } ; + --TODO: slashRCl : ClSlash -> RP -> RCl ; param diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 34d60888..682b037a 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -129,6 +129,6 @@ concrete SentenceAra of Sentence = CatAra ** open } }; --- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ; + UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ; } From 38982d73fe94fa6fa79a63fdd6fc22435049c3e6 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 16:27:42 +0100 Subject: [PATCH 20/78] (Ara) Remove parameters that are already in CommonX --- src/arabic/CatAra.gf | 4 ++-- src/arabic/QuestionAra.gf | 2 +- src/arabic/ResAra.gf | 2 -- src/arabic/SentenceAra.gf | 41 ++++++++++++++++++++------------------- 4 files changed, 24 insertions(+), 25 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 1a341855..95e4aed6 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -16,13 +16,13 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { -- Sentence - Cl = ResAra.Cl ; -- {s : ResAra.Tense => Polarity => Order => Str} ; + Cl = ResAra.Cl ; -- {s : Tense => Polarity => Order => Str} ; ClSlash = ResAra.ClSlash ; Imp = {s : Polarity => Gender => ResAra.Number => Str} ; -- Question - QCl = ResAra.QCl ; -- {s : ResAra.Tense => Polarity => QForm => Str} ; + QCl = ResAra.QCl ; -- {s : Tense => Polarity => QForm => Str} ; IDet = ResAra.IDet ; -- {s : Gender => State => Case => Str ; n : Number} ; IP = ResAra.IP ; -- {s : (isPred : Bool) => State => Case => Str ; n : Number} ; IComp = ResAra.IComp ; -- diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index a0af36df..af35450c 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -44,7 +44,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA CompIAdv iadv = { s = \\_ => iadv.s ; n = ResAra.Sg } ; - -- QCl = {s : R.Tense => Polarity => QForm => Str} ; + -- QCl = {s : Tense => Polarity => QForm => Str} ; QuestSlash ip cl = { ----IL just guessing s = \\t,p,qf => let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 25df5cd2..7841118e 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -19,7 +19,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { Gender = Masc | Fem ; Case = Nom | Acc | Gen | Bare ; -- 1st person poss. suff. overrides case - Person = P1 | P2 | P3 ; Species = NoHum | Hum ; State = Def | Indef | Const | Poss ; -- ة turns into ت @@ -27,7 +26,6 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { -- case vowel retained Mood = Ind | Cnj | Jus ; Voice = Act | Pas ; - Tense = Pres | Past | Fut ; Order = Verbal | Nominal ; oper diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 682b037a..159e1cea 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -39,20 +39,20 @@ concrete SentenceAra of Sentence = CatAra ** open yaktubu = vp.s ! pgn ! VPImpf Ind ; yaktuba = vp.s ! pgn ! VPImpf Cnj ; yaktub = vp.s ! pgn ! VPImpf Jus ; - vStr : ResAra.Tense -> Polarity -> Str = + vStr : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { - => yaktubu ; - => "لَا" ++ yaktubu ; - => "" ; --no verb "to be" in present - => "لَيسَ" ;--same here, just add negation particle - <_, ResAra.Past, Pos> => kataba ; - <_, ResAra.Past, Neg> => "لَمْ" ++ yaktub ; - <_, ResAra.Fut, Pos> => "سَ" ++ yaktubu ; - <_, ResAra.Fut, Neg> => "لَنْ" ++ yaktuba + => yaktubu ; + => "لَا" ++ yaktubu ; + => "" ; --no verb "to be" in present + => "لَيسَ" ;--same here, just add negation particle + <_, Past, Pos> => kataba ; + <_, Past, Neg> => "لَمْ" ++ yaktub ; + <_, _Fut, Pos> => "سَ" ++ yaktubu ; + <_, _Fut, Neg> => "لَنْ" ++ yaktuba }; - pred : ResAra.Tense -> Polarity -> Str = + pred : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { - => vp.pred.s ! gn ! Nom; --xabar marfooc + => vp.pred.s ! gn ! Nom; --xabar marfooc _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; @@ -113,19 +113,20 @@ concrete SentenceAra of Sentence = CatAra ** open -- UseCl t p cl = - {s = case of { --- IL guessed tenses - <(Pres|Cond),Simul> => cl.s ! ResAra.Pres ! p.p ! Verbal ; - => cl.s ! ResAra.Fut ! p.p ! Verbal ; - <_ ,_ > => cl.s ! ResAra.Past ! p.p ! Verbal + {s = t.s ++ p.s ++ + case of { --- IL guessed tenses + <(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; + => cl.s ! Fut ! p.p ! Nominal ; + <_ ,_ > => cl.s ! Past ! p.p ! Nominal } }; UseQCl t p qcl = - {s = \\q => - case of { --- IL guessed tenses - <(Pres|Cond),Simul> => qcl.s ! ResAra.Pres ! p.p ! q ; - => qcl.s ! ResAra.Fut ! p.p ! q ; - <_ ,_ > => qcl.s ! ResAra.Past ! p.p ! q + {s = \\q => t.s ++ p.s ++ + case of { --- IL guessed tenses + <(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ; + => qcl.s ! Fut ! p.p ! q ; + <_ ,_ > => qcl.s ! Past ! p.p ! q } }; From 520d1a44a28ac6de70821bbaa8dc99ab07b56a8b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 7 Nov 2018 17:47:26 +0100 Subject: [PATCH 21/78] (Som) Add strings from Temp and Pol to linearisations of Use*Cl --- src/somali/SentenceSom.gf | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/somali/SentenceSom.gf b/src/somali/SentenceSom.gf index 93d52274..5714f975 100644 --- a/src/somali/SentenceSom.gf +++ b/src/somali/SentenceSom.gf @@ -70,13 +70,13 @@ lin -} -- : Temp -> Pol -> Cl -> S ; - UseCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ; + UseCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ; {- -- : Temp -> Pol -> RCl -> RS ; - UseRCl temp pol cl = { s = cl.s ! temp.t ! temp.a ! pol.p } ; + UseRCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ; -- : Temp -> Pol -> QCl -> QS ; - UseQCl temp pol qcl = { s = qcl.s ! temp.t ! temp.a ! pol.p } ; + UseQCl t p cl = { s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p } ; -- An adverb can be added to the beginning of a sentence, either with comma ("externally") -- or without: @@ -89,7 +89,7 @@ lin -- There's an SubjS already in AdverbSom -- should this be deprecated? -- : S -> Subj -> S -> S ; - SSubjS s1 subj s2 = AdvS (AE.SubjS subj s2) s1 ; + SSubjS s1 subj s2 = AdvS (AS.SubjS subj s2) s1 ; -- A sentence can be modified by a relative clause referring to its contents. From e6d57f3b032b8637eb8a655e26564b45ecb6fc9d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 8 Nov 2018 15:17:09 +0100 Subject: [PATCH 22/78] (Ara) More fixes to hamza rules --- src/arabic/OrthoAra.gf | 105 +++++++++++++++++++++-------------------- 1 file changed, 54 insertions(+), 51 deletions(-) diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index c5968270..edf4f0f8 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -2,67 +2,70 @@ resource OrthoAra = open Prelude, Predef in { flags coding=utf8 ; - oper +oper - vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ; + vow : pattern Str = #("َ" | "ِ" | "ُ" | "ً" | "ٍ" | "ٌ") ; - weak : pattern Str = #("و"|"ي") ; + weak : pattern Str = #("و"|"ي") ; - -- "Sun letters": assimilate with def. article - sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ; + -- "Sun letters": assimilate with def. article + sun : pattern Str = #("ت"|"ث"|"د"|"ذ"|"ر"|"ز"|"س"|"ش"|"ص"|"ض"|"ط"|"ظ"|"ل"|"ن") ; - -- Shadda: https://www.unicode.org/L2/L2017/17253-arabic-ordering.pdf - fixShd : Str -> Str -> Str = \word,suffix -> - case of { - -- => x + v + "ّ" + y ; - => x + "ّ" + v + y ; - _ => word + suffix - } ; - - -- IL: using this to reuse patterns for weak verbs, might be strange/wrong - rmSukun : Str -> Str = \s -> case s of { - x + "ْ" + y => x + y ; - _ => s +-- Shadda: https://www.unicode.org/L2/L2017/17253-arabic-ordering.pdf + fixShd : Str -> Str -> Str = \word,suffix -> + case of { + -- => x + v + "ّ" + y ; + => x + "ّ" + v + y ; + _ => word + suffix } ; - -- Hamza - hamza : pattern Str = #("ء"|"؟") ; +-- IL: using this to reuse patterns for weak verbs, might be strange/wrong + rmSukun : Str -> Str = \s -> case s of { + x + "ْ" + y => x + y ; + _ => s + } ; - rectifyHmz: Str -> Str = \word -> - case word of { - l@(""|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail; - l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail; - l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail; - l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail; +-- Hamza + hamza : pattern Str = #("ء"|"؟") ; - head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + #hamza + v2@(""|"ُ"|"َ"|"ْ"|"ِ") => head + v1 + (tHmz v1) + v2; - head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail - _ => word - }; + rectifyHmz : Str -> Str = \word -> + case word of { + l@(""|"ال") + ("أ"|"أَ") + #hamza + "ْ" + tail => l + "آ" + tail; + l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail; + l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail; + l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail; + head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + + #hamza + v2@(#vow|"ْ") + tail => + case v2 of { "ْ" => head + v1 + tHmz v1 + tail ; -- unsure about this /IL + _ => head + v1 + tHmz v1 + v2 + tail } ; - --hamza at beginning of word (head) - hHmz : Str -> Str = \d -> - case d of { - "ِ" => "إ"; - _ => "أ" - }; + head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail + _ => word + }; - --hamza in middle of word (body) - bHmz : Str -> Str -> Str = \d1,d2 -> - case of { - <"ِ",_> | <_,"ِ"> => "ئ"; - <"ُ",_> | <_,"ُ"> => "ؤ"; - <"َ",_> | <_,"َ"> => "أ"; - _ => "ء" - }; + --hamza at beginning of word (head) + hHmz : Str -> Str = \d -> + case d of { + "ِ" => "إ"; + _ => "أ" + }; - --hamza carrier sequence - tHmz : Str -> Str = \d -> - case d of { - "ِ" => "ئ"; - "ُ" => "ؤ"; - "َ" => "أ"; - "ْ"|"ا"|"و"|"ي" => "ء" - }; + --hamza in middle of word (body) + bHmz : Str -> Str -> Str = \d1,d2 -> + case of { + <"ِ",_> | <_,"ِ"> => "ئ"; + <"ُ",_> | <_,"ُ"> => "ؤ"; + <"َ",_> | <_,"َ"> => "أ"; + _ => "ء" + }; + + --hamza carrier sequence + tHmz : Str -> Str = \d -> + case d of { + "ِ" => "ئ"; + "ُ" => "ؤ"; + "َ" => "أ"; + "ْ"|"ا"|"و"|"ي" => "ء" + }; } From 7713518ad594ce410d03ec0c673451230077811e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 8 Nov 2018 15:52:06 +0100 Subject: [PATCH 23/78] (Ara) More relative clauses + fix questions + update MissingAra --- src/arabic/AdjectiveAra.gf | 10 +++++++--- src/arabic/CatAra.gf | 1 + src/arabic/LexiconAra.gf | 2 +- src/arabic/MissingAra.gf | 10 ---------- src/arabic/NounAra.gf | 3 ++- src/arabic/ParadigmsAra.gf | 8 +------- src/arabic/QuestionAra.gf | 21 +++++++++++---------- src/arabic/RelativeAra.gf | 21 +++++++++++++-------- src/arabic/ResAra.gf | 17 +++++------------ src/arabic/SentenceAra.gf | 4 ++-- 10 files changed, 43 insertions(+), 54 deletions(-) diff --git a/src/arabic/AdjectiveAra.gf b/src/arabic/AdjectiveAra.gf index ec15d535..20988aea 100644 --- a/src/arabic/AdjectiveAra.gf +++ b/src/arabic/AdjectiveAra.gf @@ -37,7 +37,11 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in { AdAP ada ap = { s = \\sp,g,n,st,c => ada.s ++ ap.s ! sp ! g ! n ! st ! c } ; --- --- UseA2 a = a ; --- + + UseA2 = PositA ; + + UseComparA a = { + s = \\h,g,n,d,c => a.s ! AComp d c + }; + } diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 95e4aed6..7bc37f08 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -10,6 +10,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { -- Tensed/Untensed + SSlash, S = {s : Str} ; QS = {s : QForm => Str} ; RS = {s : Agr => Case => Str} ; diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 4f3cff58..6be7abdf 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -295,7 +295,7 @@ flags hair_N = sdfN "شعر" "فَعلة" Fem NoHum ; hand_N = brkN "يد" "فَع" "أَفَاعِي" Fem NoHum ; head_N = brkN "رءس" "فَعل" "فُعُول" Masc NoHum; - heart_N = brkN "قلب" "فَعل" "فُعُول" Masc NoHum; + heart_N = brkN "قلب" "فَعْل" "فُعُول" Masc NoHum; horn_N = brkN "قرن" "فَعل" "فُعُول" Masc NoHum; husband_N = brkN "زوج" "فَعل" "أَفعَال" Masc NoHum; ice_N = brkN "ثلج" "فَعل" "فُعُول" Masc NoHum; diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index 7d82c4eb..68d182d4 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -39,7 +39,6 @@ oper ExistIP : IP -> QCl = notYet "ExistIP" ; oper ExistNP : NP -> Cl = notYet "ExistNP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; oper GenericCl : VP -> Cl = notYet "GenericCl" ; -oper IdRP : RP = notYet "IdRP" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; oper PConjConj : Conj -> PConj = notYet "PConjConj" ; @@ -48,11 +47,6 @@ oper PredSCVP : SC -> VP -> Cl = notYet "PredSCVP" ; oper ProgrVP : VP -> VP = notYet "ProgrVP" ; oper ReflA2 : A2 -> AP = notYet "ReflA2" ; oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; -oper RelCN : CN -> RS -> CN = notYet "RelCN" ; -oper RelCl : Cl -> RCl = notYet "RelCl" ; -oper RelNP : NP -> RS -> NP = notYet "RelNP" ; -oper RelSlash : RP -> ClSlash -> RCl = notYet "RelSlash" ; -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" ; @@ -63,10 +57,6 @@ oper SlashV2V : V2V -> VP -> VPSlash = notYet "SlashV2V" ; oper SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash = notYet "SlashV2VNP" ; oper SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper SubjS : Subj -> S -> Adv = notYet "SubjS" ; -oper UseA2 : A2 -> AP = notYet "UseA2" ; -oper UseComparA : A -> AP = notYet "UseComparA" ; -oper UseRCl : Temp -> Pol -> RCl -> RS = notYet "UseRCl" ; -oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ; oper VocNP : NP -> Voc = notYet "VocNP" ; oper pot3plus : Sub1000 -> Sub1000 -> Sub1000000 = notYet "pot3plus" ; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 834b9ad9..7f7e7092 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -190,6 +190,8 @@ lin }; RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; + + RelNP np rs = np ** {s = \\c => np.s ! c ++ rs.s ! np.a ! c} ; -- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; -- -- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; @@ -201,7 +203,6 @@ lin np = \\c => cn.np ! c ++ np.s ! Gen }; - -- : CN -> NP -> CN ; -- glass of wine --PartNP } diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 962c0158..c5a765a4 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -370,13 +370,7 @@ resource ParadigmsAra = open v1 = \rootStr,vPerf,vImpf -> let { raw = v1' rootStr vPerf vImpf } in - { s = \\vf => - case rootStr of { - _ + #hamza + _ => rectifyHmz(raw.s ! vf); - _ => raw.s ! vf - }; - lock_V = <> - } ; + lin V { s = \\vf =>rectifyHmz (raw.s ! vf) } ; v1' : Str -> Vowel -> Vowel -> Verb = \rootStr,vPerf,vImpf -> diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index af35450c..bb14074e 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -16,10 +16,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA --IL guessed QuestVP qp vp = - let np = { s = qp.s ! vp.isPred ! Def ; - a = { pgn = Per3 Masc qp.n ; - isPron = False } - } ; + let np = ip2np qp vp.isPred ; cl = PredVP np vp ; in { s = \\t,p,_qf => cl.s ! t ! p ! Nominal } ; @@ -32,17 +29,17 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA -- : IComp -> NP -> QCl QuestIComp ic np = let vp = kaan (CompNP np) ; - ip = ic ** { s : Bool => State => Case => Str = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; + ip : ResAra.IP = np ** { + s = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; in QuestVP ip vp ; -- : IP -> IComp ; - CompIP ip = { + CompIP ip = ip ** { s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence ! Def ! Nom ; -- IP will be a subject - n = ip.n } ; - CompIAdv iadv = { s = \\_ => iadv.s ; n = ResAra.Sg } ; + CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ; -- QCl = {s : Tense => Polarity => QForm => Str} ; QuestSlash ip cl = { ----IL just guessing @@ -62,13 +59,17 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA } ; -- : IDet -> IP - IdetIP idet = idet ** { s = \\isPred => idet.s ! Masc } ; + IdetIP idet = idet ** { + s = \\isPred => idet.s ! Masc ; + a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False } + } ; -- : IDet -> CN -> IP - IdetCN idet cn = idet ** { + IdetCN idet cn = { s = \\isPred,s,c => idet.s ! cn.g ! s ! c ++ cn.s ! idet.n ! Indef ! Gen ; --idaafa + a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } } ; -- : IQuant -> Num -> IDet diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index f3a0645b..8f54c37a 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -1,11 +1,12 @@ -concrete RelativeAra of Relative = CatAra ** open ResAra, SentenceAra in { +concrete RelativeAra of Relative = CatAra ** + open ResAra, (Se=SentenceAra), (St=StructuralAra) in { flags coding=utf8; lin - -- RelCl cl = { - -- s = \\t,p,agr,c => IdRP.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal - -- } ; + RelCl cl = { + s = \\t,p,agr,c => IdRP.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal + } ; -- : RP -> VP -> RCl ; -- who loves John RelVP rp vp = { @@ -13,15 +14,19 @@ concrete RelativeAra of Relative = CatAra ** open ResAra, SentenceAra in { let npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; np = {s = npS ; a = agr} ; - cl = PredVP np vp ; + cl = Se.PredVP np vp ; in cl.s ! t ! p ! Nominal } ; -- : RP -> ClSlash -> RCl ; -- whom John loves - -- TODO: add resumptive pronouns --- RelSlash rp slash = { --- } ; + RelSlash rp cl = cl ** { + s = \\t,p,agr,c => + let obj = case (pgn2gn agr.pgn).g of { + Fem => St.she_Pron ; + Masc => St.he_Pron } ; + in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal ++ cl.c2.s ++ obj.s ! cl.c2.c + } ; -- -- FunRP p np rp = { -- s = \\c => np.s ! c ++ p.s ++ rp.s ! Acc ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 7841118e..93f046c7 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1130,12 +1130,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkIP = overload { mkIP : Str -> Number -> IP = \maa,n -> { s = \\_p,_s,_c => maa ; - n = n + a = { pgn = agrP3 NoHum Masc n ; isPron = False } } ; mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { s = table { True => \\_s,_c => maa ; False => \\_s,_c => maadhaa } ; - n = n + a = { pgn = agrP3 NoHum Masc n ; isPron = False } } } ; @@ -1189,7 +1189,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s : AAgr -- "how old": masc or fem for adjective -- no need for Case, IComp is only used by QuestIComp, as grammatical subject => Str ; - n : Number } ; Obj : Type = { @@ -1206,9 +1205,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s : Bool -- different forms for "what is this" and "what do you do" => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative => Str ; - n : Number + a : Agr -- can be both subject and object of a QCl, needs full agr. info } ; + ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Def } ; + IDet : Type = { s : Gender -- IdetCN needs to choose the gender of the CN => State => Case => Str ; @@ -1313,17 +1314,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Pl => RPl g } } ; - -- ragr2agr : Number -> Case -> Gender -> RAgr = \ra -> - -- case ra of { - -- RSg x => Per3 Sg x ; - -- RPl x => Per3 Pl x ; - -- RDl x => Per3 Dl x } ; - RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ; RP : Type = {s : RAgr => Str } ; ---TODO: slashRCl : ClSlash -> RP -> RCl ; - param Size = One | Two | ThreeTen | Teen | NonTeen | Hundreds | None ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 159e1cea..b13a8022 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -111,8 +111,8 @@ concrete SentenceAra of Sentence = CatAra ** open -- EmbedQS qs = {s = qs.s ! QIndir} ; -- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr -- - - UseCl t p cl = + UseSlash, + UseCl = \t,p,cl -> {s = t.s ++ p.s ++ case of { --- IL guessed tenses <(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; From df65c52cdeb4852363f90582c1dca96afa38e346 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 9 Nov 2018 16:38:51 +0100 Subject: [PATCH 24/78] (Ara) Passive constructions --- src/arabic/ResAra.gf | 11 +++++++++++ src/arabic/VerbAra.gf | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 93f046c7..f9f60c7b 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1263,6 +1263,17 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> isPred = False }; + passPredV : Verb -> VP = \v -> + let actVP = predV v in actVP ** { + s = \\pgn,vf => + case vf of { + VPPerf => v.s ! (VPerf Pas pgn) ; + VPImpf m => v.s ! (VImpf m Pas pgn) ; + _ => actVP.s ! pgn ! vf + } + }; + + predVSlash : Verb2 -> VPSlash = \v -> predV v ** {c2 = v.c2} ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 6c98e5b8..ad04fb90 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -44,7 +44,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { -- -- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; -- - PassV2 v = kaan {s = \\_,_ => v.s ! VPPart} ; ---- IL guessed + PassV2 = passPredV ; -- -- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no From 2159d4b0be1b38042f24508aea6886588d3af875 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 12 Nov 2018 14:25:16 +0100 Subject: [PATCH 25/78] (Ara) Add proDrop function to the API --- src/arabic/ParadigmsAra.gf | 2 ++ src/arabic/ResAra.gf | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index c5a765a4..a7b31606 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -536,6 +536,8 @@ resource ParadigmsAra = open lock_NP = <> }; + proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement. + -- e.g. al-jamii3, 2a7ad regNP : Str -> Number -> NP = \word,n -> { s = \\c => fixShd word (dec1sg ! Def ! c) ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index f9f60c7b..40ec75bf 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1201,6 +1201,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a : Agr } ; + proDrop : NP -> NP = \np -> + case np.a.isPron of { + True => np ** {s = \\_ => []}; + _ => np + } ; + + emptyNP : NP = {s = \\_ => [] ; a = {pgn = Per3 Masc Sg ; isPron = False}} ; + IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative From 87613d464c9e39da077d4d866fd2fe06f7e13f0e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 12 Nov 2018 14:30:44 +0100 Subject: [PATCH 26/78] (Ara) New category for ClSlash; update related functions --- src/arabic/MissingAra.gf | 1 + src/arabic/QuestionAra.gf | 7 ++-- src/arabic/RelativeAra.gf | 7 ++-- src/arabic/ResAra.gf | 83 +++++++++++++++++++++++++++++++++------ src/arabic/SentenceAra.gf | 70 ++++++--------------------------- src/arabic/VerbAra.gf | 6 ++- 6 files changed, 97 insertions(+), 77 deletions(-) diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index 68d182d4..a5d3b200 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -49,6 +49,7 @@ oper ReflA2 : A2 -> AP = notYet "ReflA2" ; oper ReflVP : VPSlash -> VP = notYet "ReflVP" ; oper SentAP : AP -> SC -> AP = notYet "SentAP" ; oper SentCN : CN -> SC -> CN = notYet "SentCN" ; +oper SlashPrep : Cl -> Prep -> ClSlash = notYet "SlashPrep" ; oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; oper SlashV2A : V2A -> AP -> VPSlash = notYet "SlashV2A" ; oper SlashV2Q : V2Q -> QS -> VPSlash = notYet "SlashV2Q" ; diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index bb14074e..bc01b0a7 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -42,10 +42,11 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ; -- QCl = {s : Tense => Polarity => QForm => Str} ; - QuestSlash ip cl = { ----IL just guessing + QuestSlash ip cls = { ----IL just guessing s = \\t,p,qf => - let o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing - in cl.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o + let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl + o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing + in cls.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o } ; --IL guessed diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index 8f54c37a..e3a9969c 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -20,12 +20,13 @@ concrete RelativeAra of Relative = CatAra ** } ; -- : RP -> ClSlash -> RCl ; -- whom John loves - RelSlash rp cl = cl ** { + RelSlash rp cls = cls ** { s = \\t,p,agr,c => let obj = case (pgn2gn agr.pgn).g of { - Fem => St.she_Pron ; + Fem => St.she_Pron ; -- head is repeated as a clitic object pronoun Masc => St.he_Pron } ; - in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! Nominal ++ cl.c2.s ++ obj.s ! cl.c2.c + cl : ResAra.Cl = complClSlash obj cls ; + in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS } ; -- -- FunRP p np rp = { diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 40ec75bf..7e041c63 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -26,7 +26,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { -- case vowel retained Mood = Ind | Cnj | Jus ; Voice = Act | Pas ; - Order = Verbal | Nominal ; + Order = Verbal | Nominal + | VOS ; -- Relative clauses with resumptive pronouns oper @@ -1181,6 +1182,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Agr = { pgn : PerGenNum; isPron : Bool} ; AAgr = { g : Gender ; n : Number} ; + + Comp : Type = { s : AAgr => Case => Str } ; @@ -1228,7 +1231,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s : State => Case => Str } ; - param VPForm = + param VPForm = VPPerf | VPImpf Mood | VPImp ; @@ -1236,7 +1239,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> oper VP : Type = { - s : PerGenNum => VPForm => Str; + s : PerGenNum => VPForm => Str ; obj : Obj; pred : Comp; isPred : Bool; --indicates if there is a predicate (xabar) @@ -1282,8 +1285,48 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; - predVSlash : Verb2 -> VPSlash = \v -> - predV v ** {c2 = v.c2} ; + predVP : NP -> VP -> Cl = \np,vp -> + { s =\\t,p,o => + let { + pgn = + case of { + => verbalAgr np.a.pgn; + _ => np.a.pgn + }; + gn = pgn2gn pgn; + kataba = vp.s ! pgn ! VPPerf ; + yaktubu = vp.s ! pgn ! VPImpf Ind ; + yaktuba = vp.s ! pgn ! VPImpf Cnj ; + yaktub = vp.s ! pgn ! VPImpf Jus ; + vStr : ParamX.Tense -> Polarity -> Str = + \tn,pl -> case of { + => yaktubu ; + => "لَا" ++ yaktubu ; + => "" ; --no verb "to be" in present + => "لَيسَ" ;--same here, just add negation particle + <_, Past, Pos> => kataba ; + <_, Past, Neg> => "لَمْ" ++ yaktub ; + <_, _Fut, Pos> => "سَ" ++ yaktubu ; + <_, _Fut, Neg> => "لَنْ" ++ yaktuba + }; + pred : ParamX.Tense -> Polarity -> Str = + \tn,pl -> case of { + => vp.pred.s ! gn ! Nom; --xabar marfooc + _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob + }; + + } in + -- If you want prodrop, use proDrop : NP -> NP for your subject. /IL + case o of { + Verbal => vStr t p ++ case vp.obj.a.isPron of { + True => vp.obj.s ++ np.s ! Nom ; -- obj. clitic attaches directly to the verb + False => np.s ! Nom ++ vp.obj.s } + ++ vp.s2 ++ pred t p ; + Nominal => np.s ! Nom ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ; + VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ np.s ! Nom + + } + } ; -- in verbal sentences, the verb agrees with the subject -- in Gender but not in number @@ -1305,17 +1348,36 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> { s2 = vp.s2 ++ str }; kaan : {s : AAgr => Case => Str} -> VP = \xabar -> - insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) ); + insertPred xabar (predV copula); + copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ; -- Slash categories + VPSlash : Type = VP ** {c2 : Preposition} ; - ClSlash : Type = Cl ** {c2 : Preposition} ; + ClSlash : Type = VPSlash ** {subj : NP} ; + + slashV2 : Verb2 -> VPSlash = \v -> + predV v ** {c2 = v.c2} ; + + -- Add subject string, fix agreement to the subject, + -- 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 + } ; + + complClSlash = overload { + complClSlash : NP -> ClSlash -> Cl = \obj,cls -> + predVP cls.subj (insertObj obj cls) ; + complClSlash : ClSlash -> Cl = \cls -> + predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object + } ; Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; - -- Relative - param + -- Relative + param RAgr = RSg Gender | RPl Gender | RDl Gender Case ; oper @@ -1323,9 +1385,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> agr2ragr : Agr -> Case -> RAgr = \a,c -> let gn = pgn2gn a.pgn in case of { => RSg x ; - => RPl x ; => RDl x c ; - _ => Predef.error "agr2ragr"} ; + => RPl x } ; agr2ragr : Number -> Case -> Gender -> RAgr = \n,c,g -> case n of { Sg => RSg g ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index b13a8022..23181603 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -26,58 +26,7 @@ concrete SentenceAra of Sentence = CatAra ** open } }; -} - PredVP np vp = - { s =\\t,p,o => - let { - pgn = - case of { - => verbalAgr np.a.pgn; - _ => np.a.pgn - }; - gn = pgn2gn pgn; - kataba = vp.s ! pgn ! VPPerf ; - yaktubu = vp.s ! pgn ! VPImpf Ind ; - yaktuba = vp.s ! pgn ! VPImpf Cnj ; - yaktub = vp.s ! pgn ! VPImpf Jus ; - vStr : ParamX.Tense -> Polarity -> Str = - \tn,pl -> case of { - => yaktubu ; - => "لَا" ++ yaktubu ; - => "" ; --no verb "to be" in present - => "لَيسَ" ;--same here, just add negation particle - <_, Past, Pos> => kataba ; - <_, Past, Neg> => "لَمْ" ++ yaktub ; - <_, _Fut, Pos> => "سَ" ++ yaktubu ; - <_, _Fut, Neg> => "لَنْ" ++ yaktuba - }; - pred : ParamX.Tense -> Polarity -> Str = - \tn,pl -> case of { - => vp.pred.s ! gn ! Nom; --xabar marfooc - _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob - }; - - } in - case o of { - Verbal => - --case of { ---- AR workaround 18/12/2008 - case of { - {- IL: I don't think we should do prodrop here. vStr drops the copula in present tense, - so there's hardly anything left for a predicative clause: e.g. - PredVP (UsePron i_Pron) (UseComp (CompCN (UseN car_N))) "I am a car" - would be linearised just as "car", if we have both prodrop and copula drop. - Leaving it up to someone who knows Arabic to decide what is better. - Original here: - => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) ; - -- ya2kuluhu - => (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p); -} - -- ya2kuluhu al-waladu, yakuluhu al-2awlaadu - => (vStr t p) ++ np.s ! Nom ++ vp.obj.s ++ vp.s2 ++ (pred t p); - => (vStr t p) ++ vp.obj.s ++ np.s ! Nom ++ vp.s2 ++ (pred t p) - }; - Nominal => - np.s ! Nom ++ (vStr t p) ++ vp.obj.s ++ vp.s2 ++ (pred t p) - } - }; + PredVP = predVP ; -- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; @@ -100,9 +49,13 @@ concrete SentenceAra of Sentence = CatAra ** open -- ClSlash - SlashVP np vps = PredVP np vps ** { c2 = vps.c2 } ; + SlashVP = predVPSlash ; AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ; - SlashPrep cl prep = cl ** {c2 = prep} ; + +-- SlashPrep : Cl -> Prep -> ClSlash +-- Will be awkward to implement in the way ClSlash is now. +-- ClSlash is implemented the way it is now for a good reason: +-- we need to support different word orders. -- SlashVS np vs sslash = TODO @@ -111,9 +64,9 @@ concrete SentenceAra of Sentence = CatAra ** open -- EmbedQS qs = {s = qs.s ! QIndir} ; -- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr -- - UseSlash, - UseCl = \t,p,cl -> - {s = t.s ++ p.s ++ + + UseCl t p cl = + {s = t.s ++ p.s ++ case of { --- IL guessed tenses <(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; => cl.s ! Fut ! p.p ! Nominal ; @@ -122,7 +75,7 @@ concrete SentenceAra of Sentence = CatAra ** open }; UseQCl t p qcl = - {s = \\q => t.s ++ p.s ++ + {s = \\q => t.s ++ p.s ++ case of { --- IL guessed tenses <(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ; => qcl.s ! Fut ! p.p ! q ; @@ -132,4 +85,5 @@ concrete SentenceAra of Sentence = CatAra ** open UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ; + UseSlash t p cl = UseCl t p (complClSlash cl) ; } diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index ad04fb90..0f721031 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -11,8 +11,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go --SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy - SlashV2a v = predVSlash v ; - Slash3V3 v np = insertObj np (predVSlash v) ** {c2 = v.c3}; + SlashV2a = slashV2 ; + Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3}; ComplSlash vp np = insertObj np vp ; @@ -38,6 +38,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { -- UseComp xabar = kaan xabar ; + UseCopula = predV copula ; + AdvVP vp adv = insertStr adv.s vp ; -- AdVVP adv vp = insertAdV adv.s vp ; From 4d35a0206cf0be529c352a2c7099dff3bbb62fc4 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 12 Nov 2018 16:31:09 +0100 Subject: [PATCH 27/78] (Ara) Add paradigm for doubly weak v1 --- src/arabic/ParadigmsAra.gf | 18 +++++++++--------- src/arabic/ResAra.gf | 7 ++++++- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index a7b31606..2905bb7f 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -374,15 +374,15 @@ resource ParadigmsAra = open v1' : Str -> Vowel -> Vowel -> Verb = \rootStr,vPerf,vImpf -> - let { root = mkRoot3 rootStr } in - case of { - <"ّ", _> => v1geminate rootStr vPerf vImpf ; - <"و"|"ي",_> => case vPerf of { - i => v1defective_i root vImpf ; - _ => v1defective_a root vImpf } ; - <_,"و"|"ي"> => v1hollow root vImpf ; - _ => v1sound root vPerf vImpf - }; + let root = mkRoot3 rootStr + in case rootStr of { + _ + "ّ" => v1geminate rootStr vPerf vImpf ; + ? + #hamza + #weak => v1doubleweak root ; + ? + ? + #weak => case vPerf of { + i => v1defective_i root vImpf ; + _ => v1defective_a root vImpf } ; + ? + #weak + ? => v1hollow root vImpf ; + _ => v1sound root vPerf vImpf } ; v2 = \rootStr -> diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 7e041c63..9fdb5c91 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -553,6 +553,12 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4) x => vforms_a ! x } ; in verbDef vforms_i vowImpf ; +v1doubleweak : Root3 -> Verb = \r'y -> + let ry = r'y ** {c = ""} ; + vforms : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun + in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef + + patDef1 : Vowel => Pattern = table { u => fcu ; @@ -642,7 +648,6 @@ v4doubleweak : Root3 -> Verb = \r'y -> vforms : DefForms = \\x => rmSukun (v4DefForms ry ! x) ; -- only remove the first sukun in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef - v5sound : Root3 -> Verb = \nfs -> let { From de33c46b45544f7f35c4ef2cbc857f2ad9fb1263 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 12 Nov 2018 16:58:21 +0100 Subject: [PATCH 28/78] (Ara) AdjCN retains old adjective --- src/arabic/NounAra.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 7f7e7092..7547064c 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -186,7 +186,7 @@ lin ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; AdjCN ap cn = cn ** { - adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c + adj = \\n,d,c => cn.adj ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c }; RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; From fdeaa9ea701810272d76c996c0363f6a48c3b0c8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:02 +0100 Subject: [PATCH 29/78] (Ara) Changes to nouns and NPs --- src/arabic/CatAra.gf | 1 + src/arabic/NounAra.gf | 35 ++++++++++++++++++----------------- src/arabic/ParadigmsAra.gf | 33 ++++++++++++++++++++------------- src/arabic/ResAra.gf | 18 ++++++++++++++---- 4 files changed, 53 insertions(+), 34 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 7bc37f08..246c30e9 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -93,5 +93,6 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { linref CN = \cn -> uttCN cn ! Masc ; + N = \n -> uttCN (useN n) ! Masc ; } diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 7547064c..ddb788e3 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -13,8 +13,8 @@ lin cn.s ! number ! nounState det.d number ! nounCase c det.n det.d ; - adj : Case -> Str = \c -> - cn.adj ! number + adj : NTable -> Case -> Str = \ntable,c -> + ntable ! number ! (definite ! det.d) -- Indef remains Indef, rest become Def ! c } in { @@ -22,30 +22,34 @@ lin case cnB4det det.isPron det.isNum det.n det.d of { False => determiner c ++ noun c - ++ adj c + ++ adj cn.s2 c + ++ adj cn.adj c ++ cn.np ! c ; True => noun (cas c) -- deal with possessive suffix - ++ determiner c - ++ adj c + ++ determiner c + ++ adj cn.s2 c + ++ adj cn.adj c ++ cn.np ! c }; a = { pgn = agrP3 cn.h cn.g number; - isPron = False } + isPron = False } ; + empty = [] }; UsePN pn = { s = pn.s; - a = {pgn = (Per3 pn.g Sg); isPron = False } + a = {pgn = Per3 pn.g Sg ; isPron = False} ; + empty = [] }; UsePron p = p ; - PredetNP pred np = { + PredetNP pred np = np ** { s = \\c => case pred.isDecl of { True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi False => pred.s!c ++ np.s ! c - }; - a = np.a + } ; + a = np.a ** {isPron=False} } ; {- @@ -167,21 +171,18 @@ lin MassNP cn = ---- AR {s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ; - a = {pgn = Per3 cn.g Sg ; isPron = False}} ; + a = {pgn = Per3 cn.g Sg ; isPron = False} ; + empty = []} ; -- MassDet = {s = \\_,_,_,_ => [] ; d = Indef; -- isNum = False; isPron = False} ; UseN, - UseN2 = \n -> n ** { - adj = \\_,_,_ => []; - np = \\_ => []}; + UseN2 = useN ; Use2N3 n3 = n3 ; Use3N3 n3 = n3 ** {c2 = n3.c3} ; - ComplN2 n2 np = UseN n2 ** --- IL - {s = \\n,s,c => n2.s ! n ! s ! c ++ n2.c2.s ++ np.s ! n2.c2.c} ; - + ComplN2 n2 np = UseN n2 ** {np=np.s} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 2905bb7f..d1958ae4 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -70,7 +70,8 @@ resource ParadigmsAra = open mkN : (sg,pl : Str) -> Gender -> Species -> N ; mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural - mkN : N -> (attr : Str) -> N ; -- Compound nouns + mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute + mkN : N -> N -> N ; -- Compound noun where both parts inflect --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; } ; @@ -97,6 +98,8 @@ resource ParadigmsAra = open mkPN = overload { mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum = smartPN ; + mkPN : N -> PN + = \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL mkPN : Str -> Gender -> Species -> PN = mkFullPN ; } ; @@ -343,7 +346,12 @@ resource ParadigmsAra = open mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural = brkN ; mkN : N -> (attr : Str) -> N -- Compound nouns - = \n,attr -> n ** { s = \\num,s,c => n.s ! num ! s ! c ++ attr } ; --- IL (TODO: all kinds of compounds) + = \n,attr -> n ** {s2 = \\n,s,c => attr} ; + mkN : N -> N -> N -- Compound nouns + = \n1,n2 -> n1 ** {s2 = + \\n,s,c => n1.s2 ! n ! s ! c -- card + ++ n2.s ! n ! s ! c -- type + ++ n2.s2 ! n ! s ! c} ; -- blood } ; mkV = overload { @@ -464,6 +472,7 @@ resource ParadigmsAra = open mkFullN nsc gen spec = { s = nsc; --NTable + s2 = emptyNTable; g = gen; h = spec; lock_N = <> @@ -476,14 +485,12 @@ resource ParadigmsAra = open } in mkFullN (reg kitAb kutub) gen spec; brkN root sg pl gen spec = - let { raw = brkN' root sg pl gen spec} in + let { raw = brkN' root sg pl gen spec} in raw ** { s = \\n,d,c => case root of { _ + #hamza + _ => rectifyHmz(raw.s ! n ! d ! c); _ => raw.s ! n ! d ! c - }; - g = gen; - h = spec ; lock_N = <> + } }; sdfN = @@ -525,31 +532,31 @@ resource ParadigmsAra = open lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; } ; - mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> - { s = + mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn -> + lin Pron { s = table { Acc => BIND ++ nI; -- object suffix Gen => BIND ++ I; -- possessive suffix _ => ana }; a = {pgn = pgn; isPron = True }; - lock_NP = <> + empty = [] }; proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement. -- e.g. al-jamii3, 2a7ad - regNP : Str -> Number -> NP = \word,n -> + regNP : Str -> Number -> NP = \word,n -> lin NP { s = \\c => fixShd word (dec1sg ! Def ! c) ; a = {pgn = Per3 Masc n; isPron = False }; - lock_NP = <> + empty = [] }; -- e.g. hadha, dhaalika - indeclNP : Str -> Number -> NP = \word,n -> + indeclNP : Str -> Number -> NP = \word,n -> lin NP { s = \\c => word ; a = {pgn = Per3 Masc n; isPron = False }; - lock_NP = <> + empty = [] }; mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant = diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 9fdb5c91..50d9dc68 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -106,9 +106,10 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { --types of open classes: NTable = Number => State => Case => Str; + emptyNTable : NTable = \\n,s,c => [] ; Preposition : Type = {s : Str ; c : Case} ; - Noun : Type = {s : NTable ; g : Gender; h : Species} ; + Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ; Noun2 : Type = Noun ** {c2 : Preposition} ; Noun3 : Type = Noun2 ** {c3 : Preposition} ; @@ -129,8 +130,13 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL CN : Type = Noun ** {adj : NTable ; np : Case => Str}; + + useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ; + uttCN : CN -> (Gender => Str) ; - uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ; + uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ++ + cn.s2 ! Sg ! Indef ! Bare ++ + cn.adj ! Sg ! Indef ! Bare ; NumOrdCard : Type = { s : Gender => State => Case => Str ; @@ -1206,7 +1212,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> NP : Type = { s : Case => Str ; - a : Agr + a : Agr ; + empty : Str -- to prevent ambiguities with prodrop } ; proDrop : NP -> NP = \np -> @@ -1215,7 +1222,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => np } ; - emptyNP : NP = {s = \\_ => [] ; a = {pgn = Per3 Masc Sg ; isPron = False}} ; + emptyNP : NP = { + s = \\_ => [] ; + a = {pgn = Per3 Masc Sg ; isPron = False} ; + empty = []} ; IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" From faf6c83b74cff75df30e62bcd4c0635901b05274 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:19 +0100 Subject: [PATCH 30/78] (Ara) Add stuff to ExtendAra and ConstructionAra --- src/arabic/ConstructionAra.gf | 147 ++++++++++++++++++++++++++++++++++ src/arabic/ExtendAra.gf | 28 ++++++- 2 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 src/arabic/ConstructionAra.gf diff --git a/src/arabic/ConstructionAra.gf b/src/arabic/ConstructionAra.gf new file mode 100644 index 00000000..8d935766 --- /dev/null +++ b/src/arabic/ConstructionAra.gf @@ -0,0 +1,147 @@ +concrete ConstructionAra of Construction = CatAra ** open + ParadigmsAra, + SyntaxAra, + SymbolicAra, + StructuralAra, + (R=ResAra), + (L=LexiconAra) in { + +lincat + Timeunit = N ; + Weekday = N ; + Monthday = NP ; + Month = N ; + Year = NP ; + +lin + + timeunitAdv n time = + let n_card : Card = n ; + n_hours_NP : NP = mkNP n_card time ; + in SyntaxAra.mkAdv during_Prep n_hours_NP | ParadigmsAra.mkAdv (n_hours_NP.s ! R.Nom) ; + + -- random guesses + weekdayPunctualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sunday + weekdayHabitualAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- on Sundays + weekdayNextAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- next Sunday + weekdayLastAdv w = SyntaxAra.mkAdv on_Prep (mkNP w) ; -- last Sunday + + monthAdv m = SyntaxAra.mkAdv in_Prep (mkNP m) ; + yearAdv y = SyntaxAra.mkAdv in_Prep y ; + + -- dummy + dayMonthAdv d m = SyntaxAra.mkAdv on_Prep (mkNP d) ; -- on 17 May + monthYearAdv m y = SyntaxAra.mkAdv on_Prep (mkNP m) ; -- in May 2012 + dayMonthYearAdv d m y = SyntaxAra.mkAdv on_Prep y ; -- on 17 May 2013 + + intYear = symb ; + intMonthday = symb ; + +-- n_units_AP + + -- : NP -> NP -> Cl + have_name_Cl pe nm = + let subjPron : Pron = case pe.a.isPron of { + True => pe ; + False => case (R.pgn2gn pe.a.pgn).g of { + R.Fem => she_Pron ; + R.Masc => he_Pron } + } ; + + myName : NP = mkNP (mkDet subjPron) L.name_N ; + in mkCl myName nm ; --TODO: now it only works for pronouns, drops the NP + +-- what_name_QCl = + +-- how_old_QCl + +-- hungry_VP = +-- thirsty_VP = + +lincat Language = N ; + +lin InLanguage l = mkAdv in_Prep (mkNP l) ; + +lin + weekdayN w = w ; + monthN m = m ; + + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; + + languageCN l = mkCN l ; + languageNP l = mkNP l ; + + +oper mkLanguage : Str -> N = mkN ; + +---------------------------------------------- +---- lexicon of special names + +-- TODO in arabic +lin second_Timeunit = mkN "second" ; +lin minute_Timeunit = mkN "minute" ; +lin hour_Timeunit = mkN "hour" ; +lin day_Timeunit = mkN "day" ; +lin week_Timeunit = mkN "week" ; +lin month_Timeunit = mkN "month" ; +lin year_Timeunit = mkN "year" ; + +lin monday_Weekday = mkN "Monday" ; +lin tuesday_Weekday = mkN "Tuesday" ; +lin wednesday_Weekday = mkN "Wednesday" ; +lin thursday_Weekday = mkN "Thursday" ; +lin friday_Weekday = mkN "Friday" ; +lin saturday_Weekday = mkN "Saturday" ; +lin sunday_Weekday = mkN "Sunday" ; + +lin january_Month = mkN "January" ; +lin february_Month = mkN "February" ; +lin march_Month = mkN "March" ; +lin april_Month = mkN "April" ; +lin may_Month = mkN "May" ; +lin june_Month = mkN "June" ; +lin july_Month = mkN "July" ; +lin august_Month = mkN "August" ; +lin september_Month = mkN "September" ; +lin october_Month = mkN "October" ; +lin november_Month = mkN "November" ; +lin december_Month = mkN "December" ; + +-- lin afrikaans_Language = mkLanguage "Afrikaans" ; +-- lin amharic_Language = mkLanguage "Amharic" ; +lin arabic_Language = mkLanguage "عَرَبِيَّة" ; +-- lin bulgarian_Language = mkLanguage "Bulgarian" ; +-- lin catalan_Language = mkLanguage "Catalan" ; +-- lin chinese_Language = mkLanguage "Chinese" ; +-- lin danish_Language = mkLanguage "Danish" ; +-- lin dutch_Language = mkLanguage "Dutch" ; +lin english_Language = mkLanguage "إنْجلِيزيْة" ; +-- lin estonian_Language = mkLanguage "Estonian" ; +lin finnish_Language = mkLanguage "فِنْلَنْدِيّة" ; +-- lin french_Language = mkLanguage "French" ; +-- lin german_Language = mkLanguage "German" ; +-- lin greek_Language = mkLanguage "Greek" ; +-- lin hebrew_Language = mkLanguage "Hebrew" ; +-- lin hindi_Language = mkLanguage "Hindi" ; +-- lin japanese_Language = mkLanguage "Japanese" ; +-- lin italian_Language = mkLanguage "Italian" ; +-- lin latin_Language = mkLanguage "Latin" ; +-- lin latvian_Language = mkLanguage "Latvian" ; +-- lin maltese_Language = mkLanguage "Maltese" ; +-- lin nepali_Language = mkLanguage "Nepali" ; +-- lin norwegian_Language = mkLanguage "Norwegian" ; +lin persian_Language = mkLanguage "فَارِسيّة" ; +-- lin polish_Language = mkLanguage "Polish" ; +-- lin punjabi_Language = mkLanguage "Punjabi" ; +-- lin romanian_Language = mkLanguage "Romanian" ; +-- lin russian_Language = mkLanguage "Russian" ; +-- lin sindhi_Language = mkLanguage "Sindhi" ; +-- lin spanish_Language = mkLanguage "Spanish" ; +-- lin swahili_Language = mkLanguage "Swahili" ; +lin swedish_Language = mkLanguage "سُويدِيّة" ; +-- lin thai_Language = mkLanguage "Thai" ; +-- lin turkish_Language = mkLanguage "Turkish" ; +-- lin urdu_Language = mkLanguage "Urdu" ; + +} diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index 43c35f59..cdd6e916 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -4,16 +4,36 @@ concrete ExtendAra of Extend = CatAra ** ExtendFunctor - [ GenNP, SlashBareV2S, PredAPVP, GenModNP, ExistsNP, StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem, - ComplBareVS, ComplDirectVS, ComplDirectVQ + ComplBareVS, ComplDirectVS, ComplDirectVQ, + ICompAP, + VPS, MkVPS ] with (Grammar=GrammarAra) ** open Prelude, - ResAra + ResAra, + ParamX in { lin - GenNP np = { s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum, isPron = False } ; -} ; + GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ; + + -- : AP -> IComp ; -- "how old" + ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ; + + lincat + + VPS = VP ; -- finite VP's with tense and polarity + + lin + -- : Temp -> Pol -> VP -> VPS ; -- hasn't slept + MkVPS t p vp = lin VPS (vp ** { + s = \\pgn,vf => case of { --- IL guessed tenses + <(Pres|Fut),Simul> => vp.s ! pgn ! VPImpf Ind ; + => vp.s ! pgn ! VPImpf Cnj ; + <_ ,_ > => vp.s ! pgn ! VPPerf + } + }) ; +} From c19c727f40ed6e688bf15e24b084a2097695a390 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:01:35 +0100 Subject: [PATCH 31/78] (Ara) yet another hamza fix --- src/arabic/OrthoAra.gf | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/arabic/OrthoAra.gf b/src/arabic/OrthoAra.gf index edf4f0f8..8bd8f4f3 100644 --- a/src/arabic/OrthoAra.gf +++ b/src/arabic/OrthoAra.gf @@ -34,10 +34,16 @@ oper l@(""|"ال") + ("أ"|"أَ") + #hamza + tail => l + "آ" + tail; l@(""|"ال") + #hamza + v@("َ"|"ُ") + tail => l + "أ" + v + tail; l@(""|"ال") + #hamza + v@("ِ") + tail => l + "إ" + v + tail; - head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") + #hamza + v2@(#vow|"ْ") + tail => - case v2 of { "ْ" => head + v1 + tHmz v1 + tail ; -- unsure about this /IL - _ => head + v1 + tHmz v1 + v2 + tail } ; + case v2 of { "ْ" => head + v1 + bHmz v1 v2 + tail ; -- unsure about this /IL + _ => head + v1 + bHmz v1 v2 + v2 + tail } ; + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends in vowel + + #hamza + v2@(#vow|"ْ") => + case v2 of { "ْ" => head + v1 + tHmz v1 ; + _ => head + v1 + tHmz v1 + v2 } ; + head + v1@(#vow|"ْ"|"ا"|"ي"|"و") -- the same but it ends without vowel + + #hamza => head + v1 + tHmz v1 ; head + #hamza + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail _ => word From eb43758d3770b22d310c8f609dfb5e36a72226fd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:02:57 +0100 Subject: [PATCH 32/78] (Ara) Add variable gender to IP --- src/arabic/PhraseAra.gf | 2 +- src/arabic/QuestionAra.gf | 18 ++++++++++-------- src/arabic/ResAra.gf | 16 +++++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 5e11b5e5..6e0abc7f 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -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 = \\_g => ip.s ! False ! Def ! Nom} ; --IL + UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL UttCard c = {s = ResAra.uttNum c} ; --IL diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index bc01b0a7..f8afc2da 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -29,14 +29,15 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA -- : IComp -> NP -> QCl QuestIComp ic np = let vp = kaan (CompNP np) ; - ip : ResAra.IP = np ** { - s = \\_,_,_ => ic.s ! pgn2gn np.a.pgn } ; + 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 ; -- : IP -> IComp ; CompIP ip = ip ** { - s = \\_ => ip.s ! True -- True=IP will be a subject of predicative sentence - ! Def ! Nom ; -- IP will be a subject + s = \\gn => ip.s ! True -- True=IP will be a subject of predicative sentence + ! gn.g -- IComp agrees in gender with eventual head + ! Def ! Nom ; -- IP will be a subject } ; CompIAdv iadv = { s = \\_ => iadv.s ; a = ResAra.Sg } ; @@ -46,28 +47,29 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA s = \\t,p,qf => let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing - in cls.c2.s ++ ip.s ! False ! Def ! Nom ++ cl.s ! t ! p ! o + in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o } ; --IL guessed PrepIP p ip = { s = p.s ++ ip.s ! False -- not used as a subject of predicative sentence + ! Masc ---- ! Def ! Gen } ; AdvIP ip adv = ip ** { - s = \\g,s,c => ip.s ! g ! s ! c ++ adv.s ; + s = \\isPred,g,s,c => ip.s ! isPred ! g ! s ! c ++ adv.s ; } ; -- : IDet -> IP IdetIP idet = idet ** { - s = \\isPred => idet.s ! Masc ; + s = \\isPred => idet.s ; a = { pgn = agrP3 NoHum Masc idet.n ; isPron = False } } ; -- : IDet -> CN -> IP IdetCN idet cn = { - s = \\isPred,s,c + s = \\isPred,g,s,c => idet.s ! cn.g ! s ! c ++ cn.s ! idet.n ! Indef ! Gen ; --idaafa a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 50d9dc68..ea1e8de7 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1141,12 +1141,12 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkIP = overload { mkIP : Str -> Number -> IP = \maa,n -> { - s = \\_p,_s,_c => maa ; + s = \\_p,_g,_s,_c => maa ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } } ; mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { - s = table { True => \\_s,_c => maa ; - False => \\_s,_c => maadhaa } ; + s = table { True => \\_g,_s,_c => maa ; + False => \\_g,_s,_c => maadhaa } ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } } } ; @@ -1229,13 +1229,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" - => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative + => Gender -- because an IP can be made into an IComp + => State => Case -- because of PrepIP: e.g. "in which" chooses definite accusative => Str ; - a : Agr -- can be both subject and object of a QCl, needs full agr. info + a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh) } ; - ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Def } ; - + ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ; + np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ; + IDet : Type = { s : Gender -- IdetCN needs to choose the gender of the CN => State => Case => Str ; From c14e87922437039ebf834080ce027cfefffcb246 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 13 Nov 2018 17:03:32 +0100 Subject: [PATCH 33/78] (Ara) Misc fixes to tenses, NPs, VPs --- src/arabic/RelativeAra.gf | 2 +- src/arabic/ResAra.gf | 20 ++++++++++++-------- src/arabic/SentenceAra.gf | 12 ++++++------ src/arabic/SymbolAra.gf | 2 ++ src/arabic/VerbAra.gf | 3 ++- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index e3a9969c..12bf8e6c 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -13,7 +13,7 @@ concrete RelativeAra of Relative = CatAra ** s = \\t,p,agr,c => let npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; - np = {s = npS ; a = agr} ; + np = emptyNP ** {s = npS ; a = agr} ; cl = Se.PredVP np vp ; in cl.s ! t ! p ! Nominal diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index ea1e8de7..3df3a117 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1301,7 +1301,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } }; - predVP : NP -> VP -> Cl = \np,vp -> { s =\\t,p,o => let { @@ -1323,24 +1322,29 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => "لَيسَ" ;--same here, just add negation particle <_, Past, Pos> => kataba ; <_, Past, Neg> => "لَمْ" ++ yaktub ; - <_, _Fut, Pos> => "سَ" ++ yaktubu ; - <_, _Fut, Neg> => "لَنْ" ++ yaktuba + <_, Cond, _ > => yaktuba ; + <_, Fut, Pos> => "سَ" ++ yaktubu ; + <_, Fut, Neg> => "لَنْ" ++ yaktuba }; pred : ParamX.Tense -> Polarity -> Str = \tn,pl -> case of { => vp.pred.s ! gn ! Nom; --xabar marfooc _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; + subj = np.empty + ++ case of { + => [] ; -- prodrop if it's not predicative + _ => np.s ! Nom + } ; } in - -- If you want prodrop, use proDrop : NP -> NP for your subject. /IL case o of { Verbal => vStr t p ++ case vp.obj.a.isPron of { - True => vp.obj.s ++ np.s ! Nom ; -- obj. clitic attaches directly to the verb - False => np.s ! Nom ++ vp.obj.s } + True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb + False => subj ++ vp.obj.s } ++ vp.s2 ++ pred t p ; - Nominal => np.s ! Nom ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ; - VOS => vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p ++ np.s ! Nom + 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 } } ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 23181603..408b3468 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -68,18 +68,18 @@ concrete SentenceAra of Sentence = CatAra ** open UseCl t p cl = {s = t.s ++ p.s ++ case of { --- IL guessed tenses - <(Pres|Cond),Simul> => cl.s ! Pres ! p.p ! Nominal ; - => cl.s ! Fut ! p.p ! Nominal ; - <_ ,_ > => cl.s ! Past ! p.p ! Nominal + => cl.s ! Pres ! p.p ! Nominal ; + => cl.s ! Past ! p.p ! Nominal ; + => cl.s ! x ! p.p ! Nominal } }; UseQCl t p qcl = {s = \\q => t.s ++ p.s ++ case of { --- IL guessed tenses - <(Pres|Cond),Simul> => qcl.s ! Pres ! p.p ! q ; - => qcl.s ! Fut ! p.p ! q ; - <_ ,_ > => qcl.s ! Past ! p.p ! q + => qcl.s ! Pres ! p.p ! q ; + => qcl.s ! Past ! p.p ! q ; + => qcl.s ! x ! p.p ! q } }; diff --git a/src/arabic/SymbolAra.gf b/src/arabic/SymbolAra.gf index c239b087..43bf160a 100644 --- a/src/arabic/SymbolAra.gf +++ b/src/arabic/SymbolAra.gf @@ -17,10 +17,12 @@ lin let g = cn.g ; n = sizeToNumber det.n in { s = \\c => det.s ! NoHum ! g ! c ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments. a = dummyAgrP3 n ; + empty = [] } ; CNNumNP cn i = { s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ; a = dummyAgrP3 Sg ; + empty = [] } ; SymbS sy = sy ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 0f721031..110059dd 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -26,7 +26,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { vp ** { s = \\pgn,vpf => vvVP.s ! pgn ! vpf ++ vv.c2.s -- أَنْ - ++ vp.s ! pgn ! VPImpf Cnj + ++ vp.s ! pgn ! VPImpf Cnj ; + isPred = False } ; -- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; From 08c5914466c6785294312a81ea3542d46ad7351d Mon Sep 17 00:00:00 2001 From: odanoburu Date: Tue, 13 Nov 2018 15:46:50 -0200 Subject: [PATCH 34/78] (Por) - add AdjAsCN AdjAsNP - copied VPS functions from ExtraRomance - fixes to Lexicon --- src/abstract/Sentence.gf | 2 +- src/portuguese/ExtendPor.gf | 56 ++++++++++++++++++++++++++---------- src/portuguese/LexiconPor.gf | 4 +-- 3 files changed, 44 insertions(+), 18 deletions(-) diff --git a/src/abstract/Sentence.gf b/src/abstract/Sentence.gf index 6068223c..fc3c760b 100644 --- a/src/abstract/Sentence.gf +++ b/src/abstract/Sentence.gf @@ -70,7 +70,7 @@ abstract Sentence = Cat ** { -- This covers subjunctive clauses, but they can also be added to the end. - SSubjS : S -> Subj -> S -> S ; -- I go home if she comes + SSubjS : S -> Subj -> S -> S ; -- I go home, if she comes -- A sentence can be modified by a relative clause referring to its contents. diff --git a/src/portuguese/ExtendPor.gf b/src/portuguese/ExtendPor.gf index 12ab235b..52cb8e90 100644 --- a/src/portuguese/ExtendPor.gf +++ b/src/portuguese/ExtendPor.gf @@ -4,6 +4,8 @@ concrete ExtendPor of Extend = CatPor ** ExtendFunctor - [ AdAdV, + AdjAsCN, + AdjAsNP, ApposNP, BaseVPS, ByVP, @@ -13,6 +15,7 @@ concrete ExtendPor of Extend = CompoundAP, CompoundN, CompVP, + ConjVPS, ConsVPS, --EmptyRelSlash, ExistsNP, @@ -27,11 +30,13 @@ concrete ExtendPor of Extend = ICompAP, InOrderToVP, ListVPS, + MkVPS, PassAgentVPSlash, PassVPSlash, PastPartAP, PastPartAgentAP, PositAdVAdj, + PredVPS, PresPartAP, ProDrop, PurposeVP, @@ -52,13 +57,13 @@ concrete ExtendPor of Extend = with (Grammar = GrammarPor), (Syntax = SyntaxPor) ** open - GrammarPor, - ResPor, - MorphoPor, - Coordination, - Prelude, - ParadigmsPor, - (S = StructuralPor) in { + GrammarPor, + ResPor, + MorphoPor, + Coordination, + Prelude, + ParadigmsPor, + (S = StructuralPor) in { lin GenNP np = @@ -85,17 +90,28 @@ concrete ExtendPor of Extend = c = Nom } ; + ---- these come from ExtraRomance: how to avoid the repetition? + ---- can't seem to be able to use two functors lincat - VPS = {s : Agr => Mood => Str} ; - [VPS] = {s1,s2 : Agr => Mood => Str} ; --- VPI = {s : VType => Agr => Str } ; + VPS = {s : Mood => Agr => Bool => Str} ; + [VPS] = {s1,s2 : Mood => Agr => Bool => Str} ; lin - BaseVPS = twoTable2 Agr Mood ; - ConsVPS = consrTable2 Agr Mood comma ; + BaseVPS x y = twoTable3 Mood Agr Bool x y ; + ConsVPS = consrTable3 Mood Agr Bool comma ; --- MkVPS t p vp = mkVPS (lin Temp t) (lin Pol p) (lin VP vp) ; ---TODO: write mkVPS oper + PredVPS np vpi = { + s = \\m => (np.s ! Nom).comp ++ vpi.s ! m ! np.a ! np.isNeg + } ; + + MkVPS tm p vp = { + s = \\m,agr,isNeg => + tm.s ++ p.s ++ + (mkClausePol (orB isNeg vp.isNeg) [] False False agr vp).s + ! DDir ! tm.t ! tm.a ! p.p ! m + } ; + + ConjVPS = conjunctDistrTable3 Mood Agr Bool ; lin ProDrop p = { @@ -148,13 +164,23 @@ concrete ExtendPor of Extend = ComplBareVS = ComplVS ; + AdjAsCN ap = { + s =\\n => ap.s ! AF Masc n ; + g = Masc + } ; + + AdjAsNP ap = heavyNP { + s = \\_c => ap.s ! AF Masc Sg ; + a = Ag Masc Sg P3 + } ; + oper pastPartAP : VPSlash -> Str -> AP ; pastPartAP vps agent = lin AP { s = \\af => vps.comp ! (aform2aagr af ** {p = P3}) ++ vps.s.s ! VPart (aform2gender af) (aform2number af) ++ agent ; isPre = False } ; - + passVPSlash : VPSlash -> Str -> VP ; passVPSlash vps agent = let auxvp = predV auxPassive diff --git a/src/portuguese/LexiconPor.gf b/src/portuguese/LexiconPor.gf index e3900909..699a8fa6 100644 --- a/src/portuguese/LexiconPor.gf +++ b/src/portuguese/LexiconPor.gf @@ -10,7 +10,7 @@ flags lin easy_A2V = mkA2V (mkA "fácil") dative genitive ; married_A2 = mkA2 (mkA "casado") dative ; - probable_AS = mkAS (mkA "provável" "provavelmente") ; + probable_AS = mkAS (prefA (mkA "provável" "provavelmente")) ; fun_AV = mkAV (mkA "divertido") genitive ; -- A bad_A = prefA (mkA (mkA "mau") (mkA "pior")) ; @@ -38,7 +38,7 @@ lin narrow_A = mkA "estreito" ; near_A = mkA "perto" ; new_A = prefA (mkA "novo") ; - old_A = prefA (mkA "velho") ; + old_A = prefA (mkA "velho") ; ready_A = mkA "pronto" ; red_A = mkA "vermelho" ; rotten_A = mkA "podre" ; From f0065986a66fb8822fde1b6679ec3174627bac34 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 13 Nov 2018 22:44:13 +0100 Subject: [PATCH 35/78] Add column for language name in `languages.csv` This will be used for listing languages in Synopsis --- Config.hs | 20 ++++++------ Make.sh | 10 +++--- README.md | 1 + languages.csv | 90 +++++++++++++++++++++++++-------------------------- 4 files changed, 62 insertions(+), 59 deletions(-) diff --git a/Config.hs b/Config.hs index d3b325fd..b671eacb 100644 --- a/Config.hs +++ b/Config.hs @@ -15,6 +15,7 @@ configFile = "languages.csv" -- | Information about a language data LangInfo = LangInfo { langCode :: String -- ^ 3-letter ISO 639-2/B code + , langName :: String -- ^ language name , langDir :: String -- ^ directory name , langFunctor :: Maybe String -- ^ functor (not used) , langUnlexer :: Maybe String -- ^ decoding for postprocessing linearizations @@ -44,15 +45,16 @@ loadLangsFrom configFile = do then die $ "Invalid entry in " ++ configFile ++ ": " ++ s else return $ LangInfo { langCode = bits !! 0 - , langDir = bits !! 1 - , langFunctor = maybeBit bits 2 - , langUnlexer = maybeBit bits 3 - , langPresent = boolBit bits 4 False - , langAll = boolBit bits 5 True - , langTry = boolBit bits 6 True - , langSymbolic = boolBit bits 7 True - , langCompatibility = boolBit bits 8 False - , langSynopsis = boolBit bits 9 False + , langName = bits !! 1 + , langDir = bits !! 2 + , langFunctor = maybeBit bits 3 + , langUnlexer = maybeBit bits 4 + , langPresent = boolBit bits 5 False + , langAll = boolBit bits 6 True + , langTry = boolBit bits 7 True + , langSymbolic = boolBit bits 8 True + , langCompatibility = boolBit bits 9 False + , langSynopsis = boolBit bits 10 False } -- | Separate a string on a character diff --git a/Make.sh b/Make.sh index ce73171c..bfc2d66f 100755 --- a/Make.sh +++ b/Make.sh @@ -6,11 +6,11 @@ set -e # Get languages from config -langs=$(tail -n +2 languages.csv | awk -F ',' '{ if ($6 != "n") { print $1 } }') -langs_present=$(tail -n +2 languages.csv | awk -F ',' '{ if ($5 == "y") { print $1 } }') -langs_try=$(tail -n +2 languages.csv | awk -F ',' '{ if ($7 != "n") { print $1 } }') -langs_symbolic=$(tail -n +2 languages.csv | awk -F ',' '{ if ($8 != "n") { print $1 } }') -langs_compat=$(tail -n +2 languages.csv | awk -F ',' '{ if ($9 == "y") { print $1 } }') +langs=$(tail -n +2 languages.csv | awk -F ',' '{ if ($7 != "n") { print $1 } }') +langs_present=$(tail -n +2 languages.csv | awk -F ',' '{ if ($6 == "y") { print $1 } }') +langs_try=$(tail -n +2 languages.csv | awk -F ',' '{ if ($8 != "n") { print $1 } }') +langs_symbolic=$(tail -n +2 languages.csv | awk -F ',' '{ if ($9 != "n") { print $1 } }') +langs_compat=$(tail -n +2 languages.csv | awk -F ',' '{ if ($10 == "y") { print $1 } }') # Modules to compile for each language modules_langs="All Symbol Compatibility" diff --git a/README.md b/README.md index 7d784ae1..489dbdbd 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ This file should be kept up-to-date and all build methods should read this confi | Column | Description | Default | |:--------------|:-----------------------------------------|:-------:| | Code | e.g. `Eng` | - | +| Name | language name in English, e.g. `English` | - | | Directory | folder name under `src`, e.g. `english` | - | | Functor | (not used) | - | | Unlexer | (not used) | - | diff --git a/languages.csv b/languages.csv index 4cddceaf..0bc0de3b 100644 --- a/languages.csv +++ b/languages.csv @@ -1,45 +1,45 @@ -Code,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis -Afr,afrikaans,,,,,,n,,y -Amh,amharic,,,,,n,n,,n -Ara,arabic,,,,,,y,,y -Bul,bulgarian,,,y,,,,,y -Cat,catalan,Romance,,y,,,,y,y -Chi,chinese,,,,,,,,y -Dan,danish,Scand,,y,,,,,y -Dut,dutch,,,y,,,,,y -Eng,english,,,y,,,,y,y -Est,estonian,,,,,,,,y -Eus,basque,,,,,,,,y -Fin,finnish,,,y,,,,y,y -Fre,french,Romance,,y,,,,y,y -Ger,german,,,,,,,,y -Grc,ancient_greek,,,y,,n,n,,n -Gre,greek,,,,,,,,y -Heb,hebrew,,,,,n,n,,n -Hin,hindi,Hindustani,to_devanagari,y,,,,,y -Hun,hungarian,,,y,n,n,n,,n -Ice,icelandic,,,,,,n,,y -Ina,interlingua,,,y,,n,n,,n -Ita,italian,Romance,,y,,,,y,y -Jpn,japanese,,,,,,,,y -Lat,latin,,,y,,n,n,,n -Lav,latvian,,,,,,,y,y -Mlt,maltese,,,,,,,,y -Mon,mongolian,,,,,,n,,y -Nep,nepali,,,,,,n,,y -Nno,nynorsk,,,y,,,,,y -Nor,norwegian,Scand,,y,,,,,y -Pes,persian,,,,,,,,y -Pnb,punjabi,,,y,,,,,y -Pol,polish,,,,,,,,y -Por,portuguese,Romance,,y,,,,y,y -Ron,romanian,,,y,,,,,y -Rus,russian,,,y,,,,,y -Snd,sindhi,,,,,,,,y -Spa,spanish,Romance,,y,,,,y,y -Swa,swahili,,,,n,n,n,y,n -Swe,swedish,Scand,,y,,,,y,y -Tel,telugu,,,y,n,n,n,,n -Tha,thai,,to_thai,,,,,,y -Tur,turkish,,,,,n,n,,n -Urd,urdu,Hindustani,,,,,,,y +Code,Name,Directory,Functor,Unlexer,Present,All,Try,Symbolic,Compatibility,Synopsis +Afr,Afrikaans,afrikaans,,,,,,n,,y +Amh,Amharic,amharic,,,,,n,n,,n +Ara,Arabic,arabic,,,,,,y,,y +Bul,Bulgarian,bulgarian,,,y,,,,,y +Cat,Catalan,catalan,Romance,,y,,,,y,y +Chi,Chinese (simplified),chinese,,,,,,,,y +Dan,Danish,danish,Scand,,y,,,,,y +Dut,Dutch,dutch,,,y,,,,,y +Eng,English,english,,,y,,,,y,y +Est,Estonian,estonian,,,,,,,,y +Eus,Basque,basque,,,,,,,,y +Fin,Finnish,finnish,,,y,,,,y,y +Fre,French,french,Romance,,y,,,,y,y +Ger,German,german,,,,,,,,y +Grc,Ancient Greek,ancient_greek,,,y,,n,n,,n +Gre,Greek,greek,,,,,,,,y +Heb,Hebrew,hebrew,,,,,n,n,,n +Hin,Hindi,hindi,Hindustani,to_devanagari,y,,,,,y +Hun,Hungarian,hungarian,,,y,n,n,n,,n +Ice,Icelandic,icelandic,,,,,,n,,y +Ina,Interlingua,interlingua,,,y,,n,n,,n +Ita,Italian,italian,Romance,,y,,,,y,y +Jpn,Japanese,japanese,,,,,,,,y +Lat,Latin,latin,,,y,,n,n,,n +Lav,Latvian,latvian,,,,,,,y,y +Mlt,Maltese,maltese,,,,,,,,y +Mon,Mongolian,mongolian,,,,,,n,,y +Nep,Nepali,nepali,,,,,,n,,y +Nno,Norwegian (nynorsk),nynorsk,,,y,,,,,y +Nor,Norwegian (bokmål),norwegian,Scand,,y,,,,,y +Pes,Persian,persian,,,,,,,,y +Pnb,Punjabi,punjabi,,,y,,,,,y +Pol,Polish,polish,,,,,,,,y +Por,Portuguese,portuguese,Romance,,y,,,,y,y +Ron,Pomanian,romanian,,,y,,,,,y +Rus,Russian,russian,,,y,,,,,y +Snd,Sindhi,sindhi,,,,,,,,y +Spa,Spanish,spanish,Romance,,y,,,,y,y +Swa,Swahili,swahili,,,,n,n,n,y,n +Swe,Swedish,swedish,Scand,,y,,,,y,y +Tel,Telugu,telugu,,,y,n,n,n,,n +Tha,Thai,thai,,to_thai,,,,,,y +Tur,Turkish,turkish,,,,,n,n,,n +Urd,Urdu,urdu,Hindustani,,,,,,,y From f665c697bdc6a791aecca9c6f989d0130856cee9 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Tue, 13 Nov 2018 23:28:48 +0100 Subject: [PATCH 36/78] doc/Makefile: use the correct column from languages.csv The synopsis flag is now in column 11 --- doc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/Makefile b/doc/Makefile index 90133f78..f766adca 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -16,7 +16,7 @@ synopsis: synopsis.html S=../src # List of languages extracted from languages.csv, with 'Synopsis' column == y -LANGS=$(shell cat ../languages.csv | cut -d',' -f1,10 | grep ',y' | cut -d',' -f1) +LANGS=$(shell cat ../languages.csv | cut -d',' -f1,11 | grep ',y' | cut -d',' -f1) # This list was constructed by observing what files MkSynopsis.hs reads SRC_FILES=$(S)/abstract/Common.gf $(S)/abstract/Cat.gf $(S)/api/Constructors.gf $(S)/abstract/Structural.gf $(patsubst %,$S/*/Paradigms%.gf,$(LANGS)) From 942dd3ace815b552b07816db6d994b91a6a9387d Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 14 Nov 2018 10:04:54 +0100 Subject: [PATCH 37/78] Add column numbers in README --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 489dbdbd..fc0c8c24 100644 --- a/README.md +++ b/README.md @@ -31,19 +31,19 @@ A list of all languages and their properties is maintained centrally in [`langua This file should be kept up-to-date and all build methods should read this config file. **If you see something wrong, please report/fix it.** -| Column | Description | Default | -|:--------------|:-----------------------------------------|:-------:| -| Code | e.g. `Eng` | - | -| Name | language name in English, e.g. `English` | - | -| Directory | folder name under `src`, e.g. `english` | - | -| Functor | (not used) | - | -| Unlexer | (not used) | - | -| Present | language is marked with `--# notpresent` | n | -| All | compile `All` module | y | -| Try | compile `Try` module | y | -| Symbolic | compile `Symbolic` module | y | -| Compatibility | complile `Compatibility` module | n | -| Synopsis | include language in the RGL synopsis | n | +| # | Column | Description | Default | +|:---|:--------------|:-----------------------------------------|:-------:| +| 1 | Code | 3-letter language code, e.g. `Eng` | - | +| 2 | Name | language name in English, e.g. `English` | - | +| 3 | Directory | folder name under `src`, e.g. `english` | - | +| 4 | Functor | functor name (not used) | - | +| 5 | Unlexer | unlexer (not used) | - | +| 6 | Present | language is marked with `--# notpresent` | n | +| 7 | All | compile `All` module | y | +| 8 | Try | compile `Try` module | y | +| 9 | Symbolic | compile `Symbolic` module | y | +| 10 | Compatibility | complile `Compatibility` module | n | +| 11 | Synopsis | include language in the RGL synopsis | n | If default is `y` then anything other than `n`, including the empty string, is treated as true (and vice versa when default is `n`). From b89aa34bfd04fe9c38d5441e57e6b7dfd6dae97a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 14 Nov 2018 15:48:20 +0100 Subject: [PATCH 38/78] (Ara) Conjunctions, ComplV*, additions in Idiom&Construction, etc. --- src/arabic/CatAra.gf | 3 +- src/arabic/ConjunctionAra.gf | 119 +++++++++++++-------- src/arabic/ConstructionAra.gf | 35 ++++--- src/arabic/ExtendAra.gf | 6 +- src/arabic/IdiomAra.gf | 74 ++++++++++--- src/arabic/LangAra.gf | 3 +- src/arabic/MissingAra.gf | 18 ---- src/arabic/NounAra.gf | 9 +- src/arabic/ParadigmsAra.gf | 52 +++++----- src/arabic/PhraseAra.gf | 2 +- src/arabic/QuestionAra.gf | 10 +- src/arabic/RelativeAra.gf | 11 +- src/arabic/ResAra.gf | 189 +++++++++++++++++++++++++--------- src/arabic/StructuralAra.gf | 16 +-- src/arabic/VerbAra.gf | 45 +++++--- 15 files changed, 385 insertions(+), 207 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 246c30e9..9879772a 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -38,7 +38,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { VP = ResAra.VP ; VPSlash = ResAra.VPSlash ; -- VP ** {c2:Preposition} - Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ; + Comp = ResAra.Comp ** {obj : Obj ; isNP : Bool} ; -- SC = {s : Str} ; -- -- Adjective @@ -94,5 +94,6 @@ linref CN = \cn -> uttCN cn ! Masc ; N = \n -> uttCN (useN n) ! Masc ; + VP = \vp -> uttVP vp ! Masc ; } diff --git a/src/arabic/ConjunctionAra.gf b/src/arabic/ConjunctionAra.gf index f7683c6c..c57f029d 100644 --- a/src/arabic/ConjunctionAra.gf +++ b/src/arabic/ConjunctionAra.gf @@ -1,45 +1,80 @@ concrete ConjunctionAra of Conjunction = CatAra ** open ResAra, Coordination, Prelude in { --- --- flags optimize=all_subs ; --- --- lin --- --- ConjS = conjunctSS ; --- DConjS = conjunctDistrSS ; --- --- ConjAdv = conjunctSS ; --- DConjAdv = conjunctDistrSS ; --- --- ConjNP conj ss = conjunctTable Case conj ss ** { --- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} --- } ; --- DConjNP conj ss = conjunctDistrTable Case conj ss ** { --- a = {n = conjNumber conj.n ss.a.n ; p = ss.a.p} --- } ; --- --- ConjAP conj ss = conjunctTable Agr conj ss ** { --- isPre = ss.isPre --- } ; --- DConjAP conj ss = conjunctDistrTable Agr conj ss ** { --- isPre = ss.isPre --- } ; --- ----- These fun's are generated from the list cat's. --- --- BaseS = twoSS ; --- ConsS = consrSS comma ; --- BaseAdv = twoSS ; --- ConsAdv = consrSS comma ; --- BaseNP x y = twoTable Case x y ** {a = conjAgr x.a y.a} ; --- ConsNP xs x = consrTable Case comma xs x ** {a = conjAgr xs.a x.a} ; --- BaseAP x y = twoTable Agr x y ** {isPre = andB x.isPre y.isPre} ; --- ConsAP xs x = consrTable Agr comma xs x ** {isPre = andB xs.isPre x.isPre} ; --- --- lincat --- [S] = {s1,s2 : Str} ; --- [Adv] = {s1,s2 : Str} ; --- [NP] = {s1,s2 : Case => Str ; a : Agr} ; --- [AP] = {s1,s2 : Agr => Str ; isPre : Bool} ; --- + +lincat + + [S], + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ; + [AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ; + +lin + + BaseS, + BaseAdv = twoSS ; + ConsS, + ConsAdv = consrSS comma ; + ConjS, + ConjAdv = conjunctSS ; + + BaseNP x y = twoTable Case x y ** { + a = conjAgr x.a y.a ; + empty = [] + } ; + ConsNP xs x = consrTable Case comma xs x ** { + a = conjAgr xs.a x.a ; + empty = [] + } ; + ConjNP conj ss = conjunctTable Case conj ss ** { + a = let gn = pgn2gn ss.a.pgn in + {pgn = Per3 gn.g (conjNumber conj.n gn.n) ; isPron = False} ; + empty = [] + } ; + + BaseAP x y = twoTable5 Species Gender Number State Case x y ; + ConsAP xs x = consrTable5 Species Gender Number State Case comma xs x ; + ConjAP conj ss = conjunctTable5 Species Gender Number State Case conj ss ; + + +oper + conjAgr : Agr -> Agr -> Agr = \a,b -> { + isPron = False ; + pgn = let gnA = pgn2gn a.pgn ; gnB = pgn2gn b.pgn in + Per3 (conjGender gnA.g gnB.g) (conjNumber gnA.n gnB.n) + } ; + + conjGender : Gender -> Gender -> Gender = \g,h -> + case g of {Fem => h ; _ => Masc} ; + + conjNumber : Number -> Number -> Number = \m,n -> + case m of {Sg => n ; _ => Pl} ; + + -- move to predef? + + ListTable5 : PType -> PType -> PType -> PType -> PType -> Type = \P,Q,R,T,S -> + {s1,s2 : P => Q => R => T => S => Str} ; + + twoTable5 : (P,Q,R,T,S : PType) -> (_,_ : {s : P => Q => R => T => S => Str}) -> + ListTable5 P Q R T S = + \_,_,_,_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consrTable5 : + (P,Q,R,T,S : PType) -> Str -> {s : P => Q => R => T => S => Str} -> + ListTable5 P Q R T S -> ListTable5 P Q R T S = + \P,Q,R,T,S,c,x,xs -> + {s1 = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ c ++ xs.s2 ! p ! q ! r ! t ! s ; + s2 = x.s + } ; + + conjunctTable5 : + (P,Q,R,T,S : PType) -> Conjunction -> ListTable5 P Q R T S -> {s : P => Q => R => T => S => Str} = + \P,Q,R,T,S,or,xs -> + {s = \\p,q,r,t,s => xs.s1 ! p ! q ! r ! t ! s ++ or.s ++ xs.s2 ! p ! q ! r ! t ! s} ; + + -- conjunctDistrTable5 : + -- (P,Q,R,T,S : PType) -> ConjunctionDistr -> ListTable5 P Q R T S -> + -- {s : P => Q => R => T => S => Str} = + -- \P,Q,R,T,S,or,xs -> + -- {s = \\p,q,r,t,s => or.s1++ xs.s1 ! p ! q ! r ! t ! s ++ or.s2 ++ xs.s2 ! p ! q ! r ! t ! s} ; } diff --git a/src/arabic/ConstructionAra.gf b/src/arabic/ConstructionAra.gf index 8d935766..95a37061 100644 --- a/src/arabic/ConstructionAra.gf +++ b/src/arabic/ConstructionAra.gf @@ -1,8 +1,10 @@ concrete ConstructionAra of Construction = CatAra ** open + Prelude, ParadigmsAra, SyntaxAra, SymbolicAra, StructuralAra, + (E=ExtendAra), (R=ResAra), (L=LexiconAra) in { @@ -39,19 +41,26 @@ lin -- n_units_AP + +oper + -- hack used in the name constructions + toNP : Bool -> NP -> NP = \b -> if_then_else NP b R.emptyNP ; + +lin -- : NP -> NP -> Cl - have_name_Cl pe nm = - let subjPron : Pron = case pe.a.isPron of { - True => pe ; - False => case (R.pgn2gn pe.a.pgn).g of { - R.Fem => she_Pron ; - R.Masc => he_Pron } - } ; + have_name_Cl np nm = + let subjPron : Pron = R.np2pron np ; + me : NP = toNP np.a.isPron np ; + myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ; + in mkCl myName nm ; - myName : NP = mkNP (mkDet subjPron) L.name_N ; - in mkCl myName nm ; --TODO: now it only works for pronouns, drops the NP - --- what_name_QCl = + -- : NP -> QCl + what_name_QCl np = + let subjPron : Pron = R.np2pron np ; + me : R.NP = toNP np.a.isPron np ; + myName : NP = E.ApposNP me (mkNP (mkDet subjPron) L.name_N) ; + what_IP : R.IP = R.mkIP "مَا هُوَ" R.Sg ; + in mkQCl what_IP myName ; -- how_old_QCl @@ -76,7 +85,7 @@ lin oper mkLanguage : Str -> N = mkN ; ---------------------------------------------- ----- lexicon of special names +---- lexicon of snpcial names -- TODO in arabic lin second_Timeunit = mkN "second" ; @@ -131,7 +140,7 @@ lin finnish_Language = mkLanguage "فِنْلَنْدِيّة" ; -- lin maltese_Language = mkLanguage "Maltese" ; -- lin nepali_Language = mkLanguage "Nepali" ; -- lin norwegian_Language = mkLanguage "Norwegian" ; -lin persian_Language = mkLanguage "فَارِسيّة" ; +lin nprsian_Language = mkLanguage "فَارِسيّة" ; -- lin polish_Language = mkLanguage "Polish" ; -- lin punjabi_Language = mkLanguage "Punjabi" ; -- lin romanian_Language = mkLanguage "Romanian" ; diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index cdd6e916..3b667a23 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -6,7 +6,8 @@ concrete ExtendAra of Extend = StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem, ComplBareVS, ComplDirectVS, ComplDirectVQ, ICompAP, - VPS, MkVPS + VPS, MkVPS, + ApposNP ] with (Grammar=GrammarAra) ** open @@ -20,6 +21,9 @@ concrete ExtendAra of Extend = lin GenNP np = {s = \\_,_,_,_ => np.s ! Gen ; d = Const ; isNum,isPron,is1sg = False} ; + -- : NP -> NP -> NP + ApposNP np1 np2 = np2 ** {s = \\c => np1.s ! c ++ np2.s ! c} ; + -- : AP -> IComp ; -- "how old" ICompAP ap = {s = \\gn => "كَمْ" ++ ap.s ! NoHum ! gn.g ! gn.n ! Indef ! Acc} ; diff --git a/src/arabic/IdiomAra.gf b/src/arabic/IdiomAra.gf index fbfc5f9b..7f43ab64 100644 --- a/src/arabic/IdiomAra.gf +++ b/src/arabic/IdiomAra.gf @@ -1,15 +1,63 @@ -concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra in { - flags coding=utf8; --- --- flags optimize=all_subs ; --- --- lin --- ExistNP np = --- mkClause "تهري" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ; --- ImpersCl vp = mkClause "ِت" (agrP3 Sg) vp ; --- GenericCl vp = mkClause "ْني" (agrP3 Sg) vp ; --- --- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ; --- +concrete IdiomAra of Idiom = CatAra ** open + Prelude, + ResAra, + ParadigmsAra + in { + + + lin + + -- : VP -> Cl ; -- it is hot + ImpersCl vp = + let it : ResAra.NP = pron2np (pgn2pron vp.obj.a.pgn) ; -- if no obj, Per3 Masc Sg chosen by default + in predVP it vp ; + + -- : VP -> Cl ; -- one sleeps + GenericCl = predVP (regNP "المَرْء" Sg) ; + + -- : NP -> RS -> Cl ; -- it is I who did it + --CleftNP np rs = + + -- : Adv -> S -> Cl ; -- it is here she slept + CleftAdv adv s = + let comp : Comp = {s = \\_,_ => adv.s ++ s.s} in ---- + predVP he_Pron (kaan comp) ; + + -- : NP -> Cl ; -- there is a house + ExistNP np = + predVP emptyNP (insertObj np (predV copula ** {c2=noPrep})) ; -- dummy /IL + + -- ExistIP : IP -> QCl ; -- which houses are there + +-- 7/12/2012 generalizations of these + + -- : NP -> Adv -> Cl ; -- there is a house in Paris + ExistNPAdv np adv = + predVP emptyNP (insertStr adv.s (insertObj np (predV copula ** {c2=noPrep}))) ; + + -- ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris + + -- ProgrVP : VP -> VP ; -- be sleeping + + -- ImpPl1 : VP -> Utt ; -- let's go + + -- ImpP3 : NP -> VP -> Utt ; -- let John walk + +-- 3/12/2013 non-reflexive uses of "self" + + -- : VP -> VP ; -- is at home himself; is himself at home + SelfAdvVP, + SelfAdVVP = \vp -> vp ** { + s = \\pgn,vf => let pron : ResAra.NP = pgn2pron pgn in + vp.s ! pgn ! vf ++ refl ! Nom ++ pron.s ! Gen + } ; + + -- : NP -> NP ; -- the president himself (is at home) + SelfNP np = np ** { + s = let pron : ResAra.NP = np2pron np ; + in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen + } ; + + } diff --git a/src/arabic/LangAra.gf b/src/arabic/LangAra.gf index 55c9008b..ae49cc61 100644 --- a/src/arabic/LangAra.gf +++ b/src/arabic/LangAra.gf @@ -2,7 +2,8 @@ concrete LangAra of Lang = GrammarAra, - LexiconAra + LexiconAra, + ConstructionAra ** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding = utf8 ; diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index a5d3b200..9bfd3c3e 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -8,37 +8,19 @@ oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; oper AdvS : Adv -> S -> S = notYet "AdvS" ; -oper BaseAP : AP -> AP -> ListAP = notYet "BaseAP" ; -oper BaseAdv : Adv -> Adv -> ListAdv = notYet "BaseAdv" ; -oper BaseNP : NP -> NP -> ListNP = notYet "BaseNP" ; oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; -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 ComparAdvAdj : CAdv -> A -> NP -> Adv = notYet "ComparAdvAdj" ; oper ComparAdvAdjS : CAdv -> A -> S -> Adv = notYet "ComparAdvAdjS" ; -oper ComplVA : VA -> AP -> VP = notYet "ComplVA" ; -oper ComplVQ : VQ -> QS -> VP = notYet "ComplVQ" ; -oper ComplVS : VS -> S -> VP = notYet "ComplVS" ; -oper ConjAP : Conj -> ListAP -> AP = notYet "ConjAP" ; -oper ConjAdv : Conj -> ListAdv -> Adv = notYet "ConjAdv" ; -oper ConjNP : Conj -> ListNP -> NP = notYet "ConjNP" ; oper ConjRS : Conj -> ListRS -> RS = notYet "ConjRS" ; -oper ConjS : Conj -> ListS -> S = notYet "ConjS" ; -oper ConsAP : AP -> ListAP -> ListAP = notYet "ConsAP" ; -oper ConsAdv : Adv -> ListAdv -> ListAdv = notYet "ConsAdv" ; -oper ConsNP : NP -> ListNP -> ListNP = notYet "ConsNP" ; oper ConsRS : RS -> ListRS -> ListRS = notYet "ConsRS" ; -oper ConsS : S -> ListS -> ListS = notYet "ConsS" ; oper DetNP : Det -> NP = notYet "DetNP" ; oper EmbedQS : QS -> SC = notYet "EmbedQS" ; oper EmbedS : S -> SC = notYet "EmbedS" ; oper EmbedVP : VP -> SC = notYet "EmbedVP" ; oper ExistIP : IP -> QCl = notYet "ExistIP" ; -oper ExistNP : NP -> Cl = notYet "ExistNP" ; oper FunRP : Prep -> NP -> RP -> RP = notYet "FunRP" ; -oper GenericCl : VP -> Cl = notYet "GenericCl" ; oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ; oper ImpersCl : VP -> Cl = notYet "ImpersCl" ; oper PConjConj : Conj -> PConj = notYet "PConjConj" ; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index ddb788e3..7929adc0 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -6,7 +6,7 @@ lin DetCN det cn = let { cas : Case -> Case = if_then_else Case det.is1sg Bare ; - number = sizeToNumber det.n ; + number = case cn.isDual of {True => Dl ; _ => sizeToNumber det.n} ; determiner : Case -> Str = \c -> det.s ! cn.h ! (detGender cn.g det.n) ! c ; noun : Case -> Str = \c -> @@ -169,8 +169,11 @@ lin isNum,isPron,is1sg = False } ; - MassNP cn = ---- AR - {s = \\c => cn.s ! Sg ! Indef ! c ++ cn.np ! c ++ cn.adj ! Sg ! Indef ! c ; + MassNP cn = + {s = \\c => cn.s ! Sg ! Indef ! c + ++ cn.s2 ! Sg ! Indef ! c + ++ cn.np ! c + ++ cn.adj ! Sg ! Indef ! c ; a = {pgn = Per3 cn.g Sg ; isPron = False} ; empty = []} ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index d1958ae4..2300521f 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -76,6 +76,8 @@ resource ParadigmsAra = open --- = sdfN ; } ; + dualN : N -> N ; + --This is used for loan words or anything that has untreated irregularities --in the interdigitization process of its words mkFullN : NTable -> Gender -> Species -> N ; @@ -261,7 +263,8 @@ resource ParadigmsAra = open mkV2S : V -> Str -> V2S ; mkVV = overload { mkVV : V -> VV = regVV ; - mkVV : V -> Str -> VV = c2VV + mkVV : V -> Str -> VV = c2VV ; + mkVV : V -> Preposition -> VV = prepVV } ; mkV2V : overload { mkV2V : V -> Str -> Str -> V2V ; @@ -349,11 +352,17 @@ resource ParadigmsAra = open = \n,attr -> n ** {s2 = \\n,s,c => attr} ; mkN : N -> N -> N -- Compound nouns = \n1,n2 -> n1 ** {s2 = - \\n,s,c => n1.s2 ! n ! s ! c -- card - ++ n2.s ! n ! s ! c -- type - ++ n2.s2 ! n ! s ! c} ; -- blood + \\n,s,c => n1.s2 ! n ! s ! c + ++ n2.s ! n ! s ! c + ++ n2.s2 ! n ! s ! c} ; } ; + dualN : N -> N = \n -> n ** {isDual=True} ; + + proDrop : NP -> NP ; -- Force a NP to lose its string, only contributing with its agreement. + + mkPron : (_,_,_ : Str) -> PerGenNum -> Pron ; + mkV = overload { mkV : (imperfect : Str) -> V = regV ; @@ -470,12 +479,12 @@ resource ParadigmsAra = open _ => v10sound } } in lin V (v10fun rbT) ; - mkFullN nsc gen spec = + mkFullN nsc gen spec = lin N { s = nsc; --NTable s2 = emptyNTable; g = gen; h = spec; - lock_N = <> + isDual = False }; brkN' : Str -> Str -> Str -> Gender -> Species -> N = @@ -533,31 +542,19 @@ resource ParadigmsAra = open } ; mkPron : (_,_,_ : Str) -> PerGenNum -> Pron = \ana,nI,I,pgn -> - lin Pron { s = - table { - Acc => BIND ++ nI; -- object suffix - Gen => BIND ++ I; -- possessive suffix - _ => ana - }; - a = {pgn = pgn; isPron = True }; - empty = [] - }; + lin Pron (ResAra.mkPron ana nI I pgn) ; - proDrop : NP -> NP = ResAra.proDrop ; -- Force a NP to lose its string, only contributing with its agreement. + proDrop : NP -> NP = \np -> lin NP (ResAra.proDrop np) ; -- e.g. al-jamii3, 2a7ad - regNP : Str -> Number -> NP = \word,n -> lin NP - { s = \\c => fixShd word (dec1sg ! Def ! c) ; - a = {pgn = Per3 Masc n; isPron = False }; - empty = [] - }; + regNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { + s = \\c => fixShd word (dec1sg ! Def ! c) + }); -- e.g. hadha, dhaalika - indeclNP : Str -> Number -> NP = \word,n -> lin NP - { s = \\c => word ; - a = {pgn = Per3 Masc n; isPron = False }; - empty = [] - }; + indeclNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { + s = \\c => word + }); mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant = \hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det -> lin Quant (baseQuant ** @@ -666,7 +663,8 @@ resource ParadigmsAra = open mkVQ v = v ** {lock_VQ = <>} ; regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ"} ; - c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = noPrep} ; + c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep} ; + prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep} ; V0 : Type = V ; ---- V2S, V2V, V2Q, V2A : Type = V2 ; diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 6e0abc7f..78c8f947 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -17,7 +17,7 @@ concrete PhraseAra of Phrase = CatAra ** open UttCN cn = {s = ResAra.uttCN cn } ; --IL UttNP np = {s = \\_ => np.s ! Nom} ; - UttVP vp = {s = \\g => (compVP vp).s ! {g=g ; n=Sg} ! Nom} ; --IL + UttVP vp = {s = uttVP vp} ; --IL UttS, UttAdv, UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index f8afc2da..9df2234a 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -7,8 +7,8 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA QuestCl cl = { s = \\t,p => table { - QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ; - QDir => "هَلْ" ++ cl.s ! t ! p ! Verbal + QIndir => "إِذا" ++ cl.s ! t ! p ! toOrder QIndir ; + QDir => "هَلْ" ++ cl.s ! t ! p ! toOrder QDir } }; @@ -18,12 +18,12 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA QuestVP qp vp = let np = ip2np qp vp.isPred ; cl = PredVP np vp ; - in { s = \\t,p,_qf => cl.s ! t ! p ! Nominal } ; + in { s = \\t,p,qf => cl.s ! t ! p ! toOrder qf } ; ---- AR guessed - QuestIAdv iadv cl = {s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! Verbal} ; + QuestIAdv iadv cl = {s = \\t,p,qf => iadv.s ++ cl.s ! t ! p ! toOrder qf} ; ---- IL guessed -- : IComp -> NP -> QCl @@ -46,7 +46,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA QuestSlash ip cls = { ----IL just guessing s = \\t,p,qf => let cl : ResAra.Cl = complClSlash cls ; -- dummy conversion to Cl - o = case qf of { QDir => Nominal ; _ => Verbal } ; -- purely guessing + o = toOrder qf in cls.c2.s ++ ip.s ! False ! Masc ! Def ! Nom ++ cl.s ! t ! p ! o } ; diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index 12bf8e6c..9c764ade 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -1,5 +1,5 @@ concrete RelativeAra of Relative = CatAra ** - open ResAra, (Se=SentenceAra), (St=StructuralAra) in { + open ResAra in { flags coding=utf8; lin @@ -13,8 +13,8 @@ concrete RelativeAra of Relative = CatAra ** s = \\t,p,agr,c => let npS : Case => Str = \\_ => rp.s ! agr2ragr agr c ; - np = emptyNP ** {s = npS ; a = agr} ; - cl = Se.PredVP np vp ; + np : NP = agrNP agr ** {s = npS} ; + cl = predVP np vp ; in cl.s ! t ! p ! Nominal } ; @@ -22,9 +22,8 @@ concrete RelativeAra of Relative = CatAra ** -- : RP -> ClSlash -> RCl ; -- whom John loves RelSlash rp cls = cls ** { s = \\t,p,agr,c => - let obj = case (pgn2gn agr.pgn).g of { - Fem => St.she_Pron ; -- head is repeated as a clitic object pronoun - Masc => St.he_Pron } ; + let --empty : Agr -> NP = emptyNP ; + obj : ResAra.NP = pgn2pron agr.pgn ; -- head is repeated as a clitic object pronoun cl : ResAra.Cl = complClSlash obj cls ; in rp.s ! agr2ragr agr c ++ cl.s ! t ! p ! VOS } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 3df3a117..28b72591 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -31,7 +31,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { oper - --roots, patterns, and making words: +----------------------------------------------------------------------------- +-- General morphology with roots, patterns, and making words: Pattern : Type = {h, m1, m2, t : Str}; Root : Type = {f : Str}; @@ -109,7 +110,12 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { emptyNTable : NTable = \\n,s,c => [] ; Preposition : Type = {s : Str ; c : Case} ; - Noun : Type = {s,s2 : NTable ; g : Gender; h : Species} ; + Noun : Type = { + s,s2 : NTable ; + g : Gender ; + h : Species ; + isDual : Bool -- whether it takes dual instead of plural: eyes, twins, ... + } ; Noun2 : Type = Noun ** {c2 : Preposition} ; Noun3 : Type = Noun2 ** {c3 : Preposition} ; @@ -118,6 +124,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { mkPreposition : Str -> Preposition = \s -> {s=s;c=Gen} ; } ; + noPrep : Preposition = mkPreposition [] Nom ; + Adj : Type = {s : AForm => Str} ; Adj2 : Type = Adj ** {c2 : Preposition} ; @@ -1138,18 +1146,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } }; + gn2pgn : {g : Gender; n : Number} -> PerGenNum = \gn -> + case gn of { {g = gn; n = nm} => Per3 gn nm } ; + + -- these are chosen in many places, trying to be consistent + toOrder : QForm -> Order = \qf -> + case qf of { QIndir => Nominal ; + QDir => Verbal } ; - mkIP = overload { - mkIP : Str -> Number -> IP = \maa,n -> { - s = \\_p,_g,_s,_c => maa ; - a = { pgn = agrP3 NoHum Masc n ; isPron = False } - } ; - mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { - s = table { True => \\_g,_s,_c => maa ; - False => \\_g,_s,_c => maadhaa } ; - a = { pgn = agrP3 NoHum Masc n ; isPron = False } - } - } ; mkOrd : (_,_ : Str) -> Size -> NumOrdCard = \aysar,yusra,sz -> @@ -1163,7 +1167,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; - oper + +----------------------------------------------------------------------------- +-- Det, Quant BaseQuant : Type = { d : State; @@ -1194,21 +1200,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> AAgr = { g : Gender ; n : Number} ; - - Comp : Type = { - s : AAgr => Case => Str - } ; - - IComp : Type = { - s : AAgr -- "how old": masc or fem for adjective - -- no need for Case, IComp is only used by QuestIComp, as grammatical subject - => Str ; - } ; - - Obj : Type = { - s : Str ; - a : Agr - }; +----------------------------------------------------------------------------- +-- NP, Pron NP : Type = { s : Case => Str ; @@ -1216,16 +1209,79 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> empty : Str -- to prevent ambiguities with prodrop } ; + mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> + { s = + table { + Acc => BIND ++ nI; -- object suffix + Gen => BIND ++ I; -- possessive suffix + _ => ana + }; + a = {pgn = pgn; isPron = True }; + empty = [] + }; + proDrop : NP -> NP = \np -> case np.a.isPron of { True => np ** {s = \\_ => []}; _ => np } ; - + emptyNP : NP = { s = \\_ => [] ; a = {pgn = Per3 Masc Sg ; isPron = False} ; - empty = []} ; + empty = [] } ; + + agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ; + + i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ; + youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; + youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ; + youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ; + youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ; + he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; + she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; + we_Pron : NP = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; + youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; + youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Sg) ; + theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; + theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ; + theyDlMasc_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Masc Dl) ; + theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ; + + -- Used e.g. to encode the subject as an object clitic + -- or to find a possessive suffix corresponding to the NP. + -- If the NP is a pronoun, just use itself. + np2pron : NP -> NP = \np -> case np.a.isPron of { + True => np ; + False => pgn2pron np.a.pgn + } ; + + pgn2pron : PerGenNum -> NP = \pgn -> + case pgn of { + Per1 Sing => i_Pron ; + Per1 Plur => we_Pron ; + Per2 Fem Sg => youSgFem_Pron ; + Per2 Masc Sg => youSgMasc_Pron ; + Per2 Fem Dl => youDlFem_Pron ; + Per2 Masc Dl => youDlMasc_Pron ; + Per2 Fem Pl => youPlFem_Pron ; + Per2 Masc Pl => youPlMasc_Pron ; + Per3 Fem Sg => she_Pron ; + Per3 Masc Sg => he_Pron ; + Per3 Fem Dl => theyDlFem_Pron ; + Per3 Masc Dl => theyDlMasc_Pron ; + Per3 Fem Pl => theyFem_Pron ; + Per3 Masc Pl => theyMasc_Pron + } ; + + pron2np : NP -> NP = \np -> np ** { + a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop + } ; + + refl : Case => Str = \\c => "نَفْس" + caseTbl ! c ; + +----------------------------------------------------------------------------- +-- IP, questions IP : Type = { s : Bool -- different forms for "what is this" and "what do you do" @@ -1235,6 +1291,18 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh) } ; + mkIP = overload { + mkIP : Str -> Number -> IP = \maa,n -> { + s = \\_p,_g,_s,_c => maa ; + a = { pgn = agrP3 NoHum Masc n ; isPron = False } + } ; + mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { + s = table { True => \\_g,_s,_c => maa ; + False => \\_g,_s,_c => maadhaa } ; + a = { pgn = agrP3 NoHum Masc n ; isPron = False } + } + } ; + ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ; np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ; @@ -1248,6 +1316,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s : State => Case => Str } ; + IComp : Type = { + s : AAgr -- "how old": masc or fem for adjective + -- no need for Case, IComp is only used by QuestIComp, as grammatical subject + => Str ; + } ; + +----------------------------------------------------------------------------- +-- VP + param VPForm = VPPerf | VPImpf Mood @@ -1263,16 +1340,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> s2 : Str }; - -- For complements of VV. - -- TODO: does verbal complement agree with the noun - compVP : VP -> Comp = \vp -> ---- IL - { s = table { - aagr@{g=g ; n=n} => \\c => - vp.s ! Per3 g n ! VPImpf Ind ---- IL guesswork + https://arabic.desert-sky.net/g_modals.html - ++ vp.s2 - ++ vp.pred.s ! aagr ! Acc - ++ vp.obj.s } - } ; + uttVP : VP -> (Gender=>Str) = \vp -> + \\g => vp.s ! Per3 g Sg ! VPPerf + ++ vp.obj.s ++ vp.pred.s ! {n = Sg ; g = g} ! Nom + ++ vp.s2 ; predV : Verb -> VP = \v -> { s = \\pgn,vf => @@ -1282,12 +1353,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> VPImpf m => v.s ! (VImpf m Act pgn); VPImp => v.s ! (VImp gn.g gn.n) }; - obj = { - s = [] ; - a = {pgn = Per3 Masc Sg ; isPron = False} - }; --or anything! + obj = emptyObj ; s2 = []; - pred = { s = \\_,_ => []}; + pred = {s = \\_,_ => []} ; isPred = False }; @@ -1357,10 +1425,24 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => pgn }; +----------------------------------------------------------------------------- +-- Comp, arguments for VP + + Comp : Type = { + s : AAgr => Case => Str ; + } ; + + Obj : Type = { + s : Str ; + a : Agr -- default Agr in a VP without real Obj is Per3 Masc Sg + }; + + emptyObj : Obj = emptyNP ** {s=[]} ; + insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** { obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} }; - insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> vp ** + insertPred : Comp -> VP -> VP = \p,vp -> vp ** { pred = p; isPred = True }; @@ -1372,7 +1454,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> insertPred xabar (predV copula); copula : Verb = v1hollow {f = "ك"; c = "و" ; l = "ن"} u ; - -- Slash categories + +----------------------------------------------------------------------------- +-- Slash categories VPSlash : Type = VP ** {c2 : Preposition} ; ClSlash : Type = VPSlash ** {subj : NP} ; @@ -1397,7 +1481,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; - -- Relative +----------------------------------------------------------------------------- +-- Relative + param RAgr = RSg Gender | RPl Gender | RDl Gender Case ; @@ -1418,6 +1504,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> RCl : Type = {s : Tense => Polarity => Agr => Case => Str} ; RP : Type = {s : RAgr => Str } ; +----------------------------------------------------------------------------- +-- Num + param Size = One | Two | ThreeTen | Teen | NonTeen | Hundreds | None ; @@ -1505,6 +1594,4 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Masc => Fem; Fem => Masc }; - - } diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 59bdce40..bb30d905 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -35,7 +35,7 @@ concrete StructuralAra of Structural = CatAra ** few_Det = mkDet "بَعض" Pl Const ; -- first_Ord = ss "فِرست" ; from_Prep = mkPrep "مِنَ" ; - he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; + he_Pron = ResAra.he_Pron ; here_Adv = ss "هُنا" ; -- here7to_Adv = ss ["تْ هري"] ; -- here7from_Adv = ss ["فرْم هري"] ; @@ -43,7 +43,7 @@ concrete StructuralAra of Structural = CatAra ** -- how8many_IDet = mkDet "كَمْ" Pl Const ; -- IL: check (was ["هْو مَني"]) ; -- if_Subj = ss "ِف" ; in8front_Prep = mkPrep "مُقَابِلَ" ; - i_Pron = mkPron "أَنَا" "نِي" "ي" (Per1 Sing); + i_Pron = ResAra.i_Pron ; in_Prep = mkPrep "فِي" ; it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- less_CAdv = ss "لسّ" ; @@ -66,7 +66,7 @@ concrete StructuralAra of Structural = CatAra ** -- please_Voc = ss "ةلَسي" ; possess_Prep = mkPrep "ل" ; -- quite_Adv = ss "قُِتي" ; - she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; + she_Pron = ResAra.she_Pron ; -- so_AdA = ss "سْ" ; somebody_NP = regNP "أَحَد" Sg ; someSg_Det = mkDet "أَحَد" Sg Const ; @@ -80,7 +80,7 @@ concrete StructuralAra of Structural = CatAra ** -- there7from_Adv = ss ["فرْم تهري"] ; -- therefore_PConj = ss "تهرفْري" ; ----b these_NP = indeclNP "هَؤُلَاء" Pl ; - they_Pron = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; + they_Pron = theyMasc_Pron ; this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def; ----b this_NP = indeclNP "هَذا" Sg ; ----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ; @@ -90,7 +90,7 @@ concrete StructuralAra of Structural = CatAra ** under_Prep = mkPrep "تَحْتَ" ; -- very_AdA = ss "ثري" ; -- want_VV = P.mkVV (P.regV "وَنت") ; - we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; + we_Pron = ResAra.we_Pron ; whatPl_IP = mkIP "ما" "ماذا" Pl ; whatSg_IP = mkIP "ما" "ماذا" Sg ; when_IAdv = ss "مَتَى" ; @@ -113,9 +113,9 @@ concrete StructuralAra of Structural = CatAra ** without_Prep = mkPrep "بِدُونِ" ; with_Prep = mkPrep "مَع" ; yes_Utt = {s = \\_ => "نَعَم"} ; - youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; - youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; - youPol_Pron = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ; + youSg_Pron = youSgMasc_Pron ; + youPl_Pron = youPlMasc_Pron ; + youPol_Pron = youSgFem_Pron ; -- arbitrary? have_V2 = dirV2 (regV "يَملِك") ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 110059dd..57cc1719 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -1,4 +1,4 @@ -concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { +concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { flags optimize=all_subs ; @@ -16,13 +16,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { ComplSlash vp np = insertObj np vp ; --- Complv3 v np np2 = insertObj np2 (insertObj np (predV v)) ; - -{-{s = \\_ => v.c2 ++ np.s ! Acc ++ v.c3 ++ np2.s ! Acc ; - a = {pgn = Per3 Masc Sg ; isPron = False} } --FIXME - (predV v) ;-} - - ComplVV vv vp = let vvVP = predV vv in --- IL + -- : VV -> VP -> VP ; -- want to run + ComplVV vv vp = let vvVP = predV vv in -- IL vp ** { s = \\pgn,vpf => vvVP.s ! pgn ! vpf ++ vv.c2.s -- أَنْ @@ -30,14 +25,26 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { isPred = False } ; --- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; --- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; --- --- ComplVA v ap = insertObj (ap.s) (predV v) ; + -- : VS -> S -> VP ; -- say that she runs + ComplVS vs s = predV vs ** { -- IL + obj = emptyObj ** s } ; + + -- : VQ -> QS -> VP ; -- wonder who runs + ComplVQ vq qs = predV vq ** { -- IL + obj = emptyObj ** {s = qs.s ! QIndir} + } ; + + -- : VA -> AP -> VP ; -- they become red + ComplVA v ap = predV v ** {comp = CompAP ap} ; + -- ComplV2A v np ap = -- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; -- - UseComp xabar = kaan xabar ; + UseComp xabar = + case xabar.isNP of { + False => kaan xabar ; + True => predV copula ** {obj = xabar.obj ; isPred=True} + } ; UseCopula = predV copula ; @@ -51,10 +58,14 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { -- -- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no - CompCN cn = {s = \\agr,c => cn.s ! agr.n ! Indef ! c ++ cn.np ! c ++ cn.adj ! agr.n ! Indef ! c} ; ----IL - CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c} ; --FIXME - CompNP np = {s = \\_,c => np.s ! c}; - CompAdv a = {s = \\_,_ => a.s} ; + CompAP ap = {s = \\agr,c => ap.s ! Hum ! agr.g ! agr.n ! Indef ! c ; --FIXME + obj = emptyObj ; isNP = False} ; + CompAdv a = {s = \\_,_ => a.s ; + obj = emptyObj ; isNP = False} ; + + CompCN cn = {s = \\agr,c => cn.s ! agr.n ! Indef ! Nom ++ cn.np ! Nom ++ cn.adj ! agr.n ! Indef ! Nom ; + obj = emptyObj ; isNP = False} ; + CompNP np = {s = \\_,_ => [] ; obj = np ** {s = np.s ! Nom} ; isNP = True} ; -- -- } From 6c71da78f76339f5515cf53589f30e8017012bd4 Mon Sep 17 00:00:00 2001 From: Thomas Hallgren Date: Wed, 14 Nov 2018 17:55:47 +0100 Subject: [PATCH 39/78] arabic: add api to -path flags in AllAra.gf and LangAra.gf This fixes a build problem (either a type error, if doing an incremental rebuild, or a failure to find SyntaxAra.gf if building from scratch.) I wonder why the Travis build didn't catch this? --- src/arabic/AllAra.gf | 2 +- src/arabic/LangAra.gf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/arabic/AllAra.gf b/src/arabic/AllAra.gf index c331a6af..dc20a645 100644 --- a/src/arabic/AllAra.gf +++ b/src/arabic/AllAra.gf @@ -1,3 +1,3 @@ ---# -path=.:../abstract:../common:../prelude +--# -path=.:../abstract:../common:../api:../prelude concrete AllAra of AllAraAbs = LangAra ; diff --git a/src/arabic/LangAra.gf b/src/arabic/LangAra.gf index ae49cc61..bf4be4c7 100644 --- a/src/arabic/LangAra.gf +++ b/src/arabic/LangAra.gf @@ -1,4 +1,4 @@ ---# -path=.:../abstract:../common:../prelude +--# -path=.:../abstract:../common:../api:../prelude concrete LangAra of Lang = GrammarAra, From 2b1611806302f38ed748cbf91ef46d7f1652a550 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 14 Nov 2018 18:10:28 +0100 Subject: [PATCH 40/78] (Ara) Add new verb paradigm for hollow 8 --- src/arabic/ParadigmsAra.gf | 5 ++++- src/arabic/PatternsAra.gf | 3 +++ src/arabic/ResAra.gf | 22 ++++++++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 2300521f..06b181f3 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -467,7 +467,10 @@ resource ParadigmsAra = open rbT = mkRoot3 rootStr ; v8fun = case rbT.f of { ("و"|"ي"|"ّ") => v8assimilated ; - _ => v8sound } + _ => + case rbT.c of { + #weak => v8hollow ; + _ => v8sound }} } in lin V (v8fun rbT) ; v10 = diff --git a/src/arabic/PatternsAra.gf b/src/arabic/PatternsAra.gf index 1390d67a..23175098 100644 --- a/src/arabic/PatternsAra.gf +++ b/src/arabic/PatternsAra.gf @@ -77,6 +77,9 @@ flags coding=utf8 ; ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ; ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ; ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; + ftical = ftacal ** { m1 = "ْتِ" } ; -- IL hollow VIII + ftAcal = ftacal ** { m1 = "ْتَا" } ; -- IL hollow VIII + ftIcal = ftacal ** { m1 = "ْتِي" } ; -- IL hollow VIII ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ; ttacal = ftacal ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII ttacil = ftacil ** { m1 = "" ; h = "تَّ" } ; ---- IL assimilated VIII diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 28b72591..65f504f4 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -708,6 +708,28 @@ v8assimilated : Root3 -> Verb = --- IL 8a1 muttafaq = "م" + uttafaq } in verb eittafaq euttufiq attafiq uttafaq eittafiq muttafaq; +v8hollow : Root3 -> Verb = -- IL + \Hwj -> + let { + _Htaj = mkHollow ftacal Hwj ; + _HtAj = mkHollow ftAcal Hwj ; + _Htij = mkHollow ftical Hwj ; + _HtIj = mkHollow ftIcal Hwj ; + iHtaj = "اِ" + _Htaj ; -- VPerf Act (Per3 Fem Pl) + iHtAj = "اِ" + _HtAj ; -- VPerf Act _ + uHtij = "اُ" + _Htij ; -- VPerf Pas (Per3 Fem Pl) + uHtIj = "اُ" + _HtIj ; -- VPerf Pas _ + aHtaj = "َ" + _Htaj ; -- VImpf Act (Per2/Per3 Fem Pl) + aHtAj = "َ" + _HtAj ; -- VImpf Act _ + uHtaj = "ُ" + _Htaj ; -- VImpf Pas (Per2/Per3 Fem Pl) + uHtAj = "ُ" + _Htaj ; -- VImpf Pas _ + -- iHtaj again -- VImp Sg Masc / Pl Fem + -- iHtAj again -- VImp Pl Masc / Sg Fem + ppart = "مُ" + _HtAj -- PPart + + } in verbHollow (toDefForms + iHtAj iHtaj uHtIj uHtij aHtAj aHtaj + uHtAj uHtaj iHtAj iHtaj ppart) ; v10sound : Root3 -> Verb = ---- IL 10s -- to be checked \qtl -> let { From 06efa09f93cfab8daf5739c896856d58a7a4f78b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 14 Nov 2018 18:11:10 +0100 Subject: [PATCH 41/78] (Ara) Add UttInterj and an API command mkInterj --- src/arabic/ParadigmsAra.gf | 4 +++- src/arabic/PhraseAra.gf | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 06b181f3..eb81ad02 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -168,6 +168,8 @@ resource ParadigmsAra = open mkAdA : Str -> AdA ; + mkInterj : Str -> Interj ; + --2 Prepositions -- -- A preposition as used for rection in the lexicon, as well as to @@ -641,7 +643,7 @@ resource ParadigmsAra = open mkAdv x = lin Adv (ss x) ; mkAdV x = lin AdV (ss x) ; mkAdA x = lin AdA (ss x) ; - + mkInterj x = lin Interj (ss x) ; dirV2 v = prepV2 v (casePrep acc) ; diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 78c8f947..9bc36fa6 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -10,6 +10,7 @@ concrete PhraseAra of Phrase = CatAra ** open UttQS qs = {s = \\g => qs.s ! QDir} ; 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} ; + UttInterj i = {s = \\g => i.s} ; UttIP ip = {s = \\g => ip.s ! False ! g ! Def ! Nom} ; --IL UttAP ap = {s = ResAra.uttAP ap} ; --IL From 51e1c771c1a035acb83191de75ecd12770f4d6e7 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 14 Nov 2018 18:11:26 +0100 Subject: [PATCH 42/78] (Ara) small bugfixes --- src/arabic/QuestionAra.gf | 2 +- src/arabic/ResAra.gf | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index 9df2234a..c967f261 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -28,7 +28,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA ---- IL guessed -- : IComp -> NP -> QCl QuestIComp ic np = - let vp = kaan (CompNP np) ; + let vp = UseComp (CompNP np) ; 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 ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 65f504f4..48ce8833 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -569,8 +569,15 @@ v1defective_i : Root3 -> Vowel -> Verb = \bqy,vowImpf -> -- IL (conjugation 1d4) v1doubleweak : Root3 -> Verb = \r'y -> let ry = r'y ** {c = ""} ; - vforms : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun - in verbDoubleDef vforms i ; -- sukun in suffixes is removed in verbDoubleDef + vforms_doubleweak : DefForms = \\x => rmSukun (v1DefForms_perfA ry a ! x) ; -- only remove the first sukun + vforms_weak : DefForms = v1DefForms_perfA r'y a ; + vforms = table { 0 => vforms_weak ! 0 ; -- all perfect forms + 1 => vforms_weak ! 1 ; + 2 => vforms_weak ! 2 ; + 3 => vforms_weak ! 3 ; + 4 => vforms_weak ! 4 ; + x => vforms_doubleweak ! x } ; + in verbDoubleDef vforms a ; -- sukun in suffixes is removed in verbDoubleDef patDef1 : Vowel => Pattern = From be42e2015839c903b5b55a7dc42511279281a58a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 15 Nov 2018 16:45:51 +0100 Subject: [PATCH 43/78] (Ara) Add subject case field to VP --- src/arabic/CatAra.gf | 5 +++-- src/arabic/ResAra.gf | 4 +++- src/arabic/VerbAra.gf | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 9879772a..2fda445f 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -13,7 +13,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { SSlash, S = {s : Str} ; QS = {s : QForm => Str} ; - RS = {s : Agr => Case => Str} ; + RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case -- Sentence @@ -79,7 +79,8 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ; V2, V2A = ResAra.Verb2 ; - VV, V2S, V2Q = ResAra.Verb2 ; + VV = ResAra.Verb2 ** {sc : Preposition} ; + V2S, V2Q = ResAra.Verb2 ; V2V, V3 = ResAra.Verb3 ; A = ResAra.Adj ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 48ce8833..15309d1e 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1363,6 +1363,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> VP : Type = { s : PerGenNum => VPForm => Str ; + sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ obj : Obj; pred : Comp; isPred : Bool; --indicates if there is a predicate (xabar) @@ -1382,6 +1383,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> VPImpf m => v.s ! (VImpf m Act pgn); VPImp => v.s ! (VImp gn.g gn.n) }; + sc = noPrep ; obj = emptyObj ; s2 = []; pred = {s = \\_,_ => []} ; @@ -1431,7 +1433,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> subj = np.empty ++ case of { => [] ; -- prodrop if it's not predicative - _ => np.s ! Nom + _ => vp.sc.s ++ np.s ! vp.sc.c } ; } in diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 57cc1719..6fe7c335 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -22,7 +22,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { s = \\pgn,vpf => vvVP.s ! pgn ! vpf ++ vv.c2.s -- أَنْ ++ vp.s ! pgn ! VPImpf Cnj ; - isPred = False + isPred = False ; + sc = vv.sc } ; -- : VS -> S -> VP ; -- say that she runs From b69608bd21c52c874b6f0704f78bfc057d4eb6b9 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 15 Nov 2018 16:46:35 +0100 Subject: [PATCH 44/78] (Ara) New verb paradigm (geminate 7) + clean up CN --- src/arabic/IdiomAra.gf | 4 +++- src/arabic/NounAra.gf | 34 +++++++++++++--------------- src/arabic/ParadigmsAra.gf | 28 ++++++++++++++++------- src/arabic/QuestionAra.gf | 2 +- src/arabic/ResAra.gf | 45 +++++++++++++++++++++++++++++++------ src/arabic/StructuralAra.gf | 2 +- src/arabic/SymbolAra.gf | 6 ++--- src/arabic/VerbAra.gf | 2 +- 8 files changed, 83 insertions(+), 40 deletions(-) diff --git a/src/arabic/IdiomAra.gf b/src/arabic/IdiomAra.gf index 7f43ab64..33c6b7ff 100644 --- a/src/arabic/IdiomAra.gf +++ b/src/arabic/IdiomAra.gf @@ -18,6 +18,8 @@ concrete IdiomAra of Idiom = CatAra ** open -- : NP -> RS -> Cl ; -- it is I who did it --CleftNP np rs = + -- TODO: check page 61 for existentials and clefts /IL + -- : Adv -> S -> Cl ; -- it is here she slept CleftAdv adv s = let comp : Comp = {s = \\_,_ => adv.s ++ s.s} in ---- @@ -31,7 +33,7 @@ concrete IdiomAra of Idiom = CatAra ** open -- 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 = predVP emptyNP (insertStr adv.s (insertObj np (predV copula ** {c2=noPrep}))) ; diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 7929adc0..2df55ad9 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -13,22 +13,20 @@ lin cn.s ! number ! nounState det.d number ! nounCase c det.n det.d ; - adj : NTable -> Case -> Str = \ntable,c -> - ntable ! number - ! (definite ! det.d) -- Indef remains Indef, rest become Def - ! c + adj : Case -> Str = \c -> + cn.s2 ! number + ! (definite ! det.d) -- Indef remains Indef, rest become Def + ! c } in { s = \\c => case cnB4det det.isPron det.isNum det.n det.d of { False => determiner c ++ noun c - ++ adj cn.s2 c - ++ adj cn.adj c + ++ adj c ++ cn.np ! c ; True => noun (cas c) -- deal with possessive suffix ++ determiner c - ++ adj cn.s2 c - ++ adj cn.adj c + ++ adj c ++ cn.np ! c }; a = { pgn = agrP3 cn.h cn.g number; @@ -170,10 +168,7 @@ lin } ; MassNP cn = - {s = \\c => cn.s ! Sg ! Indef ! c - ++ cn.s2 ! Sg ! Indef ! c - ++ cn.np ! c - ++ cn.adj ! Sg ! Indef ! c ; + {s = \\c => cn2str cn Sg Indef c ; a = {pgn = Per3 cn.g Sg ; isPron = False} ; empty = []} ; @@ -190,20 +185,23 @@ lin ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; AdjCN ap cn = cn ** { - adj = \\n,d,c => cn.adj ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c + s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c }; - RelCN cn rs = cn ** {s = \\n,s,c => cn.s ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; + RelCN cn rs = cn ** { + s2 = \\n,s,c => cn.s2 ! n ! s ! c ++ rs.s ! {pgn=Per3 cn.g n ; isPron=False} ! c}; RelNP np rs = np ** {s = \\c => np.s ! c ++ rs.s ! np.a ! c} ; - -- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; - -- - -- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; + + AdvCN, + SentCN = \cn,ss -> cn ** {s2 = \\n,d,c => cn.s2 ! n ! d ! c ++ ss.s} ; + ApposCN cn np = cn ** { np = \\c => cn.np ! c ++ np.s ! c } ; -- : CN -> NP -> CN ; -- house of Paris, house of mine PossNP cn np = cn ** { - s = \\n,_d,c => cn.s ! n ! Const ! c ; + s = \\n,_d,c => cn.s ! n ! Const ! c ; + s2 = \\n,_d,c => cn.s2 ! n ! Const ! c ; np = \\c => cn.np ! c ++ np.s ! Gen }; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index eb81ad02..0900043c 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -218,7 +218,11 @@ resource ParadigmsAra = open v6 : Str -> V ; ---Verb Form VIII 'ifta`ala +--Verb Form VII : tafaa`ala + + v7 : Str -> V ; + +--Verb Form VIII infa`ala v8 : Str -> V ; @@ -266,7 +270,8 @@ resource ParadigmsAra = open mkVV = overload { mkVV : V -> VV = regVV ; mkVV : V -> Str -> VV = c2VV ; - mkVV : V -> Preposition -> VV = prepVV + mkVV : V -> Preposition -> VV = prepVV ; + mkVV : V -> Preposition -> Preposition -> VV = prep2VV } ; mkV2V : overload { mkV2V : V -> Str -> Str -> V2V ; @@ -463,6 +468,13 @@ resource ParadigmsAra = open lock_V = <> }; + v7 = + \rootStr -> + let { + fcl = mkRoot3 rootStr ; + v7fun = v7geminate ; -- TODO add rest + } in lin V (v7fun fcl) ; + v8 = \rootStr -> let { @@ -667,10 +679,10 @@ resource ParadigmsAra = open mkVS v = v ** {lock_VS = <>} ; mkVQ v = v ** {lock_VQ = <>} ; - regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ"} ; - c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep} ; - prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep} ; - + regVV : V -> VV = \v -> lin VV v ** {c2 = mkPreposition "أَنْ" ; sc = noPrep} ; + c2VV : V -> Str -> VV = \v,prep -> regVV v ** {c2 = mkPreposition prep ; sc = noPrep} ; + prepVV : V -> Preposition -> VV = \v,prep -> regVV v ** {c2=prep; sc=noPrep} ; + prep2VV : V -> (_,_ : Preposition) -> VV = \v,p1,p2 -> regVV v ** {c2=p1; sc=p2} ; V0 : Type = V ; ---- V2S, V2V, V2Q, V2A : Type = V2 ; AS, A2S, AV : Type = A ; @@ -715,12 +727,12 @@ formV : (root : Str) -> VerbForm -> V = \s,f -> case f of { FormIV => v4 s ; FormV => v5 s ; FormVI => v6 s ; ---- FormVII => v7 s ; + FormVII => v7 s ; FormVIII => v8 s ; FormX => v10 s } ; param VerbForm = - FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVIII | FormX ; + FormI | FormII | FormIII | FormIV | FormV | FormVI | FormVII | FormVIII | FormX ; } ; diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index c967f261..2a4c69ad 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -71,7 +71,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA IdetCN idet cn = { s = \\isPred,g,s,c => idet.s ! cn.g ! s ! c ++ - cn.s ! idet.n ! Indef ! Gen ; --idaafa + cn2str cn idet.n Indef Gen ; --idaafa a = { pgn = agrP3 NoHum cn.g idet.n ; isPron = False } } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 15309d1e..e503607c 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -137,14 +137,18 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { uttAP : AP -> (Gender => Str) ; uttAP ap = \\g => ap.s ! NoHum ! g ! Sg ! Def ! Nom ; ----IL - CN : Type = Noun ** {adj : NTable ; np : Case => Str}; + CN : Type = Noun ** {np : Case => Str}; - useN : Noun -> CN = \n -> n ** {adj = \\_,_,_ => []; np = \\_ => []} ; + -- All fields of NP + cn2str : CN -> Number -> State -> Case -> Str = \cn,n,s,c -> + cn.s ! n ! s ! c ++ + cn.s2 ! n ! s ! c ++ + cn.np ! c ; + + useN : Noun -> CN = \n -> n ** {np = \\_ => []} ; uttCN : CN -> (Gender => Str) ; - uttCN cn = \\_ => cn.s ! Sg ! Indef ! Bare ++ - cn.s2 ! Sg ! Indef ! Bare ++ - cn.adj ! Sg ! Indef ! Bare ; + uttCN cn = \\_ => cn2str cn Sg Indef Bare ; NumOrdCard : Type = { s : Gender => State => Case => Str ; @@ -689,6 +693,33 @@ v6sound : Root3 -> Verb = mutafAqam = "م" + utafAqam } in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam; +-- v7sound : Root3 -> Verb = -- TODO 7s +-- \fcl -> +-- let { +-- _facal = mkStrong facal fcl ; +-- _facil = mkStrong facil fcl; +-- infacal = "اِنْ" + _facal ; -- VPerf Act +-- ; -- VPerf Pas +-- anfacil = "َنْ" + _facil ; -- VImpf _ Act +-- ; -- VImpf _ Pas +-- ; -- VImp +-- -- VPPart +-- } in +-- verb ; + +v7geminate : Root3 -> Verb = -- IL 7g -- very likely wrong + \fcl -> + let { + _nfacc = "نْ" + mkHollow facc fcl ; + infacal = "اِنْ" + mkStrong facal fcl ; -- VPerf Act -- TODO use another constructor, this is wrong for 3rd person + unfucc = "اُنْ" + mkHollow fucc fcl ; -- VPerf Pas + anfacc = "َ" + _nfacc ; -- VImpf _ Act + unfacc = "ُ" + _nfacc ; -- VImpf _ Pas + infacc = "اِ" + _nfacc ; -- VImp + munfacc = "مُ" +_nfacc -- VPPart + } in + verb infacal unfucc anfacc unfacc infacc munfacc ; + v8sound : Root3 -> Verb = \rbT -> let { @@ -740,8 +771,8 @@ v8hollow : Root3 -> Verb = -- IL v10sound : Root3 -> Verb = ---- IL 10s -- to be checked \qtl -> let { - _staqtal = "َستَ" + mkStrong fcal qtl ; - _staqtil = "َستَ" + mkStrong fcil qtl; + _staqtal = "ستَ" + mkStrong fcal qtl ; + _staqtil = "ستَ" + mkStrong fcil qtl; istaqtal = "اِ" + _staqtal ; -- VPerf Act ustuqtil = "اُسْتُ" + mkStrong fcil qtl; -- VPerf Pas astaqtil = "َ" + _staqtil ; -- VImpf _ Act diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index bb30d905..93349fbb 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -45,7 +45,7 @@ concrete StructuralAra of Structural = CatAra ** in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = ResAra.i_Pron ; in_Prep = mkPrep "فِي" ; - it_Pron = he_Pron ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); + it_Pron = emptyNP ** {s = \\_ => "هَذَا"} ; -- was: it_Pron = mkPron "ِت" "ِت" "ِتس" (Per3 Masc Sg); -- less_CAdv = ss "لسّ" ; many_Det = mkDet "جَمِيع" Pl Const ; -- more_CAdv = ss "مْري" ; diff --git a/src/arabic/SymbolAra.gf b/src/arabic/SymbolAra.gf index 43bf160a..fd1a95cd 100644 --- a/src/arabic/SymbolAra.gf +++ b/src/arabic/SymbolAra.gf @@ -9,18 +9,18 @@ lin FloatPN i = {s = \\c => i.s ; g = Masc ; h = NoHum } ; --IL NumPN i = {s = \\c => uttNum i ! Masc ; g = Masc ; h = NoHum } ; --IL -- CNIntNP cn i = { - -- s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ; + -- s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ; -- a = dummyAgrP3 Sg ; -- } ; --IL TODO: check out some opers regarding state in ResAra. These are just dummy values. CNSymbNP det cn xs = let g = cn.g ; n = sizeToNumber det.n in { - s = \\c => det.s ! NoHum ! g ! c ++ cn.s ! Sg ! Def ! c ++ cn.adj ! n ! Def ! c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments. + s = \\c => det.s ! NoHum ! g ! c ++ cn2str cn n Def c ++ xs.s; ----IL word order?? Seems to be nontrivial according to ResAra comments. a = dummyAgrP3 n ; empty = [] } ; CNNumNP cn i = { - s = \\c => cn.s ! Sg ! Def ! c ++ uttNum i ! Masc ; + s = \\c => cn2str cn Sg Def c ++ uttNum i ! cn.g ; a = dummyAgrP3 Sg ; empty = [] } ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 6fe7c335..8e82368d 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -64,7 +64,7 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { CompAdv a = {s = \\_,_ => a.s ; obj = emptyObj ; isNP = False} ; - CompCN cn = {s = \\agr,c => cn.s ! agr.n ! Indef ! Nom ++ cn.np ! Nom ++ cn.adj ! agr.n ! Indef ! Nom ; + CompCN cn = {s = \\agr,c => cn2str cn agr.n Indef Nom ; obj = emptyObj ; isNP = False} ; CompNP np = {s = \\_,_ => [] ; obj = np ** {s = np.s ! Nom} ; isNP = True} ; -- From 9171a1b6121bfa1cde4f6a6950971991ab9b9b91 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 16 Nov 2018 15:02:18 +0100 Subject: [PATCH 45/78] (Ara) Add DetNP + fix state of num in DetQuantOrd --- src/arabic/NounAra.gf | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 2df55ad9..dd845055 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -25,7 +25,7 @@ lin ++ adj c ++ cn.np ! c ; True => noun (cas c) -- deal with possessive suffix - ++ determiner c + ++ determiner c -- (nounCase c det.n det.d) --?? ++ adj c ++ cn.np ! c }; @@ -42,6 +42,8 @@ lin UsePron p = p ; + DetNP det = emptyNP ** {s = det.s ! NoHum ! Masc} ; ---- + PredetNP pred np = np ** { s = \\c => case pred.isDecl of { True => pred.s!c ++ np.s ! Gen ; -- akvaru l-awlAdi @@ -64,26 +66,15 @@ lin AdvNP np adv = np ** { 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 ** { - s = \\h,g,c => quant.s ! Pl ! h ! g ! c - ++ num.s ! g ! (toDef quant.d num.n) ! c + s = \\h,g,c => let d = toDef quant.d num.n in + quant.s ! Pl ! h ! g ! c + ++ num.s ! g ! d ! c --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; isNum = orB num.isNum ord.isNum ; -- ord may come from OrdDigits or OrdNumeral @@ -172,8 +163,6 @@ lin a = {pgn = Per3 cn.g Sg ; isPron = False} ; empty = []} ; --- MassDet = {s = \\_,_,_,_ => [] ; d = Indef; --- isNum = False; isPron = False} ; UseN, UseN2 = useN ; From 9d59e59387f637ff192ed07955bd60a69c4e321a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 16 Nov 2018 15:02:59 +0100 Subject: [PATCH 46/78] (Ara) Add inherent state field in IDet --- src/arabic/QuestionAra.gf | 5 +++-- src/arabic/ResAra.gf | 6 ++++-- src/arabic/StructuralAra.gf | 6 +++++- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index 2a4c69ad..ee7edaca 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -71,7 +71,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA IdetCN idet cn = { s = \\isPred,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 } } ; @@ -80,6 +80,7 @@ concrete QuestionAra of Question = CatAra ** open ResAra, ParamX, Prelude, VerbA 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 + n = sizeToNumber num.n ; + d = Indef ---- TODO check } ; } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index e503607c..9b80898d 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1368,8 +1368,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> IDet : Type = { s : Gender -- IdetCN needs to choose the gender of the CN - => State => Case => Str ; - n : Number + => State -- Needs to be retained variable for IP; PrepIP chooses the state of IP + => Case => Str ; + n : Number ; + d : State -- in IdetCN, chooses the state of the CN } ; IQuant : Type = { diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 93349fbb..bc7d40c2 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -40,7 +40,11 @@ concrete StructuralAra of Structural = CatAra ** -- here7to_Adv = ss ["تْ هري"] ; -- here7from_Adv = 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 "ِف" ; in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = ResAra.i_Pron ; From a2907a91a5bb6e8a73b39b37fdaaf5cc8e26e861 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 16 Nov 2018 15:03:19 +0100 Subject: [PATCH 47/78] (Ara) Add a paradigm for relative adjectives --- src/arabic/ParadigmsAra.gf | 21 +++++++++++++++------ src/arabic/ResAra.gf | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 0900043c..4209267b 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -76,7 +76,7 @@ resource ParadigmsAra = open --- = 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 --in the interdigitization process of its words @@ -130,16 +130,15 @@ resource ParadigmsAra = open -- Overloaded operator for main cases 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); - mkA : (root : Str) -> A -- forms adjectives with positive form aFCal + mkA : (root : Str) -> A -- adjective with positive form aFCal = \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) ; - -- mkA : (posit,compar,plur : Str) -> A - -- = degrA ; } ; + degrA : (posit,compar,plur : Str) -> A ; --Takes a root string and a pattern string sndA : (root,patt : Str) -> Adj ; @@ -147,6 +146,8 @@ resource ParadigmsAra = open --Takes a root string only clrA : (root : Str) -> Adj ; -- forms adjectives of type aFCal + nisbaA : Str -> Adj ; -- forms relative adjectives by adding the suffix ِيّ + --3 Two-place adjectives -- -- 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 = let { eaHmar = mkWord "أَفعَل" root; HamrA' = mkWord "فَعلاء" root; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 9b80898d..3c3afade 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -966,9 +966,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- determine the declension and gives the corresponding inf table sing : Str -> State => Case => Str = \word -> \\s,c => defArt s (case word of { - lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; - _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; - lemma + "ة" => case s of { + lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ; + lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; + _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; + lemma + "ة" => case s of { Poss => lemma + "ت" + dec1sg ! s ! c ; _ => word + dec1sg ! s ! c } ; @@ -1046,6 +1047,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => "ِي" }; + --declension 3 (ending in alif) dec3sg : State => Case => Str = \\s,c => case of { @@ -1054,6 +1056,15 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => [] }; + --declension 2 (ends in yaa') + decNisba : State => Case => Str = \\s,c => + case of { + <_, Bare> => [] ; + => "اً" ; + => "ٍ" ; + <_, Acc> => "َ" ; + _ => [] + }; --dual suffixes dl : State => Case => Str = From c4f207a541765b9d1625845d095171f2f24ae352 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 16 Nov 2018 16:05:55 +0100 Subject: [PATCH 48/78] (Ara) Fix existential constructions --- src/arabic/IdiomAra.gf | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/arabic/IdiomAra.gf b/src/arabic/IdiomAra.gf index 33c6b7ff..269d2799 100644 --- a/src/arabic/IdiomAra.gf +++ b/src/arabic/IdiomAra.gf @@ -1,6 +1,7 @@ -concrete IdiomAra of Idiom = CatAra ** open +concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra, + VerbAra, ParadigmsAra in { @@ -8,34 +9,32 @@ concrete IdiomAra of Idiom = CatAra ** open lin -- : 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 in predVP it vp ; -- : VP -> Cl ; -- one sleeps - GenericCl = predVP (regNP "المَرْء" Sg) ; + GenericCl = predVP (regNP "المَرْء" Sg) ; -- : NP -> RS -> Cl ; -- it is I who did it - --CleftNP np rs = - - -- TODO: check page 61 for existentials and clefts /IL + --CleftNP np rs = -- : Adv -> S -> Cl ; -- it is here she slept - CleftAdv adv s = - let comp : Comp = {s = \\_,_ => adv.s ++ s.s} in ---- - predVP he_Pron (kaan comp) ; + CleftAdv adv s = + let comp : Comp = CompAdv adv in + predVP he_Pron (UseComp comp) ; -- : NP -> Cl ; -- there is a house 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 -- 7/12/2012 generalizations of these -- : NP -> Adv -> Cl ; -- there is a house in Paris - ExistNPAdv np adv = - predVP emptyNP (insertStr adv.s (insertObj np (predV copula ** {c2=noPrep}))) ; + ExistNPAdv np adv = + predVP (emptyNP ** {s=\\c=>"هُنَاكَ"}) (AdvVP (UseComp (CompNP np)) adv) ; -- IL -- 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" -- : VP -> VP ; -- is at home himself; is himself at home - SelfAdvVP, + SelfAdvVP, SelfAdVVP = \vp -> vp ** { 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) SelfNP np = np ** { - s = let pron : ResAra.NP = np2pron np ; - in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen + s = let pron : ResAra.NP = np2pron np ; + in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen } ; - } - From 5a6fe1e336f183213cde73da854c7edaa10c9205 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 16 Nov 2018 17:21:29 +0100 Subject: [PATCH 49/78] (Ara) Add subordinate clauses --- src/arabic/CatAra.gf | 2 +- src/arabic/ConjunctionAra.gf | 16 +++++++++------- src/arabic/PhraseAra.gf | 2 +- src/arabic/ResAra.gf | 19 ++++++++++--------- src/arabic/SentenceAra.gf | 8 ++++---- src/arabic/StructuralAra.gf | 3 ++- src/arabic/SymbolAra.gf | 2 +- src/arabic/VerbAra.gf | 3 ++- 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 2fda445f..95a53b92 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -11,7 +11,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { -- Tensed/Untensed SSlash, - S = {s : Str} ; + S = {s : Order => Str} ; -- subordinate clause has nominal word order and subject in acc QS = {s : QForm => Str} ; RS = {s : Agr => Case => Str} ; -- case because the relative pronoun inflects in case diff --git a/src/arabic/ConjunctionAra.gf b/src/arabic/ConjunctionAra.gf index c57f029d..0db6abd1 100644 --- a/src/arabic/ConjunctionAra.gf +++ b/src/arabic/ConjunctionAra.gf @@ -3,20 +3,22 @@ concrete ConjunctionAra of Conjunction = lincat - [S], + [S] = {s1,s2 : Order => Str} ; [Adv] = {s1,s2 : Str} ; [NP] = {s1,s2 : Case => Str ; a : Agr ; empty : Str} ; [AP] = {s1,s2 : Species => Gender => Number => State => Case => Str} ; lin - BaseS, + BaseAdv = twoSS ; - ConsS, ConsAdv = consrSS comma ; - ConjS, ConjAdv = conjunctSS ; + BaseS = twoTable Order ; + ConsS = consrTable Order comma ; + ConjS = conjunctTable Order ; + BaseNP x y = twoTable Case x y ** { a = conjAgr x.a y.a ; empty = [] @@ -31,9 +33,9 @@ lin empty = [] } ; - BaseAP x y = twoTable5 Species Gender Number State Case x y ; - ConsAP xs x = consrTable5 Species Gender Number State Case comma xs x ; - ConjAP conj ss = conjunctTable5 Species Gender Number State Case conj ss ; + BaseAP = twoTable5 Species Gender Number State Case ; + ConsAP = consrTable5 Species Gender Number State Case comma ; + ConjAP = conjunctTable5 Species Gender Number State Case ; oper diff --git a/src/arabic/PhraseAra.gf b/src/arabic/PhraseAra.gf index 9bc36fa6..40482e3a 100644 --- a/src/arabic/PhraseAra.gf +++ b/src/arabic/PhraseAra.gf @@ -19,7 +19,7 @@ concrete PhraseAra of Phrase = CatAra ** open UttCN cn = {s = ResAra.uttCN cn } ; --IL UttNP np = {s = \\_ => np.s ! Nom} ; UttVP vp = {s = uttVP vp} ; --IL - UttS, + UttS s = {s = \\_ => s.s ! Verbal} ; UttAdv, UttIAdv = \s -> {s = \\_ => s.s} ; ---- OK? AR -- diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 3c3afade..870d8402 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -27,7 +27,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { Mood = Ind | Cnj | Jus ; Voice = Act | Pas ; Order = Verbal | Nominal - | VOS ; -- Relative clauses with resumptive pronouns + | VOS -- Relative clauses with resumptive pronouns + | Subord ; -- Nominal word order but subject in accusative oper @@ -1293,7 +1294,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> proDrop : NP -> NP = \np -> case np.a.isPron of { - True => np ** {s = \\_ => []}; + True => np ** {s = table {Nom => [] ; x => np.s ! x}}; _ => np } ; @@ -1474,10 +1475,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => vp.pred.s ! gn ! Nom; --xabar marfooc _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; - subj = np.empty - ++ case of { - => [] ; -- prodrop if it's not predicative - _ => vp.sc.s ++ np.s ! vp.sc.c + sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; Dir => 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 @@ -1486,9 +1488,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> True => vp.obj.s ++ subj ; -- obj. clitic attaches directly to the verb False => subj ++ vp.obj.s } ++ 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 } } ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 408b3468..34267a0f 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -66,11 +66,11 @@ concrete SentenceAra of Sentence = CatAra ** open -- UseCl t p cl = - {s = t.s ++ p.s ++ + {s = \\o => t.s ++ p.s ++ case of { --- IL guessed tenses - => cl.s ! Pres ! p.p ! Nominal ; - => cl.s ! Past ! p.p ! Nominal ; - => cl.s ! x ! p.p ! Nominal + => cl.s ! Pres ! p.p ! o ; + => cl.s ! Past ! p.p ! o ; + => cl.s ! x ! p.p ! o } }; diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index bc7d40c2..030e8b45 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -44,7 +44,7 @@ concrete StructuralAra of Structural = CatAra ** s = \\g,s,c => "كَمْ عَدَد" + caseTbl ! c ; n = Pl ; d = Def } ; -- IL - + -- if_Subj = ss "ِف" ; in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = ResAra.i_Pron ; @@ -78,6 +78,7 @@ concrete StructuralAra of Structural = CatAra ** something_NP = regNP "شَيْء" Sg ; -- somewhere_Adv = ss "سْموهري" ; that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def; + that_Subj = ss "أنَّ" ; ----b that_NP = indeclNP "ذَلِكَ" Sg ; there_Adv = ss "هُناك" ; -- there7to_Adv = ss "تهري" ; diff --git a/src/arabic/SymbolAra.gf b/src/arabic/SymbolAra.gf index fd1a95cd..10e2b7bb 100644 --- a/src/arabic/SymbolAra.gf +++ b/src/arabic/SymbolAra.gf @@ -25,7 +25,7 @@ lin empty = [] } ; - SymbS sy = sy ; + SymbS sy = {s = \\_ => sy.s} ; SymbOrd n = {s = \\_,_,_ => n.s ; n = One ; isNum = False } ; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 8e82368d..e07ff791 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -28,7 +28,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { -- : VS -> S -> VP ; -- say that she runs ComplVS vs s = predV vs ** { -- IL - obj = emptyObj ** s } ; + obj = emptyObj ** {s = s.s ! Subord} + } ; -- : VQ -> QS -> VP ; -- wonder who runs ComplVQ vq qs = predV vq ** { -- IL From efebc082fa3f1797e343d9386ea55beccbcb413b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 12:05:50 +0100 Subject: [PATCH 50/78] (Ara) Add SubjS --- src/arabic/AdverbAra.gf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index d6f8eb9f..df61ffc5 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -14,7 +14,8 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { -- AdAdv = cc2 ; -- --- SubjS = cc2 ; + -- : Subj -> S -> Adv ; -- when she sleeps + SubjS subj s = {s = subj.s ++ s.s ! Subord} ; -- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing -- -- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ; From 7a4f43aea21e14df03ef21fea8f0d37bb15c20e1 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 12:06:13 +0100 Subject: [PATCH 51/78] (Ara) Add want_VV --- src/arabic/StructuralAra.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 030e8b45..927ea1b7 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -94,7 +94,7 @@ concrete StructuralAra of Structural = CatAra ** to_Prep = mkPrep "إِلى" ; under_Prep = mkPrep "تَحْتَ" ; -- very_AdA = ss "ثري" ; --- want_VV = P.mkVV (P.regV "وَنت") ; + want_VV = mkVV (mkV "رود" FormIV) ; we_Pron = ResAra.we_Pron ; whatPl_IP = mkIP "ما" "ماذا" Pl ; whatSg_IP = mkIP "ما" "ماذا" Sg ; From 7b51bb66388e4c2f7085d7cee38b6460578d171e Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 12:07:29 +0100 Subject: [PATCH 52/78] (Ara) Added support for preposition contraction: added a "Dat" case --- src/arabic/LexiconAra.gf | 4 ++-- src/arabic/MorphoAra.gf | 2 +- src/arabic/ResAra.gf | 46 ++++++++++++++++++++----------------- src/arabic/StructuralAra.gf | 4 ++-- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 6be7abdf..3b8ad2fd 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -73,7 +73,7 @@ flags door_N = brkN "بوب" "فاع" "أَفعَال" Masc NoHum ; drink_V2 = dirV2 (regV "شَرِب") ; -- drink_V2 = dirV2 (v1 "شرب" i a) ; - easy_A2V = mkA2 (sndA "سهل" "فَعل") "لِ" ; + easy_A2V = mkA2 (sndA "سهل" "فَعل") datPrep ; 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 "حدث") "لِ" "عَن" ; + talk_V3 = mkV3 (v5 "حدث") datPrep (mkPrep "عَن") ; teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö teach_V2 = dirV2 (v2 "علم") ; television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ; diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index b55549b8..5d0a0657 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -34,7 +34,7 @@ flags optimize = all ;--noexpand; case g of { Masc => waHid; Fem => waHida - } in defArt state waHid + word + dec1sg ! state ! c; + } in defArt state c waHid + word + dec1sg ! state ! c; n = num; d = state; isPron = False; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 870d8402..e97354b8 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -18,7 +18,8 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { Number = Sg | Dl | Pl; Gender = Masc | Fem ; Case = Nom | Acc | Gen - | Bare ; -- 1st person poss. suff. overrides case + | Bare -- 1st person poss. suff. overrides case + | Dat ; -- Hack to make the preposition لِ contract Species = NoHum | Hum ; State = Def | Indef | Const | Poss ; -- ة turns into ت @@ -126,6 +127,7 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { } ; noPrep : Preposition = mkPreposition [] Nom ; + datPrep : Preposition = mkPreposition ("لِ" ++ BIND) Dat ; Adj : Type = {s : AForm => Str} ; Adj2 : Type = Adj ** {c2 : Preposition} ; @@ -901,7 +903,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Bare => [] ; Nom => "ُ"; Acc => "َ"; - Gen => "ِ" + _Gen => "ِ" -- dat is the same as gen, except in definite before لِ }; --takes the adjective lemma and gives the Posit table @@ -931,7 +933,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- indeclinable nominal word (mamnuu3 mina S-Sarf) indeclN : Str -> State => Case => Str = - \aHmar -> \\s,c => defArt s aHmar + indecl!c; + \aHmar -> \\s,c => defArt s c aHmar + indecl!c; -- takes 2 words, singular and broken plural, and gives the -- complete noun inflection table @@ -966,7 +968,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- takes a singular or broken plural word and tests the ending to -- determine the declension and gives the corresponding inf table sing : Str -> State => Case => Str = \word -> - \\s,c => defArt s (case word of { + \\s,c => defArt s c (case word of { lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ; lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; @@ -981,7 +983,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> -- 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 -> - \\s,c => defArt s (case caSaA of { + \\s,c => defArt s c (case caSaA of { lemma + ("ا"|"ى") => lemma + "ي" + dl ! s ! c ; lemma + "ة" => lemma + "ت" + dl ! s ! c ; _ => fixShd caSaA (dl ! s ! c) @@ -991,13 +993,13 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> --plural feminine table plurF : Str -> State => Case => Str = \kalima -> - \\s,c => defArt s (mkAt kalima) + f_pl ! s ! c ; + \\s,c => defArt s c (mkAt kalima) + f_pl ! s ! c ; -- takes a singular word and gives the corresponding sound --plural masculine table. FIXME: consider declension 3 plurM : Str -> State => Case => Str = \mucallim -> - \\s,c => defArt s mucallim + m_pl ! s ! c ; + \\s,c => defArt s c mucallim + m_pl ! s ! c ; -- to add the Al prefix for Definite words Al : State => Str = @@ -1006,13 +1008,14 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => "" }; - defArt : State -> Str -> Str = \st,stem -> -- IL -- to be checked + defArt : State -> Case -> Str -> Str = \st,c,stem -> -- IL -- to be checked let al = "ال" in - case st of { - Def => + case of { + => "ل" + stem ; -- only happens before the preposition لِ + => case stem of { - s@#sun + x => fixShd (al + s) ("ّ" + x) ; - x => al + x } ; + s@#sun + x => fixShd (al + s) ("ّ" + x) ; + x => al + x } ; _ => stem }; @@ -1024,7 +1027,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Bare => []; Nom => "ٌ"; Acc => "ً"; - Gen => "ٍ" + _Gen => "ٍ" }; _ => caseTbl --think of ?axU, ?axA, (the five nouns) @@ -1033,8 +1036,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> --indeclinables (mamnuu3 mina S-Sarf) indecl : Case => Str = table { - Gen => "َ" ; - x => caseTbl ! x + (Gen|Dat) => "َ" ; + x => caseTbl ! x }; @@ -1284,9 +1287,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> { s = table { + Nom => ana; Acc => BIND ++ nI; -- object suffix - Gen => BIND ++ I; -- possessive suffix - _ => ana + Gen => BIND ++ I; -- possessive suffix + Dat => I -- will only be used with preposition لِ, which already has a BIND }; a = {pgn = pgn; isPron = True }; empty = [] @@ -1612,16 +1616,16 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> NCard => table { Masc => \\s,c => (sing wAhid) ! s ! c ; --all fem are first declension: - Fem => \\s,c => defArt s wAhida + dec1sg ! s ! c + Fem => \\s,c => defArt s c wAhida + dec1sg ! s ! c }; NOrd => table { - Masc => \\s,c => defArt s awwal + dec1sg ! s ! c; + Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c; Fem => \\s,c => (sing Ula) ! s ! c } }; ten => table { - NCard => \\_,s,c => defArt s wAhid + m_pl ! Indef ! c; - NOrd => \\_,s,c => defArt s awwal + m_pl ! Indef ! c + NCard => \\_,s,c => defArt s c wAhid + m_pl ! Indef ! c; + NOrd => \\_,s,c => defArt s c awwal + m_pl ! Indef ! c } } }; diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 927ea1b7..1015dae3 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -108,8 +108,8 @@ concrete StructuralAra of Structural = CatAra ** => "أيُّ" ; => "أيّاً" ; => "أيَّ" ; - => "أيٍّ" ; - => "أيِّ" + <_Gen,Indef> => "أيٍّ" ; + <_Gen,_> => "أيِّ" } } ; whoSg_IP = mkIP "مَنْ" "مَنْ" Sg ; From fe4bec4e58aa81e9d5b0b5a746342bdb9352802b Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 15:23:37 +0100 Subject: [PATCH 53/78] (Ara) Improve documentation for verb constructors + add reflV --- src/arabic/IdiomAra.gf | 6 ++--- src/arabic/ParadigmsAra.gf | 53 ++++++++++++++------------------------ src/arabic/ResAra.gf | 12 ++++++++- 3 files changed, 32 insertions(+), 39 deletions(-) diff --git a/src/arabic/IdiomAra.gf b/src/arabic/IdiomAra.gf index 269d2799..c46bbadd 100644 --- a/src/arabic/IdiomAra.gf +++ b/src/arabic/IdiomAra.gf @@ -49,14 +49,12 @@ concrete IdiomAra of Idiom = CatAra ** open -- : VP -> VP ; -- is at home himself; is himself at home SelfAdvVP, SelfAdVVP = \vp -> vp ** { - s = \\pgn,vf => let pron : ResAra.NP = pgn2pron pgn in - vp.s ! pgn ! vf ++ refl ! Nom ++ pron.s ! Gen + s = \\pgn,vf => vp.s ! pgn ! vf ++ reflPron Nom pgn } ; -- : NP -> NP ; -- the president himself (is at home) SelfNP np = np ** { - s = let pron : ResAra.NP = np2pron np ; - in \\c => np.s ! c ++ refl ! c ++ pron.s ! Gen + s = \\c => np.s ! c ++ reflPron c (np.a.pgn) } ; } diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 4209267b..d3edb2b3 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -185,51 +185,33 @@ resource ParadigmsAra = open -- Overloaded operations mkV : overload { - mkV : (imperfect : Str) -> V ; + mkV : (imperfect : Str) -> V ; -- The verb in Per3 Sg Masc imperfect tense gives the most information mkV : (root : Str) -> (perf,impf : Vowel) -> V ; -- verb form I ; vowel = a|i|u mkV : (root : Str) -> VerbForm -> V ; -- FormI .. FormX (no VII, IX) ; default vowels a u for I mkV : V -> (particle : Str) -> V -- V with a non-inflecting particle/phrasal verb } ; --- The verb in the imperfect tense gives the most information + -- regV : Str -> V ; - regV : Str -> V ; + reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ ---Verb Form I : fa`ala, fa`ila, fa`ula + v1 : Str -> Vowel -> Vowel -> V ; --Verb Form I : fa`ala, fa`ila, fa`ula - v1 : Str -> Vowel -> Vowel -> V ; + v2 : Str -> V ; --Verb Form II : fa``ala ---Verb Form II : fa``ala + v3 : Str -> V ; --Verb Form III : faa`ala - v2 : Str -> V ; + v4 : Str -> V ; --Verb Form IV : 'af`ala ---Verb Form III : faa`ala + v5 : Str -> V ; --Verb Form V : tafa``ala - v3 : Str -> V ; + v6 : Str -> V ; --Verb Form VI : tafaa`ala ---Verb Form IV : 'af`ala + v7 : Str -> V ; --Verb Form VII : infa`ala - v4 : Str -> V ; + v8 : Str -> V ; --Verb Form VIII ifta`ala ---Verb Form V : tafa``ala - - v5 : Str -> V ; - ---Verb Form VI : tafaa`ala - - v6 : Str -> V ; - ---Verb Form VII : tafaa`ala - - v7 : Str -> V ; - ---Verb Form VIII infa`ala - - v8 : Str -> V ; - --- Verb Form X 'istaf`ala - - v10 : Str -> V ; + v10 : Str -> V ; -- Verb Form X 'istaf`ala --3 Two-place verbs @@ -359,10 +341,11 @@ resource ParadigmsAra = open mkN : N -> (attr : Str) -> N -- Compound nouns = \n,attr -> n ** {s2 = \\n,s,c => attr} ; mkN : N -> N -> N -- Compound nouns - = \n1,n2 -> n1 ** {s2 = - \\n,s,c => n1.s2 ! n ! s ! c - ++ n2.s ! n ! s ! c - ++ n2.s2 ! n ! s ! c} ; + = \n1,n2 -> n1 ** { + s = \\n,_,c => n1.s ! n ! Const ! c ; + s2 = \\n,s,c => n1.s2 ! n ! s ! c + ++ n2.s ! n ! s ! c + ++ n2.s2 ! n ! s ! c} ; } ; dualN : N -> N = \n -> n ** {isDual=True} ; @@ -497,6 +480,8 @@ resource ParadigmsAra = open _ => v10sound } } in lin V (v10fun rbT) ; + reflV v = lin V (ResAra.reflV v) ; + mkFullN nsc gen spec = lin N { s = nsc; --NTable s2 = emptyNTable; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index e97354b8..b644807d 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1354,8 +1354,18 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a = np.a ** {isPron=False} -- hack, sometimes we *don't* want prodrop } ; - refl : Case => Str = \\c => "نَفْس" + caseTbl ! c ; + reflPron : Case -> PerGenNum -> Str = \c,pgn -> + let pron : NP = pgn2pron pgn + in "نَفْس" + caseTbl ! c ++ pron.s ! Gen ; + reflV : Verb -> Verb = \v -> v ** { + s = \\vf => case vf of { + VPerf _ pgn => v.s ! vf ++ reflPron Acc pgn ; + VImpf _ _ pgn => v.s ! vf ++ reflPron Acc pgn ; + VImp g n => v.s ! vf ++ reflPron Acc (Per2 g n) ; + VPPart => v.s ! vf ++ reflPron Acc (Per3 Masc Sg) ---- + } + } ; ----------------------------------------------------------------------------- -- IP, questions From 7b520280d7ac1e3c3e62112d568ab0ebd1b09ee6 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 15:23:54 +0100 Subject: [PATCH 54/78] (Ara) adverbs --- src/arabic/AdverbAra.gf | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index df61ffc5..d10d2ac4 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -2,22 +2,24 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { flags coding=utf8; lin + PositAdvAdj a = {s = a.s ! APosit Masc Sg Indef Acc} ; --- ComparAdvAdj cadv a np = { --- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen --- } ; --- ComparAdvAdjS cadv a s = { --- s = cadv.s ++ a.s ! AAdv ++ "تهَن" ++ s.s --- } ; + -- ComparAdvAdj cadv a np = { + -- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ np.s ! Gen + -- } ; + -- ComparAdvAdjS cadv a s = { + -- s = cadv.s ++ a.s ! AAdv ++ "مِنْ" ++ s.s + -- } ; PrepNP prep np = {s = prep.s ++ np.s ! prep.c} ; --- AdAdv = cc2 ; --- - -- : Subj -> S -> Adv ; -- when she sleeps - SubjS subj s = {s = subj.s ++ s.s ! Subord} ; + AdAdv ad av = cc2 av ad ; + + -- : Subj -> S -> Adv ; -- when she sleeps + SubjS subj s = {s = subj.s ++ s.s ! Subord} ; + -- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing --- --- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ; --- + + AdnCAdv cadv = {s = cadv.s ++ "مِنْ"} ; + } From f1a88574b80c72d9b79ea72199105ae9aa7fff27 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 15:41:11 +0100 Subject: [PATCH 55/78] (Ara) Fix orthographical rules for indefinite accusative --- src/arabic/ResAra.gf | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index b644807d..dfdd97f5 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -972,9 +972,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> lemma + "ِيّ" => fixShd word (decNisba ! s ! c) ; lemma + "ِي" => fixShd lemma (dec2sg ! s ! c) ; _ + ("ا"|"ى") => fixShd word (dec3sg ! s ! c) ; + lemma + ("ء"|"أ"|"ئ"|"ؤ") => word + dec1sgNoDoubleAlif ! s ! c ; lemma + "ة" => case s of { Poss => lemma + "ت" + dec1sg ! s ! c ; - _ => word + dec1sg ! s ! c + _ => word + dec1sgNoDoubleAlif ! s ! c } ; _ => fixShd word (dec1sg ! s ! c) }) ; @@ -1026,13 +1027,20 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> table { Bare => []; Nom => "ٌ"; - Acc => "ً"; + Acc => "اً"; _Gen => "ٍ" }; _ => caseTbl --think of ?axU, ?axA, (the five nouns) }; + -- if a word ends in ء or ة, don't add alif for indef acc. + dec1sgNoDoubleAlif : State => Case => Str = \\s,c => + case of { + => "ً" ; + _ => dec1sg ! s ! c + }; + --indeclinables (mamnuu3 mina S-Sarf) indecl : Case => Str = table { @@ -1287,7 +1295,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> { s = table { - Nom => ana; + (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 @@ -1481,7 +1489,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> <_, Past, Pos> => kataba ; <_, Past, Neg> => "لَمْ" ++ yaktub ; <_, Cond, _ > => yaktuba ; - <_, Fut, Pos> => "سَ" ++ yaktubu ; + <_, Fut, Pos> => glue "سَ" yaktubu ; <_, Fut, Neg> => "لَنْ" ++ yaktuba }; pred : ParamX.Tense -> Polarity -> Str = @@ -1626,7 +1634,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> NCard => table { Masc => \\s,c => (sing wAhid) ! s ! c ; --all fem are first declension: - Fem => \\s,c => defArt s c wAhida + dec1sg ! s ! c + Fem => \\s,c => defArt s c wAhida + dec1sgNoDoubleAlif ! s ! c }; NOrd => table { Masc => \\s,c => defArt s c awwal + dec1sg ! s ! c; From 9e5cbb35fdb73bed43ecd8b6eb51a9b24dd0b5dd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 19 Nov 2018 17:00:06 +0100 Subject: [PATCH 56/78] (Ara) Add AdVVPSlash --- src/arabic/VerbAra.gf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index e07ff791..83323dc6 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -52,7 +52,8 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { AdvVP vp adv = insertStr adv.s vp ; --- AdVVP adv vp = insertAdV adv.s vp ; + AdVVP adv = insertStr adv.s ; + AdVVPSlash adv vps = vps ** insertStr adv.s vps ; -- -- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; -- From 97c9152acbcaf1402f69e17b684b57780078eabc Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 19 Nov 2018 14:32:47 -0200 Subject: [PATCH 57/78] (travis) fix build script so that it can actually fail --- .travis.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1e4a560b..8f654852 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,8 @@ before_install: - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then alias gf='gf.exe' && alias runghc='runghc.exe' ; fi script: - - runghc Make.hs build prelude all --verbose ; rm -rf dist - - bash Make.sh --dest=dist-bash --verbose ; rm -rf dist + - runghc Make.hs build prelude all --verbose + - rm -rf dist + - bash Make.sh --dest=dist-bash --verbose + - rm -rf dist - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then cmd //c Make.bat --dest=dist-bat --verbose ; fi From 00f9a1be49b1232fa853b3b4d616c203cca06195 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 20 Nov 2018 09:34:30 +0100 Subject: [PATCH 58/78] (Ara) Fix formatting in documentation --- src/arabic/ParadigmsAra.gf | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index d3edb2b3..c029fba2 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -114,7 +114,7 @@ resource ParadigmsAra = open mkN2 : overload { mkN2 : N -> Preposition -> N2 ; -- ready-made preposition - mkN2 : (mother : N) -> (of_ : Str) -> N2 ; -- preposition given as a string + mkN2 : N -> Str -> N2 ; -- preposition given as a string mkN2 : N -> N2 ; -- no preposition mkN2 : Str -> N2 ; -- no preposition, predictable inflection } ; @@ -195,21 +195,21 @@ resource ParadigmsAra = open reflV : V -> V ; -- نَفْس in the proper case and with possessive suffix, e.g. نَفْسَكِ - v1 : Str -> Vowel -> Vowel -> V ; --Verb Form I : fa`ala, fa`ila, fa`ula + v1 : Str -> Vowel -> Vowel -> V ; -- Verb Form I : fa`ala, fa`ila, fa`ula - v2 : Str -> V ; --Verb Form II : fa``ala + v2 : Str -> V ; -- Verb Form II : fa``ala - v3 : Str -> V ; --Verb Form III : faa`ala + v3 : Str -> V ; -- Verb Form III : faa`ala - v4 : Str -> V ; --Verb Form IV : 'af`ala + v4 : Str -> V ; -- Verb Form IV : 'af`ala - v5 : Str -> V ; --Verb Form V : tafa``ala + v5 : Str -> V ; -- Verb Form V : tafa``ala - v6 : Str -> V ; --Verb Form VI : tafaa`ala + v6 : Str -> V ; -- Verb Form VI : tafaa`ala - v7 : Str -> V ; --Verb Form VII : infa`ala + v7 : Str -> V ; -- Verb Form VII : infa`ala - v8 : Str -> V ; --Verb Form VIII ifta`ala + v8 : Str -> V ; -- Verb Form VIII ifta`ala v10 : Str -> V ; -- Verb Form X 'istaf`ala From 47bcbe73f621b6d3e2146a4184fcf9fc6b544ce2 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 20 Nov 2018 14:09:15 +0100 Subject: [PATCH 59/78] (Ara) Add two new verb paradigms --- src/arabic/ParadigmsAra.gf | 8 ++++--- src/arabic/PatternsAra.gf | 12 +++++++++- src/arabic/ResAra.gf | 45 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 4 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index c029fba2..d7868cb9 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -419,6 +419,7 @@ resource ParadigmsAra = open let root : Root3 = mkRoot3 rootStr ; verb : Verb = case rootStr of { ? + #hamza + #weak => v4doubleweak root ; + ? + #weak + ? => v4hollow root ; _ + #weak => v4defective root ; _ => v4sound root } ; in lin V verb ; @@ -475,9 +476,10 @@ resource ParadigmsAra = open \rootStr -> let { rbT = mkRoot3 rootStr ; - v10fun = case rbT.c of { - ("و"|"ي") => v10hollow ; - _ => v10sound } + v10fun : Root3 -> Verb = case rootStr of { + ? + #weak + ? => v10hollow ; + ? + ? + #weak => v10defective ; + _ => v10sound } } in lin V (v10fun rbT) ; reflV v = lin V (ResAra.reflV v) ; diff --git a/src/arabic/PatternsAra.gf b/src/arabic/PatternsAra.gf index 23175098..8fa311af 100644 --- a/src/arabic/PatternsAra.gf +++ b/src/arabic/PatternsAra.gf @@ -35,9 +35,13 @@ flags coding=utf8 ; fuci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِ" } ; fucu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُ" } ; fUc = { h = "" ; m1 = "ُو"; m2 = ""; t = "" } ; - ufAc = { h = "ُ" ; m1 = "َا"; m2 = ""; t = "" } ; ufca = { h = "ُ" ; m1 = "ْ" ; m2 = ""; t = "َ" } ; + eafAc = fAc ** { h = "أَ" } ; + eafac = fac ** { h = "أَ" } ; + eafIc = fIc ** { h = "أَ" } ; + eafic = fic ** { h = "أَ" } ; + eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ; eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ; eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ; @@ -47,6 +51,12 @@ flags coding=utf8 ; eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + eufic = fic ** { h = "أُ" } ; + eufIc = fIc ** { h = "أُ" } ; + ufic = fic ** { h = "ُ" } ; + ufIc = fIc ** { h = "ُ" } ; + ufac = fac ** { h = "ُ" } ; + ufAc = fAc ** { h = "ُ" } ; euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ; euttucil = euftucil ** { h = "اُتُّ" ; m1 = "ِ" } ; ---- IL assimilated VIII afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index dfdd97f5..01f764c8 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -649,6 +649,28 @@ v4sound : Root3 -> Verb = } in verb eaqnac euqnic uqnic uqnac eaqnic muqnac; +v4hollow : Root3 -> Verb = + \rwd -> + let { + earad = mkHollow eafac rwd ; -- VPerf Act (Per3 Fem Pl) etc. + earAd = mkHollow eafAc rwd ; -- VPerf Act + eurid = mkHollow eufic rwd ; -- VPerf Pas (Per3 Fem Pl) etc. + eurId = mkHollow eufIc rwd ; -- VPerf Pas + + urid = mkHollow ufic rwd ; -- VImpf Act (Per2/Per3 Fem Pl) + urId = mkHollow ufIc rwd ; -- VImpf Act + urad = mkHollow ufac rwd ; -- VImpf Pas (Per2/Per3 Fem Pl) + urAd = mkHollow ufAc rwd ; -- VImpf Pas + + earid = mkHollow eafic rwd ; -- VImp (Sg Masc / Pl Fem) + earId = mkHollow eafIc rwd ; -- VImp (Pl Masc / Sg Fem) + + ppart = "م" + urAd ; + + } in verbHollow (toDefForms + earAd earad eurId eurid + urId urid urAd urad + earId earid ppart) ; v4DefForms : Root3 -> DefForms = \cTy -> let { @@ -808,6 +830,29 @@ v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked istaxAf istaxaf ustuxIf ustuxif astaxIf astaxif ustaxAf ustaxaf istaxif istaxIf ppart) ; +v10defective : Root3 -> Verb = -- IL + \lqy -> + let { + _stalqa = "سْتَ" + mkDefective fca lqy ; + _stalqu = "سْتَ" + mkDefective fcu lqy ; + _stalqi = "سْتَ" + mkDefective fci lqy ; + _stulqi = "سْتُ" + mkDefective fci lqy ; + + istalqa = "اِ" + _stalqa ; -- VPerf Act (Per3 Masc Sg) + istalqay = "اِسْتَ" + mkStrong fcal lqy ; -- VPerf Act (Per3 Fem Pl) + ustulqi = "اُ" + _stulqi; -- VPerf Pas (Per3 _ _) + + astalqu = "َ" + _stalqu ; -- VImpf Act (Per2/3 Masc Pl) + astalqi = "َ" + _stalqi ; -- VImpf Act _ + ustalqa = "ُ" + _stalqa ; -- VImpf Pas _ + istalqi = "اِ" + _stalqi; -- VImp (Masc Sg / Fem _) + istalqu = "اِ" + _stalqu; -- VImp Masc Pl + mustalqin = "مُ" + _stalqi + "ت" ; + + } in verbDef (toDefForms + istalqa istalqay ustulqi ustulqi ustulqi + astalqi astalqu ustalqa istalqi istalqu mustalqin) i ; + patV1Perf : Vowel => Pattern = table { a => facal ; --katab From b174bba3a9ee5113488b6d51a06eac33bed3bf81 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 20 Nov 2018 14:10:49 +0100 Subject: [PATCH 60/78] (Ara) V2V and related functions --- src/arabic/CatAra.gf | 5 +++-- src/arabic/MissingAra.gf | 2 -- src/arabic/ParadigmsAra.gf | 4 ++-- src/arabic/ResAra.gf | 9 ++++++--- src/arabic/VerbAra.gf | 27 +++++++++++++++++++++++---- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 95a53b92..1902bfac 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -79,9 +79,10 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ; V2, V2A = ResAra.Verb2 ; - VV = ResAra.Verb2 ** {sc : Preposition} ; + VV = ResAra.Verb2 ** {sc : Preposition} ; -- c2 is for verb V2S, V2Q = ResAra.Verb2 ; - V2V, V3 = ResAra.Verb3 ; + V3 = ResAra.Verb3 ; + V2V = ResAra.Verb3 ** {sc : Preposition} ; -- c3 is for verb, c2 is for dir.obj A = ResAra.Adj ; A2 = ResAra.Adj2 ; diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index 9bfd3c3e..d95c8691 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -36,8 +36,6 @@ oper Slash2V3 : V3 -> NP -> VPSlash = notYet "Slash2V3" ; 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 SlashVS : NP -> VS -> SSlash -> ClSlash = notYet "SlashVS" ; oper SubjS : Subj -> S -> Adv = notYet "SubjS" ; oper VocNP : NP -> Voc = notYet "VocNP" ; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index d7868cb9..5315286f 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -688,9 +688,9 @@ resource ParadigmsAra = open mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ; mkV2V = overload { mkV2V : V -> Str -> Str -> V2V = \v,p,q -> - lin V2V (prepV3 v (mkPreposition p) (mkPreposition q)) ; + lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ; mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q -> - lin V2V (prepV3 v p q) ; + lin V2V (prepV3 v p q ** {sc = noPrep}) ; mkV2V : VV -> Preposition -> V2V = \vv,p -> lin V2V (vv ** {c2 = p ; c3 = vv.c2}) ; } ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 01f764c8..b0512f9f 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1583,7 +1583,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> emptyObj : Obj = emptyNP ** {s=[]} ; insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** - { obj = {s = vp.obj.s ++ vp.c2.s ++ np.s ! vp.c2.c ; a = np.a} }; + { obj = {s = vp.obj.s -- old object, if there was one + ++ vp.c2.s ++ np.s ! vp.c2.c -- new object + ++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V + a = np.a} }; insertPred : Comp -> VP -> VP = \p,vp -> vp ** { pred = p; @@ -1601,11 +1604,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> ----------------------------------------------------------------------------- -- Slash categories - VPSlash : Type = VP ** {c2 : Preposition} ; + VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ; ClSlash : Type = VPSlash ** {subj : NP} ; slashV2 : Verb2 -> VPSlash = \v -> - predV v ** {c2 = v.c2} ; + predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ; -- Add subject string, fix agreement to the subject, -- but keep the structure as VP, because later on diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 83323dc6..aa68506a 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -7,12 +7,31 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { SlashVV vv vps = vps ** predV vv ; ----IL - -- TODO: --c3 is for verb, c2 is for dir.obj - --SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go - --SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + -- : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2V v2v vp = let v2vVP = predV v2v in -- IL + vp ** { + s = v2vVP.s ; + agrObj = \\pgn => v2v.c3.s -- أَنْ + ++ vp.s ! pgn ! VPImpf Cnj ; + isPred = False ; + c2 = v2v.c2 ; -- for the direct object + sc = v2v.sc + } ; + + -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP v2v np vps = let v2vVP = predV v2v in -- IL + vps ** { + s = \\pgn,vpf => v2vVP.s ! pgn ! vpf + ++ v2v.c2.s ++ np.s ! v2v.c2.c + ++ v2v.c3.s -- أَنْ + ++ vps.s ! pgn ! VPImpf Cnj ; + isPred = False ; + -- preposition for the direct object comes from VP + sc = v2v.sc + } ; SlashV2a = slashV2 ; - Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3}; + Slash3V3 v np = insertObj np (slashV2 v) ** {c2 = v.c3 ; agrObj = \\_ => []}; ComplSlash vp np = insertObj np vp ; From b63da6573e6edb1e1b63257d2ad25de31244538a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 20 Nov 2018 14:11:15 +0100 Subject: [PATCH 61/78] (Ara) Formatting + small typofixes --- src/arabic/ResAra.gf | 91 +++++++++++++++++++------------------ src/arabic/StructuralAra.gf | 2 +- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index b0512f9f..8fb6ff66 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -112,10 +112,10 @@ resource ResAra = PatternsAra ** open Prelude, Predef, OrthoAra, ParamX in { emptyNTable : NTable = \\n,s,c => [] ; Preposition : Type = {s : Str ; c : Case} ; - Noun : Type = { - s,s2 : NTable ; - g : Gender ; - h : Species ; + Noun : Type = { + s,s2 : NTable ; + g : Gender ; + h : Species ; isDual : Bool -- whether it takes dual instead of plural: eyes, twins, ... } ; Noun2 : Type = Noun ** {c2 : Preposition} ; @@ -771,7 +771,7 @@ v8assimilated : Root3 -> Verb = --- IL 8a1 muttafaq = "م" + uttafaq } in verb eittafaq euttufiq attafiq uttafaq eittafiq muttafaq; -v8hollow : Root3 -> Verb = -- IL +v8hollow : Root3 -> Verb = -- IL \Hwj -> let { _Htaj = mkHollow ftacal Hwj ; @@ -793,7 +793,7 @@ v8hollow : Root3 -> Verb = -- IL } in verbHollow (toDefForms iHtAj iHtaj uHtIj uHtij aHtAj aHtaj uHtAj uHtaj iHtAj iHtaj ppart) ; -v10sound : Root3 -> Verb = ---- IL 10s -- to be checked +v10sound : Root3 -> Verb = -- IL 10s -- to be checked \qtl -> let { _staqtal = "ستَ" + mkStrong fcal qtl ; @@ -807,7 +807,7 @@ v10sound : Root3 -> Verb = ---- IL 10s -- to be checked } in verb istaqtal ustuqtil astaqtil astaqtal istaqtil mustaqtal ; -v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked +v10hollow : Root3 -> Verb = -- IL 10h -- to be checked \xwf -> let { _staxaf = "سْتَ" + mkHollow fac xwf ; @@ -826,7 +826,7 @@ v10hollow : Root3 -> Verb = ---- IL 10h -- to be checked ustaxAf = "ُ" + _staxAf ; -- VImpf Pas _ ppart = "مُ" + _staxIf -- PPart ("weird anomalies" here too?) - } in verbHollow (toDefForms + } in verbHollow (toDefForms istaxAf istaxaf ustuxIf ustuxif astaxIf astaxif ustaxAf ustaxaf istaxif istaxIf ppart) ; @@ -1079,7 +1079,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; - -- if a word ends in ء or ة, don't add alif for indef acc. + -- if a word ends in ء or ة, don't add alif for indef acc. dec1sgNoDoubleAlif : State => Case => Str = \\s,c => case of { => "ً" ; @@ -1274,7 +1274,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } }; - gn2pgn : {g : Gender; n : Number} -> PerGenNum = \gn -> + gn2pgn : {g : Gender; n : Number} -> PerGenNum = \gn -> case gn of { {g = gn; n = nm} => Per3 gn nm } ; -- these are chosen in many places, trying to be consistent @@ -1349,33 +1349,36 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> empty = [] }; - proDrop : NP -> NP = \np -> + proDrop : NP -> NP = \np -> case np.a.isPron of { - True => np ** {s = table {Nom => [] ; x => np.s ! x}}; + True => np ** {s = table {Nom => [] ; x => np.s ! x}}; _ => np } ; - + emptyNP : NP = { - s = \\_ => [] ; + s = \\_ => [] ; a = {pgn = Per3 Masc Sg ; isPron = False} ; empty = [] } ; agrNP : Agr -> NP = \agr -> emptyNP ** {a = agr} ; - i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ; - youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; - youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ; - youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ; - youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ; - he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; - she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; + i_Pron : NP = mkPron "أَنَا" "نِي" "ي" (Per1 Sing) ; we_Pron : NP = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; - youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; - youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Sg) ; - theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; - theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ; + + youSgMasc_Pron : NP = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; + youSgFem_Pron : NP = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ; + youDlMasc_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Masc Dl) ; + youDlFem_Pron : NP = mkPron "أَنتُمَا" "كُمَا" "كُمَا" (Per2 Fem Dl) ; + youPlMasc_Pron : NP = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Pl) ; + youPlFem_Pron : NP = mkPron "أَنتُنَّ" "كُنَّ" "كُنَّ" (Per2 Fem Pl) ; + + he_Pron : NP = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; + she_Pron : NP = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; theyDlMasc_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Masc Dl) ; - theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ; + theyDlFem_Pron : NP = mkPron "هُمَا" "هُمَا" "هُمَا" (Per3 Fem Dl) ; + theyMasc_Pron : NP = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; + theyFem_Pron : NP = mkPron "هُنَّ" "هُنَّ" "هُنَّ" (Per3 Fem Pl) ; + -- Used e.g. to encode the subject as an object clitic -- or to find a possessive suffix corresponding to the NP. @@ -1385,7 +1388,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> False => pgn2pron np.a.pgn } ; - pgn2pron : PerGenNum -> NP = \pgn -> + pgn2pron : PerGenNum -> NP = \pgn -> case pgn of { Per1 Sing => i_Pron ; Per1 Plur => we_Pron ; @@ -1400,7 +1403,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Per3 Fem Dl => theyDlFem_Pron ; Per3 Masc Dl => theyDlMasc_Pron ; Per3 Fem Pl => theyFem_Pron ; - Per3 Masc Pl => theyMasc_Pron + Per3 Masc Pl => theyMasc_Pron } ; pron2np : NP -> NP = \np -> np ** { @@ -1430,25 +1433,25 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> a : Agr -- can be both subject and object of a QCl, needs full agr. info (stupid given that s depends on gender but meh) } ; - mkIP = overload { + mkIP = overload { mkIP : Str -> Number -> IP = \maa,n -> { - s = \\_p,_g,_s,_c => maa ; + s = \\_p,_g,_s,_c => maa ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } } ; mkIP : (_,_ : Str) -> Number -> IP = \maa,maadhaa,n -> { - s = table { True => \\_g,_s,_c => maa ; - False => \\_g,_s,_c => maadhaa } ; + s = table { True => \\_g,_s,_c => maa ; + False => \\_g,_s,_c => maadhaa } ; a = { pgn = agrP3 NoHum Masc n ; isPron = False } - } + } } ; ip2np : IP -> Bool -> NP = \ip,isPred -> ip ** { s = ip.s ! isPred ! Masc ! Def ; empty = [] } ; np2ip : NP -> IP = \np -> np ** {s = \\_,_,_ => np.s} ; - + IDet : Type = { s : Gender -- IdetCN needs to choose the gender of the CN => State -- Needs to be retained variable for IP; PrepIP chooses the state of IP - => Case => Str ; + => Case => Str ; n : Number ; d : State -- in IdetCN, chooses the state of the CN } ; @@ -1483,7 +1486,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; uttVP : VP -> (Gender=>Str) = \vp -> - \\g => vp.s ! Per3 g Sg ! VPPerf + \\g => vp.s ! Per3 g Sg ! VPPerf ++ vp.obj.s ++ vp.pred.s ! {n = Sg ; g = g} ! Nom ++ vp.s2 ; @@ -1503,7 +1506,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> }; passPredV : Verb -> VP = \v -> - let actVP = predV v in actVP ** { + let actVP = predV v in actVP ** { s = \\pgn,vf => case vf of { VPPerf => v.s ! (VPerf Pas pgn) ; @@ -1543,7 +1546,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob }; sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; Dir => vp.sc} ; - subj = np.empty ++ sc.s + 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 @@ -1552,11 +1555,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } 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 + 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 + Nominal|Subord => subj ++ vStr t p ++ vp.obj.s ++ vp.s2 ++ pred t p } } ; @@ -1616,11 +1619,11 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> predVPSlash : NP -> VPSlash -> ClSlash = \np,v -> v ** { subj = np } ; - + complClSlash = overload { complClSlash : NP -> ClSlash -> Cl = \obj,cls -> predVP cls.subj (insertObj obj cls) ; - complClSlash : ClSlash -> Cl = \cls -> + complClSlash : ClSlash -> Cl = \cls -> predVP cls.subj (insertObj emptyNP cls) -- Empty subject and object } ; @@ -1630,7 +1633,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> ----------------------------------------------------------------------------- -- Relative - param + param RAgr = RSg Gender | RPl Gender | RDl Gender Case ; oper @@ -1675,7 +1678,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> \wAhid,awwal,Ula -> let wAhida : Str = case wAhid of { x + "ة" => mkAt wAhid ; - _ => wAhid + "َة" } + _ => wAhid + "َة" } in { s= table { unit => table { diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 1015dae3..4502cba1 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -120,7 +120,7 @@ concrete StructuralAra of Structural = CatAra ** yes_Utt = {s = \\_ => "نَعَم"} ; youSg_Pron = youSgMasc_Pron ; youPl_Pron = youPlMasc_Pron ; - youPol_Pron = youSgFem_Pron ; -- arbitrary? + youPol_Pron = youPlFem_Pron ; -- arbitrary? have_V2 = dirV2 (regV "يَملِك") ; From d6310e2a8b9c62a0b495468347368252c663888d Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 20 Nov 2018 15:47:47 +0100 Subject: [PATCH 62/78] (Ara) Add AdjOrd + AdvS --- src/arabic/AdjectiveAra.gf | 2 ++ src/arabic/MissingAra.gf | 3 --- src/arabic/SentenceAra.gf | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/arabic/AdjectiveAra.gf b/src/arabic/AdjectiveAra.gf index 20988aea..93c64a42 100644 --- a/src/arabic/AdjectiveAra.gf +++ b/src/arabic/AdjectiveAra.gf @@ -44,4 +44,6 @@ concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in { s = \\h,g,n,d,c => a.s ! AComp d c }; + -- : Ord -> AP ; -- warmest + AdjOrd ord = {s = \\h,g,n,s,c => ord.s ! g ! s ! c} ; } diff --git a/src/arabic/MissingAra.gf b/src/arabic/MissingAra.gf index d95c8691..e714eb0e 100644 --- a/src/arabic/MissingAra.gf +++ b/src/arabic/MissingAra.gf @@ -3,11 +3,8 @@ resource MissingAra = open GrammarAra, Prelude in { -- temporary definitions to enable the compilation of RGL API oper AdAdv : AdA -> Adv -> Adv = notYet "AdAdv" ; oper AdVVP : AdV -> VP -> VP = notYet "AdVVP" ; -oper AdjOrd : Ord -> AP = notYet "AdjOrd" ; oper AdnCAdv : CAdv -> AdN = notYet "AdnCAdv" ; -oper AdvCN : CN -> Adv -> CN = notYet "AdvCN" ; oper AdvIAdv : IAdv -> Adv -> IAdv = notYet "AdvIAdv" ; -oper AdvS : Adv -> S -> S = notYet "AdvS" ; oper BaseRS : RS -> RS -> ListRS = notYet "BaseRS" ; oper CAdvAP : CAdv -> AP -> NP -> AP = notYet "CAdvAP" ; oper CleftNP : NP -> RS -> Cl = notYet "CleftNP" ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index 34267a0f..a46854c1 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -86,4 +86,6 @@ concrete SentenceAra of Sentence = CatAra ** open UseRCl t p cl = {s = \\agr,c => t.s ++ p.s ++ cl.s ! t.t ! p.p ! agr ! c} ; UseSlash t p cl = UseCl t p (complClSlash cl) ; + + AdvS adv s = s ** {s = \\o => adv.s ++ s.s ! o} ; } From 45df74b36b77b6f57a4d259ae855021705ef934a Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 21 Nov 2018 16:02:10 +0100 Subject: [PATCH 63/78] (Ara) Renaming and consistency with prepositions --- src/arabic/LexiconAra.gf | 4 ++-- src/arabic/ResAra.gf | 16 ++++++++++++---- src/arabic/StructuralAra.gf | 7 ++++--- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/arabic/LexiconAra.gf b/src/arabic/LexiconAra.gf index 3b8ad2fd..ca5571cf 100644 --- a/src/arabic/LexiconAra.gf +++ b/src/arabic/LexiconAra.gf @@ -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 ; diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 8fb6ff66..497caa97 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -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 = [] diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 4502cba1..7ae7afd3 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -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 "سْ" ; From 473f6ae05be89b8859d7826aa85cb82d4b47f8cd Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 21 Nov 2018 16:04:55 +0100 Subject: [PATCH 64/78] (Ara) Small fixes + comments --- src/arabic/QuestionAra.gf | 2 +- src/arabic/RelativeAra.gf | 2 +- src/arabic/ResAra.gf | 6 +++--- src/arabic/SentenceAra.gf | 6 +++--- src/arabic/VerbAra.gf | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/arabic/QuestionAra.gf b/src/arabic/QuestionAra.gf index ee7edaca..e6bcf6a6 100644 --- a/src/arabic/QuestionAra.gf +++ b/src/arabic/QuestionAra.gf @@ -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 ; diff --git a/src/arabic/RelativeAra.gf b/src/arabic/RelativeAra.gf index 9c764ade..25f1fe64 100644 --- a/src/arabic/RelativeAra.gf +++ b/src/arabic/RelativeAra.gf @@ -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 diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 497caa97..d1d74c9d 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1553,7 +1553,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => 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 @@ -1588,8 +1588,8 @@ 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 emptyObj : Obj = emptyNP ** {s=[]} ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index a46854c1..e6c7fbdc 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -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 }; -- diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index aa68506a..c0e0b7e9 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -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) ; From e911ad7cb3afdfbbd89869cfacaa71f7448be0a8 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 21 Nov 2018 16:20:44 +0100 Subject: [PATCH 65/78] (Ara) replace NP with just its string and isPron:Bool for ClSlash --- src/arabic/ResAra.gf | 47 ++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index d1d74c9d..0311148c 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1559,18 +1559,34 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> 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 of { + => 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 -> @@ -1591,6 +1607,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> 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 ** @@ -1616,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 = \\_ => []} ; @@ -1625,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} ; From 6b91d8409a87826e533e1568693f1a68c9c5b058 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Wed, 21 Nov 2018 16:31:36 +0100 Subject: [PATCH 66/78] (Ara) Force inherently dual nouns to dual only with a plural determiner --- src/arabic/NounAra.gf | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index dd845055..a674b884 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -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 -> From 570d347efe7e8fdd21547598effee76894b1da59 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Thu, 22 Nov 2018 16:09:11 +0100 Subject: [PATCH 67/78] (Ara) Various fixes with nouns, compounding, attributes etc. --- src/arabic/NounAra.gf | 4 ++-- src/arabic/ParadigmsAra.gf | 48 +++++++++++++++++++++----------------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index a674b884..0ae1ad13 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -99,7 +99,7 @@ lin } ; PossPron p = { - s = \\_,_,_,_ => p.s ! Gen; + s = \\_,_,_,_ => BIND ++ p.s ! Gen; d = Poss; is1sg = case p.a.pgn of { Per1 Sing => True ; _ => False } ; isPron = True; @@ -195,7 +195,7 @@ lin -- : CN -> NP -> CN ; -- house of Paris, house of mine PossNP cn np = cn ** { s = \\n,_d,c => cn.s ! n ! Const ! c ; - s2 = \\n,_d,c => cn.s2 ! n ! Const ! c ; + s2 = \\n,_d,c => cn.s2 ! n ! Const ! Gen ; -- unsure about this /IL np = \\c => cn.np ! c ++ np.s ! Gen }; diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index 5315286f..fc196e91 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -71,7 +71,8 @@ resource ParadigmsAra = open mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute - mkN : N -> N -> N ; -- Compound noun where both parts inflect + mkN : N -> N -> N ; -- Compound noun where attribute inflects in state and case but not number + mkN : Number -> N -> N -> N ; -- Compound noun where attribute inflects in state, case and number --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; } ; @@ -100,7 +101,7 @@ resource ParadigmsAra = open mkPN = overload { mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum = smartPN ; - mkPN : N -> PN + mkPN : N -> PN = \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL mkPN : Str -> Gender -> Species -> PN = mkFullPN ; @@ -338,16 +339,21 @@ resource ParadigmsAra = open = mkFullN ; mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N -- broken plural = brkN ; - mkN : N -> (attr : Str) -> N -- Compound nouns + mkN : N -> (attr : Str) -> N -- Compound nouns with noninflecting attribute = \n,attr -> n ** {s2 = \\n,s,c => attr} ; - mkN : N -> N -> N -- Compound nouns - = \n1,n2 -> n1 ** { - s = \\n,_,c => n1.s ! n ! Const ! c ; - s2 = \\n,s,c => n1.s2 ! n ! s ! c - ++ n2.s ! n ! s ! c - ++ n2.s2 ! n ! s ! c} ; + mkN : N -> N -> N -- Compound nouns where attribute inflects in state and case but not number + = attrN Sg ; + mkN : Number -> N -> N -> N -- Compound nouns where attribute inflects in state, case and number + = attrN ; } ; + attrN : Number -> N -> N -> N = \num,n1,n2 -> n1 ** { + s = \\n,_,c => n1.s ! n ! Const ! c ; + s2 = \\n,s,c => let c' = case c of {Dat => Gen; _ => c} in -- the Dat with liPrep hack only applies to the first word + n1.s2 ! num ! s ! c' -- attribute doesn't change + ++ n2.s ! num ! s ! c' + ++ n2.s2 ! num ! s ! c'} ; + dualN : N -> N = \n -> n ** {isDual=True} ; proDrop : NP -> NP ; -- Force a NP to lose its string, only contributing with its agreement. @@ -361,7 +367,7 @@ resource ParadigmsAra = open = v1 ; mkV : (root : Str) -> VerbForm -> V -- FormI .. FormX (no VII, IX) ; default vowels a u for I = formV ; - mkV : V -> (particle : Str) -> V = \v,p -> + mkV : V -> (particle : Str) -> V = \v,p -> v ** { s = \\vf => v.s ! vf ++ p } ; } ; @@ -466,7 +472,7 @@ resource ParadigmsAra = open rbT = mkRoot3 rootStr ; v8fun = case rbT.f of { ("و"|"ي"|"ّ") => v8assimilated ; - _ => + _ => case rbT.c of { #weak => v8hollow ; _ => v8sound }} @@ -512,7 +518,7 @@ resource ParadigmsAra = open let { kalimaStr = mkWord sg root; kalimaRaw = sndf kalimaStr; kalima : NTable = \\n,d,c => case root of { - _ + #hamza + _ + _ + #hamza + _ => rectifyHmz (kalimaRaw ! n ! d ! c); _ => kalimaRaw ! n ! d ! c }; @@ -540,9 +546,9 @@ resource ParadigmsAra = open prepN2 : N -> Preposition -> N2 = \n,p -> lin N2 (n ** {c2 = p}) ; mkN3 = overload { - mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q -> + mkN3 : N -> Preposition -> Preposition -> N3 = \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ; - mkN3 : N -> Str -> Str -> N3 = \n,p,q -> + mkN3 : N -> Str -> Str -> N3 = \n,p,q -> lin N3 (n ** {c2 = mkPreposition p ; c3 = mkPreposition q}) ; } ; @@ -552,12 +558,12 @@ resource ParadigmsAra = open proDrop : NP -> NP = \np -> lin NP (ResAra.proDrop np) ; -- e.g. al-jamii3, 2a7ad - regNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { + regNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { s = \\c => fixShd word (dec1sg ! Def ! c) }); -- e.g. hadha, dhaalika - indeclNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { + indeclNP : Str -> Number -> NP = \word,n -> lin NP (emptyNP ** { s = \\c => word }); @@ -656,18 +662,18 @@ resource ParadigmsAra = open dirV2 v = prepV2 v (casePrep acc) ; mkV3 = overload { - mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q -> + mkV3 : V -> Preposition -> Preposition -> V3 = \v,p,q -> lin V3 (prepV3 v p q) ; mkV3 : V -> Str -> Str -> V3 = \v,p,q -> - lin V3 (v ** {s = v.s ; c2 = mkPreposition p ; c3 = mkPreposition q}) + lin V3 (v ** {s = v.s ; c2 = mkPreposition p ; c3 = mkPreposition q}) } ; - prepV3 : V -> Preposition -> Preposition -> Verb3 = \v,p,q -> + prepV3 : V -> Preposition -> Preposition -> Verb3 = \v,p,q -> v ** {s = v.s ; c2 = p ; c3 = q} ; dirV3 = overload { dirV3 : V -> Preposition -> V3 = \v,p -> mkV3 v (casePrep acc) p ; - dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s) + dirV3 : V -> Str -> V3 = \v,s -> mkV3 v (casePrep acc) (mkPreposition s) } ; dirdirV3 v = dirV3 v (casePrep acc) ; @@ -687,7 +693,7 @@ resource ParadigmsAra = open mkV0 v = v ; mkV2S v p = lin V2S (prepV2 v (mkPreposition p)) ; mkV2V = overload { - mkV2V : V -> Str -> Str -> V2V = \v,p,q -> + mkV2V : V -> Str -> Str -> V2V = \v,p,q -> lin V2V (prepV3 v (mkPreposition p) (mkPreposition q) ** {sc = noPrep}) ; mkV2V : V -> Preposition -> Preposition -> V2V = \v,p,q -> lin V2V (prepV3 v p q ** {sc = noPrep}) ; From c8e220196435171cbd1b44d11b2db1e1d366bbfb Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 23 Nov 2018 11:25:08 +0100 Subject: [PATCH 68/78] (Swe) Add ProDrop to ExtendSwe --- src/swedish/ExtendSwe.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/swedish/ExtendSwe.gf b/src/swedish/ExtendSwe.gf index 5dfcf9a2..37acbeca 100644 --- a/src/swedish/ExtendSwe.gf +++ b/src/swedish/ExtendSwe.gf @@ -8,7 +8,7 @@ concrete ExtendSwe of Extend = CatSwe ** PassVPSlash, PassAgentVPSlash, UttVPShort, ByVP, InOrderToVP, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, - ICompAP, + ICompAP,ProDrop, AdAdV, PositAdVAdj, GerundCN, GerundNP, GerundAdv, PresPartAP, PastPartAP, PastPartAgentAP, RNP, RNPList, ReflRNP, ReflPron, ReflPoss, PredetRNP, ConjRNP, Base_rr_RNP, Base_nr_RNP, Base_rn_RNP, Cons_rr_RNP, Cons_nr_RNP, @@ -122,7 +122,7 @@ concrete ExtendSwe of Extend = CatSwe ** ICompAP ap = {s = \\a => hur_IAdv.s ++ ap.s ! a} ; - + ProDrop pro = pro ** {s = \\_ => []} ; lincat RNP = {s : Agr => Str ; isPron : Bool} ; ---- inherent Agr needed: han färgar sitt hår vitt. But also depends on subject From 03380c79fbe94d8c10a43d8b81f5c4b91d650c46 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Fri, 23 Nov 2018 14:49:33 +0100 Subject: [PATCH 69/78] (Ara) Add more VPS funs to Extend + refactor predVP to work with VPS --- src/arabic/ExtendAra.gf | 40 ++++++++++++----- src/arabic/ResAra.gf | 97 +++++++++++++++++++++++------------------ 2 files changed, 83 insertions(+), 54 deletions(-) diff --git a/src/arabic/ExtendAra.gf b/src/arabic/ExtendAra.gf index 3b667a23..a371dd23 100644 --- a/src/arabic/ExtendAra.gf +++ b/src/arabic/ExtendAra.gf @@ -6,15 +6,16 @@ concrete ExtendAra of Extend = StrandRelSlash, ExistPluralCN, ExistMassCN, ExistCN, EmptyRelSlash, DetNPMasc, DetNPFem, ComplBareVS, ComplDirectVS, ComplDirectVQ, ICompAP, - VPS, MkVPS, + VPS, MkVPS, PredVPS, BaseVPS, ConsVPS, ConjVPS, ApposNP ] with (Grammar=GrammarAra) ** open - Prelude, + ParamX, ResAra, - ParamX + Prelude, + Coordination in { @@ -29,15 +30,30 @@ concrete ExtendAra of Extend = lincat - VPS = VP ; -- finite VP's with tense and polarity - + VPS = {s : PerGenNum => Str} ; -- finite VP's with tense and polarity + [VPS] = {s1,s2 : PerGenNum => Str} ; lin -- : Temp -> Pol -> VP -> VPS ; -- hasn't slept - MkVPS t p vp = lin VPS (vp ** { - s = \\pgn,vf => case of { --- IL guessed tenses - <(Pres|Fut),Simul> => vp.s ! pgn ! VPImpf Ind ; - => vp.s ! pgn ! VPImpf Cnj ; - <_ ,_ > => vp.s ! pgn ! VPPerf - } - }) ; + MkVPS t p vp = { + s = \\pgn => let vps = + wordOrderNoSubj + Nominal -- Nominal (=SVO) generalises best for ConjVPS. + vp.obj.a.isPron + (vStr vp pgn t.t p.p) + (case of { + => BIND ++ vp.obj.s ; + _ => vp.obj.s }) + (pred vp pgn t.t p.p) + vp.s2 + in vps.before ++ vps.after -- word order is SVO, so this is safe for just this case. + } ; + + BaseVPS = twoTable PerGenNum ; + ConsVPS = consrTable PerGenNum comma ; + ConjVPS = conjunctTable PerGenNum ; + + PredVPS np vps = { + s = \\_ => np.s ! Nom ++ vps.s ! np.a.pgn -- first quick version with order always Nominal. + } ; -- if necessary, change VPS into {s : PerGenNum => Order => {before,after : Str}} + } diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 0311148c..95335fe8 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1484,14 +1484,17 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> oper - VP : Type = { - s : PerGenNum => VPForm => Str ; + BaseVP : Type = { -- to minimise duplication of code for VPS sc : Preposition ; -- subject case: e.g. يُمْكِنُ *لِ*Xِ obj : Obj; pred : Comp; isPred : Bool; --indicates if there is a predicate (xabar) s2 : Str - }; + } ; + + VP : Type = BaseVP ** { + s : PerGenNum => VPForm => Str ; + } ; uttVP : VP -> (Gender=>Str) = \vp -> \\g => vp.s ! Per3 g Sg ! VPPerf @@ -1531,28 +1534,6 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => verbalAgr np.a.pgn; _ => np.a.pgn }; - gn = pgn2gn pgn; - kataba = vp.s ! pgn ! VPPerf ; - yaktubu = vp.s ! pgn ! VPImpf Ind ; - yaktuba = vp.s ! pgn ! VPImpf Cnj ; - yaktub = vp.s ! pgn ! VPImpf Jus ; - vStr : ParamX.Tense -> Polarity -> Str = - \tn,pl -> case of { - => yaktubu ; - => "لَا" ++ yaktubu ; - => "" ; --no verb "to be" in present - => "لَيسَ" ;--same here, just add negation particle - <_, Past, Pos> => kataba ; - <_, Past, Neg> => "لَمْ" ++ yaktub ; - <_, Cond, _ > => yaktuba ; - <_, Fut, Pos> => glue "سَ" yaktubu ; - <_, Fut, Neg> => "لَنْ" ++ yaktuba - }; - pred : ParamX.Tense -> Polarity -> Str = - \tn,pl -> case of { - => 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} ; _ => vp.sc} ; subj = np.empty ++ sc.s ++ case vp.isPred of { @@ -1561,30 +1542,59 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } ; } in wordOrder o vp.obj.a.isPron np.a.isPron - (vStr t p) - subj - + (vStr vp pgn t p) (case of { => BIND ++ vp.obj.s ; _ => vp.obj.s }) - - (pred t p) + (pred vp pgn t p) vp.s2 - + subj } ; - -- 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 -> + -- seems complicated, but this is to share code with VPS and other similar structures + wordOrder : Order -> (objIsPron,subjIsPron : Bool) -> (verb,obj,pred,adv,subj : Str) -> Str = + \o,objIsPron,subjIsPron,verb,obj,pred,adv,subj -> + let cl = wordOrderNoSubj o objIsPron verb obj pred adv in 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 + Subord => + let bind = if_then_Str subjIsPron BIND [] -- in subord. clause, subj. pronoun binds to the main verb + in cl.before ++ bind ++ subj ++ cl.after ; + _ => cl.before ++ subj ++ cl.after + } ; + + wordOrderNoSubj : Order -> (objIsPron : Bool) -> (verb,obj,pred,adv : Str) -> {before,after : Str} = + \o,objIsPron,verb,obj,pred,adv -> + case o of { + VOS => {before = verb ++ obj ++ pred ++ adv; after = []} ; + Verbal => case objIsPron of { + True => {before = verb ++ obj ; after = adv ++ pred} ; -- obj. clitic attaches directly to the verb + False => {before = verb ; after = obj ++ adv ++ pred} + } ; + (Nominal|Subord) => {before = [] ; after = verb ++ obj ++ adv ++ pred} + } ; + + pred : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl -> + let gn = pgn2gn pgn + in case of { + => vp.pred.s ! gn ! Nom; --xabar marfooc + _ => vp.pred.s ! gn ! Acc --xabar kaana wa laysa manSoob + } ; + + vStr : VP -> PerGenNum -> ParamX.Tense -> Polarity -> Str = \vp,pgn,tn,pl -> + let kataba = vp.s ! pgn ! VPPerf ; + yaktubu = vp.s ! pgn ! VPImpf Ind ; + yaktuba = vp.s ! pgn ! VPImpf Cnj ; + yaktub = vp.s ! pgn ! VPImpf Jus ; + in case of { + => yaktubu ; + => "لَا" ++ yaktubu ; + => "" ; --no verb "to be" in present + => "لَيسَ" ;--same here, just add negation particle + <_, Past, Pos> => kataba ; + <_, Past, Neg> => "لَمْ" ++ yaktub ; + <_, Cond, _ > => yaktuba ; + <_, Fut, Pos> => glue "سَ" yaktubu ; + <_, Fut, Neg> => "لَنْ" ++ yaktuba } ; -- in verbal sentences, the verb agrees with the subject @@ -1659,6 +1669,9 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> Cl : Type = {s : Tense => Polarity => Order => Str} ; QCl : Type = {s : Tense => Polarity => QForm => Str} ; + forceOrder : Order -> Cl -> Cl = \o,cl -> + {s = \\t,p,_ => cl.s ! t ! p ! o} ; + ----------------------------------------------------------------------------- -- Relative From 28bc19f09c9469eca8fbd893d633427a4710a270 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 26 Nov 2018 11:02:40 +0100 Subject: [PATCH 70/78] Haskell/Shell build scripts handle multiple paths in GF_LIB_PATH (pick first) Not implemented for Batch --- Make.bat | 1 + Make.hs | 4 ++-- Make.sh | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Make.bat b/Make.bat index 8bb7c412..5cb9603e 100644 --- a/Make.bat +++ b/Make.bat @@ -29,6 +29,7 @@ goto Loop REM Try to determine install location if "%dest%"=="" ( + REM TODO Separate paths with search path separator ; and pick first one set dest=%GF_LIB_PATH% ) if "%dest%"=="" ( diff --git a/Make.hs b/Make.hs index c491fe42..76c21b35 100644 --- a/Make.hs +++ b/Make.hs @@ -9,7 +9,7 @@ import System.IO.Error (catchIOError) import System.Exit (ExitCode(..),exitFailure) import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) -import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) +import System.FilePath ((),splitSearchPath) -- ,takeFileName,addExtension,dropExtension) import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile) #if __GLASGOW_HASKELL__>=800 import System.Directory (getModificationTime,setModificationTime) @@ -119,7 +119,7 @@ mkInfo = do -- Look for install location in a few different places let mflag = getFlag destination_flag args mbuilt <- catchIOError (readFile "../gf-core/DATA_DIR" >>= \d -> return (Just (d "lib"))) (\e -> return Nothing) - menvar <- lookupEnv "GF_LIB_PATH" + menvar <- lookupEnv "GF_LIB_PATH" >>= return . fmap (head . splitSearchPath) let inst_dir = case catMaybes [mflag,menvar,mbuilt] of diff --git a/Make.sh b/Make.sh index bfc2d66f..6e8c5e1f 100755 --- a/Make.sh +++ b/Make.sh @@ -36,7 +36,7 @@ done # Try to determine install location if [ -z "$dest" ]; then - dest="$GF_LIB_PATH" + dest=$(echo "$GF_LIB_PATH" | sed 's/:.*$//') fi if [ -z "$dest" ] && [ -f "../gf-core/DATA_DIR" ]; then dest=$(cat ../gf-core/DATA_DIR) From b2a0f252b07ac746a3106e9026a0b58bc4490a35 Mon Sep 17 00:00:00 2001 From: odanoburu Date: Mon, 26 Nov 2018 11:14:48 -0200 Subject: [PATCH 71/78] (Construction) add timeunitRange - fix documentation comments --- src/abstract/Construction.gf | 7 ++++--- src/english/ConstructionEng.gf | 2 ++ src/portuguese/ConstructionPor.gf | 9 ++++----- src/portuguese/DiffPor.gf | 10 ++++++++-- src/portuguese/ResPor.gf | 1 + 5 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/abstract/Construction.gf b/src/abstract/Construction.gf index ca2b39d7..69f5d1b4 100644 --- a/src/abstract/Construction.gf +++ b/src/abstract/Construction.gf @@ -78,7 +78,8 @@ cat Year ; fun - timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours + timeunitAdv : Card -> Timeunit -> Adv ; -- (for) three hours + timeunitRange : Card -> Card -> Timeunit -> Adv ; -- (cats live) ten to twenty years oneHour : Hour ; twoHour : Hour ; @@ -105,8 +106,8 @@ fun twentyThreeHour : Hour ; twentyFourHour : Hour ; - timeHour : Hour -> Adv ; -- at three (o'clock / am / pm) - timeHourMinute : Hour -> Card -> Adv ; -- at forty past six + timeHour : Hour -> Adv ; -- at three a.m./p.m. + timeHourMinute : Hour -> Card -> Adv ; -- at six forty a.m./p.m. weekdayPunctualAdv : Weekday -> Adv ; -- on Monday weekdayHabitualAdv : Weekday -> Adv ; -- on Mondays diff --git a/src/english/ConstructionEng.gf b/src/english/ConstructionEng.gf index d0e6b591..a12cc46c 100644 --- a/src/english/ConstructionEng.gf +++ b/src/english/ConstructionEng.gf @@ -74,6 +74,8 @@ lincat n_hours_NP : NP = mkNP n_card time ; in Sy.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; + timeunitRange l u time = {s = l.s ! True ! R.Nom ++ to_Prep.s ++ u.s ! True ! R.Nom ++ time.s ! R.Pl ! R.Nom} ; + oneHour = mkHour "1" True ; twoHour = mkHour "2" True ; threeHour = mkHour "3" True ; diff --git a/src/portuguese/ConstructionPor.gf b/src/portuguese/ConstructionPor.gf index f3409985..5803e813 100644 --- a/src/portuguese/ConstructionPor.gf +++ b/src/portuguese/ConstructionPor.gf @@ -69,6 +69,8 @@ lin let n_card : Card = lin Card n; n_hours_NP : NP = mkNP n_card time ; in S.mkAdv for_Prep n_hours_NP | S.mkAdv to_Prep n_hours_NP ;--| S.mkAdv (n_hours_NP.s ! R.Nom) ; + timeunitRange l u time = {s = "de" ++ l.s ! time.g + ++ "a" ++ u.s ! time.g ++ time.s ! u.n } ; oneHour = mkHour "1" Manha Sg ; twoHour = mkHour "2" Manha Pl ; @@ -95,12 +97,12 @@ lin twentyThreeHour = mkHour "23" Noite Pl ; twentyFourHour = {s = "meia-noite" ; pe = None ; n = Sg} ; - timeHour h = mkAdv (a ! h.n ++ h.s ++ period ! h.pe) ; + timeHour h = mkAdv (R.a ! Fem ! h.n ++ h.s ++ period ! h.pe) ; timeHourMinute h m = let min = m.s ! Masc in - mkAdv (a ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ; + mkAdv (R.a ! Fem ! h.n ++ h.s ++ "e" ++ min ++ period ! h.pe) ; oper mkHour : Str -> Period -> Number -> {s : Str ; pe : Period ; n : Number} ; @@ -114,9 +116,6 @@ lin None => "" } ; - a : Number => Str ; - a = numForms "à" "às" ; - lin weekdayPunctualAdv w = lin Adv {s = w.s ! C.Sg} ; -- lundi weekdayHabitualAdv w = SyntaxPor.mkAdv noPrep (mkNP the_Det w) ; -- il lunedí ---- diff --git a/src/portuguese/DiffPor.gf b/src/portuguese/DiffPor.gf index c8cfc598..16cd4d11 100644 --- a/src/portuguese/DiffPor.gf +++ b/src/portuguese/DiffPor.gf @@ -106,12 +106,18 @@ instance DiffPor of DiffRomance - [partAgr,vpAgrSubj,vpAgrClits] = open CommonRo partitive = \_,c -> prepCase c ; oper + a : Gender => Number => Str ; + a = genNumForms "a" "à" "aos" "às" ; + + de : Gender => Number => Str ; + de = genNumForms "do" "da" "dos" "das" ; + artDef : Bool -> Gender -> Number -> Case -> Str ; -- not sure if isNP is relevant artDef _isNP g n c = case c of { Nom | Acc => genNumForms "o" "a" "os" "as" ; - CPrep P_de => genNumForms "do" "da" "dos" "das" ; - CPrep P_a => genNumForms "ao" "à" "aos" "às" ; + CPrep P_de => de ; + CPrep P_a => a ; CPrep P_em => genNumForms "no" "na" "nos" "nas" ; CPrep P_por => genNumForms "pelo" "pela" "pelos" "pelas" } ! g ! n ; diff --git a/src/portuguese/ResPor.gf b/src/portuguese/ResPor.gf index f75f9df3..dcd9c98d 100644 --- a/src/portuguese/ResPor.gf +++ b/src/portuguese/ResPor.gf @@ -9,4 +9,5 @@ instance ResPor of ResRomance = DiffPor ** open CommonRomance, Prelude in { oper vowel : pattern Str = #("a" | "e" | "i" | "o" | "u") ; + } ; From 4a85289597425f003cc66073d220aacb6ef26f6e Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 26 Nov 2018 15:19:05 +0100 Subject: [PATCH 72/78] Batch build script handles multiple paths in GF_LIB_PATH (picks first) --- Make.bat | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Make.bat b/Make.bat index 5cb9603e..2cf36947 100644 --- a/Make.bat +++ b/Make.bat @@ -29,11 +29,15 @@ goto Loop REM Try to determine install location if "%dest%"=="" ( - REM TODO Separate paths with search path separator ; and pick first one - set dest=%GF_LIB_PATH% + REM Separate paths with search path separator ; and pick first one + for %%p in ("%GF_LIB_PATH:;=";"%") do ( + set dest=%%~p + goto BreakLibPath + ) ) +:BreakLibPath if "%dest%"=="" ( - REM TODO Look in ../gf-core/DATA=DIR + REM TODO Look in ../gf-core/DATA_DIR ) if "%dest%"=="" ( echo Unable to determine where to install the RGL. Please do one of the following: From 92f7dbc80e14c805abda39be3c07e55730969377 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 26 Nov 2018 15:35:44 +0100 Subject: [PATCH 73/78] Batch build script also looks in ../gf-core/DATA_DIR --- Make.bat | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Make.bat b/Make.bat index 2cf36947..9dc085fb 100644 --- a/Make.bat +++ b/Make.bat @@ -36,9 +36,21 @@ if "%dest%"=="" ( ) ) :BreakLibPath + +set DATA_DIR=..\gf-core\DATA_DIR if "%dest%"=="" ( - REM TODO Look in ../gf-core/DATA_DIR + REM Look in already compiled GF folder + if exist %DATA_DIR% ( + for /f "delims=" %%x in (%DATA_DIR%) do ( + if not "%%x"=="" ( + set dest=%%x\lib + goto BreakDataDir + ) + ) + ) ) +:BreakDataDir + if "%dest%"=="" ( echo Unable to determine where to install the RGL. Please do one of the following: echo - Pass the --dest=... flag to this script From 9da4ea3f5cf6f0b5bcbc67fae57c3b26f96fca90 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 26 Nov 2018 17:03:09 +0100 Subject: [PATCH 74/78] (Ara) Add word order as a parameter to Subj --- src/arabic/AdverbAra.gf | 2 +- src/arabic/CatAra.gf | 2 +- src/arabic/ParadigmsAra.gf | 10 ++++++++++ src/arabic/StructuralAra.gf | 7 +++---- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/arabic/AdverbAra.gf b/src/arabic/AdverbAra.gf index d10d2ac4..c02aa593 100644 --- a/src/arabic/AdverbAra.gf +++ b/src/arabic/AdverbAra.gf @@ -16,7 +16,7 @@ concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { AdAdv ad av = cc2 av ad ; -- : Subj -> S -> Adv ; -- when she sleeps - SubjS subj s = {s = subj.s ++ s.s ! Subord} ; + SubjS subj s = {s = subj.s ++ s.s ! subj.o} ; -- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing diff --git a/src/arabic/CatAra.gf b/src/arabic/CatAra.gf index 1902bfac..6cb7ccdb 100644 --- a/src/arabic/CatAra.gf +++ b/src/arabic/CatAra.gf @@ -72,7 +72,7 @@ concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { Conj = {s : Str ; n : ResAra.Number} ; -- DConj = {s1,s2 : Str ; n : ResAra.Number} ; --- Subj = {s : Str} ; + Subj = {s : Str ; o : Order} ; Prep = ResAra.Preposition ; -- Open lexical classes, e.g. Lexicon diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index fc196e91..f3fdb6ef 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -172,6 +172,11 @@ resource ParadigmsAra = open mkInterj : Str -> Interj ; + mkSubj : overload { + mkSubj : Str -> Subj ; -- Default order Subord (=noun first and in accusative) + mkSubj : Str -> Order -> Subj -- Specify word order + } ; + --2 Prepositions -- -- A preposition as used for rection in the lexicon, as well as to @@ -659,6 +664,11 @@ resource ParadigmsAra = open mkAdA x = lin AdA (ss x) ; mkInterj x = lin Interj (ss x) ; + mkSubj = overload { + mkSubj : Str -> Subj = \s -> lin Subj {s = s ; o = Subord} ; + mkSubj : Str -> Order -> Subj = \s,o -> lin Subj {s = s ; o = o} ; + } ; + dirV2 v = prepV2 v (casePrep acc) ; mkV3 = overload { diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index 7ae7afd3..f4abefa2 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -62,8 +62,7 @@ concrete StructuralAra of Structural = CatAra ** -- isAux = True -- } ; no_Utt = {s = \\_ => "لا"} ; - on_Prep = mkPrep "عَلى" ; ---- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ; + on_Prep = mkPrep "عَلَى" ; only_Predet = mkPredet "فَقَط" False; -- or_Conj = ss "ْر" ** {n = Sg} ; -- otherwise_PConj = ss "ْتهروِسي" ; @@ -79,7 +78,7 @@ concrete StructuralAra of Structural = CatAra ** something_NP = regNP "شَيْء" Sg ; -- somewhere_Adv = ss "سْموهري" ; that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def; - that_Subj = ss "أنَّ" ; + that_Subj = mkSubj "أنَّ" ; ----b that_NP = indeclNP "ذَلِكَ" Sg ; there_Adv = ss "هُناك" ; -- there7to_Adv = ss "تهري" ; @@ -100,7 +99,7 @@ concrete StructuralAra of Structural = CatAra ** whatPl_IP = mkIP "ما" "ماذا" Pl ; whatSg_IP = mkIP "ما" "ماذا" Sg ; when_IAdv = ss "مَتَى" ; --- when_Subj = ss "وهن" ; + when_Subj = mkSubj "عِنْدَمَا" Verbal ; where_IAdv = ss "أَينَ" ; which_IQuant = { s = \\s,c => case of { From a29a4132cf10554e763e0826dd2e0f972a922ad5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Mon, 26 Nov 2018 17:03:31 +0100 Subject: [PATCH 75/78] (Ara) misc. small fixes/additions --- src/arabic/ParadigmsAra.gf | 20 ++++++++++++++------ src/arabic/ResAra.gf | 7 +++++-- src/arabic/VerbAra.gf | 6 ++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/arabic/ParadigmsAra.gf b/src/arabic/ParadigmsAra.gf index f3fdb6ef..b00c1844 100644 --- a/src/arabic/ParadigmsAra.gf +++ b/src/arabic/ParadigmsAra.gf @@ -50,6 +50,10 @@ resource ParadigmsAra = open masc : Gender ; fem : Gender ; + Number : Type ; + sg : Number ; + pl : Number ; + Species : Type ; hum : Species ; nohum : Species ; @@ -71,8 +75,8 @@ resource ParadigmsAra = open mkN : NTable -> Gender -> Species -> N ; -- loan words, irregular mkN : (root,sgPatt,brokenPlPatt : Str) -> Gender -> Species -> N ; -- broken plural mkN : N -> (attr : Str) -> N ; -- Compound noun with invariant attribute - mkN : N -> N -> N ; -- Compound noun where attribute inflects in state and case but not number - mkN : Number -> N -> N -> N ; -- Compound noun where attribute inflects in state, case and number + mkN : N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute in singular. + mkN : Number -> N -> N -> N ; -- Compound noun where attribute inflects in state and case. Attribute's number specified by 1st arg. --- mkN : (root,sgPatt : Str) -> Gender -> Species -> N -- sound feminine plural --- = sdfN ; } ; @@ -102,7 +106,7 @@ resource ParadigmsAra = open mkPN : Str -> PN -- Fem Hum if ends with ة, otherwise Masc Hum = smartPN ; mkPN : N -> PN - = \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! Bare}) ; -- no idea /IL + = \n -> lin PN (n ** {s = \\c => n.s ! Sg ! Const ! c ++ n.s2 ! Sg ! Const ! c }) ; -- no idea /IL mkPN : Str -> Gender -> Species -> PN = mkFullPN ; } ; @@ -306,6 +310,10 @@ resource ParadigmsAra = open masc = ResAra.Masc ; fem = ResAra.Fem ; + Number = ResAra.Number ; + sg = ResAra.Sg ; + pl = ResAra.Pl ; + Species = ResAra.Species ; hum = ResAra.Hum ; nohum = ResAra.NoHum ; @@ -608,9 +616,9 @@ resource ParadigmsAra = open mascTbl = reg jadId judud ; femTbl = reg jadIda judud ; in { s = table { - APosit Masc n d c => mascTbl ! n ! d ! c ; - APosit Fem n d c => femTbl ! n ! d ! c ; - AComp d c => indeclN akbar ! d ! c } + APosit Masc n d c => rectifyHmz (mascTbl ! n ! d ! c) ; + APosit Fem n d c => rectifyHmz (femTbl ! n ! d ! c) ; + AComp d c => rectifyHmz (indeclN akbar ! d ! c) } } ; degrA : (posit,compar,plur : Str) -> A diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 95335fe8..e1699cf1 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1231,7 +1231,7 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => Acc; => Gen; => Gen; - <_,Const> => Gen; + <_,Const> => Gen; -- not sure if this is an actual rule /IL _ => c }; @@ -1534,7 +1534,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> => verbalAgr np.a.pgn; _ => np.a.pgn }; - sc : Preposition = case o of {Subord => {s=[]; c=Acc} ; _ => vp.sc} ; + sc : Preposition = case o of { -- very unsure of this /IL + Subord => {s=[]; c=Acc} ; -- to prevent weird stuff with VVs + _ => case np.a.isPron of {True => noPrep; _ => vp.sc} + } ; subj = np.empty ++ sc.s ++ case vp.isPred of { False => (proDrop np).s ! sc.c ; -- prodrop if it's not predicative diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index c0e0b7e9..2fe248c3 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -69,6 +69,12 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { UseCopula = predV copula ; + -- : VP -> Prep -> VPSlash ; -- live in (it) + VPSlashPrep vp prep = vp ** { + c2 = prep ; + agrObj = \\_ => [] + } ; + AdvVP vp adv = insertStr adv.s vp ; AdVVP adv = insertStr adv.s ; From 29b5ac47fb12b67714727675d4c8b5875f0492e3 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 27 Nov 2018 17:34:16 +0100 Subject: [PATCH 76/78] (Ara) include N2's c2 in ComplN2 --- src/arabic/NounAra.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arabic/NounAra.gf b/src/arabic/NounAra.gf index 0ae1ad13..174a1d81 100644 --- a/src/arabic/NounAra.gf +++ b/src/arabic/NounAra.gf @@ -174,7 +174,7 @@ lin Use2N3 n3 = n3 ; Use3N3 n3 = n3 ** {c2 = n3.c3} ; - ComplN2 n2 np = UseN n2 ** {np=np.s} ; + ComplN2 n2 np = UseN n2 ** {np = \\c => n2.c2.s ++ np.s ! n2.c2.c} ; ComplN3 n3 np = ComplN2 n3 np ** {c2 = n3.c3} ; From f2e99934257483a393f2a26fbd34b34876dd315f Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 27 Nov 2018 17:35:59 +0100 Subject: [PATCH 77/78] (Ara) Fix bug in SlashV2VNP + refactor some related opers --- src/arabic/ResAra.gf | 23 ++++++++++++++--------- src/arabic/VerbAra.gf | 12 +++++++----- 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index e1699cf1..0cf91ddb 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1545,10 +1545,8 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> } ; } in wordOrder o vp.obj.a.isPron np.a.isPron - (vStr vp pgn t p) - (case of { - => BIND ++ vp.obj.s ; - _ => vp.obj.s }) + (vStr vp pgn t p) + vp.obj.s (pred vp pgn t p) vp.s2 subj @@ -1626,11 +1624,18 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> 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 ** - { obj = {s = vp.obj.s -- old object, if there was one - ++ vp.c2.s ++ np.s ! vp.c2.c -- new object - ++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V - a = np.a} }; + insertObj : NP -> VPSlash -> VP = \np,vp -> vp ** { + obj = {s = vp.obj.s -- old object, if there was one + ++ bindIfPron np vp -- new object, bind if pronoun and not pred + ++ vp.agrObj ! np.a.pgn ; -- only used for SlashV2V + a = np.a} + } ; + + bindIfPron : NP -> {c2:Preposition; isPred:Bool} -> Str = \np,vp -> + let bind = case of { + => BIND ; + _ => [] } + in vp.c2.s ++ bind ++ np.s ! vp.c2.c ; insertPred : Comp -> VP -> VP = \p,vp -> vp ** { pred = p; diff --git a/src/arabic/VerbAra.gf b/src/arabic/VerbAra.gf index 2fe248c3..abfdc218 100644 --- a/src/arabic/VerbAra.gf +++ b/src/arabic/VerbAra.gf @@ -14,17 +14,19 @@ concrete VerbAra of Verb = CatAra ** open Prelude, ResAra, ParamX in { agrObj = \\pgn => v2v.c3.s -- أَنْ ++ vp.s ! pgn ! VPImpf Cnj ; isPred = False ; - c2 = v2v.c2 ; -- for the direct object + c2 = v2v.c2 ; -- preposition for the direct object sc = v2v.sc } ; -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy - SlashV2VNP v2v np vps = let v2vVP = predV v2v in -- IL + SlashV2VNP v2v np vps = let v2vVP = slashV2 v2v in -- IL vps ** { - s = \\pgn,vpf => v2vVP.s ! pgn ! vpf - ++ v2v.c2.s ++ np.s ! v2v.c2.c + s = \\pgn,vpf => v2vVP.s ! pgn ! vpf -- main verb agrees with subject + ++ bindIfPron np v2vVP ++ v2v.c3.s -- أَنْ - ++ vps.s ! pgn ! VPImpf Cnj ; + ++ vps.s ! np.a.pgn ! VPImpf Cnj -- verb from old VP agrees with object + ++ vps.obj.s ; -- otherwise obj appears in a weird place /IL + obj = emptyObj ; isPred = False ; -- preposition for the direct object comes from VP sc = v2v.sc From 19129aa420231655534428dba7bbda36157308d5 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 27 Nov 2018 17:36:23 +0100 Subject: [PATCH 78/78] (Ara) misc. small fixes and additions --- src/arabic/IdiomAra.gf | 9 ++++++--- src/arabic/ResAra.gf | 4 ++++ src/arabic/SentenceAra.gf | 6 ++---- src/arabic/StructuralAra.gf | 2 +- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/arabic/IdiomAra.gf b/src/arabic/IdiomAra.gf index c46bbadd..7a18b133 100644 --- a/src/arabic/IdiomAra.gf +++ b/src/arabic/IdiomAra.gf @@ -10,7 +10,9 @@ concrete IdiomAra of Idiom = CatAra ** open -- : VP -> Cl ; -- it is hot 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 = case vp.isPred of { + True => pron2np (pgn2pron vp.obj.a.pgn) ; + False => pgn2pron vp.obj.a.pgn } ; -- if no obj, Per3 Masc Sg chosen by default in predVP it vp ; -- : VP -> Cl ; -- one sleeps @@ -21,8 +23,9 @@ concrete IdiomAra of Idiom = CatAra ** open -- : Adv -> S -> Cl ; -- it is here she slept CleftAdv adv s = - let comp : Comp = CompAdv adv in - predVP he_Pron (UseComp comp) ; + let comp : Comp = CompAdv (lin Adv {s = adv.s ++ s.s ! Verbal}) ; -- no idea about word order /IL + pass_V = mkV "مضي" va vi ; -- switch to copula or some other verb if better /IL + in predVP emptyNP (UseV pass_V ** {isPred=True ; pred=comp}) ; -- very hacky /IL -- : NP -> Cl ; -- there is a house ExistNP np = diff --git a/src/arabic/ResAra.gf b/src/arabic/ResAra.gf index 0cf91ddb..6156d435 100644 --- a/src/arabic/ResAra.gf +++ b/src/arabic/ResAra.gf @@ -1656,6 +1656,10 @@ patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> VPSlash : Type = VP ** {c2 : Preposition ; agrObj : PerGenNum => Str} ; ClSlash : Type = VPSlash ** {subj : Subj} ; + emptyVPslash : VP -> VPSlash = \vp -> vp ** { + c2 = noPrep ; agrObj = \\_ => [] + } ; + slashV2 : Verb2 -> VPSlash = \v -> predV v ** {c2 = v.c2 ; agrObj = \\_ => []} ; diff --git a/src/arabic/SentenceAra.gf b/src/arabic/SentenceAra.gf index e6c7fbdc..854daaf4 100644 --- a/src/arabic/SentenceAra.gf +++ b/src/arabic/SentenceAra.gf @@ -52,10 +52,8 @@ concrete SentenceAra of Sentence = CatAra ** open SlashVP = predVPSlash ; AdvSlash slash adv = slash ** { s2 = slash.s2 ++ adv.s } ; --- SlashPrep : Cl -> Prep -> ClSlash --- Will be awkward to implement in the way ClSlash is now. --- ClSlash is implemented the way it is now for a good reason: --- we need to support different word orders. +-- : Cl -> Prep -> ClSlash +-- SlashPrep cl prep = TODO -- SlashVS np vs sslash = TODO diff --git a/src/arabic/StructuralAra.gf b/src/arabic/StructuralAra.gf index f4abefa2..c6c8aaaf 100644 --- a/src/arabic/StructuralAra.gf +++ b/src/arabic/StructuralAra.gf @@ -46,7 +46,7 @@ concrete StructuralAra of Structural = CatAra ** n = Pl ; d = Def } ; -- IL --- if_Subj = ss "ِف" ; + if_Subj = mkSubj "إِذَا" Verbal ; in8front_Prep = mkPrep "مُقَابِلَ" ; i_Pron = ResAra.i_Pron ; in_Prep = mkPrep "فِي" ;