From 98a4b6a8088273dfa55dfa1c3ea78e85cd9c7a8d Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 18 Dec 2008 14:17:42 +0000 Subject: [PATCH] Arabic compiles now in 1.5 --- next-lib/src/arabic/AdjectiveAra.gf | 43 + next-lib/src/arabic/AdverbAra.gf | 21 + next-lib/src/arabic/AllAra.gf | 3 + next-lib/src/arabic/AllAraAbs.gf | 3 + next-lib/src/arabic/CatAra.gf | 103 +++ next-lib/src/arabic/ConjunctionAra.gf | 45 + next-lib/src/arabic/ExtAra.gf | 26 + next-lib/src/arabic/GrammarAra.gf | 21 + next-lib/src/arabic/IdiomAra.gf | 14 + next-lib/src/arabic/IrregAra.gf | 181 ++++ next-lib/src/arabic/LangAra.gf | 12 + next-lib/src/arabic/LexiconAra.gf | 384 ++++++++ next-lib/src/arabic/MorphoAra.gf | 49 ++ next-lib/src/arabic/NounAra.gf | 188 ++++ next-lib/src/arabic/NumeralAra.gf | 154 ++++ next-lib/src/arabic/OrthoAra.gf | 41 + next-lib/src/arabic/ParadigmsAra.gf | 500 +++++++++++ next-lib/src/arabic/PatternsAra.gf | 106 +++ next-lib/src/arabic/PhraseAra.gf | 26 + next-lib/src/arabic/QuestionAra.gf | 55 ++ next-lib/src/arabic/RelativeAra.gf | 34 + next-lib/src/arabic/ResAra.gf | 1171 +++++++++++++++++++++++++ next-lib/src/arabic/SentenceAra.gf | 134 +++ next-lib/src/arabic/StructuralAra.gf | 110 +++ next-lib/src/arabic/VerbAra.gf | 44 + 25 files changed, 3468 insertions(+) create mode 100644 next-lib/src/arabic/AdjectiveAra.gf create mode 100644 next-lib/src/arabic/AdverbAra.gf create mode 100644 next-lib/src/arabic/AllAra.gf create mode 100644 next-lib/src/arabic/AllAraAbs.gf create mode 100644 next-lib/src/arabic/CatAra.gf create mode 100644 next-lib/src/arabic/ConjunctionAra.gf create mode 100644 next-lib/src/arabic/ExtAra.gf create mode 100644 next-lib/src/arabic/GrammarAra.gf create mode 100644 next-lib/src/arabic/IdiomAra.gf create mode 100644 next-lib/src/arabic/IrregAra.gf create mode 100644 next-lib/src/arabic/LangAra.gf create mode 100644 next-lib/src/arabic/LexiconAra.gf create mode 100644 next-lib/src/arabic/MorphoAra.gf create mode 100644 next-lib/src/arabic/NounAra.gf create mode 100644 next-lib/src/arabic/NumeralAra.gf create mode 100644 next-lib/src/arabic/OrthoAra.gf create mode 100644 next-lib/src/arabic/ParadigmsAra.gf create mode 100644 next-lib/src/arabic/PatternsAra.gf create mode 100644 next-lib/src/arabic/PhraseAra.gf create mode 100644 next-lib/src/arabic/QuestionAra.gf create mode 100644 next-lib/src/arabic/RelativeAra.gf create mode 100644 next-lib/src/arabic/ResAra.gf create mode 100644 next-lib/src/arabic/SentenceAra.gf create mode 100644 next-lib/src/arabic/StructuralAra.gf create mode 100644 next-lib/src/arabic/VerbAra.gf diff --git a/next-lib/src/arabic/AdjectiveAra.gf b/next-lib/src/arabic/AdjectiveAra.gf new file mode 100644 index 000000000..f324d95d3 --- /dev/null +++ b/next-lib/src/arabic/AdjectiveAra.gf @@ -0,0 +1,43 @@ +concrete AdjectiveAra of Adjective = CatAra ** open ResAra, Prelude in { + + lin + + + PositA a = { + s = \\h,g,n,d,c => case h of { + Hum => a.s ! APosit g n d c; + NoHum => case n of { + Pl => a.s ! APosit Fem Sg d c ; + _ => a.s ! APosit g n d c + } + } + }; +-- ComparA a np = { +-- s = \\_ => a.s ! AAdj Compar ++ "مِنْ" ++ np.s ! Gen ; +-- } ; +-- +-- $SuperlA$ belongs to determiner syntax in $Noun$. +-- +-- ComplA2 a np = { +-- s = \\_ => a.s ! AAdj Posit ++ a.c2 ++ np.s ! Acc ; +-- isPre = False +-- } ; +-- +-- ReflA2 a = { +-- s = \\ag => a.s ! AAdj Posit ++ a.c2 ++ reflPron ! ag ; +-- isPre = False +-- } ; +-- +-- SentAP ap sc = { +-- s = \\a => ap.s ! a ++ sc.s ; +-- isPre = False +-- } ; +-- +-- AdAP ada ap = { +-- s = \\a => ada.s ++ ap.s ! a ; +-- isPre = ap.isPre +-- } ; +-- +-- UseA2 a = a ; +-- +} diff --git a/next-lib/src/arabic/AdverbAra.gf b/next-lib/src/arabic/AdverbAra.gf new file mode 100644 index 000000000..5c2cbdfb6 --- /dev/null +++ b/next-lib/src/arabic/AdverbAra.gf @@ -0,0 +1,21 @@ +concrete AdverbAra of Adverb = CatAra ** open ResAra, Prelude in { + + 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 +-- } ; + + PrepNP prep np = {s = prep.s ++ np.s ! Gen} ; + +-- AdAdv = cc2 ; +-- +-- SubjS = cc2 ; +-- AdvSC s = s ; --- this rule give stack overflow in ordinary parsing +-- +-- AdnCAdv cadv = {s = cadv.s ++ "تهَن"} ; +-- +} diff --git a/next-lib/src/arabic/AllAra.gf b/next-lib/src/arabic/AllAra.gf new file mode 100644 index 000000000..d23f9b997 --- /dev/null +++ b/next-lib/src/arabic/AllAra.gf @@ -0,0 +1,3 @@ +--# -path=.:../abstract:../common:prelude + +concrete AllAra of AllAraAbs = LangAra ; diff --git a/next-lib/src/arabic/AllAraAbs.gf b/next-lib/src/arabic/AllAraAbs.gf new file mode 100644 index 000000000..9889c81ed --- /dev/null +++ b/next-lib/src/arabic/AllAraAbs.gf @@ -0,0 +1,3 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllAraAbs = Lang ; diff --git a/next-lib/src/arabic/CatAra.gf b/next-lib/src/arabic/CatAra.gf new file mode 100644 index 000000000..dd1790a94 --- /dev/null +++ b/next-lib/src/arabic/CatAra.gf @@ -0,0 +1,103 @@ +concrete CatAra of Cat = CommonX - [Utt] ** open ResAra, Prelude, ParamX in { + + flags optimize=all_subs ; + + lincat + +-- Phrase + + Utt = {s : Gender => Str}; + +-- Tensed/Untensed + + S = {s : Str} ; + QS = {s : QForm => Str} ; +-- RS = {s : Agr => Str} ; + +-- Sentence + + Cl = {s : ResAra.Tense => Polarity => Order => Str} ; +-- Slash = {s : Tense => Anteriority => Polarity => Order => Str} ** {c2 : Str} ; + Imp = {s : Polarity => Gender => ResAra.Number => Str} ; + +-- Question + + QCl = {s : ResAra.Tense => Polarity => QForm => Str} ; + IP = {s : Str ; n : ResAra.Number} ; +-- IAdv = {s : Str} ; +-- IDet = {s : Str ; n : ResAra.Number} ; +-- +---- Relative +-- +-- RCl = {s : Tense => Anteriority => Polarity => Agr => Str} ; +-- RP = {s : Case => Str ; a : RAgr} ; +-- +-- Verb + + VP = ResAra.VP ; + VPSlash = ResAra.VP ** {c2 : Str} ; + Comp = ResAra.Comp ; --{s : AAgr => Case => Str} ; +-- SC = {s : Str} ; +-- +-- Adjective + + AP = {s : Species => Gender => NTable } ; + +-- Noun + + CN = ResAra.Noun ** {adj : NTable}; + NP, Pron = ResAra.NP; --{s : Case => Str ; a : Agr } ; + Num, Ord, Card = {s : Gender => State => Case => Str ; + n : Size }; + Predet = ResAra.Predet ; + +-- DEPRECATED +-- QuantSg, QuantPl = +-- {s : Species => Gender => Case => Str; +-- n : ResAra.Number; +-- d : State; +-- isNum : Bool; +-- isPron : Bool} ; + + Det = ResAra.Det ; +-- {s : Species => Gender => Case => Str ; +-- d : State; n : Size; isNum : Bool } ; + Quant = {s : ResAra.Number => Species => Gender => Case => Str; + d : State; + isNum : Bool; + isPron: Bool} ; + Art = {s : ResAra.Number => Species => Gender => Case => Str; + d : State} ; + +-- Numeral + + Numeral = {s : CardOrd => Gender => State => Case => Str ; + n : Size } ; + Digits = {s : Str; + n : Size}; + +-- Structural + + Conj = {s : Str ; n : ResAra.Number} ; +-- DConj = {s1,s2 : Str ; n : ResAra.Number} ; +-- Subj = {s : Str} ; + Prep = {s : Str} ; + +-- Open lexical classes, e.g. Lexicon + + V, VS, VQ, VA = ResAra.Verb ; -- = {s : VForm => Str} ; + V2, V2A = ResAra.Verb ** {c2 : Str} ; + V2V, V2S, V2Q = ResAra.Verb ** {c2 : Str} ; --- AR + V3 = ResAra.Verb ** {c2, c3 : Str} ; +-- VV = {s : VVForm => Str ; isAux : Bool} ; + + A = ResAra.Adj ; + A2 = ResAra.Adj ** {c2 : Str} ; + + N, N2 = ResAra.Noun ; +--{s : ResAra.Number => State => Case => Str; g : Gender ; h = Species} ; +-- N2 = {s : ResAra.Number => Case => Str} ** {c2 : Str} ;?? + N3 = ResAra.Noun ** {c2,c3 : Str} ; + PN = {s : Case => Str; g : Gender; h : Species} ; + +} diff --git a/next-lib/src/arabic/ConjunctionAra.gf b/next-lib/src/arabic/ConjunctionAra.gf new file mode 100644 index 000000000..f7683c6cc --- /dev/null +++ b/next-lib/src/arabic/ConjunctionAra.gf @@ -0,0 +1,45 @@ +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} ; +-- +} diff --git a/next-lib/src/arabic/ExtAra.gf b/next-lib/src/arabic/ExtAra.gf new file mode 100644 index 000000000..120c7caea --- /dev/null +++ b/next-lib/src/arabic/ExtAra.gf @@ -0,0 +1,26 @@ +concrete ExtAra of ExtAraAbs = CatAra ** open ResAra in { +-- +-- lincat +-- +-- Aux = {s : Polarity => Str} ; +-- +-- lin +-- +-- PredAux np aux vp = mkClause (np.s ! Nom) np.a { +-- s = \\t,ant,b,ord,agr => +-- let +-- fin = aux.s ! b ; +-- vf : Str -> Str -> {fin, inf : Str} = \x,y -> +-- {fin = x ; inf = y} ; +-- in +-- case ant of { +-- Simul => vf fin [] ; +-- Anter => vf fin "هَثي" +-- } ; +-- s2 = \\agr => infVP vp agr +-- } ; +-- +-- can_Aux = {s = \\p => posneg p "عَن"} ; ---- cannt +-- must_Aux = {s = \\p => posneg p "مُست"} ; +-- +} diff --git a/next-lib/src/arabic/GrammarAra.gf b/next-lib/src/arabic/GrammarAra.gf new file mode 100644 index 000000000..f276984ad --- /dev/null +++ b/next-lib/src/arabic/GrammarAra.gf @@ -0,0 +1,21 @@ +--# -path=.:../abstract:../common:prelude + +concrete GrammarAra of Grammar = + NounAra, + VerbAra, + AdjectiveAra, + AdverbAra, + NumeralAra, + SentenceAra, + QuestionAra, + RelativeAra, + ConjunctionAra, + PhraseAra, + TextX - [Utt], + StructuralAra, + IdiomAra + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} ; diff --git a/next-lib/src/arabic/IdiomAra.gf b/next-lib/src/arabic/IdiomAra.gf new file mode 100644 index 000000000..d185c5aa7 --- /dev/null +++ b/next-lib/src/arabic/IdiomAra.gf @@ -0,0 +1,14 @@ +concrete IdiomAra of Idiom = CatAra ** open Prelude, ResAra in { +-- +-- 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) ; +-- +} + diff --git a/next-lib/src/arabic/IrregAra.gf b/next-lib/src/arabic/IrregAra.gf new file mode 100644 index 000000000..0d463bb83 --- /dev/null +++ b/next-lib/src/arabic/IrregAra.gf @@ -0,0 +1,181 @@ +--# -path=.:prelude:../abstract:../common +-- +concrete IrregAra of IrregAraAbs = CatAra ** open ParadigmsAra in { +-- +--flags optimize=values ; +-- +-- lin +-- awake_V = irregV "َوَكي" "َوْكي" "َوْكن" ; +-- bear_V = irregV "بَر" "بْري" "بْرن" ; +-- beat_V = irregV "بَت" "بَت" "بَت" ; +-- become_V = irregV "بعْمي" "بعَمي" "بعْمي" ; +-- begin_V = irregV "بغِن" "بغَن" "بغُن" ; +-- bend_V = irregV "بند" "بنت" "بنت" ; +-- beset_V = irregV "بست" "بست" "بست" ; +-- bet_V = irregDuplV "بت" "بت" "بت" ; +-- bid_V = irregDuplV "بِد" (variants {"بِد" ; "بَدي"}) (variants {"بِد" ; "بِدّن"}) ; +-- bind_V = irregV "بِند" "بُْند" "بُْند" ; +-- bite_V = irregV "بِتي" "بِت" "بِتّن" ; +-- bleed_V = irregV "بلّد" "بلد" "بلد" ; +-- blow_V = irregV "بلْو" "بلو" "بلْون" ; +-- break_V = irregV "برَك" "برْكي" "برْكن" ; +-- breed_V = irregV "برّد" "برد" "برد" ; +-- bring_V = irregV "برِنغ" "برُْغهت" "برُْغهت" ; +-- broadcast_V = irregV "برَْدعَست" "برَْدعَست" "برَْدعَست" ; +-- build_V = irregV "بُِلد" "بُِلت" "بُِلت" ; +-- burn_V = irregV "بُرن" (variants {"بُرند" ; "بُرنت"}) (variants {"بُرند" ; "بُرنت"}) ; +-- burst_V = irregV "بُرست" "بُرست" "بُرست" ; +-- buy_V = irregV "بُي" "بُْغهت" "بُْغهت" ; +-- cast_V = irregV "عَست" "عَست" "عَست" ; +-- catch_V = irregV "عَتعه" "عَُغهت" "عَُغهت" ; +-- choose_V = irregV "عهّْسي" "عهْسي" "عهْسن" ; +-- cling_V = irregV "علِنغ" "علُنغ" "علُنغ" ; +-- come_V = irregV "عْمي" "عَمي" "عْمي" ; +-- cost_V = irregV "عْست" "عْست" "عْست" ; +-- creep_V = irregV "عرّة" "عرةت" "عرةت" ; +-- cut_V = irregDuplV "عُت" "عُت" "عُت" ; +-- deal_V = irregV "دَل" "دَلت" "دَلت" ; +-- dig_V = irregDuplV "دِغ" "دُغ" "دُغ" ; +-- dive_V = irregV "دِثي" (variants {"دِثد" ; "دْثي"}) "دِثد" ; +-- do_V = mkV "دْ" "دْس" "دِد" "دْني" "دِْنغ" ; +-- draw_V = irregV "درَو" "درو" "درَون" ; +-- dream_V = irregV "درَم" (variants {"درَمد" ; "درَمت"}) (variants {"درَمد" ; "درَمت"}) ; +-- drive_V = irregV "درِثي" "درْثي" "درِثن" ; +-- drink_V = irregV "درِنك" "درَنك" "درُنك" ; +-- eat_V = irregV "َت" "َتي" "َتن" ; +-- fall_V = irregV "فَلّ" "فلّ" "فَلّن" ; +-- feed_V = irregV "فّد" "فد" "فد" ; +-- feel_V = irregV "فّل" "فلت" "فلت" ; +-- fight_V = irregV "فِغهت" "فُْغهت" "فُْغهت" ; +-- find_V = irregV "فِند" "فُْند" "فُْند" ; +-- fit_V = irregDuplV "فِت" "فِت" "فِت" ; +-- flee_V = irregV "فلّ" "فلد" "فلد" ; +-- fling_V = irregV "فلِنغ" "فلُنغ" "فلُنغ" ; +-- fly_V = irregV "فلي" "فلو" "فلْون" ; +-- forbid_V = irregDuplV "فْربِد" "فْربَدي" "فْربِدّن" ; +-- forget_V = irregDuplV "فْرغت" "فْرغْت" "فْرغْتّن" ; +-- forgive_V = irregV "فْرغِثي" "فْرغَثي" "فْرغِثن" ; +-- forsake_V = irregV "فْرسَكي" "فْرسّْك" "فْرسَكن" ; +-- freeze_V = irregV "فرّزي" "فرْزي" "فرْزن" ; +-- get_V = irregDuplV "غت" "غْت" "غْتّن" ; +-- give_V = irregV "غِثي" "غَثي" "غِثن" ; +-- go_V = irregV "غْ" "ونت" "غْني" ; +-- grind_V = irregV "غرِند" "غرُْند" "غرُْند" ; +-- grow_V = irregV "غرْو" "غرو" "غرْون" ; +-- hang_V = irregV "هَنغ" "هُنغ" "هُنغ" ; +-- have_V = mkV "هَثي" "هَس" "هَد" "هَد" "هَثِنغ" ; +-- hear_V = irregV "هَر" "هَرد" "هَرد" ; +-- hide_V = irregV "هِدي" "هِد" "هِدّن" ; +-- hit_V = irregDuplV "هِت" "هِت" "هِت" ; +-- hold_V = irregV "هْلد" "هلد" "هلد" ; +-- hurt_V = irregV "هُرت" "هُرت" "هُرت" ; +-- keep_V = irregV "كّة" "كةت" "كةت" ; +-- kneel_V = irregV "كنّل" "كنلت" "كنلت" ; +-- knit_V = irregDuplV "كنِت" "كنِت" "كنِت" ; +-- know_V = irregV "كنْو" "كنو" "كنْو" ; +-- lay_V = irregV "لَي" "لَِد" "لَِد" ; +-- lead_V = irregV "لَد" "لد" "لد" ; +-- leap_V = irregV "لَة" (variants {"لَةد" ; "لةت"}) (variants {"لَةد" ; "لةت"}) ; +-- learn_V = irregV "لَرن" (variants {"لَرند" ; "لَرنت"}) (variants {"لَرند" ; "لَرنت"}) ; +-- leave_V = irregV "لَثي" "لفت" "لفت" ; +-- lend_V = irregV "لند" "لنت" "لنت" ; +-- let_V = irregDuplV "لت" "لت" "لت" ; +-- lie_V = irregV "لِي" "لَي" "لَِن" ; +-- light_V = irregV "لِغهت" (variants {"لِغهتد" ; "لِت"}) "لِغهتد" ; +-- lose_V = irregV "لْسي" "لْست" "لْست" ; +-- make_V = irregV "مَكي" "مَدي" "مَدي" ; +-- mean_V = irregV "مَن" "مَنت" "مَنت" ; +-- meet_V = irregV "مّت" "مت" "مت" ; +-- misspell_V = irregV "مِسّةلّ" (variants {"مِسّةلّد" ; "مِسّةلت"}) (variants {"مِسّةلّد" ; "مِسّةلت"}) ; +-- mistake_V = irregV "مِستَكي" "مِستّْك" "مِستَكن" ; +-- mow_V = irregV "مْو" "مْود" (variants {"مْود" ; "مْون"}) ; +-- overcome_V = irregV "ْثرعْمي" "ْثرعَمي" "ْثرعْمي" ; +-- overdo_V = mkV "ْثردْ" "ْثردْس" "ْثردِد" "ْثردْني" "ْثردِْنغ" ; +-- overtake_V = irregV "ْثرتَكي" "ْثرتّْك" "ْثرتَكن" ; +-- overthrow_V = irregV "ْثرتهرْو" "ْثرتهرو" "ْثرتهرْون" ; +-- pay_V = irregV "ةَي" "ةَِد" "ةَِد" ; +-- plead_V = irregV "ةلَد" "ةلد" "ةلد" ; +-- prove_V = irregV "ةرْثي" "ةرْثد" (variants {"ةرْثد" ; "ةرْثن"}) ; +-- put_V = irregDuplV "ةُت" "ةُت" "ةُت" ; +-- quit_V = irregDuplV "قُِت" "قُِت" "قُِت" ; +-- read_V = irregV "رَد" "رَد" "رَد" ; +-- rid_V = irregDuplV "رِد" "رِد" "رِد" ; +-- ride_V = irregV "رِدي" "رْدي" "رِدّن" ; +-- ring_V = irregV "رِنغ" "رَنغ" "رُنغ" ; +-- rise_V = irregV "رِسي" "رْسي" "رِسن" ; +-- run_V = irregDuplV "رُن" "رَن" "رُن" ; +-- saw_V = irregV "سَو" "سَود" (variants {"سَود" ; "سَون"}) ; +-- say_V = irregV "سَي" "سَِد" "سَِد" ; +-- see_V = irregV "سّ" "سَو" "سّن" ; +-- seek_V = irregV "سّك" "سُْغهت" "سُْغهت" ; +-- sell_V = irregV "سلّ" "سْلد" "سْلد" ; +-- send_V = irregV "سند" "سنت" "سنت" ; +-- set_V = irregDuplV "ست" "ست" "ست" ; +-- sew_V = irregV "سو" "سود" (variants {"سود" ; "سون"}) ; +-- shake_V = irregV "سهَكي" "سهّْك" "سهَكن" ; +-- shave_V = irregV "سهَثي" "سهَثد" (variants {"سهَثد" ; "سهَثن"}) ; +-- shear_V = irregV "سهَر" "سهْري" "سهْرن" ; +-- shed_V = irregDuplV "سهد" "سهد" "سهد" ; +-- shine_V = irregV "سهِني" "سهْني" "سهْني" ; +-- shoe_V = irregV "سهْي" "سهْد" (variants {"سهْد" ; "سهْد"}) ; +-- shoot_V = irregV "سهّْت" "سهْت" "سهْت" ; +-- show_V = irregV "سهْو" "سهْود" (variants {"سهْود" ; "سهْون"}) ; +-- shrink_V = irregV "سهرِنك" "سهرَنك" "سهرُنك" ; +-- shut_V = irregDuplV "سهُت" "سهُت" "سهُت" ; +-- sing_V = irregV "سِنغ" "سَنغ" "سُنغ" ; +-- sink_V = irregV "سِنك" "سَنك" "سُنك" ; +-- sit_V = irregDuplV "سِت" "سَت" "سَت" ; +-- sleep_V = irregV "سلّة" "سلةت" "سلةت" ; +-- slay_V = irregV "سلَي" "سلو" "سلَِن" ; +-- slide_V = irregV "سلِدي" "سلِد" "سلِد" ; +-- sling_V = irregV "سلِنغ" "سلُنغ" "سلُنغ" ; +-- slit_V = irregDuplV "سلِت" "سلِت" "سلِت" ; +-- smite_V = irregV "سمِتي" "سمْتي" "سمِتّن" ; +-- sow_V = irregV "سْو" "سْود" (variants {"سْود" ; "سْون"}) ; +-- speak_V = irregV "سةَك" "سةْكي" "سةْكن" ; +-- speed_V = irregV "سةّد" "سةد" "سةد" ; +-- spend_V = irregV "سةند" "سةنت" "سةنت" ; +-- spill_V = irregV "سةِلّ" (variants {"سةِلّد" ; "سةِلت"}) (variants {"سةِلّد" ; "سةِلت"}) ; +-- spin_V = irregDuplV "سةِن" "سةُن" "سةُن" ; +-- spit_V = irregDuplV "سةِت" (variants {"سةِت" ; "سةَت"}) "سةِت" ; +-- split_V = irregDuplV "سةلِت" "سةلِت" "سةلِت" ; +-- spread_V = irregV "سةرَد" "سةرَد" "سةرَد" ; +-- spring_V = irregV "سةرِنغ" (variants {"سةرَنغ" ; "سةرُنغ"}) "سةرُنغ" ; +-- stand_V = irregV "ستَند" "ستّْد" "ستّْد" ; +-- steal_V = irregV "ستَل" "ستْلي" "ستْلن" ; +-- stick_V = irregV "ستِعك" "ستُعك" "ستُعك" ; +-- sting_V = irregV "ستِنغ" "ستُنغ" "ستُنغ" ; +-- stink_V = irregV "ستِنك" "ستَنك" "ستُنك" ; +-- stride_V = irregV "سترِدي" "سترْد" "سترِدّن" ; +-- strike_V = irregV "سترِكي" "سترُعك" "سترُعك" ; +-- string_V = irregV "سترِنغ" "سترُنغ" "سترُنغ" ; +-- strive_V = irregV "سترِثي" "سترْثي" "سترِثن" ; +-- swear_V = irregV "سوَر" "سوْري" "سوْرن" ; +-- sweep_V = irregV "سوّة" "سوةت" "سوةت" ; +-- swell_V = irregV "سولّ" "سولّد" (variants {"سولّد" ; "سوْلّن"}) ; +-- swim_V = irregDuplV "سوِم" "سوَم" "سوُم" ; +-- swing_V = irregV "سوِنغ" "سوُنغ" "سوُنغ" ; +-- take_V = irregV "تَكي" "تّْك" "تَكن" ; +-- teach_V = irregV "تَعه" "تَُغهت" "تَُغهت" ; +-- tear_V = irregV "تَر" "تْري" "تْرن" ; +-- tell_V = irregV "تلّ" "تْلد" "تْلد" ; +-- think_V = irregV "تهِنك" "تهُْغهت" "تهُْغهت" ; +-- thrive_V = irregV "تهرِثي" (variants {"تهرِثد" ; "تهرْثي"}) "تهرِثد" ; +-- throw_V = irregV "تهرْو" "تهرو" "تهرْون" ; +-- thrust_V = irregV "تهرُست" "تهرُست" "تهرُست" ; +-- tread_V = irregV "ترَد" "ترْد" "ترْدّن" ; +-- understand_V = irregV "ُندرستَند" "ُندرستّْد" "ُندرستّْد" ; +-- uphold_V = irregV "ُةهْلد" "ُةهلد" "ُةهلد" ; +-- upset_V = irregDuplV "ُةست" "ُةست" "ُةست" ; +-- wake_V = irregV "وَكي" "وْكي" "وْكن" ; +-- wear_V = irregV "وَر" "وْري" "وْرن" ; +-- weave_V = irregV "وَثي" (variants {"وَثد" ; "وْثي"}) (variants {"وَثد" ; "وْثن"}) ; +-- wed_V = irregDuplV "ود" "ود" "ود" ; +-- weep_V = irregV "وّة" "وةت" "وةت" ; +-- wind_V = irregV "وِند" "وُْند" "وُْند" ; +-- win_V = irregDuplV "وِن" "وْن" "وْن" ; +-- withhold_V = irregV "وِتهّْلد" "وِتهّلد" "وِتهّلد" ; +-- withstand_V = irregV "وِتهستَند" "وِتهستّْد" "وِتهستّْد" ; +-- wring_V = irregV "ورِنغ" "ورُنغ" "ورُنغ" ; +-- write_V = irregV "ورِتي" "ورْتي" "ورِتّن" ; +} diff --git a/next-lib/src/arabic/LangAra.gf b/next-lib/src/arabic/LangAra.gf new file mode 100644 index 000000000..2a1dc95b5 --- /dev/null +++ b/next-lib/src/arabic/LangAra.gf @@ -0,0 +1,12 @@ +--# -path=.:../abstract:../common:prelude + +concrete LangAra of Lang = + GrammarAra, + LexiconAra + ** { + + flags startcat = Phr ; unlexer = text ; lexer = text ; coding = utf8 ; + +} + + diff --git a/next-lib/src/arabic/LexiconAra.gf b/next-lib/src/arabic/LexiconAra.gf new file mode 100644 index 000000000..6d457e0d8 --- /dev/null +++ b/next-lib/src/arabic/LexiconAra.gf @@ -0,0 +1,384 @@ +--# -path=.:prelude +-- +concrete LexiconAra of Lexicon = CatAra ** open + ParadigmsAra, + ResAra, + MorphoAra, --shouldn't open it here, only needed reg &sndf + Prelude in { + +flags + optimize=values ; coding=utf8 ; + + lin + + airplane_N = sdfN "ط؟ر" "فاعِلة" Fem NoHum ; + answer_V2S = dirV2 (v3 "جوب") ; + apartment_N = brkN "شقّ" "فِعّة" "فِعَل" Fem NoHum ; + apple_N = sdfN "تفح" "فِعّالة" Fem NoHum ; + art_N = brkN "فنّ" "فَعّ" "فُعُول" Masc NoHum ; + ask_V2Q = dirV2 (regV "يَس؟َل") ; +-- ask_V2Q = dirV2 (v1 "س؟ل" a a) ; + baby_N = brkN "طفل" "فِعل" "أَفعال" Masc Hum; + bad_A = sndA "سو؟" "فَيِّع" ; + bank_N = brkN "بنك" "فَعل" "فُعُول" Masc NoHum ; + beautiful_A = sndA "جمل" "فَعِيل" ; + become_VA = mkVA (v4 "صبح") ; + beer_N = sdfN "بير" "فِعلة" Fem NoHum ; + beg_V2V = dirV2 (v5 "وسل") ; + big_A = sndA "كبر" "فَعِيل" ; + bike_N = sdfN "درج" "فَعّالة" Fem NoHum ; + bird_N = brkN "طير" "فَعل" "فُعُول" Masc NoHum; + black_A = clrA "سود" ; + blue_A = clrA "زرق" ; + boat_N = brkN "قرب" "فاعِل" "فَواعِل" Masc NoHum ; + book_N = brkN "كتب" "فِعال" "فُعُل" Masc NoHum ; + boot_N = sdfN "جزم" "فَعلة" Fem NoHum ; + boss_N = brkN "دور" "مُفِيع" "مُفَعاء" Masc Hum ; + boy_N = brkN "صبي" "فَعِل" "فُعلان" Masc Hum ; + bread_N = brkN "خبز" "فُعل" "أَفعال" Masc NoHum ; + break_V2 = dirV2 (regV "يَكسُر") ; +-- break_V2 = dirV2 (v1 "كسر" a u) ; + broad_A = sndA "وسع" "فاعِل" ; + brother_N2 = brkN "؟خو" "فَع" "فِعلة" Masc Hum ; --FIXME + 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ö + car_N = sdfN "سير" "فَعّالة" Fem NoHum ; + carpet_N = sdfN "سجد" "فَعّالة" Fem NoHum ; + cat_N = brkN "هرّ" "فِعّة" "فِعَل" Fem NoHum ; + ceiling_N = brkN "سقف" "فَعل" "أَفعُل" Masc NoHum ; + chair_N = brkN "كرس" "فُعلِي" "فَعالِي" Masc NoHum ; + cheese_N = brkN "جبن" "فُعلة" "أَفعال" Fem NoHum ; + child_N = brkN "ولد" "فَعَل" "أَفعال" Masc Hum ; + church_N = brkN "كنس" "فَعِيلة" "فَعاٱِل" Fem Hum ; + city_N = brkN "مدن" "فَعِيلة" "فُعُل" Fem NoHum ; + clean_A = sndA "نظف" "فَعِيل" ; + clever_A = sndA "جهد" "مُفتَعِل" ; + close_V2 = dirV2 (v4 "غلق") ; + coat_N = brkN "عطف" "مِفعَل" "مَفاعِل" Masc NoHum ; + cold_A = sndA "برد" "فاعِل" ; + come_V = v1 "جي؟" a i ; --check + computer_N = brkN "حسب" "فاعُول" "فَواعِيل" Masc NoHum ; + country_N = brkN "بلد" "فَعَل" "فِعال" Masc NoHum ; + cousin_N = brkN "قرب" "فَعِيل" "أَفعِلاء" Masc Hum ; -- (aDAc +-- lose_V2 = dirV2 (v1 "خسر" i a) ; --Dayyac, >aDAc + love_N = brkN "حبّ" "فُعّ" "فُعّ" Masc NoHum ; -- no plur + love_V2 = dirV2 (v1 "حبّ" a i) ; + man_N = brkN "رجل" "فَعُل" "فِعال" Masc Hum ; + married_A2 = mkA2 (sndA "زوج" "مُتَفَعِّل") "مِن" ; + meat_N = brkN "لحم" "فَعلة" "فُعُول" Masc NoHum ; + milk_N = brkN "حلب" "فَعِيل" "فَعِيل" Masc NoHum ; --no plur + moon_N = brkN "قمر" "فَعَل" "أَفعال" Masc NoHum ; + mother_N2 = sdfN "؟م" "فُعّ" Fem Hum ; + mountain_N = brkN "جبل" "فَعَل" "فِعال" Masc NoHum ; + music_N = mkN (reg "مُوسِيقَى" "مُوسِيقَى") Fem NoHum ; --no plur + narrow_A = sndA "ضيق" "فَعِّل" ; + new_A = sndA "جدّ" "فَعِيل" ; + newspaper_N = brkN "صحف" "فَعِيلة" "فُعُل" Fem NoHum ; + oil_N = brkN "زيت" "فَعل" "فُعُول" Masc NoHum ; + old_A = sndA "قدم" "فَعِيل" ; + open_V2 = dirV2 (regV "يَفتَح") ; +-- open_V2 = dirV2 (v1 "فتح" a a ) ; + paint_V2A = mkV2A (regV "يَدهَن" ) [] ; +-- paint_V2A = mkV2A (v1 "دهن" a a ) [] ; + paper_N = brkN "ورق" "فَعَلة" "أَفعال" Fem NoHum ; + paris_PN = mkPN "بارِيس" Fem NoHum ; + peace_N = brkN "سلم" "فَعال" "فَعال" Masc NoHum; --no plur + pen_N = brkN "قلم" "فَعَل" "أَفعال" Masc NoHum; + planet_N = mkN (reg "كَوكَب" "كَواكِب") Masc NoHum ; -- quadriconsonantal + plastic_N = mkN (sndf "بلاستِيك") Masc NoHum ; + play_V2 = dirV2 (regV "لَعِب") ; +-- play_V2 = dirV2 (v1 "لعب" i a) ; + policeman_N = sdmN "شرط" "فِعلِي" Masc Hum ; + priest_N = brkN "قسّ" "فِعِّيل" "أَفِعّة" Masc Hum ; + probable_AS = mkAS (sndA "مكن" "مُفعِل") ; + queen_N = sdfN "ملك" "فَعِلة" Fem Hum ; + radio_N = mkN (sndf "راديُو") Masc NoHum ; + rain_V0 = mkV0 (regV "يَمطُر") ; +-- rain_V0 = mkV0 (v1 "مطر" a u) ; + read_V2 = dirV2 (regV "يَقرَ؟") ; +-- read_V2 = dirV2 (v1 "قر؟" a a ) ; + red_A = clrA "حمر" ; + religion_N = brkN "دين" "فِعل" "أَفعال" Masc NoHum ; + restaurant_N = brkN "طعم" "مَفعَل" "مَفاعِل" Masc NoHum ; + river_N = brkN "نهر" "فَعل" "أَفعال" Masc NoHum ; + rock_N = brkN "صخر" "فَعلة" "فُعُول" Fem NoHum ; + roof_N = brkN "سطح" "فَعل" "أَفعُل" Masc NoHum ; + rubber_N = brkN "مطّ" "فَعّال" "فَعّال" Masc NoHum ; -- no hum + run_V = regV "يَركُض" ; +-- run_V = v1 "ركض" a u ; + say_VS = mkVS (v1 "قول" a u) ; --check + school_N = brkN "درس" "مَفعَلة" "مَفاعِل" Fem NoHum ; + science_N = brkN "علم" "فِعل" "فُعُول" Masc NoHum ; + sea_N = brkN "بحر" "فَعل" "فُعُول" Masc NoHum ; + seek_V2 = dirV2 (regV "يَطلُب") ; +-- seek_V2 = dirV2 (v1 "طلب" a u) ; + see_V2 = dirV2 (v1 "ر؟ي" a a) ; + sell_V3 = dirdirV3 (v1 "بيع" a i) ; --check + send_V3 = dirdirV3 (v4 "رسل") ; + sheep_N = brkN "خرف" "فَعُول" "فِعال" Masc NoHum ; + ship_N = brkN "سفن" "فَعِيلة" "فُعُل" Fem NoHum ; + shirt_N = brkN "قمص" "فَعِيل" "فُعلان" Masc NoHum ; + shoe_N = brkN "حذو" "فِعاء" "أَفعِية" Masc NoHum ; + shop_N = brkN "تجر" "مَفعَل" "مَفاعِل" Masc NoHum ; + short_A = sndA "قصر" "فَعِيل" ; + 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 ; + sock_N = brkN "جرب" "فَوعَل" "فَواعِل" Masc NoHum ; + speak_V2 = dirV2 (v5 "كلم") ; + star_N = brkN "نجم" "فَعل" "فُعُول" Masc NoHum ; --najmö + steel_N = brkN "فلذ" "فُوعال" "فَواعِل" Masc NoHum ; + stone_N = brkN "حجر" "فَعَل" "أَفعال" Masc NoHum ; + stove_N = brkN "وقد" "مَفعِل" "مَفاعِل" Masc NoHum ; + student_N = brkN "طلب" "فاعِل" "فُعّال" Masc Hum ; --tilmI* + stupid_A = clrA "بله" ; + sun_N = brkN "شمس" "فَعل" "فُعُول" Fem NoHum ; + switch8off_V2 = dirV2 (v4 "طف؟") ; + switch8on_V2 = dirV2 (v4 "شعل") ; + table_N = sdfN "طول" "فاعِلة" Fem NoHum ; + talk_V3 = mkV3 (v5 "حدث") "لِ" "عَن" ; + teacher_N = sdmN "علم" "مُفَعِّل" Masc Hum ; --mucal~imö + teach_V2 = dirV2 (v2 "علم") ; + television_N = mkN (sndf "تِلِفِزيُون") Masc NoHum ; + thick_A = sndA "سمك" "فَعِيل" ; + thin_A = sndA "رفع" "فَعِيل" ; + train_N = sdfN "قطر" "فِعال" Masc NoHum; + travel_V = v3 "سفر" ; + tree_N = brkN "شجر" "فَعلة" "أَفعال" Fem NoHum ; + ugly_A = sndA "قبح" "فَعِيل" ; + understand_V2 = dirV2 (regV "فَهِم") ; +-- understand_V2 = dirV2 (v1 "فهم" i a ) ; + university_N = sdfN "جمع" "فاعِلة" Fem NoHum ; + village_N = brkN "قري" "فَعلة" "فُعَى" Fem NoHum ; --Daycö + wait_V2 = dirV2 (v8 "نظر") ; + walk_V = v1 "مشي" a i ; --check + warm_A = sndA "دف؟" "فاعِل" ; + war_N = brkN "حرب" "فَعل" "فُعُول" Fem NoHum ; + watch_V2 = dirV2 (v3 "شهد") ; + water_N = mkN (reg "ماء" "مِياه") Fem NoHum ; --"موه" "فاء" "فِياع" ?? + white_A = clrA "بيض" ; + window_N = brkN "نفذ" "فاعِلة" "فَواعِل" Fem NoHum ; --$ub~Ak + wine_N = brkN "خمر" "فَعل" "فُعُول" Masc NoHum ; + win_V2 = dirV2 (regV "رَبِح") ; +-- win_V2 = dirV2 (v1 "ربح" i a) ; + woman_N = mkN (reg "إِمرَأَة" "نِسوَة") Fem Hum ; + wonder_VQ = mkVQ (v6 "س؟ل") ; + wood_N = brkN "خشب" "فَعَل" "أَفعال" Masc NoHum ; + write_V2 = dirV2 (regV "يَكتُب") ; +-- write_V2 = dirV2 (v1 "كتب" a u) ; + yellow_A = clrA "صفر" ; + young_A = sndA "شبّ" "فاعّ" ; + + do_V2 = dirV2 (regV "يَفعَل") ; +-- do_V2 = dirV2 (v1 "فعل" a a ) ; + now_Adv = mkAdv "الآن" ; + already_Adv = mkAdv "سابِقاً" ; + song_N = brkN "غني" "أَفعِلة" "أَفاعِي" Fem NoHum ; + add_V3 = dirV3 (regV "يَجمَع") "وَ" ; +-- add_V3 = dirV3 (v1 "جمع" a a) "وَ" ; + number_N = brkN "رقم" "فَعل" "أَفعال" Masc NoHum ; --cadad + put_V2 = dirV2 (v1 "وضع" a a ); + stop_V = v5 "وقف" ; + jump_V = regV "يَقفِز" ; +-- jump_V = v1 "قفز" a i ; + + left_Ord = mkOrd "أَيسَر" "يُسرَى"; + right_Ord = mkOrd "أَيمَن" "يُمنَى" ; + + far_Adv = mkAdv "بَعِيداً" ; + correct_A = sndA "صحّ" "فَعِيل" ; + dry_A = sndA "نشف" "فاعِل" ; + dull_A = sndA "بهت" "فاعِل" ; + full_A = sndA "مل؟" "فَعِيل" ; + heavy_A = sndA "ثقل" "فَعِيل" ; + near_A = sndA "قرب" "فَعِيل" ; + rotten_A = sndA "فسد" "فاعِل" ; + round_A = sndA "دور" "مُفَعَّل" ; + sharp_A = sndA "حدّ" "فاعّ" ; + smooth_A = sndA "نعم" "فاعِل" ; + straight_A = sndA "قوم" "مُستَفِيع" ; + wet_A = sndA "رطب" "فَعِل" ; + wide_A = sndA "وسع" "فاعِل" ; + + animal_N = sdfN "حيّ" "فَعَوان" Masc NoHum ; + ashes_N = brkN "رمد" "فَعال" "أَفعِلة" Masc NoHum; + back_N = brkN "ظهر" "فَعل" "فُعُول" Masc NoHum; + bark_N = brkN "نبح" "فَعل" "فُعال" Masc NoHum; + belly_N = brkN "بطن" "فَعل" "فُعُول" Fem NoHum; + blood_N = brkN "دم" "فَع" "فِعاء" Masc NoHum; + bone_N = brkN "عظم" "فَعلة" "فِعال" Fem NoHum; + breast_N = brkN "صدر" "فَعل" "فُعُول" Masc NoHum; + cloud_N = brkN "غيم" "فَعلة" "فُعُول" Fem NoHum; + day_N = brkN "يوم" "فَعل" "أَفّاع" Masc NoHum; + dust_N = brkN "غبر" "فُعال" "أَفعِلة" Masc NoHum; + ear_N = brkN "؟ذن" "فُعل" "أَفعال" Fem NoHum; + earth_N = brkN "ترب" "فُعلة" "فُعَل" Fem NoHum; + egg_N = sdfN "بيض" "فَعلة" Fem NoHum; + eye_N = brkN "عين" "فَعل" "فُعُول" Fem NoHum; + fat_N = brkN "دهن" "فُعل" "فُعُول" Masc NoHum ; + feather_N = sdfN "ريش" "فِعلة" Fem NoHum; + fingernail_N = brkN "ظفر" "فُعل" "أَفاعِل" Masc NoHum; + fire_N = brkN "نور" "فاع" "فِيعان" Fem NoHum; + flower_N = brkN "زهر" "فَعلة" "فُعُول" Fem NoHum; + fog_N = brkN "ضبّ" "فَعال" "فَعال" Masc NoHum; --no plural ? + foot_N = brkN "قدم" "فَعَل" "أَفعال" Fem NoHum; + forest_N = sdfN "غيب" "فاعة" Fem NoHum; + grass_N = brkN "عشب" "فُعلة" "أَفعال" Fem NoHum; + guts_N = brkN "حشو" "فَعا" "أَفعاء" Fem NoHum; + hair_N = sdfN "شعر" "فَعلة" Fem NoHum ; + hand_N = brkN "يد" "فَع" "أَفاعِي" Fem NoHum ; + head_N = brkN "ر؟س" "فَعل" "فُعُول" Masc NoHum; + heart_N = brkN "قلب" "فَعل" "فُعُول" Masc NoHum; + horn_N = brkN "قرن" "فَعل" "فُعُول" Masc NoHum; + husband_N = brkN "زوج" "فَعل" "أَفعال" Masc NoHum; + ice_N = brkN "ثلج" "فَعل" "فُعُول" Masc NoHum; + knee_N = brkN "ركب" "فُعلة" "فُعَل" Fem NoHum; + leaf_N = brkN "ورق" "فَعَلة" "أَفعال" Fem NoHum; + leg_N = brkN "رجل" "فِعل" "أَفعُل" Fem NoHum; + liver_N = brkN "كبد" "فَعِل" "أَفعال" Masc NoHum ; + louse_N = sdfN "قمل" "فَعلة" Fem NoHum; + mouth_N = brkN "فوه" "فُعل" "أَفعال" Masc NoHum ; + name_N = brkN "؟سم" "فِعل" "فَعالِي" Masc NoHum; + neck_N = brkN "رقب" "فَعَلة" "فِعال" Fem NoHum; + night_N = brkN "ليل" "فَعلة" "فَعالِي" Fem NoHum; --plural? + nose_N = brkN "؟نف" "فَعل" "فُعُول" Masc NoHum; + person_N = brkN "شخص" "فَعل" "أَفعال" Masc Hum; + rain_N = brkN "مطر" "فَعَل" "أَفعال" Masc NoHum; + road_N = brkN "طرق" "فَعِيل" "فُعُل" Fem NoHum; + root_N = brkN "جذر" "فَعل" "فُعُول" Masc NoHum ; + rope_N = brkN "حبل" "فَعل" "فِعال" Masc NoHum; + salt_N = brkN "ملح" "فِعل" "أَفعال" Masc NoHum; + sand_N = brkN "رمل" "فَعل" "فِعال" Masc NoHum; + seed_N = brkN "بذر" "فَعل" "فُعُول" Masc NoHum; + skin_N = brkN "جلد" "فِعل" "فُعُول" Masc NoHum; + sky_N = sdfN "سمو" "فَعاء" Fem NoHum; + smoke_N = brkN "دخن" "فُعال" "أَفعِلة" Masc NoHum; + snow_N = brkN "ثلج" "فَعل" "فُعُول" Masc NoHum; + stick_N = brkN "عصو" "فَعا" "فِعِي" Masc NoHum ; --"عصو" + tail_N = brkN "ذنب" "فَعَل" "أَفعال" Masc NoHum; + tongue_N = brkN "لسن" "فِعال" "أَفعِلة" Masc NoHum; + tooth_N = brkN "سنّ" "فِعل" "أَفعال" Masc NoHum ; + wife_N = sdfN "زوج" "فَعلة" Fem Hum; + wind_N = brkN "ريح" "فِعل" "فِعال" Fem NoHum; + wing_N = brkN "جنح" "فَعال" "أَفعِلة" Masc NoHum ; + worm_N = brkN "دود" "فُعلة" "فِيعان" Fem NoHum ; + year_N = sdfN "سن" "فَعة" Fem NoHum ; + + blow_V = regV "يَنفُخ" ; + breathe_V = dirV2 (v5 "نفس") ; + burn_V = regV "يَحرِق" ; + dig_V = regV "يَحفِر" ; + fall_V = v1 "وقع" a a ; + float_V = v1 "عوم" a u ; + flow_V = v1 "سيل" a i ; + fly_V = v1 "طير" a i ; + freeze_V = v2 "جمد" ; + give_V3 = dirdirV3 (v4 "عطي") ; + laugh_V = regV "ضَحِك" ; + lie_V = regV "يَكذِب" ; + play_V = regV "لَعِب" ; + sew_V = v1 "خيط" a i ; + sing_V = v2 "غني" ; + sit_V = regV "يَقعُد" ; + smell_V = v1 "شمّ" i a ; + spit_V = regV "يَبصُق" ; + stand_V = v1 "وقف" a i ; + swell_V = v8 "نفخ" ; + swim_V = regV "يَسبَح" ; + think_V = v2 "فكر" ; + turn_V = regV "يَبرُم" ; + vomit_V = v5 "قي؟" ; + + bite_V2 = dirV2 ( v1 "عضّ" a a ) ; + count_V2 = dirV2 (v1 "عدّ" a u) ; + cut_V2 = dirV2 (v1 "قصّ" a u) ; + fear_V2 = dirV2 (v1 "خوف" i a) ; + fight_V2 = dirV2 (v3 "قتل") ; + hit_V2 = dirV2 (regV "يَضرِب" ) ; + hold_V2 = dirV2 (regV "يَمسِك" ) ; + hunt_V2 = dirV2 (v1 "صيد" a i) ; + kill_V2 = dirV2 (regV "يَقتُل" ) ; + pull_V2 = dirV2 (regV "يَسحَب") ; + push_V2 = dirV2 (regV "يَدفَع" ) ; + rub_V2 = dirV2 ( regV "يَفرُك" ) ; + scratch_V2 = dirV2 (regV "يَخدِش" ) ; + split_V2 = dirV2 ( v2 "قسم" ) ; + squeeze_V2 = dirV2 (regV "يَعصِر" ) ; + stab_V2 = dirV2 ( regV "يَطعُن" ) ; + suck_V2 = dirV2 (v1 "مصّ" a u) ; + throw_V2 = dirV2 (v1 "رمي" a i) ; + tie_V2 = dirV2 (regV "يَربُط" ) ; + wash_V2 = dirV2 ( regV "يَغسِل" ) ; + wipe_V2 = dirV2 ( regV "يَمسَح" ) ; + +-- other_A = sndA "ْتهر" ; + +} ; diff --git a/next-lib/src/arabic/MorphoAra.gf b/next-lib/src/arabic/MorphoAra.gf new file mode 100644 index 000000000..8846e11a6 --- /dev/null +++ b/next-lib/src/arabic/MorphoAra.gf @@ -0,0 +1,49 @@ +resource MorphoAra = ResAra ** open Prelude in { + +flags optimize = all ;--noexpand; coding=utf8 ; + + oper + + mkDet : Str -> Number -> State -> Det + = \word,num,state -> + { s = \\_,_,c => word + vowel ! c ; + n = numberToSize num; + d = state; --only Const is used now. check StructuralAra + isNum = False; + isPron = False + }; + + mkPredet : Str -> Bool -> Predet + = \word,decl -> + { s = \\c => + case decl of { + True => word + vowel!c; + False => word + }; + isDecl = decl + }; + + mkQuantNum : Str -> Number -> State -> { + s: Species => Gender => Case => Str; n: Number; d : State; isPron: Bool; isNum : Bool} = + \waHid,num,state -> + let waHida = waHid + "َة" in + { s = \\_,g,c => + let word = + case g of { + Masc => waHid; + Fem => waHida + } in Al ! state + word + dec1sg ! state ! c; + n = num; + d = state; + isPron = False; + isNum = True + }; + + vowel : Case => Str = + table { + Nom => "ُ"; + Acc => "َ"; + Gen => "ِ" + }; + +} diff --git a/next-lib/src/arabic/NounAra.gf b/next-lib/src/arabic/NounAra.gf new file mode 100644 index 000000000..d96e71970 --- /dev/null +++ b/next-lib/src/arabic/NounAra.gf @@ -0,0 +1,188 @@ +concrete NounAra of Noun = CatAra ** open ResAra, Prelude in { + +flags optimize=noexpand ; + +lin + + DetCN det cn = let { + number = sizeToNumber det.n; + determiner : Case -> Str = \c -> + det.s ! cn.h ! (detGender cn.g det.n) ! c; + noun : Case -> Str = \c -> cn.s ! + number ! (nounState det.d number) ! (nounCase c det.n det.d) + } in { + s = \\c => + case cnB4det det.isPron det.isNum det.n det.d of { + False => determiner c ++ noun c; + --FIXME use the adj -> cn -> cn rule from below instead of + --repeating code + True => cn.s ! number ! det.d ! c ++ det.s ! cn.h ! cn.g ! c + ++ cn.adj ! number ! det.d ! c + }; + a = { pgn = agrP3 cn.h cn.g number; + isPron = False } + }; + + UsePN pn = { + s = pn.s; + a = {pgn = (Per3 pn.g Sg); isPron = False } + }; + + UsePron p = p ; + + PredetNP pred 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 + } ; + {- + --should compile.. not working :( wierd error message.. bug? + PPartNP np v2 = + let x = case np.a.pgn of { + Per3 g n => ( positAdj (v2.s ! VPPart) ) ! g ! n ! Indef ; + _ => \\_ => [] -- not occuring anyway + } in { + s = \\c => np.s ! c ++ x ! c ; + a = np.a + }; + -} + + -- FIXME try parsing something like "this house now" and you'll get + -- an internal compiler error, but it still works.. wierd.. + AdvNP np adv = { + s = \\c => np.s ! c ++ adv.s; + a = np.a + }; +{- + 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 = { + s = \\h,g,c => quant.s ! Pl ! h ! g ! c + ++ num.s ! g ! (toDef quant.d num.n) ! c + --FIXME check this: + ++ ord.s ! g ! (toDef quant.d num.n) ! c ; + n = num.n; + d = quant.d; + isPron = quant.isPron; + isNum = + case num.n of { + None => False; + _ => True + } + } ; + + DetQuant quant num = { + s = \\h,g,c => quant.s ! Pl ! h ! g ! c + ++ num.s ! g ! (toDef quant.d num.n) ! c ; + n = num.n; + d = quant.d; + isPron = quant.isPron; + isNum = + case num.n of { + None => False; + _ => True + } + } ; + + + --DEPRECATED + -- SgQuant quant = {s = quant.s ! Sg ; d = quant.d; + -- isPron = quant.isPron; isNum = False} ; + -- PlQuant quant = {s = quant.s ! Pl ; d = quant.d; + -- isPron = quant.isPron; isNum = False} ; + + PossPron p = { + s = \\_,_,_,_ => p.s ! Gen; + d = Const; + isPron = True; + isNum = False } ; + + NumSg = { + s = \\_,_,_ => [] ; + n = One } ; + + NumPl = { + s = \\_,_,_ => [] ; + n = None } ; + + NumDigits digits = { + s = \\_,_,_ => digits.s; + n = digits.n + }; + + NumNumeral numeral = { + s = numeral.s ! NCard ; + n = numeral.n + }; + + AdNum adn num = { + s = \\g,d,c => adn.s ++ num.s ! g ! d ! c ; + n = num.n } ; + + OrdDigits digits = { + s = \\_,d,_ => Al ! d ++ digits.s; + n = digits.n + }; + + -- OrdNumeral : Numeral -> Ord ; -- fifty-first + OrdNumeral numeral = { + s = numeral.s ! NOrd ; + n = numeral.n + }; + + -- FIXME, "the biggest house" would better translate into + -- akbaru baytin rather than al-baytu l-2akbaru + -- DetCN (DetSg DefArt (OrdSuperl big_A)) (UseN house_N) + OrdSuperl a = { + s = \\_,d,c => a.s ! AComp d c; + n = One + } ; + + DefArt = { + s = \\_,_,_,_ => []; + d = Def ; + isNum,isPron = False + } ; + + IndefArt = { + s = \\_,_,_,_ => []; + d = Indef ; + isNum,isPron = False + } ; + +-- MassDet = {s = \\_,_,_,_ => [] ; d = Indef; +-- isNum = False; isPron = False} ; + + UseN n = n ** {adj = \\_,_,_ => []}; + -- ComplN2 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c} ; + -- ComplN3 f x = {s = \\n,c => f.s ! n ! Nom ++ f.c2 ++ x.s ! c ; c2 = f.c3} ; + -- + -- UseN2 n = n ; + -- UseN3 n = n ; + -- + AdjCN ap cn = { + s = \\n,d,c => cn.s ! n ! d ! c; + adj = \\n,d,c => ap.s ! cn.h ! cn.g ! n ! (definite ! d) ! c ; + g = cn.g; + h = cn.h + }; + -- RelCN cn rs = {s = \\n,c => cn.s ! n ! c ++ rs.s ! {n = n ; p = P3}} ; + -- AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s} ; + -- + -- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s} ; + -- ApposCN cn np = +} diff --git a/next-lib/src/arabic/NumeralAra.gf b/next-lib/src/arabic/NumeralAra.gf new file mode 100644 index 000000000..12c7548f8 --- /dev/null +++ b/next-lib/src/arabic/NumeralAra.gf @@ -0,0 +1,154 @@ +concrete NumeralAra of Numeral = CatAra ** + open Predef, Prelude, ResAra, MorphoAra in { + + + +lincat + + Digit = {s : DForm => CardOrd => Gender => State => Case => Str ; + n : Size } ; + Sub10 = {s : DForm => CardOrd => Gender => State => Case => Str ; + n : Size } ; + Sub100 = {s : CardOrd => Gender => State => Case => Str ; + n : Size} ; + Sub1000 = {s : CardOrd => Gender => State => Case => Str ; + n : Size } ; + Sub1000000 = {s : CardOrd => Gender => State => Case => Str ; + n : Size} ; + + + + lin num x = x ; + + lin n2 = num2 ** {n = Two }; + + lin n3 = num3_10 "ثَلاث" "ثالِث"; + lin n4 = num3_10 "أَربَع" "رابِع"; + lin n5 = num3_10 "خَمس" "خامِس"; + lin n6 = num3_10 "سِتّ" "سادِس"; + lin n7 = num3_10 "سَبع" "سابِع"; + lin n8 = num3_10 "ثَمانِي" "ثامِن"; + lin n9 = num3_10 "تِسع" "تاسِع"; + + lin pot01 = mkNum "واحِد" "أَوَّل" "أُولى" ** { n = One } ; + + lin pot0 d = d ; + + lin pot110 = { + s= ((num3_10 "عَشر" "عاشِر").s ! unit ) ; + n = ThreeTen + }; + + lin pot111 = { + s = \\_,g,d,_ => + case g of { + Masc => Al ! d + "أَحَدَ" ++ teen ! Masc ; + Fem => Al ! d + "إِحدَى" ++ teen ! Fem + }; + n = NonTeen + }; + + lin pot1to19 dig = { + s = \\co,g,d,c => case dig.n of { + Two => Al ! d + num2.s ! unit ! co ! g ! Const ! c ++ teen ! g ; + _ => dig.s ! unit ! co ! g ! (toDef d ThreeTen) ! Acc ++ + teen ! (genPolarity ! g) + }; + n = case dig.n of { + Two => NonTeen; + _ => Teen + } + }; + + lin pot0as1 num = { + s= num.s ! unit; + n = num.n + } ; + + lin pot1 dig = { + s = dig.s ! ten; + n = NonTeen + } ; + + lin pot1plus dig n = { + s = \\co,g,d,c => n.s ! unit ! co ! g ! d ! c + ++ "وَ" ++ dig.s ! ten ! co ! g ! d ! c ; + n = NonTeen + }; + + lin pot1as2 n = n ; + + lin pot2 dig = { + s = \\co,_,d,c => case dig.n of { + One => num100 ! d ! c ; + Two => num200 ! d ! c ; + _ => dig.s ! unit ! co ! Masc ! (toDef d ThreeTen) ! c ++ "مِٱَةِ" + }; + n = Hundreds + }; + + lin pot2plus m e = { + s = \\co,g,d,c => case m.n of { + One => num100 ! d ! c; + Two => num200 ! d ! c; + _ => m.s ! unit ! co ! Masc ! (toDef d ThreeTen) ! c ++ "مِٱَةٌ" + } ++ "وَ" ++ e.s ! co ! g ! d ! c ; + n = e.n + }; + + lin pot2as3 n = n ; + + lin pot3 m = { + s = \\co,_,d,c => case m.n of { + One => num1000 ! (definite ! d) ! c; + Two => num2000 ! (definite ! d) ! c; + _ => m.s ! co ! Fem ! (toDef d ThreeTen) ! c ++ "آلافٌ" + } ; + n = m.n + }; +--lin pot3plus n m = { +-- s = \\c => n.s ! NCard ++ "تهُْسَند" ++ m.s ! c ; n = Pl} ; + +-- numerals as sequences of digits + + lincat + Dig = Digits ; +-- Numeral,Digits = {s : Gender => State => Case => Str ; +-- n : Size } ; + + + lin + IDig d = d ; + + IIDig d i = { + s = d.s ++ i.s; + n = ThreeTen ; + } ; + + D_0 = mk1Dig "0" ; + D_1 = mk2Dig "1" One ; + D_2 = mk2Dig "2" Two ; + D_3 = mk1Dig "3" ; + D_4 = mk1Dig "4" ; + D_5 = mk1Dig "5" ; + D_6 = mk1Dig "6" ; + D_7 = mk1Dig "7" ; + D_8 = mk1Dig "8" ; + D_9 = mk1Dig "9" ; + + oper + + + mk2Dig : Str -> Size -> Digits = \str,sz -> { + s = str ; + n = sz ; + lock_Digits = <> + }; + + mk1Dig : Str -> Digits = \str -> { + s = str ; + n = ThreeTen; + lock_Digits = <> + }; + +} diff --git a/next-lib/src/arabic/OrthoAra.gf b/next-lib/src/arabic/OrthoAra.gf new file mode 100644 index 000000000..62ebc9b58 --- /dev/null +++ b/next-lib/src/arabic/OrthoAra.gf @@ -0,0 +1,41 @@ +resource OrthoAra = open Prelude, Predef in { + +flags coding=utf8 ; + + oper + + rectifyHmz: Str -> Str = \word -> + case word of { + l@(""|"ال") + "؟" + v@("َ"|"ُ") + tail => l + "أ" + v + tail; + l@(""|"ال") + "؟" + v@("ِ") + tail => l + "إ" + v + tail; + head + v1@("ِ"|"ُ"|"َ"|"ْ"|"ا"|"ي"|"و") + "؟" + v2@(""|"ُ"|"َ"|"ْ"|"ِ") => head + v1 + (tHmz v1) + v2; + head + "؟" + tail => head + (bHmz (dp 2 head) (take 2 tail)) + tail; --last head , take 1 tail + _ => word + }; + + --hamza at beginning of word (head) + hHmz : 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 { + "ِ" => "ئ"; + "ُ" => "ؤ"; + "َ" => "أ"; + "ْ"|"ا"|"و"|"ي" => "ء" + }; + +} diff --git a/next-lib/src/arabic/ParadigmsAra.gf b/next-lib/src/arabic/ParadigmsAra.gf new file mode 100644 index 000000000..bc9d498a5 --- /dev/null +++ b/next-lib/src/arabic/ParadigmsAra.gf @@ -0,0 +1,500 @@ +--# -path=.:../abstract:../../prelude:../common + +--1 Arabic Lexical Paradigms +-- +-- Ali El Dada 2005--2006 +-- +-- This is an API to the user of the resource grammar +-- for adding lexical items. It gives functions for forming +-- expressions of open categories: nouns, adjectives, verbs. +-- +-- Closed categories (determiners, pronouns, conjunctions) are +-- accessed through the resource syntax API, $Structural.gf$. +-- +-- The main difference with $MorphoAra.gf$ is that the types +-- referred to are compiled resource grammar types. We have moreover +-- had the design principle of always having existing forms, rather +-- than stems, as string arguments of the paradigms. +-- +-- The structure of functions for each word class $C$ is the following: +-- first we give a handful of patterns that aim to cover all +-- regular cases. Then we give a worst-case function $mkC$, which serves as an +-- escape to construct the most irregular words of type $C$. +-- +-- The following modules are presupposed: + +resource ParadigmsAra = open + Predef, + Prelude, + MorphoAra, + OrthoAra,(ResAra=ResAra), + CatAra + in { + + flags optimize = noexpand; coding=utf8 ; + + oper + +-- Prepositions are used in many-argument functions for rection. + + Preposition : Type ; + +--2 Nouns + +--This is used for loan words or anything that has untreated irregularities +--in the interdigitization process of its words + mkN : NTable -> Gender -> Species -> N ; + +--Takes a root string, a singular pattern string, a broken plural +--pattern string, a gender, and species. Gives a noun. + brkN : Str -> Str -> Str -> Gender -> Species -> N ; + +--Takes a root string, a singular pattern string, a gender, +--and species. Gives a noun whose plural is sound feminine. + sdfN : Str -> Str -> Gender -> Species -> N ; + +--takes a root string, a singular pattern string, a gender, +--and species. Gives a noun whose plural is sound masculine + sdmN : Str -> Str -> Gender -> Species -> N ; + + mkPN : Str -> Gender -> Species -> PN ; + +--3 Relational nouns + + mkN2 : N -> Preposition -> N2 ; + + mkN3 : N -> Preposition -> Preposition -> N3 ; + +--2 Adjectives + +--Takes a root string and a pattern string + sndA : Str -> Str -> A ; + +--Takes a root string only + clrA : Str -> A ; + +--3 Two-place adjectives +-- +-- Two-place adjectives need a preposition for their second argument. + + mkA2 : A -> Preposition -> A2 ; + +--2 Adverbs + +-- Adverbs are not inflected. Most lexical ones have position +-- after the verb. Some can be preverbal. + + mkAdv : Str -> Adv ; + mkAdV : Str -> AdV ; + +-- Adverbs modifying adjectives and sentences can also be formed. + + mkAdA : Str -> AdA ; + +--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. + + mkPreposition : Str -> Preposition ; + +-- (These two functions are synonyms.) + +--2 Verbs + +--The verb in the imperfect tense gives the most information + + regV : Str -> V ; + +--Verb Form I : fa`ala, fa`ila, fa`ula + + v1 : Str -> Vowel -> Vowel -> V ; + +--Verb Form II : fa``ala + + v2 : Str -> V ; + +--Verb Form III : faa`ala + + v3 : Str -> V ; + +--Verb Form IV : 'af`ala + + v4 : Str -> V ; + +--Verb Form V : tafa``ala + + v5 : Str -> V ; + +--Verb Form VI : tafaa`ala + + v6 : Str -> V ; + +--Verb Form VIII 'ifta`ala + + v8 : Str -> V ; + +--3 Two-place verbs + +-- Two-place verbs need a preposition, except the special case with direct object. +-- (transitive verbs). Notice that a particle comes from the $V$. + + mkV2 : V -> Preposition -> V2 ; + + dirV2 : V -> V2 ; + +--3 Three-place verbs + +-- 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,_,_ + +--3 Other complement patterns +-- +-- Verbs and adjectives can take complements such as sentences, +-- questions, verb phrases, and adjectives. + + mkV0 : V -> V0 ; + mkVS : V -> VS ; + mkV2S : V -> Str -> V2S ; +-- mkVV : V -> VV ; + mkV2V : V -> Str -> Str -> V2V ; + mkVA : V -> VA ; + mkV2A : V -> Str -> V2A ; + mkVQ : V -> VQ ; + mkV2Q : V -> Str -> V2Q ; + + mkAS : A -> AS ; + mkA2S : A -> Str -> A2S ; + mkAV : A -> AV ; + mkA2V : A -> Str -> A2V ; + +-- Notice: categories $AS, A2S, AV, A2V$ are just $A$, +-- and the second argument is given +-- as an adverb. Likewise +-- $V0$ is just $V$. + + V0 : Type ; + AS, A2S, AV, A2V : Type ; + + +--. +--2 Definitions of paradigms + +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + +{- +-- AED's original definition of regV + + regV = \word -> + case word of { + "يَ" + f@_ + c@_ + "ُ" + l@_ => v1 (f+c+l) a u ; + "يَ" + f@_ + c@_ + "ِ" + l@_ => v1 (f+c+l) a i ; + "يَ" + f@_ + c@_ + "َ" + l@_ => v1 (f+c+l) a a ; + f@_ + "َ" + c@_ + "ِ" + l@_ => v1 (f+c+l) i a + }; +-} + +---- begin workaround for a problem with pattern matching, AR 27/6/2008 + + regV = \word -> + case Predef.eqStr (Predef.take 2 word) "يَ" of { + Predef.PTrue => vYa (Predef.drop 2 word) ; + _ => vCo word + }; + + vYa : Str -> V = \word -> + let + fcl = Predef.take 2 word + Predef.drop 3 word ; + voc = case Predef.take 1 (Predef.drop 2 word) of { + "ُ" => u ; + "ِ" => i ; + _ => a + } + in + v1 fcl a voc ; + + vCo : Str -> V = \word -> + let + f = Predef.take 1 word ; + c = Predef.take 1 (Predef.drop 2 word) ; + l = Predef.drop 4 word + in + v1 (f + c + l) i a ; + +---- end workaround definition + + v1 = \rootStr,vPerf,vImpf -> + let { raw = v1' rootStr vPerf vImpf } in + { s = \\vf => + case rootStr of { + _ + "؟" + _ => rectifyHmz(raw.s ! vf); + _ => raw.s ! vf + }; + lock_V = <> + } ; + + va : Vowel = ResAra.a ; + + v1' : Str -> Vowel -> Vowel -> Verb = + \rootStr,vPerf,vImpf -> + let { root = mkRoot3 rootStr ; + l = dp 2 rootStr } in --last rootStr + case of { + <"ّ",_> => v1geminate rootStr vPerf vImpf ; + <"و"|"ي",_> => v1defective root vImpf ; + <_,"و"|"ي"> => v1hollow root vImpf ; + _ => v1sound root vPerf vImpf + }; + + v2 = + \rootStr -> + let { + root = mkRoot3 rootStr + } in { + s = + case root.l of { + "و"|"ي" => (v2defective root).s; + _ => (v2sound root).s + }; + lock_V = <> + }; + + v3 = + \rootStr -> + let { + tbc = mkRoot3 rootStr ; + } in { + s = (v3sound tbc).s ; + lock_V = <> + }; + + v4 = + \rootStr -> + let { + root = mkRoot3 rootStr + } in { + s = + case root.l of { + "و"|"ي" => (v4defective root).s; + _ => (v4sound root).s + }; + lock_V = <> + }; + + + v5 = + \rootStr -> + let { raw = v5' rootStr } in + { s = \\vf => + case rootStr of { + _ + "؟" + _ => rectifyHmz(raw.s ! vf); + _ => raw.s ! vf + }; + lock_V = <> + }; + + v5' : Str -> V = + \rootStr -> + let { + nfs = mkRoot3 rootStr ; + } in { + s = (v5sound nfs).s ; lock_V = <> + }; + + v6 = + \rootStr -> + let { + fqm = mkRoot3 rootStr ; + } in { + s = (v6sound fqm).s ; + lock_V = <> + }; + + v8 = + \rootStr -> + let { + rbT = mkRoot3 rootStr ; + } in { + s = (v8sound rbT).s ; + lock_V = <> + }; + + Preposition = Str ; + + mkN nsc gen spec = + { s = nsc; --NTable + g = gen; + h = spec; + lock_N = <> + }; + + brkN' : Str -> Str -> Str -> Gender -> Species -> N = + \root,sg,pl,gen,spec -> + let { kitAb = mkWord sg root; + kutub = mkWord pl root + } in mkN (reg kitAb kutub) gen spec; + + brkN root sg pl gen spec = + let { raw = brkN' root sg pl gen spec} in + { s = \\n,d,c => + case root of { + _ + "؟" + _ => rectifyHmz(raw.s ! n ! d ! c); + _ => raw.s ! n ! d ! c + }; + g = gen; + h = spec ; lock_N = <> + }; + + sdfN = + \root,sg,gen,spec -> + let { kalima = mkWord sg root; + } in mkN (sndf kalima) gen spec; + + sdmN = + \root,sg,gen,spec -> + let { mucallim = mkWord sg root; + } in mkN (sndm mucallim) gen spec; + + mkPN = \str,gen,species -> + { s = \\c => str + indecl!c ; + g = gen; + h = species; + lock_PN = <> + }; + + + mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p} ; + + mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p ; c3 = q} ; + + mkPron : (_,_,_ : Str) -> PerGenNum -> NP = \ana,nI,I,pgn -> + { s = + table { + Nom => ana; + Acc => nI; + Gen => I + }; + a = {pgn = pgn; isPron = True }; + lock_NP = <> + }; + + -- e.g. al-jamii3, 2a7ad + regNP : Str -> Number -> NP = \word,n -> + { s = \\c => word + vowel ! c ; + a = {pgn = Per3 Masc n; isPron = False }; + lock_NP = <> + }; + + -- e.g. hadha, dhaalika + indeclNP : Str -> Number -> NP = \word,n -> + { s = \\c => word ; + a = {pgn = Per3 Masc n; isPron = False }; + lock_NP = <> + }; + + mkQuant7 : (_,_,_,_,_,_,_ : Str) -> State -> Quant = + \hava,havihi,havAn,havayn,hAtAn,hAtayn,hA'ulA,det -> + { s = \\n,s,g,c => + case of { + <_,Masc,_,Sg> => hava; + <_,Fem,_,Sg> => havihi; + <_,Masc,Nom,Dl>=> havAn; + <_,Masc,_,Dl> => havayn; + <_,Fem,Nom,Dl> => hAtAn; + <_,Fem,_,Dl> => hAtayn; + => hA'ulA; + _ => havihi + }; + d = Def; + isPron = False; + isNum = False; + lock_Quant = <> + }; + + mkQuant3 : (_,_,_ : Str) -> State -> Quant = + \dalika,tilka,ula'ika,det -> + { s = \\n,s,g,c => + case of { + <_,Masc,_,Sg> => dalika; + <_,Fem,_,Sg> => tilka; + => ula'ika; + _ => tilka + }; + d = Def; + isPron = False; + isNum = False; + lock_Quant = <> + }; + + sndA root pat = + let raw = sndA' root pat in { + s = \\af => + case root of { + _ + "؟" + _ => rectifyHmz(raw.s ! af); + _ => raw.s ! af + }; + lock_A = <> + }; + + sndA' : Str -> Str -> A = + \root,pat -> + let { kabIr = mkWord pat root; + akbar = mkWord "أَفعَل" root + } in { + s = table { + APosit g n d c => (positAdj kabIr) ! g ! n ! d ! c ; + AComp d c => (indeclN akbar) ! d ! c + }; + lock_A = <> + }; + + clrA root = + let { eaHmar = mkWord "أَفعَل" root; + HamrA' = mkWord "فَعلاء" root; + Humr = mkWord "فُعل" root + } in { + s = clr eaHmar HamrA' Humr; + lock_A = <> + }; + + mkA2 a p = a ** {c2 = p ; lock_A2 = <>} ; + + mkAdv x = ss x ** {lock_Adv = <>} ; + mkAdV x = ss x ** {lock_AdV = <>} ; + mkAdA x = ss x ** {lock_AdA = <>} ; + + mkPreposition p = p ; + mkV2 v p = v ** {s = v.s ; c2 = p ; lock_V2 = <>} ; + dirV2 v = mkV2 v [] ; + + mkV3 v p q = v ** {s = v.s ; c2 = p ; c3 = q ; lock_V3 = <>} ; + dirV3 v p = mkV3 v [] p ; + dirdirV3 v = dirV3 v [] ; + + mkVS v = v ** {lock_VS = <>} ; + mkVQ v = v ** {lock_VQ = <>} ; + + 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 = <>} ; + + 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 = <>} ; + + +} ; diff --git a/next-lib/src/arabic/PatternsAra.gf b/next-lib/src/arabic/PatternsAra.gf new file mode 100644 index 000000000..611fd262a --- /dev/null +++ b/next-lib/src/arabic/PatternsAra.gf @@ -0,0 +1,106 @@ +resource PatternsAra = { + +flags coding=utf8 ; + + oper + + fA' = { h = "" ; m1 = ""; m2 = ""; t = "َاء"} ; + + eafAcI = { h = "أَ"; m1 = "َا"; m2 = ""; t = "ِي" } ; + eafcA' = { h = "أَ"; m1 = "ْ" ; m2 = ""; t = "َاء"} ; + eafcI = { h = "أَ"; m1 = "ْ" ; m2 = ""; t = "ِي" } ; + fac = { h = "" ; m1 = "َ" ; m2 = ""; t = "" } ; + facc = { h = "" ; m1 = "َ" ; m2 = ""; t = "ّ" } ; + facca = { h = "" ; m1 = "َ" ; m2 = ""; t = "َّ" } ; + facci = { h = "" ; m1 = "َ" ; m2 = ""; t = "ِّ" } ; + faccu = { h = "" ; m1 = "َ" ; m2 = ""; t = "ُّ" } ; + facp = { h = "" ; m1 = "َ" ; m2 = ""; t = "َة" } ; + faca = { h = "" ; m1 = "َ" ; m2 = ""; t = "َ" } ; + facA = { h = "" ; m1 = "َ" ; m2 = ""; t = "َا" } ; + facA' = { h = "" ; m1 = "َ" ; m2 = ""; t = "َاء"} ; + fAc = { h = "" ; m1 = "َا"; m2 = ""; t = "" } ; + fAcp = { h = "" ; m1 = "َا"; m2 = ""; t = "َة" } ; + fic = { h = "" ; m1 = "ِ" ; m2 = ""; t = "" } ; + ficc = { h = "" ; m1 = "ِ" ; m2 = ""; t = "ّ" } ; + ficA' = { h = "" ; m1 = "ِ" ; m2 = ""; t = "َاء"} ; + fIc = { h = "" ; m1 = "ِي"; m2 = ""; t = "" } ; + fIcAn = { h = "" ; m1 = "ِي"; m2 = ""; t = "َان"} ; + fca = { h = "" ; m1 = "ْ" ; m2 = ""; t = "َ" } ; + fci = { h = "" ; m1 = "ْ" ; m2 = ""; t = "ِ" } ; + fcu = { h = "" ; m1 = "ْ" ; m2 = ""; t = "ُ" } ; + fuc = { h = "" ; m1 = "ُ" ; m2 = ""; t = "" } ; + fucc = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ّ" } ; + fucci = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ِّ" } ; + fuccu = { h = "" ; m1 = "ُ" ; m2 = ""; t = "ُّ" } ; + 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 = "َ" } ; + + eafAcil = { h = "أَ"; m1 = "َا" ; m2 = "ِ" ; t = "" } ; + eafAcIl = { h = "أَ"; m1 = "َا" ; m2 = "ِي" ; t = "" } ; + eafcilp = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "َة" } ; + eafcal = { h = "أَ"; m1 = "ْ" ; m2 = "َ" ; t = "" } ; + eafcAl = { h = "أَ"; m1 = "ْ" ; m2 = "َا" ; t = "" } ; + eafcil = { h = "أَ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + eafcul = { h = "أَ"; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; + eiftacal = { h = "إِ"; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; + eufcil = { h = "أُ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + euftucil = { h = "أُ"; m1 = "ْتُ" ; m2 = "ِ" ; t = "" } ; + afcul = { h = "َ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; + faccalo = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "ْ" } ; + facal = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "" } ; + facalo = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "ْ" } ; + facalp = { h = "" ; m1 = "َ" ; m2 = "َ" ; t = "َة" } ; + facA'il = { h = "" ; m1 = "َ" ; m2 = "َائِ"; t = "" } ; + facAl = { h = "" ; m1 = "َ" ; m2 = "َا" ; t = "" } ; + facAlI = { h = "" ; m1 = "َ" ; m2 = "َا" ; t = "ِي" } ; + facil = { h = "" ; m1 = "َ" ; m2 = "ِ" ; t = "" } ; + facIl = { h = "" ; m1 = "َ" ; m2 = "ِي" ; t = "" } ; + facl = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "" } ; + faclp = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "َة" } ; + facul = { h = "" ; m1 = "َ" ; m2 = "ُ" ; t = "" } ; + fAcal = { h = "" ; m1 = "َا" ; m2 = "َ" ; t = "" } ; + fAcil = { h = "" ; m1 = "َا" ; m2 = "ِ" ; t = "" } ; + faccal = { h = "" ; m1 = "َ" ; m2 = "َّ" ; t = "" } ; + faccil = { h = "" ; m1 = "َ" ; m2 = "ِّ" ; t = "" } ; + faclA' = { h = "" ; m1 = "َ" ; m2 = "ْ" ; t = "َاء"} ; + fAcilp = { h = "" ; m1 = "َا" ; m2 = "ِ" ; t = "َة" } ; + fawAcil = { h = "" ; m1 = "َوَا"; m2 = "ِ" ; t = "" } ; + ficAlp = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "َة" } ; + fcal = { h = "" ; m1 = "ْ" ; m2 = "َ" ; t = "" } ; + fcil = { h = "" ; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + fcul = { h = "" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; + ficl = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "" } ; + ficAl = { h = "" ; m1 = "ِ" ; m2 = "َا" ; t = "" } ; + ficlp = { h = "" ; m1 = "ِ" ; m2 = "ْ" ; t = "َة" } ; + ftacal = { h = "" ; m1 = "ْتَ" ; m2 = "َ" ; t = "" } ; + ftacil = { h = "" ; m1 = "ْتَ" ; m2 = "ِ" ; t = "" } ; + fuccAl = { h = "" ; m1 = "ُ" ; m2 = "َّا" ; t = "" } ; + fuccil = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ; + fuccilo = { h = "" ; m1 = "ُ" ; m2 = "ِّ" ; t = "ْ" } ; + fucal = { h = "" ; m1 = "ُ" ; m2 = "َ" ; t = "" } ; + fucaylp = { h = "" ; m1 = "ُ" ; m2 = "َيْ" ; t = "َة" } ; + fucAl = { h = "" ; m1 = "ُ" ; m2 = "َا" ; t = "" } ; + fucl = { h = "" ; m1 = "ُ" ; m2 = "ْ" ; t = "" } ; + fucil = { h = "" ; m1 = "ُ" ; m2 = "ِ" ; t = "" } ; + fuclp = { h = "" ; m1 = "ُ" ; m2 = "ْ" ; t = "َة" } ; + fucilo = { h = "" ; m1 = "ُ" ; m2 = "ِ" ; t = "ْ" } ; + fucul = { h = "" ; m1 = "ُ" ; m2 = "ُ" ; t = "" } ; + fuculo = { h = "" ; m1 = "ُ" ; m2 = "ُ" ; t = "ْ" } ; + fucUl = { h = "" ; m1 = "ُ" ; m2 = "ُو" ; t = "" } ; + fUcil = { h = "" ; m1 = "ُو" ; m2 = "ِ" ; t = "" } ; + mafcUl = { h = "مَ"; m1 = "ْ" ; m2 = "ُو" ; t = "" } ; + mafcil = { h = "مَ"; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + tafAcal = { h = "تَ"; m1 = "َا" ; m2 = "َ" ; t = "" } ; + tafaccal = { h = "تَ"; m1 = "َ" ; m2 = "َّ" ; t = "" } ; + tufuccil = { h = "تُ"; m1 = "ُ" ; m2 = "ِّ" ; t = "" } ; + tufUcil = { h = "تُ"; m1 = "ُو" ; m2 = "ِ" ; t = "" } ; + ufAcal = { h = "ُ" ; m1 = "َا" ; m2 = "َ" ; t = "" } ; + ufAcil = { h = "ُ" ; m1 = "َا" ; m2 = "ِ" ; t = "" } ; + ufcal = { h = "ُ" ; m1 = "ْ" ; m2 = "َ" ; t = "" } ; + ufcil = { h = "ُ" ; m1 = "ْ" ; m2 = "ِ" ; t = "" } ; + ufcul = { h = "ُ" ; m1 = "ْ" ; m2 = "ُ" ; t = "" } ; + +} diff --git a/next-lib/src/arabic/PhraseAra.gf b/next-lib/src/arabic/PhraseAra.gf new file mode 100644 index 000000000..6910d59f5 --- /dev/null +++ b/next-lib/src/arabic/PhraseAra.gf @@ -0,0 +1,26 @@ +concrete PhraseAra of Phrase = CatAra ** open + ParamX, + Prelude, + ResAra in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ! Masc ++ voc.s} ;--FIXME + +-- UttS s = s ; +-- UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = \\g => imp.s ! pol.p ! g ! ResAra.Sg} ; +-- UttImpPl pol imp = {s = pol.s ++ imp.s ! pol.p ! Pl} ; +-- +-- UttIP ip = {s = ip.s ! Nom} ; --- Acc also +-- UttIAdv iadv = iadv ; +-- UttNP np = {s = np.s ! Acc} ; +-- UttVP vp = {s = infVP False vp (agrP3 Sg)} ; +-- UttAdv adv = adv ; +-- + NoPConj = {s = []} ; +-- PConjConj conj = conj ; +-- + NoVoc = {s = []} ; +-- VocNP np = {s = "،" ++ np.s ! Nom} ; +-- +} diff --git a/next-lib/src/arabic/QuestionAra.gf b/next-lib/src/arabic/QuestionAra.gf new file mode 100644 index 000000000..651a72cfd --- /dev/null +++ b/next-lib/src/arabic/QuestionAra.gf @@ -0,0 +1,55 @@ +concrete QuestionAra of Question = CatAra ** open ResAra, ParamX in { + + flags optimize=all_subs ; + + lin + + QuestCl cl = { + s = \\t,p => + table { + QIndir => "إِذا" ++ cl.s ! t ! p ! Verbal ; + QDir => cl.s ! t ! p ! Verbal + } + }; + + +-- +-- QuestVP qp vp = +-- let cl = mkClause (qp.s ! Nom) {n = qp.n ; p = P3} vp +-- in {s = \\t,a,b,_ => cl.s ! t ! a ! b ! ODir} ; +-- +-- QuestSlash ip slash = { +-- s = \\t,a,p => +-- let +-- cls = slash.s ! t ! a ! p ; +-- who = slash.c2 ++ ip.s ! Acc --- stranding in ExtAra +-- in table { +-- QDir => who ++ cls ! OQuest ; +-- QIndir => who ++ cls ! ODir +-- } +-- } ; +-- +-- QuestIAdv iadv cl = { +-- s = \\t,a,p => +-- let +-- cls = cl.s ! t ! a ! p ; +-- why = iadv.s +-- in table { +-- QDir => why ++ cls ! OQuest ; +-- QIndir => why ++ cls ! ODir +-- } +-- } ; +-- +-- PrepIP p ip = {s = p.s ++ ip.s ! Nom} ; +-- +-- AdvIP ip adv = { +-- s = \\c => ip.s ! c ++ adv.s ; +-- n = ip.n +-- } ; +-- +-- IDetCN idet num ord cn = { +-- s = \\c => idet.s ++ num.s ++ ord.s ++ cn.s ! idet.n ! c ; +-- n = idet.n +-- } ; +-- +} diff --git a/next-lib/src/arabic/RelativeAra.gf b/next-lib/src/arabic/RelativeAra.gf new file mode 100644 index 000000000..13cf7c5f1 --- /dev/null +++ b/next-lib/src/arabic/RelativeAra.gf @@ -0,0 +1,34 @@ +concrete RelativeAra of Relative = CatAra ** open ResAra in { +-- +-- 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 +-- } ; +-- +-- 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} ; +-- +} diff --git a/next-lib/src/arabic/ResAra.gf b/next-lib/src/arabic/ResAra.gf new file mode 100644 index 000000000..e18dc5ebe --- /dev/null +++ b/next-lib/src/arabic/ResAra.gf @@ -0,0 +1,1171 @@ +--# -path=.:../abstract:../common:../../prelude +-- +----1 Arabic auxiliary operations. +-- +---- This module contains operations that are needed to make the +---- resource syntax work. To define everything that is needed to +---- implement $Test$, it moreover contains regular lexical +---- patterns needed for $Lex$. +-- +resource ResAra = PatternsAra ** open Prelude, Predef in { + + flags optimize=noexpand ; coding=utf8 ; + + + param + + Vowel = u | a | i ; + Number = Sg | Dl | Pl; + Gender = Masc | Fem ; + Case = Nom | Acc | Gen ; + Person = P1 | P2 | P3 ; + Species = NoHum | Hum ; + State = Def | Indef | Const ; + Mood = Ind | Cnj | Jus ; + Voice = Act | Pas ; + Tense = Pres | Past | Fut ; + Order = Verbal | Nominal ; + + oper + + --roots, patterns, and making words: + + Pattern : Type = {h, m1, m2, t : Str}; + Root : Type = {f : Str}; + Root2 : Type = Root ** {c : Str} ; + Root3 : Type = Root2 ** {l : Str} ; + + mkRoot3 : Str -> Root3 = \fcl -> + let { cl = drop 2 fcl; --drop 1 fcl + l' = dp 2 fcl; --last fcl + c' = take 2 cl} in --take 1 cl + {f = take 2 fcl; c = c'; --take 1 fcl + l = case l' of { + "ّ" => c'; + _ => l' + } + }; + + --for roots with 2 consonants (works also for assimilated strs, like fc~, + --because the function discards anything after the first two characters + mkRoot2 : Str -> Root2 = \fcl -> + let { cl = drop 2 fcl} in --drop 1 fcl + {f = take 2 fcl; c = take 2 cl}; --take 1 + + --opers to interdigitize (make words out of roots and patterns: + + oper + --regular case, 3 non-weak consonants + mkStrong : Pattern -> Root3 -> Str = \p,fcl -> + p.h + fcl.f + p.m1 + fcl.c + p.m2 + fcl.l + p.t; + + mkDefective: Pattern -> Root3 -> Str = \p,fcl -> + p.h + fcl.f + p.m1 + fcl.c + p.t; + + mkHollow: Pattern -> Root3 -> Str = \p,fcl -> + p.h + fcl.f + p.m1 + fcl.l + p.t; + + mkAssimilated: Pattern -> Root3 -> Str = \p,fcl -> + p.h + fcl.c + p.m1 + fcl.l + p.t; + + -- takes a weak pattern and a triliteral root and makes + -- a word, deducing which root consonant is weak + mkWeak : Pattern -> Str -> Str = \pat,root -> + let fcl = mkRoot3 root in + case root of { + _ + ("و"|"ي"|"ّ") => mkDefective pat fcl; + _ + ("و"|"ي") + _ => mkHollow pat fcl; + ("و"|"ي") + _ => mkAssimilated pat fcl + }; + + mkBilit : Pattern -> Root2 -> Str = \p,fcl -> + p.h + fcl.f + p.m1 + fcl.c + p.t; + + --takes a pattern string and root string and makes a word + mkWord : Str -> Str -> Str =\pS, rS -> + case pS of { + w@_ + "ف" + x@_ + "ع" + y@_ + "ل" + z@_ => + mkStrong { h = w ; m1 = x; m2 = y; t = z} (mkRoot3 rS); + w@_ + "ف" + x@_ + "ع" + y@_ => + let pat = { h = w ; m1 = x; m2 = ""; t = y} in + case of { + 6 | 5 => mkWeak pat rS ; --3=> + 4 | 3 => mkBilit pat (mkRoot2 rS) ; --2=> + _ => rS ---- AR error "expected 3--6" + } + }; + + --types of open classes: + + NTable = Number => State => Case => Str; + + Noun : Type = {s : NTable ; g : Gender; h : Species} ; +-- Adj : Type = {s : Gender => NTable} ; + Adj : Type = {s : AForm => Str} ; + Verb : Type = {s : VForm => Str} ; + + param + VForm = + VPerf Voice PerGenNum + | VImpf Mood Voice PerGenNum + | VImp Gender Number + | VPPart ; + + PerGenNum = + Per3 Gender Number + | Per2 Gender Number + | Per1 SgPl; + + SgPl = Sing | Plur; + + AForm = + APosit Gender Number State Case + | AComp State Case ; + + --verbal morphology + +oper + + --macro for sound verb + --PerfAct, PerfPas, ImpfAct, ImpfPas, Imp, PPart + verb : (_,_,_,_,_,_ : Str) -> Verb = + \katab,kutib,aktub,uktab,euktub,maktUb -> { + s = table { + VPerf Act pgn => katab + suffixPerf ! pgn ; + VPerf Pas pgn => kutib + suffixPerf ! pgn ; + VImpf Ind Act pgn => prefixImpf!pgn + aktub + suffixImpfInd !pgn; + VImpf Ind Pas pgn => prefixImpf!pgn + uktab + suffixImpfInd !pgn; + VImpf m Act pgn => prefixImpf!pgn + aktub + suffixImpfCJ m ! pgn; + VImpf m Pas pgn => prefixImpf !pgn + uktab + suffixImpfCJ m !pgn; + VImp g n => euktub + suffixImpfCJ Jus ! (Per2 g n); + VPPart => maktUb + } + } ; + + --affixes of sound verbs + + suffixPerf : PerGenNum => Str = + table { + Per3 Masc Sg => "َ" ; + Per3 Masc Dl => "َا" ; + Per3 Masc Pl => "ُوا" ; + Per3 Fem Sg => "َتْ" ; + Per3 Fem Dl => "َتَا" ; + Per3 Fem Pl => "ْنَ" ; + Per2 Masc Sg => "ْتَ" ; + Per2 _ Dl => "ْتُمَا" ; + Per2 Masc Pl => "ْتُمْ" ; + Per2 Fem Sg => "ْتِ" ; + Per2 Fem Pl => "ْتُنَّ" ; + Per1 Sing => "ْتُ" ; + Per1 Plur => "ْنَا" + } ; + + prefixImpf : PerGenNum => Str = + table { + Per1 Sing => "أ" ; + Per1 Plur => "ن" ; + Per3 Masc _ => "ي" ; + Per3 Fem Pl => "ي" ; + _ => "ت" + } ; + + suffixImpfInd : PerGenNum => Str = + table { + Per3 Masc Pl => "ُونَ" ; + Per3 Fem Pl => "ْنَ" ; + Per3 g Dl => "َانِ" ; + Per2 Masc Pl => "ُونَ" ; + Per2 Fem Sg => "ِينَ" ; + Per2 g Dl => "َانِ" ; + Per2 Fem Pl => "ْنَ" ; + _ => "ُ" + } ; + + suffixImpfCJ : Mood -> PerGenNum => Str = \m -> + table { + Per3 Masc Pl => "ُوا" ; + Per3 Fem Pl => "ْنَ" ; + Per3 g Dl => "َا" ; + Per2 Masc Pl => "ُوا" ; + Per2 Fem Sg => "ِي" ; + Per2 g Dl => "َا" ; + Per2 Fem Pl => "ْنَ" ; + _ => endVowel ! m + } ; + + --macro for geminate verbs: FIXME, change the misleading variable names + verbGeminate : (_,_,_,_,_,_,_,_,_,_,_ : Str) -> Verb = + \xAf,xif,xyf,xuf,axAf,axaf,uxAf,uxaf,xaf,xAf',ppart -> + let { perfPattern = patHollowPerf xAf xif xyf xuf ; + impfPattern = patHollowImpf axAf axaf uxAf uxaf ; + impPattern = patHollowImp xaf xAf' + } in + { s = table { + VPerf v pgn => perfPattern ! v ! pgn + suffixPerf ! pgn ; + VImpf Ind v pgn => prefixImpf ! pgn + impfPattern ! v ! pgn + suffixImpfInd ! pgn ; + VImpf m v pgn => prefixImpf ! pgn + impfPattern ! v ! pgn + suffixImpfCJ m ! pgn ; + VImp g n => impPattern ! g ! n + suffixImpfCJ Jus ! (Per2 g n); + VPPart => ppart + } + } ; + + --macro for hollow verbs: + verbHollow : (_,_,_,_,_,_,_,_,_,_,_ : Str) -> Verb = + \xAf,xif,xyf,xuf,axAf,axaf,uxAf,uxaf,xaf,xAf',ppart -> + let { perfPattern = patHollowPerf xAf xif xyf xuf ; + impfPattern = patHollowImpf axAf axaf uxAf uxaf ; + impPattern = patHollowImp axaf xAf' ; + jusPattern = patHollowJus axaf axAf uxaf uxAf ; + } in + { s = table { + VPerf v pgn => perfPattern ! v ! pgn + suffixPerf ! pgn ; + VImpf Ind v pgn => prefixImpf ! pgn + impfPattern ! v ! pgn + suffixImpfInd ! pgn ; + VImpf Cnj v pgn => prefixImpf ! pgn + impfPattern ! v ! pgn + suffixImpfCJ Cnj ! pgn ; + VImpf Jus v pgn => prefixImpf ! pgn + jusPattern ! v ! pgn + suffixImpfCJ Jus ! pgn ; + VImp g n => impPattern ! g ! n + suffixImpfCJ Jus ! (Per2 g n); + VPPart => ppart + } + } ; + + --macro for defective verbs: + verbDef: (_,_,_,_,_,_,_,_,_,_,_ : Str) -> Vowel -> Verb = + \rama,ramay,rumi,rumu,rumiy,armi,armu,urma,Irmi,Irmu,ppart,vowel -> + let { + patPerf = patDefPerf rama ramay rumi rumu rumiy ; + patImpfAct = patDefImpfAct armi armu ; + patImp = patDefImp Irmi Irmu + } in + { s = table { + VPerf v pgn => patPerf ! v ! pgn + (suffixPerfDef v) ! pgn ; + VImpf m Act pgn => prefixImpf ! pgn + patImpfAct ! pgn + (suffixImpfDef Act vowel) ! m ! pgn ; + VImpf m Pas pgn => prefixImpf ! pgn + urma + (suffixImpfDef Pas vowel) ! m ! pgn ; + VImp g n => patImp ! g ! n + (suffixImpfDef Act vowel) ! Jus ! (Per2 g n) ; + VPPart => ppart + } + } ; + + patDefPerf : (_,_,_,_,_ :Str) -> Voice => PerGenNum => Str = \rama,ramay,rumi,rumu,rumy -> + table { + Act => + table { + Per3 Fem Pl => ramay ; + Per3 _ _ => rama ; + _ => ramay + } ; + Pas => + table { + Per3 Masc Pl => rumu ; + Per3 Fem Pl => rumy ; + Per3 _ _ => rumi ; + _ => rumy + } + } ; + + --ignores the vowel=u case, eg "دعو" + patDefImpfAct : (_,_ : Str) -> PerGenNum => Str = \rmi,rmu -> + table { + Per3 Masc Pl => rmu ; + Per2 Masc Pl => rmu ; + _ => rmi + } ; + + + patDefImp : (_,_ : Str) -> Gender => Number => Str = \rmi, rmu -> + table { + Masc => table {Pl => rmu ; _ => rmi} ; + _ => table {_ => rmi} + } ; + + + suffixPerfDef : Voice -> PerGenNum => Str = \v -> + let {p3ms = + case v of { + Act => "ى" ; + Pas => "يَ" + } ; + ya = + case v of { + Act => "" ; + Pas => "يَ" + } + } in + table { + Per3 Masc Sg => p3ms ; + Per3 Masc Dl => "يَا" ; + Per3 Masc Pl => "وْا" ; + Per3 Fem Sg => ya + "تْ" ; + Per3 Fem Dl => ya + "تَا" ; + Per3 Fem Pl => "نَ" ; + Per2 Masc Sg => "تَ" ; + Per2 _ Dl => "تُمَا" ; + Per2 Masc Pl => "تُمْ" ; + Per2 Fem Sg => "تِ" ; + Per2 Fem Pl => "تُنَّ" ; + Per1 Sing => "تُ" ; + Per1 Plur => "نَا" + } ; + + + suffixImpfDef : Voice -> Vowel -> Mood => PerGenNum => Str = \vc,vw -> + let { + default : Mood -> Str = \m -> + case vc of { + Pas => case m of {Jus => "" ; _ => "ى"} ; + Act => case vw of { + u => case m of {Ind => "و" ; Cnj => "وَ" ; Jus => ""} ; + i => case m of {Ind => "ي" ; Cnj => "يَ" ; Jus => ""} ; + a => case m of {Ind => "ى" ; Cnj => "ى" ; Jus => ""} + } + } + } in + table { + Ind => + table { + Per3 Masc Pl => "وْنَ" ; + Per2 Masc Pl => "وْنَ" ; + Per3 g Dl => "يَانِ" ; + Per2 g Dl => "يَانِ" ; + Per3 Fem Pl => "يْنَ" ; + Per2 Fem _ => "يْنَ" ; + _ => default Ind + } ; + m => + table { + Per3 Masc Pl => "وْا" ; + Per2 Masc Pl => "وْا" ; + Per3 g Dl => "يَا" ; + Per2 g Dl => "يَا" ; + Per3 Fem Pl => "يْنَ" ; + Per2 Fem Pl => "يْنَ" ; + Per2 Fem Sg => "ي" ; + _ => default m + } + } ; + +--now is used for the sound, assimilated (weak C1), and when C1 = hamza: + +v1sound : Root3 -> Vowel -> Vowel -> Verb = + \fcl,vPerf,vImpf -> + let { + qf = {f = fcl.c ; c = fcl.l} ; + qif = mkBilit (fvc ! vImpf) qf; + katab = mkStrong (patV1Perf ! vPerf) fcl ; + kutib = mkStrong fucil fcl ; --FIXME no passive if vPerf == u + ktub = mkStrong (patV1Impf ! vImpf) fcl ; + aktub = "َ" + + case fcl.f of { + "و"|"ي" => qif ; + _ => ktub + }; + uktab = mkStrong ufcal fcl ; + euktub = case fcl.f of { + "؟"|"و"|"ي" => qif ; + _ => prefixImp ! vImpf + ktub + }; + maktUb = mkStrong mafcUl fcl + } in + verb katab kutib aktub uktab euktub maktUb ; + +v1hollow : Root3 -> Vowel -> Verb = + \xwf,vowel -> + let { + xAf = mkHollow fAc xwf ; + xif = mkHollow (patHol1 ! vowel) xwf ; + xyf = mkHollow fIc xwf ; + xuf = mkHollow (patHol2 ! vowel) xwf ; + xaf = mkHollow (fvc ! vowel) xwf ; + axaf= "َ" + xaf ; + uxAf= mkHollow ufAc xwf ; + uxaf= "ُ" + xaf ; + xAf'= mkHollow (patHol3 ! vowel) xwf ; + axAf= "َ" + xAf'; + ppart = "مَ" + xAf' -- FIXME actually wierd anomalies happen with the a vowel.. + + } in verbHollow xAf xif xyf xuf axAf axaf uxAf uxaf xaf xAf' ppart ; + +patHol1 : Vowel => Pattern = + table { u => fuc ; _ => fic} ; + +patHol2 : Vowel => Pattern = + table { u => fic ; _ => fuc} ; + +patHol3 : Vowel => Pattern = + table { + u => fUc ; + i => fIc ; + a => fAc + } ; + +--used in assimilated (wqf -> qif, wqc -> qac..) and hollow (qwl -> qul, xwf->xaf..) +fvc : Vowel => Pattern = + table { + u => fuc ; + i => fic ; + a => fac + } ; + + +v1geminate : Str -> Vowel -> Vowel -> Verb = + \rootStr,vPerf,vImpf -> + let { + mdd = mkRoot3 rootStr ; --fcc + md = mkRoot2 rootStr ; --fc + madd = mkBilit facc md ; + madad = mkStrong (patGem1 ! vPerf) mdd ; + mudd = mkBilit fucc md ; + mudid = mkStrong fucil mdd ; + mudd' = mkBilit (patGem2 ! vImpf) md ; + amudd = "َ" + mudd' ; + mdud = mkStrong (patGem3 ! vImpf) mdd ; + amdud = "َ" + mdud ; + umadd = "ُ" + madd ; + umdad = "ُ" + mkStrong fcal mdd ; + Umdud = (prefixImp ! vImpf) + mdud; + mamdUd = mkStrong mafcUl mdd + } in verbGeminate madd madad mudd mudid amudd amdud umadd umdad Umdud mudd' mamdUd; + +patGem1 : Vowel => Pattern = + table { + a => facal ; + u => facul ; + i => facil + } ; + +patGem2 : Vowel => Pattern = + table { + u => fucc ; + a => facc ; + i => ficc --no such verb probably exists + } ; + +patGem3 : Vowel => Pattern = + table { + u => fcul ; + a => fcal ; + i => fcil --no such verb probably exists + } ; + +v1defective : Root3 -> Vowel -> Verb = + \rmy,vowel -> + let { + rama = mkDefective faca rmy ; + ramay = mkStrong facalo rmy ; + rumi = mkDefective fuci rmy ; + rumu = mkDefective fucu rmy ; + rumiy = mkStrong fucilo rmy ; + rmi = mkDefective (patDef1 ! vowel) rmy ; + armi = "َ" + rmi ; + rmu = mkDefective (patDef2 ! vowel) rmy ; + armu = "َ" + rmu ; + urma = mkDefective ufca rmy ; + eirmi = prefixImp ! vowel + rmi; + eirmu = prefixImp ! vowel + rmu; + marmiy = mkStrong mafcil rmy + } in verbDef rama ramay rumi rumu rumiy armi armu urma eirmi eirmu marmiy vowel ; + +patDef1 : Vowel => Pattern = + table { + u => fcu ; + a => fca ; + i => fci + } ; + +patDef2 : Vowel => Pattern = + table { + a => fca ; + _ => fcu + } ; + +v2sound : Root3 -> Verb = \qsm -> + let { + qassam = mkStrong faccal qsm ; + qussim = mkStrong fuccil qsm ; + qassim = mkStrong faccil qsm ; + uqassim = "ُ" + qassim ; + uqassam = "ُ" + qassam ; + muqassam = "مُ" + qassam + } in + verb qassam qussim uqassim uqassam qassim muqassam; + +v2defective : Root3 -> Verb = \gny -> + let { + ganna = mkDefective facca gny ; + gannay = mkStrong faccalo gny ; + gunni = mkDefective fucci gny ; + gunnu = mkDefective fuccu gny ; + gunniy = mkStrong fuccilo gny ; + ganni = mkDefective facci gny; + uganni = "ُ" + ganni; + gannu = mkDefective faccu gny; + ugannu = "ُ" + gannu; + uganna = "ُ" + ganna; + mugannaY = "مُ" + ganna + "ى" + } in verbDef ganna gannay gunni gunnu gunniy uganni ugannu uganna ganni gannu mugannaY i; + +v3sound : Root3 -> Verb = + \tbc -> + let { + tAbac = mkStrong fAcal tbc ; + twbic = mkStrong fUcil tbc ; + tAbic = mkStrong fAcil tbc ; + utAbic = "ُ" + tAbic ; + utAbac = mkStrong ufAcal tbc ; + mutAbac = "م" + utAbac + } in verb tAbac twbic utAbic utAbac tAbic mutAbac; + +v4sound : Root3 -> Verb = + \qnc -> + let { + eaqnac = mkStrong eafcal qnc; + euqnic = mkStrong eufcil qnc; + uqnic = mkStrong ufcil qnc; + uqnac = mkStrong ufcal qnc; + eaqnic = mkStrong eafcil qnc; + muqnac = "م" + uqnac + } in + verb eaqnac euqnic uqnic uqnac eaqnic muqnac; + + +v4defective : Root3 -> Verb = \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; + mucTaY = "م" + ucTa +"ى" + } in verbDef eacTa eacTay eucTi eucTu eucTiy ucTi ucTu ucTa eacTi eacTu mucTaY i; + +v5sound : Root3 -> Verb = + \nfs -> + let { + tanaffas = mkStrong tafaccal nfs ; + tunuffis = mkStrong tufuccil nfs ; + atanaffas = "َ" + tanaffas ; + utanaffas = "ُ" + tanaffas ; + mutanaffas = "م" + tanaffas + } in verb tanaffas tunuffis atanaffas utanaffas tanaffas mutanaffas; + +v6sound : Root3 -> Verb = + \fqm -> + let { + tafAqam = mkStrong tafAcal fqm ; + tufUqim = mkStrong tufUcil fqm ; + atafAqam = "َ" + tafAqam ; + utafAqam = "ُ" + tafAqam ; + mutafAqam = "م" + utafAqam + } in verb tafAqam tufUqim atafAqam utafAqam tafAqam mutafAqam; + +v8sound : Root3 -> Verb = + \rbT -> + let { + rtabiT = mkStrong ftacil rbT ; + rtabaT = mkStrong ftacal rbT ; + eirtabaT = "إِ" + rtabaT ; + eurtubiT = mkStrong euftucil rbT ; + artabiT = "َ" + rtabiT ; + urtabaT = "ُ" + rtabaT ; + eirtabiT = "إِ" + rtabiT ; + murtabaT = "م" + urtabaT + } in verb eirtabaT eurtubiT artabiT urtabaT eirtabiT murtabaT; + +patV1Perf : Vowel => Pattern = + table { + a => facal ; --katab + u => facul ; --Hasun + i => facil --rabiH + } ; + +patV1Impf : Vowel => Pattern = + table { + u => fcul ; --ktub + a => fcal ; --rbaH + i => fcil --Hsin + } ; + +endVowel : Mood => Str = + table { + Cnj => "َ" ; + Jus => "ْ" ; + Ind => "" + } ; + +prefixImp : Vowel => Str = + table { + u => "أُ" ; + _ => "إِ" + } ; + +patHollowPerf : (_,_,_,_ :Str) -> Voice => PerGenNum => Str = \xAf,xif,xyf,xuf -> + table { + Act => + table { + Per3 Fem Pl => xif ; + Per3 _ _ => xAf ; + _ => xif + } ; + Pas => + table { + Per3 Fem Pl => xuf ; + Per3 _ _ => xyf ; + _ => xuf + } + } ; + +--this is the pattern of imperfect hollow (ind & conj) and geminate verbs (all) +patHollowImpf : (_,_,_,_ :Str) -> Voice => PerGenNum => Str = \axAf,axaf,uxAf,uxaf -> + table { + Act => + table { + Per3 Fem Pl => axaf ; + Per2 Fem Pl => axaf ; + _ => axAf + } ; + Pas => + table { + Per3 Fem Pl => uxaf ; + Per2 Fem Pl => uxaf ; + _ => uxAf + } + } ; + +patHollowJus : (_,_,_,_ : Str) -> Voice => PerGenNum => Str =\axaf,axAf,uxaf,uxAf-> + table { + Act => + table { + Per3 g Sg => axaf ; + Per3 Fem Pl => axaf; + Per2 Fem Pl => axaf; + Per2 Masc Sg => axaf; + Per1 _ => axaf; + _ => axAf + } ; + Pas => + table { + Per3 g Sg => uxaf ; + Per3 Fem Pl => uxaf; + Per2 Fem Pl => uxaf; + Per2 Masc Sg => uxaf; + Per1 _ => uxaf; + _ => uxAf + } + } ; + + + +patHollowImp : (_,_ :Str) -> Gender => Number => Str =\xaf,xAf -> + table { + Masc => table { Sg => xaf ; _ => xAf} ; + Fem => table { Pl => xaf ; _ => xAf} + } ; + +--Nominal Morphology + +--takes the adjective lemma and gives the Posit table + positAdj : Str -> Gender => NTable = + \kabIr -> + let kabIra = kabIr + "َة" in + table { + Masc => sndm kabIr; + Fem => sndf kabIra + }; + + clr : Str -> Str -> Str -> AForm => Str = + \aHmar,HamrA',Humr -> + table { + APosit Masc n d c => case n of { + Sg => indeclN aHmar ! d ! c ; + Dl => dual aHmar ! d ! c ; + Pl => sing Humr ! d ! c + }; + APosit Fem n d c => case n of { + Sg => indeclN HamrA' ! d ! c; + Dl => dual ((tk 2 HamrA') + "و") ! d ! c; + Pl => sing Humr ! d ! c + }; + AComp d c => indeclN aHmar ! d ! c + }; + + -- indeclinable nominal word (mamnuu3 mina S-Sarf) + indeclN : Str -> State => Case => Str = + \aHmar -> \\s,c => Al!s + aHmar + indecl!c; + + -- takes 2 words, singular and broken plural, and gives the + -- complete noun inflection table + reg : Str -> Str -> NTable = + \kitAb,kutub -> + table { + Sg => sing kitAb ; + Dl => dual kitAb ; + Pl => sing kutub + }; + + --takes the sound noun in singular and gives the + --complete noun inflection table of sound feminine plural + sndf : Str -> NTable = + \lawHa -> + table { + Sg => sing lawHa ; + Dl => dual lawHa ; + Pl => plurF lawHa + }; + + --takes the sound noun in singular and gives the + --complete inflection table of sound masculine plural nominals + sndm : Str -> NTable = + \muzAric -> + table { + Sg => sing muzAric ; + Dl => dual muzAric ; + Pl => plurM muzAric + }; + + -- 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 -> + case word of { + lemma + "ِي" => \\s,c => Al ! s + lemma + dec2sg ! s ! c ; + _ + ("ا"|"ى") => \\s,c => Al ! s + word + dec3sg ! s ! c ; + _ => \\s,c => Al ! s + word + dec1sg ! s ! c + }; + + -- takes a singular word and tests the ending to + -- determine the declension and gives the corresponding dual inf table + dual : Str -> State => Case => Str = + \caSaA -> + case caSaA of { + lemma + ("ا"|"ى") => \\s,c => Al ! s + lemma + "ي" + dl ! s ! c ; + _ => \\s,c => Al ! s + caSaA + dl ! s ! c + }; + + -- takes a singular word and gives the corresponding sound + --plural feminine table + plurF : Str -> State => Case => Str = + \kalima -> + \\s,c => Al ! s + (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 => Al ! s + mucallim + m_pl ! s ! c ; + + + -- to add the Al prefix for Definite words + Al : State => Str = + table { + Def => "ال"; + _ => "" + }; + + --declection 1 (strong ending) of the singular or broken plural words + dec1sg : State => Case => Str = + table { + Indef => + table { + Nom => "ٌ"; + Acc => "ً"; + Gen => "ٍ" + }; + _ => + table { --think of ?axU, ?axA, (the five nouns) + Nom => "ُ"; + Acc => "َ"; + Gen => "ِ" + } + }; + + --indeclinables (mamnuu3 mina S-Sarf) + indecl : Case => Str = + table { + Nom => "ُ"; + _ => "َ" + }; + + + --declection 2 (ends in yaa') + dec2sg : State => Case => Str = + table { + Indef => + table { + Acc => "ِياً"; + _ => "ٍ" + }; + _ => + table { + Acc => "ِيَ"; + _ => "ِي" + } + }; + + --declention 3 (ending in alif) + dec3sg : State => Case => Str = + table { + Indef => + table { + _ => "ً" + }; + _ => + table { + _ => "" + } + }; + + + --dual suffixes + dl : State => Case => Str = + table { + Const => + table { + Nom => "َا"; + _ => "َي" + }; + _ => + table { + Nom => "َانِ"; + _ => "َينِ" + } + }; + + --sound mascualine plural suffixes + m_pl : State => Case => Str = + table { + Const => + table { + Nom => "ُو"; + _ => "ِي" + }; + _ => + table { + Nom => "ُونَ"; + _ => "ِينَ" + } + }; + + --sound feminine plural suffixes + f_pl : State => Case => Str = + table { + Indef => + table { + Nom => "ٌ"; + _ => "ٍ" + }; + _ => + table { + Nom => "ُ"; + _ => "ِ" + } + }; + + + mkAt : Str -> Str = \bayDo -> + case bayDo of { + bayD + "ة" => bayD + "ات"; + bayD + "اء" => bayD + "اوات"; + bayD + "ى" => bayD + "يَات"; + _ => bayDo + "ات" + }; + + + oper + + sizeToNumber : Size -> Number = \s -> + case s of { + ThreeTen | None => Pl; + Two => Dl; + _ => Sg + } ; + + numberToSize : Number -> Size = \n -> + case n of { + Pl => ThreeTen; + Dl => Two ; + Sg => One -- or Hundreds or NonTeen + } ; + + detGender : Gender -> Size -> Gender = + \g,s -> + case s of { + ThreeTen | Teen => genPolarity ! g; + _ => g + }; + + nounState : State -> Number -> State = + \s,n -> + case of { + => Def; --kullu l-kutubi, bacDu l-kutubi + => Indef; --kullu kitaabin + => Indef; --kitaabun + _ => Def --Lkitaabu + }; + + + --FIXME needs testing + nounCase : Case -> Size -> State -> Case = + \c,size,s -> + case of { + => Acc; + => Acc; + => Gen; + => Gen; + <_,Const> => Gen; + _ => c + }; + + definite : State => State = + table { + Indef => Indef; + _ => Def + }; + + --things like mi{aö and vlAva and >alf should be treated as Const + --before the counted noun, so (vlAvaöN kutubK) is wrong + toDef : State -> Size -> State = + \s,n -> + case of { + => Const; + => Const; + _ => s + }; + + -- in a NP, sometimes the common noun preceedes the determiner + -- e.g. some determiners act as adjectives modifying the noun they count + -- "the three children, two children" + -- e.g. possesive pronouns: his book (kitaabuhu" + cnB4det : Bool -> Bool -> Size -> State -> Bool = \isPron,isNum,s,d -> + case of { + => True; + <_,False,_,_> => False; --non-numerals + <_,True,_,Def> => True; --definite numbers act as adjectives + <_,True,Two,_> => True; --numerals one and two always adjectives + <_,True,One,_> => True; --numerals one and two always adjectives + _ => False + }; + + agrP3 : Species -> Gender -> Number -> PerGenNum= \h,g,n -> + case of { + => Per3 Fem Sg; + _ => Per3 g n + }; + + pgn2gn : PerGenNum -> {g : Gender; n : Number} = \pgn -> + case pgn of { + Per3 gn nm => {g = gn; n = nm}; + Per2 gn nm => {g = gn; n = nm}; + _ => {g = Masc; n = Sg} --randomly + }; + + + mkIP : Str -> Number -> {s : Str ; n : Number} = + \s,n -> {s = s ; n = n} ; + + mkOrd : (_,_ : Str) -> {s : Gender => State => Case => Str ; n : Size } = + \aysar,yusra -> + { s = \\g,s,c => + case g of { + Masc => (sing aysar) ! s ! c; + Fem => (sing yusra) ! s ! c + }; + n = None + }; + + + oper + + Det : Type = { + s : Species => Gender => Case => Str ; + d : State; + n : Size; + isNum : Bool; + -- for genitive pronouns (suffixes). if true, then "cn ++ det" + --should be used instead of "det ++ cn" when constructing the NP + isPron : Bool + } ; + + Predet : Type = { + s : Case => Str; + isDecl : Bool + }; + + Agr = { pgn : PerGenNum; isPron : Bool} ; + AAgr = { g : Gender ; n : Number} ; + + Comp : Type = { + s : AAgr => Case => Str + } ; + + Obj : Type = { + s : Str ; + a : Agr + }; + + NP : Type = { + s : Case => Str ; + a : Agr + } ; + + param VPForm = + VPPerf + | VPImpf Mood + | VPImp ; + + oper + + VP : Type = { + s : PerGenNum => VPForm => Str; + obj : Obj; + pred : Comp; + isPred : Bool; --indicates if there is a predicate (xabar) + s2 : Str + }; + + predV : Verb -> VP = \v -> + { s = \\pgn,vf => + let gn = pgn2gn pgn in + case vf of { + VPPerf => v.s ! (VPerf Act pgn); + VPImpf m => v.s ! (VImpf m Act pgn); + VPImp => v.s ! (VImp Masc Sg)--gn.g gn.n) + }; + obj = { + s = [] ; + a = {pgn = Per3 Masc Sg ; isPron = False} + }; --or anything! + s2 = []; + pred = { s = \\_,_ => []}; + isPred = False + }; + + + -- in verbal sentences, the verb agrees with the subject + -- in Gender but not in number + verbalAgr : PerGenNum -> PerGenNum = \pgn -> + case pgn of { + Per3 g _ => Per3 g Sg; + _ => pgn + }; + + insertObj : NP -> VP -> VP = \np,vp -> + { s = vp.s; + obj = {s = np.s ! Acc ; a = np.a}; + s2 = vp.s2; + pred = vp.pred; + isPred = vp.isPred + }; + + insertPred : {s : AAgr => Case => Str} -> VP -> VP = \p,vp -> + { s = vp.s; + obj = vp.obj; + s2 = vp.s2; + pred = p; + isPred = True + }; + + insertStr : Str -> VP -> VP = \str,vp -> + { s = vp.s; + obj = vp.obj; + s2 = str; + pred = vp.pred; + isPred = vp.isPred + }; + + kaan : {s : AAgr => Case => Str} -> VP = \xabar -> + insertPred xabar (predV (v1hollow {f = "ك"; c = "و" ; l = "ن"} u) ); + + param + + Size = One | Two | ThreeTen | Teen | NonTeen | Hundreds | None ; + DForm = unit | ten ; + CardOrd = NCard | NOrd ; + + oper + --digits 1, 3 - 10: take the lemmas of the card ords & in masculine + --form and calculates the whole table + + regNum : Str -> Str -> + {s : DForm => CardOrd => Gender => State => Case => Str} = + \xams,xAmis -> + let { xamsa = xams + "َة"; + xAmisa = xAmis + "َة"} in + mkNum xamsa xAmis xAmisa; + + mkNum : Str -> Str -> Str -> + {s : DForm => CardOrd => Gender => State => Case => Str} = + \wAhid,awwal,Ula -> + let { wAhida = wAhid + "َة"} in + { s= table { + unit => table { + NCard => table { + Masc => \\s,c => (sing wAhid) ! s ! c ; + --all fem are first declension: + Fem => \\s,c => Al ! s + wAhida + dec1sg ! s ! c + }; + NOrd => table { + Masc => \\s,c => Al ! s + awwal + dec1sg ! s ! c; + Fem => \\s,c => (sing Ula) ! s ! c + } + }; + ten => table { + NCard => \\_,s,c => Al ! s + wAhid + m_pl ! Indef ! c; + NOrd => \\_,s,c => Al ! s + awwal + m_pl ! Indef ! c + } + } + }; + + num3_10 : Str -> Str -> { s : DForm => CardOrd => Gender + => State => Case => Str ; n : Size } = + \xams,xAmis -> + regNum xams xAmis ** { n = ThreeTen }; + + num2 : { s : DForm => CardOrd => Gender => State => Case => Str} = + { s = table { + unit => table { + NCard => table { + Masc => \\s,c => Al ! s + "ٱِثن" + dl ! s ! c ; + Fem => \\s,c => Al ! s + "ٱِثنَت" + dl ! s ! c + }; + NOrd => table { + Masc => \\s,c => Al ! s + "ثان" + dec2sg ! s ! c ; + Fem => \\s,c => Al ! s + "ثانِيَة" + dec1sg ! s ! c + } + }; + ten => \\_,_,s,c => Al ! s + "عِشر" + m_pl ! Indef ! c + } + }; + + num100 : State => Case => Str = + \\s,c => Al ! s + "مِٱَة" + dec1sg ! s ! c; + + num200 : State => Case => Str = + \\s,c => Al ! s + "مِٱَة" + dl ! s ! c ; + + num1000 : State => Case => Str = + \\s,c => Al ! s + "أَلف" + dec1sg ! s ! c; + + num2000 : State => Case => Str = + \\s,c => Al ! s + "أَلف" + dl ! s ! c ; + + teen : Gender => Str = + table { + Masc => "عَشَرَ"; + Fem => "عَشرَةَ" + }; + + genPolarity : Gender => Gender = + table { + Masc => Fem; + Fem => Masc + }; + + +} diff --git a/next-lib/src/arabic/SentenceAra.gf b/next-lib/src/arabic/SentenceAra.gf new file mode 100644 index 000000000..eb8147ddb --- /dev/null +++ b/next-lib/src/arabic/SentenceAra.gf @@ -0,0 +1,134 @@ +--# -path=.:abstract:common:prelude + +concrete SentenceAra of Sentence = CatAra ** open + ResAra, + Prelude, + ResAra, + ParamX, + CommonX in { + + + flags optimize=all_subs ; + + lin +{- + PredVP np vp = + { s = \\t,p,o => + case o of { + Verbal => + case vp.comp.a.isPron of { + False => vp.s ! t ! p ! Verbal ! np.a ++ np.s ! Nom ++ vp.comp.s ! Acc ; + True => vp.s ! t ! p ! Verbal ! np.a ++ vp.comp.s ! Acc ++ np.s ! Nom + }; + Nominal => + np.s ! Nom ++ vp.s ! t ! p ! Nominal ! np.a ++ vp.comp.s ! Acc + } + }; +-} + 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 : 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 + }; + } in + case o of { + Verbal => + case of { +----AR 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) + } + }; + -- PredVP np vp = mkClause (np.s ! Nom) np.a vp ; + +-- PredSCVP sc vp = mkClause sc.s (agrP3 Sg) vp ; + + 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 + } + }; + +-- +-- SlashV2 np v2 = +-- mkClause (np.s ! Nom) np.a (predV v2) ** {c2 = v2.c2} ; +-- +-- SlashVVV2 np vv v2 = +-- mkClause (np.s ! Nom) np.a +-- (insertObj (\\a => infVP vv.isAux (predV v2) a) (predVV vv)) ** +-- {c2 = v2.c2} ; +-- +-- AdvSlash slash adv = { +-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; +-- c2 = slash.c2 +-- } ; +-- +-- SlashPrep cl prep = cl ** {c2 = prep.s} ; +-- +-- EmbedS s = {s = conjThat ++ s.s} ; +-- EmbedQS qs = {s = qs.s ! QIndir} ; +-- EmbedVP vp = {s = infVP False vp (agrP3 Sg)} ; --- agr +-- + + --FIXME, all tenses + UseCl t ap cl = + {s = cl.s ! ResAra.Pres ! ap.p ! Verbal +{- case t of { + TPres => cl.s ! ResAra.Pres ! p.p ! Verbal ; + TCond => cl.s ! ResAra.Pres ! p.p ! Verbal ; + TPast => cl.s ! ResAra.Past ! p.p ! Verbal ; + TFut => cl.s ! ResAra.Fut ! p.p ! Verbal + } +-} }; + + --FIXME, all tenses + UseQCl t ap qcl = --{s = cl.s ! t ! p ! Verbal } ; + {s = + table { + QDir => "هَل" ++ qcl.s ! ResAra.Pres ! ap.p ! QDir; + QIndir => qcl.s ! ResAra.Pres ! ap.p ! QIndir + } +{- case t of { + TPres => "هَل" ++ qcl.s ! ResAra.Pres ! p.p ! q ; + TCond => "هَل" ++ qcl.s ! ResAra.Pres ! p.p ! q ; + TPast => "هَل" ++ qcl.s ! ResAra.Past ! p.p ! q ; + TFut => "هَل" ++ qcl.s ! ResAra.Fut ! p.p ! q + } +-} }; + +-- UseRCl t a p cl = {s = \\r => t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! p.p ! r} ; + +} diff --git a/next-lib/src/arabic/StructuralAra.gf b/next-lib/src/arabic/StructuralAra.gf new file mode 100644 index 000000000..58240c781 --- /dev/null +++ b/next-lib/src/arabic/StructuralAra.gf @@ -0,0 +1,110 @@ +concrete StructuralAra of Structural = CatAra ** + open MorphoAra, ResAra, ParadigmsAra, Prelude in { + + flags optimize=all ; coding=utf8 ; + + lin + above_Prep = ss "فَوْقَ" ; + after_Prep = ss "بَعْدَ" ; + all_Predet = mkPredet "كُلّ" True ; + almost_AdA = ss "تَقْرِيباً"; + almost_AdN = ss "حَوَالي" ; -- or "تَقرِيبا" +-- although_Subj = ss "َلتهُْغه" ; +-- always_AdV = ss "َلوَيس" ; + and_Conj = ss "وَ" ** {n = Pl} ; +-- because_Subj = ss "بعَُسي" ; + before_Prep = ss "قَبْلَ" ; + behind_Prep = ss "خَلْفَ" ; + between_Prep = ss "بَيْنَ" ; +-- both7and_DConj = sd2 "بْته" "َند" ** {n = Pl} ; +-- but_PConj = ss "بُت" ; + by8agent_Prep = ss "بِ" ; + by8means_Prep = ss "بِ" ; +-- can8know_VV, can_VV = { +-- s = table VVForm [["بي َبلي تْ"] ; "عَن" ; "عُْلد" ; +-- ["بّن َبلي تْ"] ; ["بِنغ َبلي تْ"] ; "عَنءت" ; "عُْلدنءت"] ; +-- isAux = True +-- } ; + during_Prep = ss "خِلَالَ" ; +-- either7or_DConj = sd2 "ِتهر" "ْر" ** {n = Sg} ; + everybody_NP = regNP "الجَمِيع" Pl ; + every_Det = mkDet "كُلّ" Sg Const ; + everything_NP = regNP "كُلّ" Sg ; +-- everywhere_Adv = ss "ثريوهري" ; + few_Det = mkDet "بَعض" Pl Const ; +-- first_Ord = ss "فِرست" ; + from_Prep = ss "مِنَ" ; + he_Pron = mkPron "هُوَ" "هُ" "هُ" (Per3 Masc Sg) ; + here_Adv = ss "هُنا" ; +-- here7to_Adv = ss ["تْ هري"] ; +-- here7from_Adv = ss ["فرْم هري"] ; + how_IAdv = ss "كَيفَ" ; +-- how8many_IDet = mkDeterminer Pl ["هْو مَني"] ; +-- if_Subj = ss "ِف" ; + in8front_Prep = ss "مُقَابِلَ" ; + i_Pron = mkPron "أَنَا" "نِي" "ِي" (Per1 Sing); + in_Prep = ss "فِي" ; +-- it_Pron = mkPron "ِت" "ِت" "ِتس" Sg P3 ; +-- less_CAdv = ss "لسّ" ; + many_Det = mkDet "جَمِيع" Pl Const ; +-- more_CAdv = ss "مْري" ; + most_Predet = mkPredet "أَكثَر" True ; + much_Det = mkDet "الكَثِير مِنَ" Pl Const ; +-- must_VV = { +-- s = table VVForm [["بي هَثي تْ"] ; "مُست" ; ["هَد تْ"] ; +-- ["هَد تْ"] ; ["هَثِنغ تْ"] ; "مُستنءت" ; ["هَدنءت تْ"]] ; ---- +-- isAux = True +-- } ; + no_Utt = {s = \\_ => "لا"} ; + on_Prep = ss "عَلى" ; +--- DEPREC one_Quant = mkQuantNum "واحِد" Sg Indef ; + only_Predet = mkPredet "فَقَط" False; +-- or_Conj = ss "ْر" ** {n = Sg} ; +-- otherwise_PConj = ss "ْتهروِسي" ; + part_Prep = ss "مِنَ" ; +-- please_Voc = ss "ةلَسي" ; + possess_Prep = ss "ل" ; +-- quite_Adv = ss "قُِتي" ; + she_Pron = mkPron "هِيَ" "ها" "ها" (Per3 Fem Sg) ; +-- so_AdA = ss "سْ" ; + somebody_NP = regNP "أَحَد" Sg ; + someSg_Det = mkDet "أَحَد" Pl Const ; + somePl_Det = mkDet "بَعض" Pl Const ; + something_NP = regNP "شَيْء" Sg ; +-- somewhere_Adv = ss "سْموهري" ; + that_Quant = mkQuant3 "ذَلِكَ" "تِلكَ" "أُلٱِكَ" Def; +----b that_NP = indeclNP "ذَلِكَ" Sg ; + there_Adv = ss "هُناك" ; +-- there7to_Adv = ss "تهري" ; +-- there7from_Adv = ss ["فرْم تهري"] ; +-- therefore_PConj = ss "تهرفْري" ; +----b these_NP = indeclNP "هَؤُلَاء" Pl ; + they_Pron = mkPron "هُمْ" "هُمْ" "هُمْ" (Per3 Masc Pl) ; + this_Quant = mkQuant7 "هَذا" "هَذِهِ" "هَذَان" "هَذَيْن" "هَاتَان" "هَاتَيْن" "هَؤُلَاء" Def; +----b this_NP = indeclNP "هَذا" Sg ; +----b those_NP = indeclNP "هَؤُلَاءكَ" Pl ; + through_Prep = ss "عَبْرَ" ; +-- too_AdA = ss "تّْ" ; + to_Prep = ss "إِلى" ; + under_Prep = ss "تَحْتَ" ; +-- very_AdA = ss "ثري" ; +-- want_VV = P.mkVV (P.regV "وَنت") ; + we_Pron = mkPron "نَحنُ" "نا" "نا" (Per1 Plur) ; + whatPl_IP = mkIP "ماذا" Pl ; + whatSg_IP = mkIP "ماذا" Sg ; + when_IAdv = ss "مَتَى" ; +-- when_Subj = ss "وهن" ; + where_IAdv = ss "أَينَ" ; +-- whichPl_IDet = mkDeterminer Pl ["وهِعه"] ; +-- whichSg_IDet = mkDeterminer Sg ["وهِعه"] ; + whoSg_IP = mkIP "مَنْ" Sg ; + whoPl_IP = mkIP "مَنْ" Pl ; +-- why_IAdv = ss "وهي" ; + without_Prep = ss "بِدُونِ" ; + with_Prep = ss "مَع" ; + yes_Utt = {s = \\_ => "نَعَم"} ; + youSg_Pron = mkPron "أَنتَ" "كَ" "كَ" (Per2 Masc Sg) ; + youPl_Pron = mkPron "أَنتُمْ" "كُمْ" "كُمْ" (Per2 Masc Sg) ; + youPol_Pron = mkPron "أَنتِ" "كِ" "كِ" (Per2 Fem Sg) ; + +} diff --git a/next-lib/src/arabic/VerbAra.gf b/next-lib/src/arabic/VerbAra.gf new file mode 100644 index 000000000..95e386d35 --- /dev/null +++ b/next-lib/src/arabic/VerbAra.gf @@ -0,0 +1,44 @@ +concrete VerbAra of Verb = CatAra ** open Prelude, ResAra in { + + flags optimize=all_subs ; + + lin + UseV = predV ; + + SlashV2a v = predV v ** {c2 = v.c2}; + + 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 v vp = insertObj (\\a => infVP v.isAux vp a) (predVV v) ; +-- +-- 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) ; +-- ComplV2A v np ap = +-- insertObj (\\_ => v.c2 ++ np.s ! Acc ++ ap.s ! np.a) (predV v) ; +-- + UseComp xabar = kaan xabar ; + + AdvVP vp adv = insertStr adv.s vp ; + +-- AdVVP adv vp = insertAdV adv.s vp ; +-- +-- ReflV2 v = insertObj (\\a => v.c2 ++ reflPron ! a) (predV v) ; +-- +-- PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ; +-- + -- UseVS, UseVQ = \vv -> {s = vv.s ; c2 = [] ; isRefl = vv.isRefl} ; -- no "تْ" +-- + 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} ; +-- +-- +}