From cd3e40a2d8aaa3ae4f261d4d722175b046f39e85 Mon Sep 17 00:00:00 2001 From: aarne Date: Fri, 15 Jan 2010 09:09:02 +0000 Subject: [PATCH] Shafqat's Urdu modules added --- lib/src/urdu/AdjectiveUrd.gf | 41 + lib/src/urdu/AdverbUrd.gf | 20 + lib/src/urdu/CatUrd.gf | 102 +++ lib/src/urdu/ConjunctionUrd.gf | 41 + lib/src/urdu/Coordination.gf | 164 ++++ lib/src/urdu/GrammarUrd.gf | 24 + lib/src/urdu/IdiomUrd.gf | 46 ++ lib/src/urdu/LangUrd.gf | 10 + lib/src/urdu/LexiconUrd.gf | 385 ++++++++++ lib/src/urdu/MorphoUrd.gf | 196 +++++ lib/src/urdu/NounUrd.gf | 136 ++++ lib/src/urdu/NumeralUrd.gf | 95 +++ lib/src/urdu/ParadigmsUrd.gf | 613 +++++++++++++++ lib/src/urdu/PhraseUrd.gf | 25 + lib/src/urdu/QuestionUrd.gf | 69 ++ lib/src/urdu/RelativeUrd.gf | 70 ++ lib/src/urdu/ResUrd.gf | 1304 ++++++++++++++++++++++++++++++++ lib/src/urdu/SentenceUrd.gf | 97 +++ lib/src/urdu/StructuralUrd.gf | 137 ++++ lib/src/urdu/VerbUrd.gf | 42 + 20 files changed, 3617 insertions(+) create mode 100644 lib/src/urdu/AdjectiveUrd.gf create mode 100644 lib/src/urdu/AdverbUrd.gf create mode 100644 lib/src/urdu/CatUrd.gf create mode 100644 lib/src/urdu/ConjunctionUrd.gf create mode 100644 lib/src/urdu/Coordination.gf create mode 100644 lib/src/urdu/GrammarUrd.gf create mode 100644 lib/src/urdu/IdiomUrd.gf create mode 100644 lib/src/urdu/LangUrd.gf create mode 100644 lib/src/urdu/LexiconUrd.gf create mode 100644 lib/src/urdu/MorphoUrd.gf create mode 100644 lib/src/urdu/NounUrd.gf create mode 100644 lib/src/urdu/NumeralUrd.gf create mode 100644 lib/src/urdu/ParadigmsUrd.gf create mode 100644 lib/src/urdu/PhraseUrd.gf create mode 100644 lib/src/urdu/QuestionUrd.gf create mode 100644 lib/src/urdu/RelativeUrd.gf create mode 100644 lib/src/urdu/ResUrd.gf create mode 100644 lib/src/urdu/SentenceUrd.gf create mode 100644 lib/src/urdu/StructuralUrd.gf create mode 100644 lib/src/urdu/VerbUrd.gf diff --git a/lib/src/urdu/AdjectiveUrd.gf b/lib/src/urdu/AdjectiveUrd.gf new file mode 100644 index 000000000..75c1c4e9a --- /dev/null +++ b/lib/src/urdu/AdjectiveUrd.gf @@ -0,0 +1,41 @@ +concrete AdjectiveUrd of Adjective = CatUrd ** open ResUrd, Prelude in { + + lin + + PositA a = a ; + UseComparA a = a; + + ComparA a np = { + s = \\n,g,c,d => np.s ! NPC Obl ++ "sE" ++ a.s ! n ! g ! c ! d ; +-- isPre = False + } ; + +---- $SuperlA$ belongs to determiner syntax in $Noun$. + + ComplA2 a np = { + s = \\n,g,c,d => np.s ! NPC Obl ++ a.c2 ++ a.s ! n ! g ! c ! d ; +-- isPre = False + } ; + +-- ReflA2 a = { +-- s = \\n,g,c,d => a.s ! n ! g ! c ! d ++ reflPron ! ag ; +-- isPre = False +-- } ; + + SentAP ap sc = { + s = \\n,g,c,d => ap.s ! n ! g ! c ! d ++ sc.s ; +-- isPre = False + } ; + + AdAP ada ap = { + s = \\n,g,c,d => ada.s ++ ap.s ! n ! g ! c ! d ; +-- isPre = ap.isPre + } ; + + UseA2 a = a ; + + CAdvAP cadv ap np = { + s = \\n,g,c,d => cadv.s ++ ap.s ! n ! g ! c ! d ++ cadv.p ++ np.s ! NPC Dir ; + }; + +} diff --git a/lib/src/urdu/AdverbUrd.gf b/lib/src/urdu/AdverbUrd.gf new file mode 100644 index 000000000..112edf9c3 --- /dev/null +++ b/lib/src/urdu/AdverbUrd.gf @@ -0,0 +1,20 @@ +concrete AdverbUrd of Adverb = CatUrd ** open ResUrd, Prelude in { + + lin + PositAdvAdj a = {s = a.s ! Sg ! Masc ! Obl ! Posit} ; + ComparAdvAdj cadv a np = { + s = np.s ! NPObj ++ cadv.p ++ cadv.s ++ a.s ! Sg ! Masc ! Obl ! Posit; + } ; + ComparAdvAdjS cadv a s = { + s = cadv.p ++ cadv.s ++ a.s ! Sg ! Masc ! Obl ! Posit ++ s.s; + } ; + + PrepNP prep np = {s = np.s ! NPObj ++ prep.s ! PP (giveNumber np.a) (giveGender np.a) } ; + + AdAdv ada adv = { s = ada.s ++ adv.s} ; + + SubjS = cc2 ; + + AdnCAdv cadv = {s = "sE" ++ cadv.s} ; + +} diff --git a/lib/src/urdu/CatUrd.gf b/lib/src/urdu/CatUrd.gf new file mode 100644 index 000000000..016542840 --- /dev/null +++ b/lib/src/urdu/CatUrd.gf @@ -0,0 +1,102 @@ +concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in { + + flags optimize=all_subs ; + + lincat +------ Tensed/Untensed + + S = {s : Str} ; + QS = {s : QForm => Str} ; +-- RS = { s: Str} ; + RS = {s : Agr => Str ; c : Case} ; -- c for it clefts +-- SSlash = {s : Str ; c2 : Str} ; + +---- Sentence + +-- Cl = Str; + Cl = ResUrd.Clause ; + ClSlash = { + s : ResUrd.VPHTense => Polarity => Order => Str ; +-- s : ResUrd.Tense => Anteriority => CPolarity => Order => Str ; + c2 : ResUrd.Compl +-- c2 : Str + } ; + Imp = {s : CPolarity => ImpForm => Str} ; + +---- Question + QCl = {s : ResUrd.VPHTense => Polarity => QForm => Str} ; +-- QCl = {s : ResUrd.Tense => Anteriority => CPolarity => QForm => Str} ; + IP = {s: Case => Str ; g : Gender ; n : Number}; +-- IP = {s : Number => Case => Str} ; +-- IComp = {s : Str} ; + IDet = {s :Gender => Str ; n : Number} ; +-- IQuant = {s : Number => Str} ; + +---- Relative + + RCl = { + s : ResUrd.VPHTense => Polarity => Order => Agr => Str ; + c : Case + } ; + RP = {s: Number => Case => Str ; a:RAgr}; +-- RP = {s : RCase => Str ; a : RAgr} ; + +---- Verb +-- VP = ResUrd.Verb; + VP = ResUrd.VPH ; + VPSlash = ResUrd.VPHSlash ; + Comp = {s : Agr => Str} ; + +---- Adjective + + AP = ResUrd.Adjective ; +-- AP = {s: Number => Gender => Case = Str}; +---- Noun + + CN = ResUrd.Noun ; + NP = ResUrd.NP ; + Pron = {s : PersPronForm => Str; a : Agr} ; +-- Pron = {s : PronCase => Str ; a : Agr} ; + Det = {s:Determiner => Str ; n : Number}; +-- Det = {s : Gender => Case => Str ; n : Number} ; + + Predet, Ord = {s : Str} ; + Num = Str; +-- Num = {s : Str ; n : Number} ; +-- Card = {s : Str; n : Number} ; + Quant = {s:DemPronForm => Str ; a : Agr}; +-- Quant = {s : Number => Gender => Case => Str} ; + Art = {s : Str} ; + +---- Numeral + +-- Numeral = {s : CardOrd => Str ; n : Number} ; +-- Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ; + +---- Structural + + Conj = {s1,s2 : Str ; n : Number} ; +-----b Conj = {s : Str ; n : Number} ; +-----b DConj = {s1,s2 : Str ; n : Number} ; + Subj = {s : Str} ; + Prep = {s : Proposition => Str ; n : Number} ; + +---- Open lexical classes, e.g. Lexicon + + V, VS, VQ, VA = ResUrd.Verb ; -- = {s : VForm => Str} ; + V2, V2A, V2Q, V2S = ResUrd.Verb ** {c2 : Compl} ; +-- V2, V2A, V2Q, V2S = ResUrd.Verb; -- ** {c2 : Str} ; + V3 = ResUrd.Verb ** {c2, c3 : Str} ; + VV = ResUrd.Verb ** { isAux : Bool} ; +-- VV = {s : VVForm => Str ; isAux : Bool} ; + V2V = ResUrd.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ; + + A = ResUrd.Adjective ; --- {s : Gender => Number => Case => Str} ; + A2 = {s : Number => Gender => Case => Degree => Str ; c2 : Str} ; + + N = {s : Number => Case => Str ; g : Gender} ; + N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Proposition => Str} ; + N3 = {s : Number => Case => Str ; g : Gender} ** {c2 : Proposition => Str ; c3 : Str} ; + PN = {s : Case => Str ; g : Gender} ; +-- +} diff --git a/lib/src/urdu/ConjunctionUrd.gf b/lib/src/urdu/ConjunctionUrd.gf new file mode 100644 index 000000000..e9832c6cb --- /dev/null +++ b/lib/src/urdu/ConjunctionUrd.gf @@ -0,0 +1,41 @@ +--concrete ConjunctionUrd of Conjunction = +-- CatUrdu ** open ResUrdu, Coordination, Prelude in { + +concrete ConjunctionUrd of Conjunction = + CatUrd ** open ResUrd, Coordination, Prelude in { + + + flags optimize=all_subs ; + + lin + + ConjS = conjunctDistrSS ; + + ConjAdv = conjunctDistrSS ; + + ConjNP conj ss = conjunctDistrTable NPCase conj ss ** { + a = conjAgr (agrP3 Masc conj.n) ss.a + } ; + + ConjAP conj ss = conjunctDistrTable4 Number Gender Case Degree 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 NPCase x y ** {a = conjAgr x.a y.a} ; + ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a} ; + BaseAP x y = twoTable4 Number Gender Case Degree x y ; -- ** {isPre = andB x.isPre y.isPre} ; + ConsAP xs x = consrTable4 Number Gender Case Degree comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ; + + lincat + [S] = {s1,s2 : Str} ; + [Adv] = {s1,s2 : Str} ; + [NP] = {s1,s2 : NPCase => Str ; a : Agr} ; + [AP] = {s1,s2 : Number => Gender => Case => Degree => Str} ; + +} diff --git a/lib/src/urdu/Coordination.gf b/lib/src/urdu/Coordination.gf new file mode 100644 index 000000000..b9fc7a25e --- /dev/null +++ b/lib/src/urdu/Coordination.gf @@ -0,0 +1,164 @@ +resource Coordination = open Prelude in { + +param + ListSize = TwoElem | ManyElem ; + +oper + ListX = {s1,s2 : Str} ; + + twoStr : (x,y : Str) -> ListX = \x,y -> + {s1 = x ; s2 = y} ; + consStr : Str -> ListX -> Str -> ListX = \comma,xs,x -> + {s1 = xs.s1 ++ comma ++ xs.s2 ; s2 = x } ; + + twoSS : (_,_ : SS) -> ListX = \x,y -> + twoStr x.s y.s ; + consSS : Str -> ListX -> SS -> ListX = \comma,xs,x -> + consStr comma xs x.s ; + + Conjunction : Type = SS ; + ConjunctionDistr : Type = {s1 : Str ; s2 : Str} ; + + conjunctX : Conjunction -> ListX -> Str = \or,xs -> + xs.s1 ++ or.s ++ xs.s2 ; + + conjunctDistrX : ConjunctionDistr -> ListX -> Str = \or,xs -> + or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2 ; + + conjunctSS : Conjunction -> ListX -> SS = \or,xs -> + ss (xs.s1 ++ or.s ++ xs.s2) ; + + conjunctDistrSS : ConjunctionDistr -> ListX -> SS = \or,xs -> + ss (or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2) ; + + -- all this lifted to tables + + ListTable : Type -> Type = \P -> {s1,s2 : P => Str} ; + + twoTable : (P : Type) -> (_,_ : {s : P => Str}) -> ListTable P = \_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable : (P : Type) -> Str -> ListTable P -> {s : P => Str} -> ListTable P = + \P,c,xs,x -> + {s1 = table P {o => xs.s1 ! o ++ c ++ xs.s2 ! o} ; s2 = x.s} ; + + conjunctTable : (P : Type) -> Conjunction -> ListTable P -> {s : P => Str} = + \P,or,xs -> + {s = table P {p => xs.s1 ! p ++ or.s ++ xs.s2 ! p}} ; + + conjunctDistrTable : + (P : Type) -> ConjunctionDistr -> ListTable P -> {s : P => Str} = \P,or,xs -> + {s = table P {p => or.s1++ xs.s1 ! p ++ or.s2 ++ xs.s2 ! p}} ; + + -- ... and to two- and three-argument tables: how clumsy! --- + + ListTable2 : Type -> Type -> Type = \P,Q -> + {s1,s2 : P => Q => Str} ; + + twoTable2 : (P,Q : Type) -> (_,_ : {s : P => Q => Str}) -> ListTable2 P Q = + \_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable2 : + (P,Q : Type) -> Str -> ListTable2 P Q -> {s : P => Q => Str} -> ListTable2 P Q = + \P,Q,c,xs,x -> + {s1 = table P {p => table Q {q => xs.s1 ! p ! q ++ c ++ xs.s2 ! p! q}} ; + s2 = x.s + } ; + + conjunctTable2 : + (P,Q : Type) -> Conjunction -> ListTable2 P Q -> {s : P => Q => Str} = + \P,Q,or,xs -> + {s = table P {p => table Q {q => xs.s1 ! p ! q ++ or.s ++ xs.s2 ! p ! q}}} ; + + conjunctDistrTable2 : + (P,Q : Type) -> ConjunctionDistr -> ListTable2 P Q -> {s : P => Q => Str} = + \P,Q,or,xs -> + {s = + table P {p => table Q {q => or.s1++ xs.s1 ! p ! q ++ or.s2 ++ xs.s2 ! p ! q}}} ; + + ListTable3 : Type -> Type -> Type -> Type = \P,Q,R -> + {s1,s2 : P => Q => R => Str} ; + + twoTable3 : (P,Q,R : Type) -> (_,_ : {s : P => Q => R => Str}) -> + ListTable3 P Q R = + \_,_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable3 : + (P,Q,R : Type) -> Str -> ListTable3 P Q R -> {s : P => Q => R => Str} -> + ListTable3 P Q R = + \P,Q,R,c,xs,x -> + {s1 = \\p,q,r => xs.s1 ! p ! q ! r ++ c ++ xs.s2 ! p ! q ! r ; + s2 = x.s + } ; + + conjunctTable3 : + (P,Q,R : Type) -> Conjunction -> ListTable3 P Q R -> {s : P => Q => R => Str} = + \P,Q,R,or,xs -> + {s = \\p,q,r => xs.s1 ! p ! q ! r ++ or.s ++ xs.s2 ! p ! q ! r} ; + + conjunctDistrTable3 : + (P,Q,R : Type) -> ConjunctionDistr -> ListTable3 P Q R -> + {s : P => Q => R => Str} = + \P,Q,R,or,xs -> + {s = \\p,q,r => or.s1++ xs.s1 ! p ! q ! r ++ or.s2 ++ xs.s2 ! p ! q ! r} ; + + --------- + ListTable4 : Type -> Type -> Type -> Type -> Type = \P,Q,R,T -> + {s1,s2 : P => Q => R => T => Str} ; + + twoTable4 : (P,Q,R,T : Type) -> (_,_ : {s : P => Q => R => T => Str}) -> + ListTable4 P Q R T = + \_,_,_,_,x,y -> + {s1 = x.s ; s2 = y.s} ; + + consTable4 : + (P,Q,R,T : Type) -> Str -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} -> + ListTable4 P Q R T = + \P,Q,R,T,c,xs,x -> + {s1 = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ c ++ xs.s2 ! p ! q ! r ! t ; + s2 = x.s + } ; + + conjunctTable4 : + (P,Q,R,T : Type) -> Conjunction -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} = + \P,Q,R,T,or,xs -> + {s = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ or.s ++ xs.s2 ! p ! q ! r ! t} ; + + conjunctDistrTable4 : + (P,Q,R,T : Type) -> ConjunctionDistr -> ListTable4 P Q R T -> + {s : P => Q => R => T => Str} = + \P,Q,R,T,or,xs -> + {s = \\p,q,r,t => or.s1++ xs.s1 ! p ! q ! r ! t ++ or.s2 ++ xs.s2 ! p ! q ! r ! t} ; + -------------- + + comma = "," ; + +-- you can also do this to right-associative lists: + + consrStr : Str -> Str -> ListX -> ListX = \comma,x,xs -> + {s1 = x ++ comma ++ xs.s1 ; s2 = xs.s2 } ; + + consrSS : Str -> SS -> ListX -> ListX = \comma,x,xs -> + consrStr comma x.s xs ; + + consrTable : (P : Type) -> Str -> {s : P => Str} -> ListTable P -> ListTable P = + \P,c,x,xs -> + {s1 = table P {o => x.s ! o ++ c ++ xs.s1 ! o} ; s2 = xs.s2} ; + + consrTable2 : (P,Q : Type) -> Str -> {s : P => Q => Str} -> + ListTable2 P Q -> ListTable2 P Q = + \P,Q,c,x,xs -> + {s1 = table P {p => table Q {q => x.s ! p ! q ++ c ++ xs.s1 ! p ! q}} ; + s2 = xs.s2 + } ; + consrTable4 : (P,Q,R,T : Type) -> Str -> {s : P => Q => R => T => Str} -> + ListTable4 P Q R T -> ListTable4 P Q R T = + \P,Q,R,T,c,x,xs -> + {s1 = table P {p => table Q {q => table R { r => table T {t => x.s ! p ! q ! r ! t ++ c ++ xs.s1 ! p ! q ! r ! t}}}} ; + s2 = xs.s2 + } ; + + +} ; diff --git a/lib/src/urdu/GrammarUrd.gf b/lib/src/urdu/GrammarUrd.gf new file mode 100644 index 000000000..0debfa78f --- /dev/null +++ b/lib/src/urdu/GrammarUrd.gf @@ -0,0 +1,24 @@ +--# -path=.:../abstract:../common:../prelude + + concrete GrammarUrd of Grammar = + NounUrd, + VerbUrd, + AdjectiveUrd, + AdverbUrd, + NumeralUrd, + SentenceUrd, + QuestionUrd, + RelativeUrd, + ConjunctionUrd, + PhraseUrd, + TextX, + StructuralUrd, + TenseX, + IdiomUrd + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} + + diff --git a/lib/src/urdu/IdiomUrd.gf b/lib/src/urdu/IdiomUrd.gf new file mode 100644 index 000000000..dedca8afe --- /dev/null +++ b/lib/src/urdu/IdiomUrd.gf @@ -0,0 +1,46 @@ +concrete IdiomUrd of Idiom = CatUrd ** open Prelude,Predef, ResUrd in { + + flags optimize=all_subs ; + + lin + ImpersCl vp = mkSClause " " (agrP3 Masc Sg) vp ; + GenericCl vp = mkSClause "kwy" (agrP3 Masc Sg) vp ; + + CleftNP np rs = + let cl = mkSClause (np.s ! NPC rs.c) (np.a) (predAux auxBe); + in + {s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a }; + +-- (insertObj (\\_ => rs.s ! np.a ++ ",") (predAux auxBe)); +-- (insertObj (\\_ => np.s ! NPC rs.c) (predAux auxBe))) ; + + CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s}; + +-- CleftAdv ad s = mkClause ad.s (agrP3 Masc Sg) +-- (insertObj (\\_ => optStr conjThat ++ s.s) +-- (insertObj (\\_ => ad.s) (predAux auxBe))) ; +-- + ExistNP np = + mkSClause "whaN" (agrP3 (fromAgr np.a).g (fromAgr np.a).n) + (insertObj (\\_ => np.s ! NPC Obl) (predAux auxBe)) ; +-- + ExistIP ip = + let cl = mkSClause ("whaN" ++ ip.s ! Dir) (agrP3 ip.g ip.n) (predAux auxBe); + in { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! ODir; + QIndir => cl.s ! t! p ! ODir + } + }; +-- mkQuestion (ss (ip.s ! Nom)) +-- (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ; +-- +-- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ; +-- +-- ImpPl1 vp = {s = "Aw" ++ infVP True vp (agrP1 Masc Pl)} ; + ImpPl1 vp = {s = "Aw" ++ (vp.s ! Pos ! VPTense VPFut (Ag Masc Pl Pers3_Near) ! ODir).inf2} ; + ImpP3 np vp = {s = np.s!NPC Dir ++ "kw" ++ (vp.s ! Pos ! VPImp ! ODir).inf2 ++ "dw"}; +-- + +} + diff --git a/lib/src/urdu/LangUrd.gf b/lib/src/urdu/LangUrd.gf new file mode 100644 index 000000000..90443f017 --- /dev/null +++ b/lib/src/urdu/LangUrd.gf @@ -0,0 +1,10 @@ +--# -path=.:../abstract:../common:../prelude + +concrete LangUrd of Lang = + GrammarUrd, + LexiconUrd + ** { + +flags startcat = Phr ; unlexer=unwords ; lexer=words ; + +} diff --git a/lib/src/urdu/LexiconUrd.gf b/lib/src/urdu/LexiconUrd.gf new file mode 100644 index 000000000..6a57f68e7 --- /dev/null +++ b/lib/src/urdu/LexiconUrd.gf @@ -0,0 +1,385 @@ +--# -path=.:prelude + +concrete LexiconUrd of Lexicon = CatUrd ** +--open ResUrd, Prelude in { + open ParadigmsUrd, Prelude in { + + flags + optimize=values ; + + lin + airplane_N = mkN "jhaz" ; +-- answer_V2S = mkV_3 (mkCmpdVerb (mkN "jwab" ) "dyna" ) (mkCmpdVerb (mkN "jwab") "dlwana") ; + answer_V2S = mkV2 (mkV (mkCmpdVerb (mkN "jwab" ) "dyna" )) ; + apartment_N = mkN "kmrh" ; + apple_N = mkN "syb" ; + art_N = mkN "fn" ; + ask_V2Q = mkV2 (mkV "pwch-na") ; + baby_N = mkN "bch" ; + bad_A = mkA "bra" ; + bank_N = mkN "bank" ; + beautiful_A = mkA "KwbSwrt" ; + become_VA = mkV "bnna"; + beer_N = mkN "beer" ; + beg_V2V = mkV2V (mkV "mangna") "sE" "kh" False; + big_A = mkA "bRa" ; + bike_N = mkN "saycl" feminine ; + bird_N = mkN "prndh" ; + black_A = mkA "kala" ; +-- black_A = mkA "kala" ; + blue_A = mkA "nyla" ; + boat_N = mkN "kXty" ; + book_N = mkN "ktab" feminine ; +-- boot_N = mkN "boot" ; +-- boss_N = mkN human (mkN "boss") ; + boy_N = mkN "lRka" ; + bread_N = mkN "rwty" ; + break_V2 = mkV2 (mkV "twRna") ; + broad_A = mkA "kh-la" ; +-- brother_N2 = mkN2 (mkN "bh-ay") (mkPrep "ka") ; --not correct + brown_A = mkA "nswary" ; + butter_N = mkN "mkh-n" ; + buy_V2 = mkV2 (mkV "Krydna"); + camera_N = mkN "kymrh" ; + cap_N = mkN "twpy" ; + car_N = mkN "gaRy" ; + carpet_N = mkN "tpay^y" ; + cat_N = mkN "bly" ; +-- ceiling_N = mkN "ceiling" ; + chair_N = mkN "krsy" ; + cheese_N = mkN "pnyr" feminine ; + child_N = mkN "bch" ; +-- church_N = mkN "church" ; + city_N = mkN "Xhr" ; + clean_A = mkA "Saf" ; + clever_A = mkA "hwXyar" ; + +-- close_V2 = mkV2 (mkV (mkCmpdVerb1 (mkN "bnd" ) (mkV "krna"))); + coat_N = mkN "kwT" ; + cold_A = mkA "Th-nDa" ; + come_V = mkV "Ana" ; + computer_N = mkN "kmpywTr" ; + country_N = mkN "mlk" ; + cousin_N = mkN (mkCmpdNoun (mkN "cca") (mkN "zad")) ; -- a compund noun made of two nouns + cow_N = mkN "gaE" feminine ; + die_V = mkV "mrna" ; + dirty_A = mkA "gnda" ; + distance_N3 = mkN3 (mkN "faSlh") (mkPrep "ka" "ky" "kE" "ky" singular) "sE" ; + doctor_N = mkN "mealj" ; + dog_N = mkN "kta" ; + door_N = mkN "drwzh" ; + drink_V2 = mkV2 (mkV "pyna"); + easy_A2V = mkA "Asan" "" ; + eat_V2 = mkV2 (mkV "kh-ana") "kw" ; +-- empty_A = mkA "Kaly" ; + enemy_N = mkN "dXmn" ; + factory_N = mkN "karKanh" ; + father_N2 = mkN2 (mkN "aba") (mkPrep "ka" "ky" "kE" "ky" singular) ; + fear_VS = mkV "drna"; + find_V2 = mkV2 (mkV "pana") ; + fish_N = mkN "mch-ly" ; + floor_N = mkN "frX" ; + forget_V2 = mkV2 (mkV "bh-wlna") ; + fridge_N = mkN "fryg" ; + friend_N = mkN "dwst" masculine ; + fruit_N = mkN "ph-l" ; +-- fun_AV = mkAV (regA "fun") ; + garden_N = mkN "baG" ; + girl_N = mkN "lRky" ; + glove_N = mkN "dstanh" ; + gold_N = mkN "swna" ; + good_A = mkA "ach-a" ; + go_V = mkV "jana" ; + green_A = mkA "sbz" ; +-- harbour_N = mkN "harbour" ; + hate_V2 = mkV2 (mkV (mkCmpdVerb (mkN "nfrt" ) "krna" )) ; + hat_N = mkN "twpy" ; +-- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ; + hear_V2 = mkV2 (mkV "snna") ; + hill_N = mkN "phaRy" ; + hope_VS = mkV (mkCmpdVerb (mkN "amyd" ) "krna" ); + horse_N = mkN "gh-wRa" ; + hot_A = mkA "grm" ; + house_N = mkN "gh-r" ; + important_A = mkA "ahm" ; + industry_N = mkN "Snet" feminine ; +-- iron_N = mkN "iron" ; + king_N = mkN "badXah" ; + know_V2 = mkV2 (mkV "janna") ; + lake_N = mkN "jh-yl" feminine ; +-- lamp_N = mkN "lamp" ; + learn_V2 = mkV2 (mkV "sykh-na") ; + leather_N = mkN "cmRa" ; +-- leave_V2 = dirV2 (irregV "leave" "left" "left") ; + like_V2 = mkV2 (mkV (mkCmpdVerb (mkN "psnd" ) "krna" )); + listen_V2 = mkV2 (mkV "snna") ; + live_V = mkV "rhna" ; ---- touch + long_A = mkA "lmba" ; + lose_V2 = mkV2 (mkV (mkCmpdVerb (mkN "kh-w" ) "dyna" )) ; + love_N = mkN "mHbt" ; + love_V2 = mkV2 (mkV (mkCmpdVerb (mkN "pyar" ) "krna" )) ; + man_N = mkN "Admy" ; -- not correct according to rules should be discussed + married_A2 = mkA "Xady krna" "sE" ; + meat_N = mkN "gwXt" ; + milk_N = mkN "dwdh-" ; + moon_N = mkN "cand" ; +-- mother_N2 = mkN "maN" feminine ; -- not covered need to be discussed + mountain_N = mkN "phaRy" ; + music_N = mkN "mwsyqy" ; + narrow_A = mkA "baryk" ; + new_A = mkA "nya" ; + newspaper_N = mkN "aKbar" ; + oil_N = mkN "tyl" ; + old_A = mkA "bwRh-a" ; + open_V2 = mkV2 (mkV "kh-wlna") ; + paint_V2A = mkV2 (mkV (mkCmpdVerb (mkN "rng" ) "krna" )) ; + paper_N = mkN "kaGz" ; +-- paris_PN = mkPN (mkN nonhuman (mkN "Paris")) ; + peace_N = mkN "amn" ; + pen_N = mkN "pnsl" ; + planet_N = mkN "syarh" ; +-- plastic_N = mkN "plastic" ; + play_V2 = mkV2 (mkV "kh-ylna") ; +-- policeman_N = mkN masculine (mkN "policeman" "policemen") ; +-- priest_N = mkN human (mkN "priest") ; +-- probable_AS = mkAS (regA "probable") ; + queen_N = mkN "Xhzady" ; +-- radio_N = mkN "radio" ; + rain_V0 = mkV (mkCmpdVerb (mkN "barX" ) "hwna" ) ; + read_V2 = mkV2 (mkV "pRh-na"); + red_A = mkA "lal" ; + religion_N = mkN "mzhb" ; +-- restaurant_N = mkN "restaurant" ; + river_N = mkN "drya" masculine ; + rock_N = mkN "cTan" ; + roof_N = mkN "ch-t" masculine ; +-- rubber_N = mkN "rubber" ; + run_V = mkV "dwRna" ; + say_VS = mkV "khna" ; + school_N = mkN "skwl" ; +-- science_N = mkN "science" ; + sea_N = mkN "smndr" ; + seek_V2 = mkV2 (mkV (mkCmpdVerb (mkN "tlaX" ) "krna" )) ; + see_V2 = mkV2 (mkV "dykh-na") ; + sell_V3 = mkV3 (mkV "bycna") "kw" ""; + send_V3 = mkV3 (mkV "bh-yjna") "kw" ""; + sheep_N = mkN "bh-yR" feminine ; + ship_N = mkN "jhaz" ; + shirt_N = mkN "qmyZ-" feminine; + shoe_N = mkN "jwta" ; + shop_N = mkN "dwkan" feminine ; + short_A = mkA "ch-wTa" ; + silver_N = mkN "candy" ; + sister_N = mkN "bhn" feminine ; + sleep_V = mkV "swna" ; + small_A = mkA "ch-wTa" ; + snake_N = mkN "sanp" ; + sock_N = mkN "jrab" feminine ; + speak_V2 = mkV2 (mkV "bwlna") ; + star_N = mkN "stara" ; +-- steel_N = mkN "steel" ; + stone_N = mkN "pth-r" ; + stove_N = mkN "cwlha" ; + student_N = mkN (mkCmpdNoun (mkN "t-alb") (mkN "elm")) ; + stupid_A = mkA "aHmq" ; + sun_N = mkN "swrj" ; +-- switch8off_V2 = dirV2 (partV (regV "switch") "off") ; +-- switch8on_V2 = dirV2 (partV (regV "switch") "on") ; + table_N = mkN "myz" feminine ; + talk_V3 = mkV3 (mkV "bwlna") "sE" "kE barE meN"; + teacher_N = mkN "istad" ; + teach_V2 = mkV2 (mkV "pRh-na") ; + television_N = mkN "telywyzn" ; + thick_A = mkA "mwTa" ; + thin_A = mkA "ptla" ; + train_N = mkN "gaRy" ; +-- travel_V = mkV + travel_V = mkV (mkCmpdVerb (mkN "sfr" ) "krna" ) ; + tree_N = mkN "drKt" masculine ; +-- ---- trousers_N = mkN "trousers" ; + ugly_A = mkA "bdSwrt" ; + understand_V2 = mkV2 (mkV "smjh-na") ; +-- university_N = mkN "university" ; + village_N = mkN "gawN" ; + wait_V2 = mkV2 (mkV (mkCmpdVerb (mkN "antz-ar" ) "krna" )) ; + walk_V = mkV "clna" ; + warm_A = mkA "grm" ; + war_N = mkN "jng" ; +-- watch_V2 = dirV2 (regV "watch") ; +-- water_N = mkN "water" ; -- not covered masculine ending with y + white_A = mkA "sfyd" ; + window_N = mkN "kh-Rky" ; + wine_N = mkN "Xrab" feminine ; + win_V2 = mkV2 (mkV "jytna") ; + woman_N = mkN "ewrt" feminine ; +-- wonder_VQ = (mkCmpdVerb (mkN "Heran" ) "hwna" ) (mkCmpdVerb (mkN "Heran") "hwna") (mkCmpdVerb (mkN "Heran") "krwana") ; + wood_N = mkN "lkRy" ; + write_V2 = mkV2 (mkV "lkh-na") ; + yellow_A = mkA "pyla" ; + young_A = mkA "jwan" ; +-- + do_V2 = mkV2 (mkV "krna") ; +-- now_Adv = mkAdv "now" ; +-- already_Adv = mkAdv "already" ; + song_N = mkN "gana" ; +-- add_V3 = mkV (mkCmpdVerb (mkN "aZ-afh" ) "krna" ) ; + number_N = mkN "hndsh" ; + put_V2 = mkV2 (mkV "Dalna") ; + stop_V = mkV "rkna" ; + jump_V = mkV "ch-langna" ; +-- +-- left_Ord = ss "left" ; +-- right_Ord = ss "right" ; +-- far_Adv = mkA "dwr" ; + correct_A = mkA "Syh" ; + dry_A = mkA "KXk" ; +-- dull_A = mkA "nalik" ; +-- full_A = regA "full" ; + heavy_A = mkA "bh-ary" ; + near_A = mkA "qryb" ; +-- rotten_A = (regA "rotten") ; + round_A = mkA "gwl" ; + sharp_A = mkA "tyz" ; + smooth_A = mkA "hmwar" ; + straight_A = mkA "sydh-a" ; + wet_A = mkA "gyla" ; ---- + wide_A = mkA "kh-la" ; + animal_N = mkN "janwr" ; + ashes_N = mkN "rakh-" feminine; -- FIXME: plural only? + back_N = mkN "qmr" feminine ; +-- bark_N = mkN "bark" ; + belly_N = mkN "dh-ny" ; + blood_N = mkN "Kwn" ; + bone_N = mkN "hDy" ; + breast_N = mkN "ch-aty" ; + cloud_N = mkN "badl" ; + day_N = mkN "dn" ; + dust_N = mkN "dh-wl" ; + ear_N = mkN "kan" ; + earth_N = mkN "zmyn" feminine ; + egg_N = mkN "anDh" ; + eye_N = mkN "Ankh-" feminine ; + fat_N = mkN "mwta" ; + feather_N = mkN "pr" ; + fingernail_N = mkN "naKn" ; + fire_N = mkN "Ag" feminine ; + flower_N = mkN "ph-wl" ; + fog_N = mkN "dh-nd" feminine ; + foot_N = mkN "pawN" ; -- not properly covered need to be discussed + forest_N = mkN "njgl" ; + grass_N = mkN "gh-s" feminine ; +-- guts_N = mkN "gut" ; -- FIXME: no singular + hair_N = mkN "bal" ; + hand_N = mkN "hath-" ; + head_N = mkN "sr" ; + heart_N = mkN "dl" ; + horn_N = mkN "gh-nty" ; + husband_N = mkN "Xwhr" ; + ice_N = mkN "brf" feminine ; + knee_N = mkN "khny" ; + leaf_N = mkN "pth" ; + leg_N = mkN "tang" feminine ; + liver_N = mkN "jgr" ; + louse_N = mkN "gh-r" ; + mouth_N = mkN "mnh" ; + name_N = mkN "nam" ; + neck_N = mkN "grdn" feminine ; + night_N = mkN "rat" feminine ; + nose_N = mkN "nak" ; + person_N = mkN "XKS" ; + rain_N = mkN "barX" feminine ; + road_N = mkN "sRk" ; + root_N = mkN "gR" feminine ; + rope_N = mkN "rsy" ; + salt_N = mkN "nmk" feminine ; + sand_N = mkN "ryt" feminine ; + seed_N = mkN "byj" ; + skin_N = mkN "jld" feminine ; + sky_N = mkN "Asman" ; + smoke_N = mkN "dh-waN"; -- singular masc nouns ending with aN,wN yet to be implemented + snow_N = mkN "brf" feminine ; + stick_N = mkN "ch-Ry" ; + tail_N = mkN "dm" ; + tongue_N = mkN "zban" feminine ; + tooth_N = mkN "dant" masculine; + wife_N = mkN "bywy" ; + wind_N = mkN "Andh-y" ; + wing_N = mkN "pr" ; + worm_N = mkN "grm" ; + year_N = mkN "sal" ; + blow_V = mkV "clna" ; + breathe_V = mkV (mkCmpdVerb (mkN "sans" ) "lyna" ) ; + burn_V = mkV "jlna" ; + dig_V = mkV "kh-wdna" ; + fall_V = mkV "grna" ; + float_V = mkV "tyrna" ; + flow_V = mkV "bhna" ; + fly_V = mkV "aRna" ; + freeze_V = mkV "jmna"; + give_V3 = mkV3 (mkV "dyna") "kw" ""; + laugh_V = mkV "hnsna" ; +-- lie_N = mkN "jh-wt" masculine ; +-- lie_V = mkV_3 (mkCmpd lie_N "bwlna") (mkCmpd lie_N "bwlwana") ; +-- lie_V = mkV_3 (mkCmpdVerb (mkN "jh-wt" masculine) "bwlna" ) (mkCmpdVerb (mkN "jh-wt" masculine) "bwlwana") ; + lie_V = mkV (mkCmpdVerb (mkN "jh-wt" masculine) "bwlna" ); + play_V = mkV "kh-ylna" ; + sew_V = mkV "syna" ; + sing_V = mkV "gana" ; + sit_V = mkV "byTh-na" ; +-- smell_V = regV "smell" ; +-- spit_V = IrregUrd.spit_V ; +-- stand_V = IrregUrd.stand_V ; + swell_V = mkV "swjh-na" ; + swim_V = mkV "tyrna" ; + think_V = mkV "swcna" ; + turn_V = mkV "mRna"; +-- vomit_V = regV "vomit" ; +-- + bite_V2 = mkV2 (mkV "katna") ; + count_V2 = mkV2 (mkV "gnna") ; + cut_V2 = mkV2 (mkV "katna") ; + fear_V2 = mkV2 (mkV "Drna") ; + fight_V2 = mkV2 (mkV "lRna") ; + hit_V2 = mkV2 (mkV (mkCmpdVerb (mkN "th-wkr" ) "marna" )); + hold_V2 = mkV2 (mkV "pkRna") ; + hunt_V2 = mkV2 (mkV (mkCmpdVerb (mkN "Xkar" ) "krna" )); + kill_V2 = mkV2 (mkV (mkCmpdVerb (mkN "mar" ) "Dalna" )) ; + pull_V2 = mkV2 (mkV "kh-ncna"); +-- push_V2 = dirV2 (regV "push") ; + rub_V2 = mkV2 (mkV "rgRna") ; +-- scratch_V2 = dirV2 (regV "scratch") ; +-- split_V2 = dirV2 split_V ; +-- squeeze_V2 = dirV2 (regV "squeeze") ; +-- stab_V2 = dirV2 (regDuplV "stab") ; + suck_V2 = mkV2 (mkV "cwsna") ; + throw_V2 = mkV2 (mkV "ph-ynkna") ; + tie_V2 = mkV2 (mkV "bandh-na") ; + wash_V2 = mkV2 (mkV "dh-wna") ; +-- wipe_V2 = dirV2 (regV "wipe") ; +-- +---- other_A = regA "other" ; +-- +-- grammar_N = mkN "grammar" ; + language_N = mkN "zban" feminine ; + rule_N = mkN "aSwl" ; +-- +---- added 4/6/2007 + john_PN = mkPN "jon" ; + question_N = mkN "swal" ; +-- ready_A = regA "ready" ; + reason_N = mkN "wjh" feminine ; +-- today_Adv = mkAdv "today" ; +-- uncertain_A = regA "uncertain" ; +-- +--oper +-- aboutP = mkPrep "about" ; +-- atP = mkPrep "at" ; +-- forP = mkPrep "for" ; +-- fromP = mkPrep "from" ; +-- inP = mkPrep "in" ; +-- onP = mkPrep "on" ; +-- toP = mkPrep "to" ; +-- + + +} diff --git a/lib/src/urdu/MorphoUrd.gf b/lib/src/urdu/MorphoUrd.gf new file mode 100644 index 000000000..6296e93ce --- /dev/null +++ b/lib/src/urdu/MorphoUrd.gf @@ -0,0 +1,196 @@ +--# -path=.:../../prelude +-- +----1 A Simple Urdu Resource Morphology +---- +---- Aarne Ranta, Shafqat Virk 2009 +---- +---- This resource morphology contains definitions needed in the resource +---- syntax. To build a lexicon, it is better to use $ParadigmsHin$, which +---- gives a higher-level access to this module. +-- +resource MorphoUrd = ResUrd ** open Prelude, (Predef=Predef) in { +-- +-- flags optimize=all ; +-- +----2 Phonology +---- +---- To regulate the use of endings for both nouns, adjectives, and verbs: +-- +--oper +-- y2ie : Str -> Str -> Str = \fly,s -> +-- let y = last (init fly) in +-- case y of { +-- "a" => fly + s ; +-- "e" => fly + s ; +-- "o" => fly + s ; +-- "u" => fly + s ; +-- _ => init fly + "ie" + s +-- } ; +-- +-- +----2 Nouns +---- +---- For conciseness and abstraction, we define a worst-case macro for +---- noun inflection. It is used for defining special case that +---- only need one string as argument. +-- +--oper +-- CommonNoun : Type = {s : Number => Case => Str} ; +-- +-- nounGen : Str -> CommonNoun = \dog -> case last dog of { +-- "y" => nounY "dog" ; +-- "s" => nounS (init "dog") ; +-- _ => nounReg "dog" +-- } ; +-- +---- These are auxiliaries to $nounGen$. +-- +-- nounReg : Str -> CommonNoun = \dog -> +-- mkNoun dog (dog + "s") (dog + "'s") (dog + "s'"); +-- nounS : Str -> CommonNoun = \kiss -> +-- mkNoun kiss (kiss + "es") (kiss + "'s") (kiss + "es'") ; +-- nounY : Str -> CommonNoun = \fl -> +-- mkNoun (fl + "y") (fl + "ies") (fl + "y's") (fl + "ies'") ; +-- +-- +----3 Proper names +---- +---- Regular proper names are inflected with "'s" in the genitive. +-- +-- nameReg : Str -> Gender -> {s : Case => Str} = \john,g -> +-- {s = table {Gen => john + "'s" ; _ => john} ; g = g} ; +-- +----2 Determiners +-- +-- mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s -> +-- {s = s ; n = n} ; +-- +----2 Pronouns +---- +---- Here we define personal pronouns. +---- +---- We record the form "mine" and the gender for later use. +-- +-- Pronoun : Type = +-- {s : Case => Str ; a : Agr} ; +-- +-- mkPronoun : (_,_,_,_ : Str) -> Number -> Person -> Gender -> Pronoun = +-- \I,me,my,mine,n,p,g -> +-- {s = table {Nom => I ; Acc => me ; Gen => my} ; +-- a = toAgr n p g +-- } ; +-- +-- human : Gender = Masc ; --- doesn't matter +-- +-- pronI = mkPronoun "I" "me" "my" "mine" Sg P1 human ; +-- pronYouSg = mkPronoun "you" "you" "your" "yours" Sg P2 human ; -- verb agr OK +-- pronHe = mkPronoun "he" "him" "his" "his" Sg P3 Masc ; +-- pronShe = mkPronoun "she" "her" "her" "hers" Sg P3 Fem ; +-- pronIt = mkPronoun "it" "it" "its" "it" Sg P3 Neutr ; +-- +-- pronWe = mkPronoun "we" "us" "our" "ours" Pl P1 human ; +-- pronYouPl = mkPronoun "you" "you" "your" "yours" Pl P2 human ; +-- pronThey = mkPronoun "they" "them" "their" "theirs" Pl P3 human ; --- +-- +-- +----2 Adjectives +---- +---- To form the adjectival and the adverbial forms, two strings are needed +---- in the worst case. (First without degrees.) +-- +-- Adjective = {s : AForm => Str} ; +-- +---- However, most adjectives can be inflected using the final character. +---- N.B. this is not correct for "shy", but $mkAdjective$ has to be used. +-- +-- regAdjective : Str -> Adjective = \free -> +-- let +-- e = last free ; +-- fre = init free ; +-- freely = case e of { +-- "y" => fre + "ily" ; +-- _ => free + "ly" +-- } ; +-- fre = case e of { +-- "e" => fre ; +-- "y" => fre + "i" ; +-- _ => free +-- } +-- in +-- mkAdjective free (fre + "er") (fre + "est") freely ; +-- +---- Many adjectives are 'inflected' by adding a comparison word. +-- +-- adjDegrLong : Str -> Adjective = \ridiculous -> +-- mkAdjective +-- ridiculous +-- ("more" ++ ridiculous) +-- ("most" ++ ridiculous) +-- ((regAdjective ridiculous).s ! AAdv) ; +-- +-- +----3 Verbs +---- +---- The worst case needs five forms. (The verb "be" is treated separately.) +-- +-- mkVerb4 : (_,_,_,_: Str) -> Verb = \go,goes,went,gone -> +-- let going = case last go of { +-- "e" => init go + "ing" ; +-- _ => go + "ing" +-- } +-- in +-- mkVerb go goes went gone going ; +-- +---- This is what we use to derive the irregular forms in almost all cases +-- +-- mkVerbIrreg : (_,_,_ : Str) -> Verb = \bite,bit,bitten -> +-- let bites = case last bite of { +-- "y" => y2ie bite "s" ; +-- "s" => init bite + "es" ; +-- _ => bite + "s" +-- } +-- in mkVerb4 bite bites bit bitten ; +-- +---- This is used to derive regular forms. +-- +-- mkVerbReg : Str -> Verb = \soak -> +-- let +-- soaks = case last soak of { +-- "y" => y2ie soak "s" ; +-- "s" => init soak + "es" ; +-- _ => soak + "s" +-- } ; +-- soaked = case last soak of { +-- "e" => init soak + "s" ; +-- _ => soak + "ed" +-- } +-- in +-- mkVerb4 soak soaks soaked soaked ; +-- +-- verbGen : Str -> Verb = \kill -> case last kill of { +-- "y" => verbP3y (init kill) ; +-- "e" => verbP3e (init kill) ; +-- "s" => verbP3s (init kill) ; +-- _ => regVerbP3 kill +-- } ; +-- +---- These are just auxiliary to $verbGen$. +-- +-- regVerbP3 : Str -> Verb = \walk -> +-- mkVerbIrreg walk (walk + "ed") (walk + "ed") ; +-- verbP3s : Str -> Verb = \kiss -> +-- mkVerb4 kiss (kiss + "es") (kiss + "ed") (kiss + "ed") ; +-- verbP3e : Str -> Verb = \love -> +-- mkVerb4 love (love + "s") (love + "d") (love + "d") ; +-- verbP3y : Str -> Verb = \cr -> +-- mkVerb4 (cr + "y") (cr + "ies") (cr + "ied") (cr + "ied") ; +-- +----- The particle always appears right after the verb. +-- +-- verbPart : Verb -> Str -> Verb = \v,p -> +-- {s = \\f => v.s ! f ++ p ; isRefl = v.isRefl} ; +-- +-- verbNoPart : Verb -> Verb = \v -> verbPart v [] ; +-- +-- +} diff --git a/lib/src/urdu/NounUrd.gf b/lib/src/urdu/NounUrd.gf new file mode 100644 index 000000000..89cf358bb --- /dev/null +++ b/lib/src/urdu/NounUrd.gf @@ -0,0 +1,136 @@ +concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { + + flags optimize=all_subs ; + + lin + DetCN det cn = { + s = \\c => detcn2NP det.s cn c det.n ; + a = agrP3 cn.g det.n + } ; + + UsePN pn = {s = \\c => toNP pn.s c ; a = agrP3 pn.g Sg} ; + UsePron p = {s = \\c => np2pronCase p.s c ; a = p.a} ; + + PredetNP pred np = { + s = \\c => pred.s ++ np.s ! c ; + a = np.a + } ; + + PPartNP np v2 = { + s = \\c => v2.s ! VF Imperf Pers1 Sg Fem ++ np.s ! c ; + a = np.a + } ; + + RelNP np rs = { + s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; +-- s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; + a = np.a + } ; + + AdvNP np adv = { + s = \\c => np.s ! c ++ adv.s ; + a = np.a + } ; + + DetQuantOrd quant num ord = { + s = \\ c => detquant2det quant.s num c ++ ord.s ; + n = Sg + } ; + + DetQuant quant num = { + s = \\c => detquant2det quant.s num c; + n = Sg + } ; + + DetNP det = { + s = \\c => det2NP det.s c ; ---- case + a = agrP3 Masc Sg + } ; + +-- PossPron p = {s = \\_,_,_ => p.s ! PPoss} ; +-- +-- NumSg = {s = []; n = Sg} ; +-- NumPl = {s = []; n = Pl} ; + +-- NumCard n = n ** {hasCard = True} ; +-- +-- NumDigits n = {s = n.s ! NCard ; n = n.n} ; +-- OrdDigits n = {s = n.s ! NOrd} ; +-- +-- NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ; +-- OrdNumeral numeral = {s = numeral.s ! NOrd} ; +-- +-- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; +-- +-- OrdSuperl a = {s = a.s ! AAdj Superl} ; +-- +-- DetArtOrd art num ord = { +-- s = art.s ! num.hasCard ! num.n ++ num.s ++ ord.s ; +-- n = num.n +-- } ; +-- +-- DetArtCard art card = { +-- s = art.s ! True ! card.n ++ card.s ; +-- n = card.n +-- } ; + + DetArtSg art cn = { + s = \\c => art.s ++ toNP (cn.s ! Sg) c ; + a = agrP3 cn.g Sg + } ; + + DetArtPl art cn = { + s = \\c => art.s ++ toNP (cn.s ! Pl) c ; + a = agrP3 cn.g Pl + } ; + +-- DefArt = {s = []} ; +-- IndefArt = {s = []} ; + + MassNP cn = {s = \\c => toNP (cn.s ! Sg) c ; a = agrP3 cn.g Sg} ; + + UseN n = n ; + UseN2 n = { s = n.s ; g = n.g }; + + Use2N3 f = { + s = f.s; + g = f.g ; + c2 = f.c2 + } ; + + Use3N3 f = { + s = f.s ; + g = f.g ; + c2 = f.c2 + } ; + +-- ComplN2 f x = {s = \\n,c => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c ; g = f.g} ; + ComplN2 f x = {s = \\n,c => case c of { + Dir => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c ; + Obl => x.s ! NPC c ++ f.c2! PP Pl f.g ++ f.s ! n ! c ; + Voc => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c + }; + g = f.g; + }; + ComplN3 f x = { + s = \\n,c => x.s ! NPObj ++ f.c3 ++ f.s ! n ! Dir ; + g = f.g ; + c2 = f.c2 + } ; + + AdjCN ap cn = { + s = \\n,c => ap.s ! n ! cn.g ! c ! Posit ++ cn.s ! n ! c ; + g = cn.g + } ; + +-- RelCN cn rs = { +-- s = \\n,c => cn.s ! n ! c ++ rs.s ! agrgP3 n cn.g ; +-- g = cn.g +-- } ; + AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s ; g = cn.g} ; +-- +-- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s ; g = cn.g} ; +-- +-- ApposCN cn np = {s = \\n,c => cn.s ! n ! Nom ++ np.s ! c ; g = cn.g} ; +-- +} diff --git a/lib/src/urdu/NumeralUrd.gf b/lib/src/urdu/NumeralUrd.gf new file mode 100644 index 000000000..459d84a80 --- /dev/null +++ b/lib/src/urdu/NumeralUrd.gf @@ -0,0 +1,95 @@ +concrete NumeralUrd of Numeral = CatUrd ** open ResUrd in { +-- +--lincat +-- Digit = {s : DForm => CardOrd => Str} ; +-- Sub10 = {s : DForm => CardOrd => Str ; n : Number} ; +-- Sub100 = {s : CardOrd => Str ; n : Number} ; +-- Sub1000 = {s : CardOrd => Str ; n : Number} ; +-- Sub1000000 = {s : CardOrd => Str ; n : Number} ; +-- +--lin num x = x ; +--lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in +-- {s = \\f,c => case of { +-- => "twelfth" ; +-- _ => two.s ! f ! c +-- } +-- } ; +-- +--lin n3 = mkNum "three" "thirteen" "thirty" "third" ; +--lin n4 = mkNum "four" "fourteen" "forty" "fourth" ; +--lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ; +--lin n6 = regNum "six" ; +--lin n7 = regNum "seven" ; +--lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ; +--lin n9 = mkNum "nine" "nineteen" "ninety" "ninth" ; +-- +--lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ; +--lin pot0 d = d ** {n = Pl} ; +--lin pot110 = regCardOrd "ten" ** {n = Pl} ; +--lin pot111 = regCardOrd "eleven" ** {n = Pl} ; +--lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ; +--lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ; +--lin pot1 d = {s = d.s ! ten} ** {n = Pl} ; +--lin pot1plus d e = { +-- s = \\c => d.s ! ten ! NCard ++ "-" ++ e.s ! unit ! c ; n = Pl} ; +--lin pot1as2 n = n ; +--lin pot2 d = {s = \\c => d.s ! unit ! NCard ++ mkCard c "hundred"} ** {n = Pl} ; +--lin pot2plus d e = { +-- s = \\c => d.s ! unit ! NCard ++ "hundred" ++ "and" ++ e.s ! c ; n = Pl} ; +--lin pot2as3 n = n ; +--lin pot3 n = { +-- s = \\c => n.s ! NCard ++ mkCard c "thousand" ; n = Pl} ; +--lin pot3plus n m = { +-- s = \\c => n.s ! NCard ++ "thousand" ++ m.s ! c ; n = Pl} ; +-- +---- numerals as sequences of digits +-- +-- lincat +-- Dig = TDigit ; +-- +-- lin +-- IDig d = d ** {tail = T1} ; +-- +-- IIDig d i = { +-- s = \\o => d.s ! NCard ++ commaIf i.tail ++ i.s ! o ; +-- n = Pl ; +-- tail = inc i.tail +-- } ; +-- +-- D_0 = mkDig "0" ; +-- D_1 = mk3Dig "1" "1st" Sg ; +-- D_2 = mk2Dig "2" "2nd" ; +-- D_3 = mk2Dig "3" "3rd" ; +-- D_4 = mkDig "4" ; +-- D_5 = mkDig "5" ; +-- D_6 = mkDig "6" ; +-- D_7 = mkDig "7" ; +-- D_8 = mkDig "8" ; +-- D_9 = mkDig "9" ; +-- +-- oper +-- commaIf : DTail -> Str = \t -> case t of { +-- T3 => "," ; +-- _ => [] +-- } ; +-- +-- inc : DTail -> DTail = \t -> case t of { +-- T1 => T2 ; +-- T2 => T3 ; +-- T3 => T1 +-- } ; +-- +-- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ; +-- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ; +-- +-- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> { +-- s = table {NCard => c ; NOrd => o} ; +-- n = n +-- } ; +-- +-- TDigit = { +-- n : Number ; +-- s : CardOrd => Str +-- } ; +-- +} diff --git a/lib/src/urdu/ParadigmsUrd.gf b/lib/src/urdu/ParadigmsUrd.gf new file mode 100644 index 000000000..f2435d2ce --- /dev/null +++ b/lib/src/urdu/ParadigmsUrd.gf @@ -0,0 +1,613 @@ +--# -path=.:../abstract:../../prelude:../common +-- +----1 Urdu Lexical Paradigms + +resource ParadigmsUrd = open + Predef, + Prelude, + MorphoUrd, + CatUrd + in { + +--2 Parameters + +oper + masculine : Gender ; + feminine : Gender ; + singular : Number; + plural : Number; + + singular = Sg ; plural = Pl; + + masculine = Masc ; feminine = Fem ; --i + + +--2 Nouns + + mkN = overload { + mkN : Str -> N + = \s -> regNoun s ** {lock_N = <>} ; + mkN : Str -> Gender -> N + = \s,g -> reggNoun s g ** {lock_N = <>} ; + mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> N + = \sd,so,sv,pd,po,pv,g -> mkNoun sd so sv pd po pv g ** {lock_N = <>} ; + } ; + mkN2 : N -> Prep -> N2; + mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s } ; + + --mkN02 : Str -> Noun ; + --mkN02 mrd = let mrdwN = mrd+"wN" ; + -- mrdw = tk 1 mrdwN + -- in mkNoun mrd mrd mrd + -- mrd mrdwN mrdw + -- Masc ; + + +-- mkPN = overload { + mkPN : Str -> PN = \s -> let n = regNoun s in {s = n.s ! Sg ; g = n.g ; lock_PN = <>} ; +-- mkPN : N -> Gender -> PN = \n,g -> {s = n.s ! Sg ; g = g ; lock_PN = <>} ; +-- } ; + +-- personalPN : Pron; + personalPN : Str -> Pron = \s -> let n = makePersPron in {s = n.s ; a = personalAgr ; lock_Pron = <>}; + demoPN : Str -> Str -> Str -> Quant = \s1,s2,s3 -> let n = makeDemonPronForm s1 s2 s3 in {s = n.s ; a = defaultAgr ; lock_Quant = <>}; + mkDet : Str -> Str -> Str -> Str -> Number -> Det = \s1,s2,s3,s4,nb -> let dt = makeDet s1 s2 s3 s4 nb in {s = dt.s ; n = nb ; lock_Det = <>}; + mkIP : (x1,x2,x3:Str) -> Number -> Gender -> IP = \s1,s2,s3,n,g -> let p = mkIntPronForm s1 s2 s3 in { s = p.s ; n = n ; g = g ; lock_IP = <>}; +-- mkIP : (x1,x2,x3,x4,x5,x6:Str) -> IP = \s1,s2,s3,s4,s5,s6 -> let n = makeDemPron s1 s2 s3 s4 s5 s6 in { s = n.s ; a = defaultAgr ; lock_IP = <>}; +--2 Adjectives + + mkA = overload { + mkA : Str-> A + = \s -> regAdjective s ** {lock_A = <>} ; + mkA : Str -> Str -> A2 + = \a,c -> let n = regAdjective a in {s = n.s; c2 = c} ** {lock_A2 = <>} ; +-- mkADeg1 : Str -> A +-- = \s -> adjDeg1 s ** {lock_A = <>} ; +-- mkA : (x1,_,x3 : Str) -> A +-- = \msd,m,f -> mkAdjective msd m f ** {lock_A = <>} ; + } ; + +--2 Verbs + +-- mkV = overload { + mkV : Str -> V + = \s -> mkVerb s ** {lock_V = <>} ; +-- mkV_3 : Str -> Str -> V +-- = \s,t -> mkVerb3 s t ** {lock_V = <>} ; +-- mkV_2 : Str -> Str -> V +-- = \s,c1 -> mkVerb2 s c1 ** {lock_V = <>} ; +-- mkV_1_2 : Str -> Str -> Str -> V +-- = \s,c1,c2 -> mkVerb1_2 s c1 c2 ** {lock_V = <>} ; +-- mkV : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> V +-- = \inf,stem,ims,imp,ifs,ifp,pms,pmp,pfs,pfp,ss1,ss2,sp2,sp3,r -> +-- mkVerb inf stem ims imp ifs ifp pms pmp pfs pfp ss1 ss2 sp2 sp3 r ** +-- {lock_V = <>} ; +-- } ; + + + mkV2 = overload { + mkV2 : Str -> V2 + = \s -> mkVerb s ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> V2 + = \v -> v ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; + mkV2 : V -> Str -> V2 + = \v,p -> v ** {c2 = {s = p ; c = VTransPost} ; lock_V2 = <>} ; + } ; + + --mkV2 = overload { +-- mkV2 : Str -> V2 +-- = \s -> mkVerb s ** { lock_V2 = <>} ; + -- mkV2 : V -> V2 + -- = \v -> v ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; + -- mkV2 : V -> Str -> V2 + -- = \v,p -> v ** {c2 = {s = p ; c = VTransPost} ; lock_V2 = <>} ; + -- } ; + +-- compund verbs + + mkCmpdVerb1 : N -> V -> Str = + \n,v -> n.s ! Sg ! Dir ++ v.s ! Inf ; + mkCmpdVerb = overload { + mkCmpdVerb : N -> Str -> Str + = \n,x -> n.s ! Sg ! Dir ++ x; + }; + mkCmpdNoun = overload { + mkCmpdNoun : N -> N -> Str + = \n1,n2 -> n1.s ! Sg ! Dir ++ n2.s ! Sg ! Dir; + }; +----3 Compound nouns +---- +---- A compound noun is an uninflected string attached to an inflected noun, +---- such as "baby boom", "chief executive officer". +-- +-- mkN : Str -> N -> N +-- } ; +-- +-- +----3 Relational nouns +---- +---- Relational nouns ("daughter of x") need a preposition. +-- +-- mkN2 : N -> Prep -> N2 ; +-- +---- The most common preposition is "of", and the following is a +---- shortcut for regular relational nouns with "of". +-- +-- regN2 : Str -> N2 ; +-- +---- Use the function $mkPrep$ or see the section on prepositions below to +---- form other prepositions. +---- +---- Three-place relational nouns ("the connection from x to y") need two prepositions. +-- + mkN3 : N -> Prep -> Str -> N3 ; +-- +-- +-- +----3 Proper names and noun phrases +---- +---- Proper names, with a regular genitive, are formed from strings. +-- +-- mkPN : overload { +-- +-- mkPN : Str -> PN ; +-- +---- Sometimes a common noun can be reused as a proper name, e.g. "Bank" +-- +-- mkPN : N -> PN +-- } ; +-- +-- +----2 Adjectives +-- +-- mkA : overload { +-- +---- For regular adjectives, the adverbial and comparison forms are derived. This holds +---- even for cases with the variations "happy - happily - happier - happiest", +---- "free - freely - freer - freest", and "rude - rudest". +-- +-- mkA : (happy : Str) -> A ; +-- +---- However, the duplication of the final consonant cannot be predicted, +---- but a separate case is used to give the comparative +-- +-- mkA : (fat,fatter : Str) -> A ; +-- +---- As many as four forms may be needed. +-- +-- mkA : (good,better,best,well : Str) -> A +-- } ; +-- +---- To force comparison to be formed by "more - most", +---- the following function is used: +-- +-- compoundA : A -> A ; -- -/more/most ridiculous +-- +-- +-- +----3 Two-place adjectives +---- +---- Two-place adjectives need a preposition for their second argument. +-- +-- mkA2 : A -> Prep -> A2 ; +-- +-- +-- +----2 Adverbs +-- +---- Adverbs are not inflected. Most lexical ones have position +---- after the verb. Some can be preverbal (e.g. "always"). +-- +-- 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. +-- + mkPrep : Str -> Str -> Str -> Str -> Number -> Prep ; +-- noPrep : Prep ; +-- +---- (These two functions are synonyms.) +-- +----2 Verbs +---- +-- +---- Verbs are constructed by the function $mkV$, which takes a varying +---- number of arguments. +-- +-- mkV : overload { +-- +---- The regular verb function recognizes the special cases where the last +---- character is "y" ("cry-cries" but "buy-buys") or a sibilant +---- ("kiss-"kisses", "jazz-jazzes", "rush-rushes", "munch - munches", +---- "fix - fixes"). +-- +-- mkV : (cry : Str) -> V ; +-- +---- Give the present and past forms for regular verbs where +---- the last letter is duplicated in some forms, +---- e.g. "rip - ripped - ripping". +-- +-- mkV : (stop, stopped : Str) -> V ; +-- +---- There is an extensive list of irregular verbs in the module $IrregularHin$. +---- In practice, it is enough to give three forms, +---- e.g. "drink - drank - drunk". +-- +-- mkV : (drink, drank, drunk : Str) -> V ; +-- +---- Irregular verbs with duplicated consonant in the present participle. +-- +-- mkV : (run, ran, run, running : Str) -> V ; +-- +---- Except for "be", the worst case needs five forms: the infinitive and +---- the third person singular present, the past indicative, and the +---- past and present participles. +-- +-- mkV : (go, goes, went, gone, going : Str) -> V +-- }; +-- +---- Verbs with a particle. +---- The particle, such as in "switch on", is given as a string. +-- +-- partV : V -> Str -> V ; +-- +---- Reflexive verbs. +---- By default, verbs are not reflexive; this function makes them that. +-- +-- reflV : V -> 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 : overload { +-- mkV2 : V -> Prep -> V2 ; -- believe in +-- mkV2 : V -> V2 -- kill +-- }; +-- +----3 Three-place verbs +---- +---- Three-place (ditransitive) verbs need two prepositions, of which +---- the first one or both can be absent. +-- + mkV3 : V -> Str -> Str -> V3; +-- dirV3 : V-> Str -> V3; +-- mkV3 : V -> Prep -> Prep -> V3 ; -- speak, with, about +-- dirV3 : V -> Prep -> 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 -> Prep -> V2S ; +-- mkVV : V -> VV ; + mkV2V : V -> Str -> Str -> Bool -> V2V ; +-- mkV2V : V -> Prep -> Prep -> V2V ; +-- mkVA : V -> VA ; +-- mkV2A : V -> Prep -> V2A ; +-- mkVQ : V -> VQ ; +-- mkV2Q : V -> Prep -> V2Q ; +-- +-- mkAS : A -> AS ; +-- mkA2S : A -> Prep -> A2S ; +-- mkAV : A -> AV ; +-- mkA2V : A -> Prep -> A2V ; +-- +---- Notice: Categories $V0, AS, A2S, AV, A2V$ are just $A$. +---- $V0$ is just $V$; the second argument is treated as adverb. +-- +-- 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. +-- +-- Gender = MorphoHin.Gender ; +-- Number = MorphoHin.Number ; +-- Case = MorphoHin.Case ; +-- human = Masc ; +-- nonhuman = Neutr ; +-- masculine = Masc ; +-- feminine = Fem ; +-- singular = Sg ; +-- plural = Pl ; +-- nominative = Nom ; +-- genitive = Gen ; +-- +-- Preposition : Type = Str ; -- obsolete +-- +-- regN = \ray -> +-- let rays = add_s ray +-- in +-- mk2N ray rays ; +-- +-- +-- add_s : Str -> Str = \w -> case w of { +-- _ + ("io" | "oo") => w + "s" ; -- radio, bamboo +-- _ + ("s" | "z" | "x" | "sh" | "ch" | "o") => w + "es" ; -- bus, hero +-- _ + ("a" | "o" | "u" | "e") + "y" => w + "s" ; -- boy +-- x + "y" => x + "ies" ; -- fly +-- _ => w + "s" -- car +-- } ; +-- +-- mk2N = \man,men -> +-- let mens = case last men of { +-- "s" => men + "'" ; +-- _ => men + "'s" +-- } +-- in +-- mk4N man men (man + "'s") mens ; +-- +-- mk4N = \man,men,man's,men's -> +-- mkNoun man man's men men's ** {g = Neutr ; lock_N = <>} ; +-- +-- genderN g man = {s = man.s ; g = g ; lock_N = <>} ; +-- +-- compoundN s n = {s = \\x,y => s ++ n.s ! x ! y ; g=n.g ; lock_N = <>} ; +-- +-- mkPN = overload { +-- mkPN : Str -> PN = regPN ; +-- mkPN : N -> PN = nounPN +-- } ; +-- +-- +-- mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ; +-- regN2 n = mkN2 (regN n) (mkPrep "of") ; + mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q} ; +-- +----3 Relational common noun phrases +---- +---- In some cases, you may want to make a complex $CN$ into a +---- relational noun (e.g. "the old town hall of"). +-- +-- cnN2 : CN -> Prep -> N2 ; +-- cnN3 : CN -> Prep -> Prep -> N3 ; +-- +---- This is obsolete. +-- cnN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ; +-- cnN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q.s} ; +-- +-- regPN n = regGenPN n human ; +-- regGenPN n g = nameReg n g ** {g = g ; lock_PN = <>} ; +-- nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ; +-- +-- mk2A a b = mkAdjective a a a b ** {lock_A = <>} ; +-- regA a = regADeg a ** {lock_A = <>} ; +-- +-- mkA2 a p = a ** {c2 = p.s ; lock_A2 = <>} ; +-- +-- ADeg = A ; ---- +-- +-- mkADeg a b c d = mkAdjective a b c d ** {lock_A = <>} ; +-- +-- regADeg happy = +-- let +-- happ = init happy ; +-- y = last happy ; +-- happie = case y of { +-- "y" => happ + "ie" ; +-- "e" => happy ; +-- _ => happy + "e" +-- } ; +-- happily : Str = case happy of { +-- _ + "y" => happ + "ily" ; +-- _ + "ll" => happy + "y" ; +-- _ => happy + "ly" +-- } ; +-- in mkADeg happy (happie + "r") (happie + "st") happily ; +-- +-- duplADeg fat = +-- mkADeg fat +-- (fat + last fat + "er") (fat + last fat + "est") (fat + "ly") ; +-- +-- compoundADeg a = +-- let ad = (a.s ! AAdj Posit) +-- in mkADeg ad ("more" ++ ad) ("most" ++ ad) (a.s ! AAdv) ; +-- +-- adegA a = a ; +-- +-- mkAdv x = ss x ** {lock_Adv = <>} ; +-- mkAdV x = ss x ** {lock_AdV = <>} ; +-- mkAdA x = ss x ** {lock_AdA = <>} ; +-- + mkPrep sgm sgf plm plf n = let p = makePrep sgm sgf plm plf n in { s = p.s ; n = n ; lock_Prep = <>} ; +-- noPrep = mkPrep [] ; +-- +-- mk5V a b c d e = mkVerb a b c d e ** {s1 = [] ; lock_V = <>} ; +-- +-- regV cry = +-- let +-- cr = init cry ; +-- y = last cry ; +-- cries = (regN cry).s ! Pl ! Nom ; -- ! +-- crie = init cries ; +-- cried = case last crie of { +-- "e" => crie + "d" ; +-- _ => crie + "ed" +-- } ; +-- crying = case y of { +-- "e" => case last cr of { +-- "e" => cry + "ing" ; +-- _ => cr + "ing" +-- } ; +-- _ => cry + "ing" +-- } +-- in mk5V cry cries cried cried crying ; +-- +-- reg2V fit fitted = +-- let fitt = Predef.tk 2 fitted ; +-- in mk5V fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") ; +-- +-- regDuplV fit = +-- case last fit of { +-- ("a" | "e" | "i" | "o" | "u" | "y") => +-- Predef.error (["final duplication makes no sense for"] ++ fit) ; +-- t => +-- let fitt = fit + t in +-- mk5V fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") +-- } ; +-- +-- irregV x y z = let reg = (regV x).s in +-- mk5V x (reg ! VPres) y z (reg ! VPresPart) ** {s1 = [] ; lock_V = <>} ; +-- +-- irreg4V x y z w = let reg = (regV x).s in +-- mk5V x (reg ! VPres) y z w ** {s1 = [] ; lock_V = <>} ; +-- +-- irregDuplV fit y z = +-- let +-- fitting = (regDuplV fit).s ! VPresPart +-- in +-- mk5V fit (fit + "s") y z fitting ; +-- +-- partV v p = verbPart v p ** {lock_V = <>} ; +-- reflV v = {s = v.s ; part = v.part ; lock_V = v.lock_V ; isRefl = True} ; +-- +-- prepV2 v p = v ** {s = v.s ; s1 = v.s1 ; c2 = p.s ; lock_V2 = <>} ; +-- dirV2 v = prepV2 v noPrep ; +-- + mkV3 v p q = v ** { c2 = p ; c3 = q ; lock_V3 = <>} ; + +-- mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; c2 = p.s ; c3 = q.s ; lock_V3 = <>} ; +-- dirV3 v p = mkV3 v noPrep p ; +-- dirdirV3 v = dirV3 v noPrep ; +-- +-- mkVS v = v ** {lock_VS = <>} ; +-- mkVV v = { +-- s = table {VVF vf => v.s ! vf ; _ => variants {}} ; +-- isAux = False ; lock_VV = <> +-- } ; +-- mkVQ v = v ** {lock_VQ = <>} ; +-- +-- V0 : Type = V ; +---- V2S, V2V, V2Q : Type = V2 ; +-- AS, A2S, AV : Type = A ; +-- A2V : Type = A2 ; +-- +-- mkV0 v = v ** {lock_V = <>} ; +-- mkV2S v p = prepV2 v p ** {lock_V2S = <>} ; + mkV2V v s1 s2 b = v ** {isAux = b ; c1 = s1 ; c2 = s2 ; lock_V2V = <>} ; +-- mkV2V v p t = prepV2 v p ** {isAux = False ; lock_V2V = <>} ; +-- mkVA v = v ** {lock_VA = <>} ; +-- mkV2A v p = prepV2 v p ** {lock_V2A = <>} ; +-- mkV2Q v p = prepV2 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 = <>} ; +-- +-- +---- pre-overload API and overload definitions +-- +-- mk4N : (man,men,man's,men's : Str) -> N ; +-- regN : Str -> N ; +-- mk2N : (man,men : Str) -> N ; +-- genderN : Gender -> N -> N ; +-- compoundN : Str -> N -> N ; +-- +-- mkN = overload { +-- mkN : (man,men,man's,men's : Str) -> N = mk4N ; +-- mkN : Str -> N = regN ; +-- mkN : (man,men : Str) -> N = mk2N ; +-- mkN : Gender -> N -> N = genderN ; +-- mkN : Str -> N -> N = compoundN +-- } ; +-- +-- +-- mk2A : (free,freely : Str) -> A ; +-- regA : Str -> A ; +-- +-- mkA = overload { +-- mkA : Str -> A = regA ; +-- mkA : (fat,fatter : Str) -> A = \fat,fatter -> +-- mkAdjective fat fatter (init fatter + "st") (fat + "ly") ** {lock_A = <>} ; +-- mkA : (good,better,best,well : Str) -> A = \a,b,c,d -> +-- mkAdjective a b c d ** {lock_A = <>} +-- } ; +-- +-- compoundA = compoundADeg ; +-- +-- +-- mk5V : (go, goes, went, gone, going : Str) -> V ; +-- regV : (cry : Str) -> V ; +-- reg2V : (stop, stopped : Str) -> V; +-- irregV : (drink, drank, drunk : Str) -> V ; +-- irreg4V : (run, ran, run, running : Str) -> V ; +-- +-- -- Use reg2V instead +-- regDuplV : Str -> V ; +-- -- Use irreg4V instead +-- irregDuplV : (get, got, gotten : Str) -> V ; +-- +-- mkV = overload { +-- mkV : (cry : Str) -> V = regV ; +-- mkV : (stop, stopped : Str) -> V = reg2V ; +-- mkV : (drink, drank, drunk : Str) -> V = irregV ; +-- mkV : (run, ran, run, running : Str) -> V = irreg4V ; +-- mkV : (go, goes, went, gone, going : Str) -> V = mk5V +-- }; +-- +-- prepV2 : V -> Prep -> V2 ; +-- dirV2 : V -> V2 ; +-- +-- mkV2 = overload { +-- mkV2 : V -> Prep -> V2 = prepV2; +-- mkV2 : V -> V2 = dirV2 +-- }; +-- +-- +------ obsolete +-- +---- Comparison adjectives may two more forms. +-- +-- ADeg : Type ; +-- +-- mkADeg : (good,better,best,well : Str) -> ADeg ; +-- +---- The regular pattern recognizes two common variations: +---- "-e" ("rude" - "ruder" - "rudest") and +---- "-y" ("happy - happier - happiest - happily") +-- +-- regADeg : Str -> ADeg ; -- long, longer, longest +-- +---- However, the duplication of the final consonant is nor predicted, +---- but a separate pattern is used: +-- +-- duplADeg : Str -> ADeg ; -- fat, fatter, fattest +-- +---- If comparison is formed by "more", "most", as in general for +---- long adjective, the following pattern is used: +-- +-- compoundADeg : A -> ADeg ; -- -/more/most ridiculous +-- +---- From a given $ADeg$, it is possible to get back to $A$. +-- +-- adegA : ADeg -> A ; +-- +-- +-- regPN : Str -> PN ; +-- regGenPN : Str -> Gender -> PN ; -- John, John's +-- +---- Sometimes you can reuse a common noun as a proper name, e.g. "Bank". +-- +-- nounPN : N -> PN ; +-- +-- +-- + +} diff --git a/lib/src/urdu/PhraseUrd.gf b/lib/src/urdu/PhraseUrd.gf new file mode 100644 index 000000000..7763a4a83 --- /dev/null +++ b/lib/src/urdu/PhraseUrd.gf @@ -0,0 +1,25 @@ +concrete PhraseUrd of Phrase = CatUrd ** open Prelude, ResUrd in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; + UttQS qs = {s = qs.s ! QDir} ; + UttImpSg pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg False} ; + UttImpPl pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Pl False} ; + UttImpPol pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg True} ; + + UttIP ip = {s = ip.s ! Dir} ; --- Acc also + UttIAdv iadv = iadv ; + UttNP np = {s = np.s ! NPC Dir} ; + UttVP vp = {s = infVP False vp (agrP3 Masc Sg)} ; + UttAdv adv = adv ; + UttCN cn = {s = cn.s ! Sg ! Dir}; + + NoPConj = {s = []} ; + PConjConj conj = {s = conj.s2} ; --- + + NoVoc = {s = []} ; + VocNP np = {s = np.s ! NPC Dir} ; + +} diff --git a/lib/src/urdu/QuestionUrd.gf b/lib/src/urdu/QuestionUrd.gf new file mode 100644 index 000000000..6eae3ee6e --- /dev/null +++ b/lib/src/urdu/QuestionUrd.gf @@ -0,0 +1,69 @@ +concrete QuestionUrd of Question = CatUrd ** open ResUrd, Prelude in { +-- + flags optimize=all_subs ; + + lin + + QuestCl cl = { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! OQuest; + QIndir => "agr" ++ cl.s ! t! p ! ODir + } + }; + + QuestVP qp vp = + + let cl = mkSClause (qp.s ! Dir) (Ag qp.g qp.n Pers3_Near) vp; + cl2 = mkSClause (qp.s ! Obl ++ "nE" ) (Ag qp.g Sg Pers3_Near) vp +-- in {s = \\t,p,o => cl.s ! t ! p ! ODir} ; + in { s = \\t,p,o => case t of { + VPImpPast => cl2.s ! t ! p ! ODir; + _ => cl.s ! t ! p ! ODir + } + }; +-- QuestSlash ip slash = +-- mkQuestion (ss (slash.c2 ++ ip.s ! Acc)) slash ; +-- --- stranding in ExratHin + + QuestIAdv iadv cl = { + s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! ODir; + }; + + QuestIComp icomp np = + let cl = mkSClause (np.s ! NPC Dir ++ icomp.s) np.a (predAux auxBe); + in { + s = \\t,p,qf => case qf of { + QDir => cl.s ! t ! p ! ODir; + QIndir => cl.s ! t! p ! ODir + } + }; + + PrepIP p ip = {s = ip.s ! Voc ++ p.s ! PP ip.n ip.g } ; + + AdvIP ip adv = { + s = \\c => adv.s ++ ip.s ! c ; + n = ip.n; + g = ip.g; + } ; + + IdetCN idet cn = { + s = \\c => idet.s ! cn.g ++ cn.s ! idet.n ! c ; + g = cn.g; + n = idet.n; + } ; + + IdetIP idet = { + s = \\_ => idet.s ! Masc ; + n = idet.n; + g = Masc; + } ; + +-- IdetQuant idet num = { +-- s = idet.s ! num.n ++ num.s ; +-- n = num.n +-- } ; +-- + CompIAdv a = a ; + CompIP p = ss (p.s ! Dir) ; + +} diff --git a/lib/src/urdu/RelativeUrd.gf b/lib/src/urdu/RelativeUrd.gf new file mode 100644 index 000000000..1beebf65d --- /dev/null +++ b/lib/src/urdu/RelativeUrd.gf @@ -0,0 +1,70 @@ +concrete RelativeUrd of Relative = CatUrd ** open ResUrd in { + + flags optimize=all_subs ; + + lin + + RelCl cl = { + s = \\t,p,o,agr => case of { + => "js" ++ cl.s ! t ! p ! o ; + => "jn" ++ cl.s ! t ! p ! o ; + <_,_> => "jw" ++ cl.s ! t ! p ! o + }; + c = Dir + } ; + + RelVP rp vp = { + s = \\t,p,o,ag => + let + agr = case rp.a of { + RNoAg => ag ; + RAg a => a + } ; + cl = mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp; + +-- cl = case t of { +-- VPImpPast => mkSClause (rp.s ! (giveNumber agr) ! Obl) agr vp; +-- _ => mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp +-- }; + in + cl.s ! t ! p ! ODir ; + c = Dir + } ; +-- +---- Pied piping: "at which we are looking". Stranding and empty +---- relative are defined in $ExtraHin.gf$ ("that we are looking at", +---- "we are looking at"). +-- + RelSlash rp slash = { + s = \\t,p,o,agr => rp.s ! (giveNumber agr) ! Dir ++ slash.c2.s ++ slash.s ! t ! p ! o ;--case t of { +-- VPImpPast => rp.s ! (giveNumber agr) Obl ++ slash.c2.s ++ slash.s ! t ! p ! o ; +-- _ => rp.s ! (giveNumber agr) Dir ++ slash.c2.s ++ slash.s ! t ! p ! o +-- }; + c = Dir + } ; + + FunRP p np rp = { + s = \\n,c => rp.s ! n ! c ++ np.s ! NPC c ++ p.s ! PP n (giveGender np.a) ; + a = RAg np.a + } ; + + IdRP = { + s = table { + Sg => table { + + Dir => "jw" ; + Obl => "js" ; + Voc => "js" + }; + Pl => table { + Dir => "jw" ; + Obl => "jn" ; + Voc => "jn" + } +-- RPrep Neutr => "jn" ; +-- RPrep _ => "whom" + }; + a = RNoAg + } ; + +} diff --git a/lib/src/urdu/ResUrd.gf b/lib/src/urdu/ResUrd.gf new file mode 100644 index 000000000..d75e10e4f --- /dev/null +++ b/lib/src/urdu/ResUrd.gf @@ -0,0 +1,1304 @@ +--# -path=.:../abstract:../common:../../prelude +-- +--1 Urdu auxiliary operations. +-- +-- This module contains operations that are needed to make the +-- resource syntax work. + +resource ResUrd = ParamX ** open Prelude,Predef in { + + flags optimize=all ; + + param + Case = Dir | Obl | Voc ; + Gender = Masc | Fem ; + VTense = Subj | Perf | Imperf; + UPerson = Pers1 + | Pers2_Casual + | Pers2_Familiar + | Pers2_Respect + | Pers3_Near + | Pers3_Distant; + + Order = ODir | OQuest ; + + --2 For $Relative$ + + RAgr = RNoAg | RAg Agr ; + RCase = RC Number Case ; + + + + ----------------------------------------- + -- Urd Pronouns + ----------------------------------------- + Pronoun = P Number Gender Case UPerson; + DemPronForm = DPF Number Case; + PersPronForm = PPF Number UPerson Case; + PossPronForm = PossF Number UPerson Gender; -- to be implemented + RefPronForm = RefPF; + InterrPronForm = IntPF Number Case; + InterrPronForm1 = IntPF1; + InterrPronForm2 = IntPF2 Number Case Gender; + InterrPronForm3 = IntPF3 Number Gender; + IndefPronForm = IPF Case Gender; + IndefPronForm1 = IPF1 Case; + IndefPronForm2 = IPF2; + RelPronForm = RPF Number Case; + RelPronForm1 = RPF1 Number Gender; + RelPronForm2 = RPF2 Case; + RelPronForm3 = RPF3; + + ----------------------------------------------- + -- Determiners + ----------------------------------------------- + + Determiner = DT Number Gender; + + + -------------------------------------------- + -- Propositions + -------------------------------------------- + + Proposition = PP Number Gender; + + ----------------------------------------------- + --Verbs + ---------------------------------------------- + + + + VerbForm = VF VTense UPerson Number Gender + | Inf + | Root + | Inf_Obl + | Inf_Fem; +{- -- Adverbs + AdjectiveForm = Adj1 AdjectiveForm1 | Adj2 AdjectiveForm2; + AdjectiveForm1 = AdjF1 Gender Number Case; + AdjectiveForm2 = AdjF2 Degree; +-} + + oper + Noun = {s : Number => Case => Str ; g : Gender} ; + + mkNoun : (x1,_,_,_,_,x6 : Str) -> Gender -> Noun = + \sd,so,sv,pd,po,pv,g -> { + s = table { + Sg => table { + Dir => sd ; + Obl => so ; + Voc => sv + } ; + Pl => table { + Dir => pd ; + Obl => po ; + Voc => pv + } + } ; + + g = g + } ; + + + + regNoun : Str -> Noun ; + regNoun s = case s of { + _ + "ya" => mkN05 (s); + _ + ("a"|"e"|"h") => mkN01 (s); + _ + "y" => mkN03 (s); + _ + ("aN"|"wN") => mkN04 (s); + _ + "w^" => mkN12 (s); + _ => regNoun2 (s) + }; + regNoun2 : Str -> Noun; + regNoun2 s = let c = if_then_else Bool (eq (last s) "a" ) True (if_then_else Bool (eq (last s) "h") True (if_then_else Bool (eq (last s) "e") True False)) + in case c of { + False => mkN02 (s); + True => mkN01 (s) + }; + + reggNoun : Str -> Gender -> Noun ; + reggNoun s g = let c = if_then_else Bool (eq (last s) "a" ) True (if_then_else Bool (eq (dp 2 s) "aN") True (if_then_else Bool (eq (dp 2 s) "wN") True False)) + in case of { + <_ + "t",Fem,_> => mkN10 (s); + <_ + "t",Masc,_> => mkN02 (s); + <_ + "w",Masc,_> => mkN11 (s); + <_ + "w",Fem,_> => mkN07 (s); + <_ + "ya",Fem,_> => mkN05 (s); + <_ + "ya",Masc,_> => mkN02 (s); + <_,Fem,False> => mkN08 (s); + <_,Fem,_> => mkN09 (s) + + }; + +-- masculine nouns end with alif, choTi_hay, ain Translitration: (a, h, e) +-- Arabic nouns ends with h. also taken as Masc + + mkN01 : Str -> Noun ; + mkN01 lRka = let end = last (lRka) ; + lRk = if_then_else Str (eq end "e") lRka (tk 1 lRka) + in mkNoun (lRka) (lRk+"E") (lRk+"E") + (lRk+"E") (lRk+"wN") (lRk+"w") + Masc ; + +-- masculine nouns does not end with a, h, e, an + + mkN02 : Str -> Noun ; + mkN02 mrd = let mrdwN = mrd+"wN" ; + mrdw = tk 1 mrdwN + in mkNoun mrd mrd mrd + mrd mrdwN mrdw + Masc ; + +-- feminine Nouns end with y + + mkN03 : Str -> Noun ; + mkN03 krsy = let krsyaN = krsy+"aN" ; + krsywN = krsy+"wN" ; + krsyw = tk 1 krsywN + in mkNoun krsy krsy krsy + krsyaN krsywN krsyw + Fem ; + +-- feminine nouns end with a, aN, wN + mkN04 : Str -> Noun ; + mkN04 n = case last n of { + "a" => let bla = n + in mkNoun bla bla bla + (bla+"y^yN") (bla+"w^N") (bla+"w^") + Fem ; + _ => let maN = n ; -- ends with aN and wN + ma = tk 1 maN + in mkNoun maN maN maN + (ma+"y^yN") (ma+"w^N") (ma+"w^N") + Fem + + }; + --feminine nouns end with ya + + mkN05 : Str -> Noun ; + mkN05 gRya = let gRy = (tk 1 gRya) + in mkNoun gRya gRya gRya + (gRya+"N") (gRy+"wN") (gRy+"w") + Fem ; + +-- feminine nouns end with w + + mkN07 : Str -> Noun ; + mkN07 khshbw = mkNoun khshbw khshbw khshbw + (khshbw + "y^yN") (khshbw + "w^N") (khshbw + "w^") + Fem ; + +-- Loan arabic feminine nouns end with t +-- this is a noun that shows state, condition + + mkN10 : Str -> Noun ; + mkN10 ndamt = mkNoun ndamt ndamt ndamt + (ndamt+"yN") (ndamt+"wN") (ndamt+"w") + Fem ; +-- Worst case function + mkN : (_,_,_,_,_,_ : Str) -> Gender -> Noun ; + mkN sgNom sgObl sgVoc plNom plObl plVoc g = + mkNoun sgNom sgObl sgVoc plNom plObl plVoc g ; + + mkN06 : Str -> Noun ; + mkN06 rya = mkNoun rya rya rya + (rya+"y^yN") (rya+"w^N") rya + Fem ; + +-- feminine nouns that do not end with a, N, w, wN + + mkN08 : Str -> Noun ; + mkN08 ktab = mkNoun ktab ktab ktab + (ktab+"yN") (ktab+"wN") (ktab+"w") + Fem ; + +-- Loan arabic feminine nouns + + mkN09 : Str -> Noun ; + mkN09 ahsan = mkNoun ahsan ahsan ahsan + (ahsan+"at") (variants{ahsan+"at";ahsan+"wN"}) (ahsan+"w") + Fem ; + +-- Loan persian maculine nouns end with w + + mkN11 : Str -> Noun ; + mkN11 alw = mkNoun alw alw alw + alw (alw+"w^N") (alw+"w^") + Masc ; + + +-- Loan persian maculine nouns end with w^ + + mkN12 : Str -> Noun ; + mkN12 bhao = mkNoun (bhao) (bhao) (bhao) + (bhao) (bhao) (bhao) + Masc ; + + +-- a useful oper +-- eq : Str -> Str -> Bool = \s1,s2-> (pbool2bool (eqStr s1 s2)) ; + + + + + + + + oper + -- Combining all verb patterns + Verb = {s : VerbForm => Str} ; + + + --Common Verb Forms between all type of verbs + CommonVF = {s : VTense => UPerson => Number => Gender => Str} ; + + mkVerb : (x1: Str) -> Verb = \inf -> + let root = (tk 2 inf); inf_obl = ((tk 1 inf) + "E"); inf_fem = ((tk 1 inf) + "y") + in { s = table { + + VF tense person number gender => (mkCmnVF root tense person number gender).s ; + Inf => inf ; + Root => root ; + Inf_Obl => inf_obl ; + Inf_Fem => inf_fem + + + } + } ; + rem_y : Str -> Str; + rem_y str = let b = take 1 str; yth = drop 1 str; a1 = take 4 yth; a2 = take 1 yth; th= if_then_else Str (eq a1 "(a)y") (drop 5 str) (drop 2 str); st = if_then_else Str (eq a1 "(a)y") (b ++ "(i)"++th) (if_then_else Str (eq a2 "y") (b ++ th) str) + in rt st; + rt: Str -> Str; + rt r = r; + mkCmnVF : Str -> VTense -> UPerson -> Number -> Gender -> {s:Str} = + \root,t,p,n,g -> + {s = + let form1 = case (last root) of { + "a"|"A"|"w" => root + "w^N" ; + _ => root + "wN" + }; + form2 = case (last root) of { + "a"|"A"|"w" => root + "y^N" ; + _ => root + "yN" + }; + in + case of { + => form1 ; + => form2 ; + => (mkImpert root p n g).s ; + => case root of { + "hw" => (mkPastInd root p n g).s ; + "ja" => (mkPastInd "gy" p n g).s ; + "kr" => (mkPastInd "k" p n g).s ; + "dE" => (mkPastInd "d" p n g).s ; + "lE" => (mkPastInd "l" p n g).s ; + _ => (mkPastInd root p n g).s }; + => root + "tE"; + => variants{root+"ty" ; root+"tyN"}; + => root + "tE"; + => root+"tyN"; + => root + "tE"; + => variants{root+"ty" ; root+"tyN"}; + => root + "tE"; + => root+"tyN"; + => root+"ta"; + => root+"ty"; + => root+"te"; + => root+"tyN" + } + + } ; + + mkPastInd : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g -> + {s = let roo = root ; + a = case (last root) of { + "a"|"A"|"w" => "ya" ; + _ => "a" + } ; + y = case (last root) of { + "a"|"A"|"w" => "y^y" ; + _ => "y" + } ; + e = case (last root) of { + "a"|"A"|"w" => "y^E" ; + _ => "E" + } ; + yN = case (last root) of { + "a"|"A"|"w" => "y^yN" ; + _ => "yN" + } ; + + in + case of { + => roo+a ; + => roo+y ; + => roo+e ; + => roo+yN ; + + => roo+a ; + => roo+y ; + => roo+e ; + => roo+yN ; + + => roo+e ; + => variants{roo+y ; roo+yN} ; + => roo+e ; + => roo+yN ; + + => roo+e ; + => variants{roo+yN ; roo+y} ; + => roo+e ; + => roo+yN ; + <_,Sg,Masc> => roo + a; + <_,Sg,Fem> => roo+y ; + <_,Pl,Masc> => roo + e; + <_,Pl,Fem> => roo+yN + + } ; + } ; + + mkImpert : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g -> + {s = let roo = root ; + w = case (last root) of { + "a"|"A"|"w" => "w^" ; + _ => "w" + } ; + yN = case (last root) of { + "a"|"A"|"w" => "y^yN" ; + _ => "yN" + } ; + yE = case (last root) of { + "a"|"A"|"w" => "y^yE" ; + _ => "yE" + } ; + e = case (last root) of { + "a"|"A"|"w" => "y^E" ; + _ => "E" + } in + case of { + => nonExist ; + => root ; + => roo+w ; + => roo+w ; + => variants{roo+w; roo+yN; roo+yE} ; + => variants{roo+yN; roo+yE} ; + <_,Sg,_> => roo+e ; + <_,Pl,_> => roo+yN + }; + }; + + + +-- a useful oper + eq : Str -> Str -> Bool = \s1,s2-> (pbool2bool (eqStr s1 s2)) ; + + + ----------------------------------------- + -- Pronouns opers + ----------------------------------------- + PronForm = {s:Pronoun => Str}; + makeDemPron : (x1,x2,x3,x4,x5,x6:Str) -> PronForm = + \y1,y2,y3,y4,y5,y6 -> { + s = table { + P Sg _ Dir _ => y1; + P Sg _ Obl _ => y2; + P Sg _ Voc _ => y3; + P Pl _ Dir _ => y4; + P Pl _ Obl _ => y5; + P Pl _ Voc _ => y6 + }; + }; + makeIP : (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12:Str) -> PronForm = + \y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12 -> { + s = table { + P Sg Mas Dir _ => y1; + P Sg Mas Obl _ => y2; + P Sg Mas Voc _ => y3; + P Sg Fem Dir _ => y4; + P Sg Fem Obl _ => y5; + P Sg Fem Voc _ => y6; + P Pl Mas Dir _ => y7; + P Pl Mas Obl _ => y8; + P Pl Mas Voc _ => y9; + P Pl Fem Dir _ => y10; + P Pl Fem Obl _ => y11; + P Pl Fem Voc _ => y12 + }; + }; + + DemonPronForm = {s:DemPronForm => Str}; + mkDemonPronForm : (x1,x2,x3,x4,x5,x6:Str) -> DemonPronForm = + \y1,y2,y3,y4,y5,y6 -> { + s = + table { + DPF Sg Dir => y1; + DPF Sg Obl => y2; + DPF Sg Voc => y3; + DPF Pl Dir => y4; + DPF Pl Obl => y5; + DPF Pl Voc => y6 + }; + }; + makeDemonPronForm : Str -> Str -> Str -> DemonPronForm ; + makeDemonPronForm yeh is inn = mkDemonPronForm yeh is "" yeh inn ""; + + PersPron = {s: PersPronForm => Str}; + + mkPersPron:(x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36:Str) -> PersPron = + \y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18,y19,y20,y21,y22,y23,y24,y25,y26,y27,y28,y29,y30,y31,y32,y33,y34,y35,y36 -> { + s = + table { + PPF Sg Pers1 Dir => y1; + PPF Sg Pers1 Obl => y2; + PPF Sg Pers1 Voc => y3; + PPF Sg Pers2_Casual Dir => y4; + PPF Sg Pers2_Casual Obl => y5; + PPF Sg Pers2_Casual Voc => y6; + PPF Sg Pers2_Familiar Dir => y7; + PPF Sg Pers2_Familiar Obl => y8; + PPF Sg Pers2_Familiar Voc => y9; + PPF Sg Pers2_Respect Dir => y10; + PPF Sg Pers2_Respect Obl => y11; + PPF Sg Pers2_Respect Voc => y12; + PPF Sg Pers3_Near Dir => y13; + PPF Sg Pers3_Near Obl => y14; + PPF Sg Pers3_Near Voc => y15; + PPF Sg Pers3_Distant Dir => y16; + PPF Sg Pers3_Distant Obl => y17; + PPF Sg Pers3_Distant Voc => y18; + PPF Pl Pers1 Dir => y19; + PPF Pl Pers1 Obl => y20; + PPF Pl Pers1 Voc => y21; + PPF Pl Pers2_Casual Dir => y22; + PPF Pl Pers2_Casual Obl => y23; + PPF Pl Pers2_Casual Voc => y24; + PPF Pl Pers2_Familiar Dir => y25; + PPF Pl Pers2_Familiar Obl => y26; + PPF Pl Pers2_Familiar Voc => y27; + PPF Pl Pers2_Respect Dir => y28; + PPF Pl Pers2_Respect Obl => y29; + PPF Pl Pers2_Respect Voc => y30; + PPF Pl Pers3_Near Dir => y31; + PPF Pl Pers3_Near Obl => y32; + PPF Pl Pers3_Near Voc => y33; + PPF Pl Pers3_Distant Dir => y34; + PPF Pl Pers3_Distant Obl => y35; + PPF Pl Pers3_Distant Voc => y36 + }; + }; + + makePersPron : PersPron; + makePersPron = mkPersPron "m(a)yN" "m(o)j'|h" "" "t(o)w " "t(o)j|h" "t(o)w " "t(o)m" "t(o)m" "t(o)m" "Ap" "Ap" "Ap" "y(i)h" "a(i)s" "" "w(o)h" "a(o)s" "" + "h(a)m" "h(a)m" "" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "Ap" "Ap" "Ap" "y(i)h" "a(i)n" "" "w(o)h" "a(o)n" "" ; + + + ------- PossPronForm yet to be implemented + RefPron = {s:RefPronForm => Str}; + mkRefPron : (x:Str) -> RefPron = + \y -> { + s = + table { + RefPF => y + }; + }; + + makeRefPron : Str -> RefPron; + makeRefPron str = mkRefPron "khud"; + +-- IntPronForm = {s:InterrPronForm => Str}; + IntPronForm = {s: Case => Str}; + mkIntPronForm : (x1,x2,x3:Str) -> IntPronForm = + \y1,y2,y3 -> { + s = + table { + Dir => y1; + Obl => y2; + Voc => y3 + } + }; +-- makeIntPronForm : IntPronForm ; +-- makeIntPronForm = mkIntPronForm "k(a)ya" "k(i)s" "k(a)wn" "k(a)ya" "k(i)n " "k(a)wn"; + + IntPronForm1 = {s:InterrPronForm1 => Str}; + mkIntPronForm1 : (x:Str) -> IntPronForm1 = + \y -> { + s = + table { + IntPF1 => y + }; + }; + + makeIntPronForm1 : Str -> IntPronForm1; + makeIntPronForm1 str = mkIntPronForm1 str; + + IntPronForm2 = {s:InterrPronForm2 => Str}; + mkIntPronForm2 : (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12:Str) -> IntPronForm2 = + \y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12 -> { + s = + table { + IntPF2 Sg Dir Masc => y1; + IntPF2 Sg Dir Fem => y2; + IntPF2 Sg Obl Masc => y3; + IntPF2 Sg Obl Fem => y4; + IntPF2 Sg Voc Masc => y5; + IntPF2 Sg Voc Fem => y6; + IntPF2 Pl Dir Masc => y7; + IntPF2 Pl Dir Fem => y8; + IntPF2 Pl Obl Masc => y9; + IntPF2 Pl Obl Fem => y10; + IntPF2 Pl Voc Masc => y11; + IntPF2 Pl Voc Fem => y12 + }; + }; + makeIntPronForm2 : Str -> Str -> Str -> IntPronForm2; + makeIntPronForm2 ktna ktne ktny = mkIntPronForm2 ktna ktny ktne ktny ktna ktny ktne "" ktne "" ktne ""; + + IntPronForm3 = {s:InterrPronForm3 => Str}; + mkIntPronForm3 : (x1,x2,x3,x4:Str) -> IntPronForm3 = + \y1,y2,y3,y4 -> { + s = + table { + IntPF3 Sg Masc => y1; + IntPF3 Sg Fem => y2; + IntPF3 Pl Masc => y3; + IntPF3 Pl Fem => y4 + }; + }; + makeIntPronForm3 : Str -> Str -> Str ->IntPronForm3 ; + makeIntPronForm3 kysa kyse kysy = mkIntPronForm3 kysa kysy kyse kysy; + + IndfPronForm = {s:IndefPronForm => Str}; + mkIndfPronForm : (x1,x2,x3,x4,x5,x6:Str) -> IndfPronForm = + \y1,y2,y3,y4,y5,y6 -> { + s = + table { + IPF Dir Masc => y1; + IPF Dir Fem => y2; + IPF Obl Masc => y3; + IPF Obl Fem => y4; + IPF Voc Masc => y5; + IPF Voc Fem => y6 + }; + }; + makeIndfPronForm : Str -> Str -> IndfPronForm ; + makeIndfPronForm flaN flany = mkIndfPronForm flaN flany flaN flany flaN flany; + + IndfPronForm1 = {s:IndefPronForm1 => Str}; + mkIndfPronForm1 : (x1,x2,x3:Str) -> IndfPronForm1 = + \y1,y2,y3 -> { + s = + table { + IPF1 Dir => y1; + IPF1 Obl => y2; + IPF1 Voc => y3 + }; + }; + makeIndfPronForm1 : Str -> IndfPronForm1 ; + makeIndfPronForm1 khuch = mkIndfPronForm1 khuch khuch khuch; + + IndfPronForm2 = {s:IndefPronForm2 => Str}; + mkIndfPronForm2 : (x:Str) -> IndfPronForm2 = + \y -> { + s = + table { + IPF2 => y + }; + }; + + makeIndfPronForm2 : Str -> IndfPronForm2 ; + makeIndfPronForm2 w = mkIndfPronForm2 w; + + + RelvPronForm = {s:RelPronForm => Str}; + mkRelvPronForm : (x1,x2,x3,x4,x5,x6:Str) -> RelvPronForm = + \y1,y2,y3,y4,y5,y6 -> { + s = + table { + RPF Sg Dir => y1; + RPF Sg Obl => y2; + RPF Sg Voc => y3; + RPF Pl Dir => y4; + RPF Pl Obl => y5; + RPF Pl Voc => y6 + }; + }; + makeRelvPronForm : RelvPronForm ; + makeRelvPronForm = mkRelvPronForm "jw" "j(i)s" "" "jw" "j(i)" ""; + + RelvPronForm1 = {s:RelPronForm1 => Str}; + mkRelvPronForm1 : (x1,x2,x3,x4:Str) -> RelvPronForm1 = + \y1,y2,y3,y4 -> { + s = + table { + RPF1 Sg Masc => y1; + RPF1 Sg Fem => y2; + RPF1 Pl Masc => y3; + RPF1 Pl Fem => y4 + }; + }; + makeRelvPronForm1 : Str -> Str -> Str -> RelvPronForm1 ; + makeRelvPronForm1 jwnsa jwnse jwnsy = mkRelvPronForm1 jwnsa jwnsy jwnse jwnsy; + + RelvPronForm2 = {s:RelPronForm2 => Str}; + mkRelvPronForm2 : (x1,x2,x3:Str) -> RelvPronForm2 = + \y1,y2,y3 -> { + s = + table { + RPF2 Dir => y1; + RPF2 Obl => y2; + RPF2 Voc => y3 + }; + }; + makeRelvPronForm2 : Str -> RelvPronForm2 ; + makeRelvPronForm2 aysa = mkRelvPronForm2 aysa aysa aysa; + + RelvPronForm3 = {s:RelPronForm3 => Str}; + mkRelvPronForm3 : (x:Str) -> RelvPronForm3 = + \y -> { + s = + table { + RPF3 => y + }; + }; + makeRelvPronForm3 : Str -> RelvPronForm3 ; + makeRelvPronForm3 aya = mkRelvPronForm3 aya; + + + + ----------------------------------------------- + -- Urd Adjectives + ----------------------------------------------- + + Adjective = { s: Number => Gender => Case => Degree => Str }; + + + mkAdjective : (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36:Str) -> Adjective = + \y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12,y13,y14,y15,y16,y17,y18,y19,y20,y21,y22,y23,y24,y25,y26,y27,y28,y29,y30,y31,y32,y33,y34,y35,y36 -> { + s = table { + Sg => table { + Masc => table { + Dir => table { + Posit => y1 ; + Compar => y2 ; + Superl => y3 + }; + Obl => table { + Posit => y4 ; + Compar => y5 ; + Superl => y6 + }; + Voc => table { + Posit => y7 ; + Compar => y8 ; + Superl => y9 + } + }; + Fem => table { + Dir => table { + Posit => y10 ; + Compar => y11 ; + Superl => y12 + }; + Obl => table { + Posit => y13 ; + Compar => y14 ; + Superl => y15 + }; + Voc => table { + Posit => y16 ; + Compar => y17 ; + Superl => y18 + } + } + }; + Pl => table { + Masc => table { + Dir => table { + Posit => y19 ; + Compar => y20 ; + Superl => y21 + }; + Obl => table { + Posit => y22 ; + Compar => y23 ; + Superl => y24 + }; + Voc => table { + Posit => y25 ; + Compar => y26 ; + Superl => y27 + } + }; + Fem => table { + Dir => table { + Posit => y28 ; + Compar => y29 ; + Superl => y30 + }; + Obl => table { + Posit => y31 ; + Compar => y32 ; + Superl => y33 + }; + Voc => table { + Posit => y34 ; + Compar => y35 ; + Superl => y36 + } + } + } + } + }; + + + regAdjective : Str -> Adjective; + regAdjective x = case x of { + acch + ("a"|"aN") => mkAdjective x ("bht" ++ x) ("sab sE" ++ x) (acch + "E") ("bht" ++ acch + "E") ("sab sE" ++ acch + "E") (acch + "E") ("bht" ++ acch + "E") ("sab sE" ++ acch + "E") + (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y") (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y") (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y") + (acch +"E") ("bht" ++ acch + "E") ("sab sE" ++ acch + "E") (acch + "E") ("bht" ++ acch + "E") ("sab sE" ++ acch + "E") (acch + "E") ("bht" ++ acch + "E") ("sab sE" ++ acch + "E") + (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y") (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y") (acch + "y") ("bht" ++ acch + "y") ("sab sE" ++ acch + "y"); + + _ => mkAdjective x x x x x x x x x + x x x x x x x x x + x x x x x x x x x + x x x x x x x x x + }; + + + + ------------------------------------------------------ + -- Determiners Opers + ------------------------------------------------------ + + IDeterminer = {s:Gender => Str ; n : Number}; + Deter = {s:Determiner => Str ; n:Number}; + makeDet : Str -> Str -> Str -> Str -> Number -> Deter = \s1,s2,s3,s4,n -> { + s = table { + DT Sg Masc => s1; + DT Sg Fem => s2; + DT Pl Masc => s3; + DT Pl Fem => s4 + }; + n = n + }; + + makeIDet : Str -> Str -> Number -> IDeterminer = \s1,s2,n -> { + s = table { + Masc => s1; + Fem => s2 + }; + n = n + }; + + ---------------------------------------------- + -- Proposition opers + --------------------------------------------- + Prepo = {s:Proposition => Str ; n:Number}; + makePrep : Str -> Str -> Str -> Str -> Number -> Prepo = \s1,s2,s3,s4,n -> { + s = table { + PP Sg Masc => s1; + PP Sg Fem => s2; + PP Pl Masc => s3; + PP Pl Fem => s4 + }; + n = n + }; + ---------------------------------------------------------- + -- Grammar part + ---------------------------------------------------------- + + param + Agr = Ag Gender Number UPerson ; +-- Agr = {g : Gender; n : Number; p : UPerson} +-- in order to access individual elements of a type i.e Agr we can use case , write a function with typ from Agr -> Gender and use case as given below +-- case np.a of { +-- Ag g _ _ => g +-- } + NPCase = NPC Case | NPObj | NPErg ; + + oper + np2pronCase : (PersPronForm => Str) -> NPCase -> Str = \ppf,npc -> case npc of { + NPC c => ppf ! PPF Sg Pers1 c; + NPObj => ppf ! PPF Sg Pers1 Dir ; + NPErg => ppf ! PPF Sg Pers1 Dir ++ "ne" + } ; + + + toNP : ( Case => Str) -> NPCase -> Str = \pn, npc -> case npc of { + NPC c => pn ! c ; + NPObj => pn ! Obl ; + NPErg => pn ! Obl ++ "ne" + } ; + detcn2NP : (Determiner => Str) -> Noun -> NPCase -> Number -> Str = \dt,cn,npc,nn -> case npc of { + NPC c => dt ! DT Sg Masc ++ cn.s ! nn ! Dir ; + NPObj => dt ! DT Sg Masc ++ cn.s ! nn ! Dir ; + NPErg => dt ! DT Sg Masc ++ cn.s ! nn ! Obl ++ "ne" + } ; + det2NP : (Determiner => Str) -> NPCase -> Str = \dt,npc -> case npc of { + NPC c => dt ! DT Sg Masc ; + NPObj => dt ! DT Sg Masc ; + NPErg => dt ! DT Sg Masc ++ "ne" + } ; + + detquant2det : (DemPronForm => Str) -> Str -> (Determiner) -> Str =\dt,n,dm -> case dm of { + DT Sg Masc => dt ! DPF Sg Dir ++ n ; + DT Sg Fem => dt ! DPF Sg Dir ++ n ; + DT Pl Masc => dt ! DPF Pl Dir ++ n ; + DT Pl Fem => dt ! DPF Pl Dir ++ n + + } ; +------------------------------------------ +-- Agreement transformations +----------------------------------------- + oper + toAgr : Number -> UPerson -> Gender -> Agr = \n,p,g -> + + Ag g n p; + + + fromAgr : Agr -> {n : Number ; p : UPerson ; g : Gender} = \a -> case a of { + Ag g n p => {n = n ; p = p ; g = g} + } ; + + conjAgr : Agr -> Agr -> Agr = \a0,b0 -> + let a = fromAgr a0 ; b = fromAgr b0 + in + toAgr + (conjNumber a.n b.n) +-- (conjUPerson a.p b.p) a.g ; + b.p a.g; + + + + giveNumber : Agr -> Number =\a -> case a of { + Ag _ n _ => n + }; + giveGender : Agr -> Gender =\a -> case a of { + Ag g _ _ => g + }; +-- giveCase : Agr -> UPerson =\a -> case a of { +-- Ag _ _ c => c +-- }; + + defaultAgr : Agr = agrP3 Masc Sg ; + agrP3 : Gender -> Number -> Agr = \g,n -> Ag g n Pers3_Distant ; + personalAgr : Agr = agrP1 Masc Sg ; + agrP1 : Gender -> Number -> Agr = \g,n -> Ag g n Pers1 ; + + param + CPolarity = + CPos + | CNeg Bool ; -- contracted or not + + oper + contrNeg : Bool -> Polarity -> CPolarity = \b,p -> case p of { + Pos => CPos ; + Neg => CNeg b + } ; + + + + -- NP : Type = {s : PersPronForm => Str ; a : Agr} ; + NP : Type = {s : NPCase => Str ; a : Agr} ; + + + param + CTense = CPresent | CPast | CFuture ; + oper + copula : CTense -> Number -> UPerson -> Gender -> Str = \t,n,p,g -> + case of { + => "hwN" ; + => "hE" ; + => "hw" ; + => "hyN" ; + => "hE" ; + => "hE" ; + => "hyN" ; + => "hw" ; + => "hw" ; + => "hyN" ; + => "hyN" ; + => "hyN" ; + => "th-a" ; + => "th-y" ; + => "th-a" ; + => "th-y" ; + => "th-a" ; + => "th-y" ; + => "th-E" ; + => "th-yN" ; + => "th-a" ; + => "th-y" ; + => "th-a" ; + => "th-y" ; + => "th-E" ; + => "th-yN" ; + => "th-E" ; + => "th-yN" ; + => "th-E" ; + => "th-yN" ; + => "th-E" ; + => "th-yN" ; + => "th-E" ; + => "th-yN" ; + => "th-E" ; + => "th-yN" ; + => "ga" ; + => "gy" ; + => "ga" ; + => "gi" ; + => "gE" ; + => "gy" ; + => "gE" ; + => "gy" ; + => "ga" ; + => "gy" ; + => "ga" ; + => "gy" ; + => "gE" ; + => "gy" ; + => "gE" ; + => "gy" ; + => "gE" ; + => "gy" ; + => "gE" ; + => "gy" ; + => "gE" ; + => "gE" ; + => "gE" ; + => "gy" + + + } ; + + param + VPHTense = + VPGenPres -- impf hum nahim "I go" + | VPImpPast -- impf Ta nahim "I went" + | VPFut -- fut na/nahim "I shall go" + | VPContPres -- stem raha hum nahim "I am going" + | VPContPast -- stem raha Ta nahim "I was going" + | VPContFut + | VPPerfPres -- perf hum na/nahim "I have gone" + | VPPerfPast -- perf Ta na/nahim "I had gone" + | VPPerfFut + | VPPerfPresCont + | VPPerfPastCont + | VPPerfFutCont + | VPSubj -- subj na "I may go" + ; + + VPHForm = + VPTense VPHTense Agr -- 9 * 12 + | VPReq + | VPImp + | VPReqFut + | VPInf + | VPStem + ; + + VType = VIntrans | VTrans | VTransPost ; + + oper + + objVType : VType -> NPCase = \vt -> case vt of { + VTrans => NPObj ; + _ => NPC Obl + } ; + + VPH : Type = { + s : Polarity => VPHForm => Order => {fin, inf,inf2, neg,quest : Str} ; +-- s : Polarity => VPHForm => {fin, inf,inf2, neg : Str} ; + obj : {s : Str ; a : Agr} ; + subj : VType ; + comp : Agr => Str; + inf : Str; + ad : Str + } ; + + VPHSlash = VPH ** {c2 : Compl} ; + + Compl : Type = {s : Str ; c : VType} ; + + + + + predV : Verb -> VPH = \verb -> { + s = \\b,vh,ord => + let na = + case b of + { Pos => []; + Neg => "na" }; + nahim = + case b of + { Pos => []; + Neg => "nhyN" }; + q = + case ord of + { ODir => []; + OQuest => "kya" }; + +-- na = if_then_Str b [] "na" ; +-- nahim = if_then_Str b [] "nhyN" ; + in + case vh of { + VPTense VPGenPres (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = verb.s ! VF Imperf p n g; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPImpPast (Ag g n p) => + {fin = [] ; inf2 =verb.s ! VF Perf p n g ; inf = []; neg = nahim ; quest = q} ; +-- {fin = copula CPast n p g ; inf = verb.s ! Pat1 (VF1 Perf Pers1 n Masc) ; neg = nahim} ; + VPTense VPFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! VF Subj p n g ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPContPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! Root ++ raha g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPContPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = verb.s ! Root ++ raha g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPContFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! Root ++ raha g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPres (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = verb.s ! Root ++ cka g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPast (Ag g n p) => + {fin = copula CPast n p g ; inf2 = verb.s !Root ++ cka g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPPerfFut (Ag g n p) => + {fin = copula CFuture n p g ; inf2 = verb.s ! Root ++ cka g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPresCont (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = verb.s ! VF Imperf p n g ++ raha g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPastCont (Ag g n p) => + {fin = copula CPast n p g ; inf2 = verb.s ! VF Imperf p n g ++ raha g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfFutCont (Ag g n p) => + {fin = copula CFuture n p g ; inf2 = verb.s ! VF Imperf p n g ++ raha g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPSubj (Ag g n p) => {fin = [] ++ verb.s ! VF Subj p n g ; inf2 = [] ; inf = "Xayd" ; neg = na; quest = []} ; + + VPImp => {fin = verb.s ! Root ; inf = [] ; inf2 = verb.s ! Inf_Obl ; neg = na ; quest = []}; + _ => {fin = verb.s ! Root ; inf = [] ; inf2 = []; neg = na ; quest = []} ---- + } ; + obj = {s = [] ; a = defaultAgr} ; +-- subj = VIntrans ; + subj = VTrans ; + inf = verb.s ! Inf; + ad = []; + comp = \\_ => [] + } ; + + predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> + predV verb ** {c2 = {s = verb.c1 ; c = VTrans} } ; + + +-- predV2 was supposed to be used with compl to get rid of ergativity...but that issue has been solved....delet it or use some where else +{- predV2 : Verb -> NP -> VPH = \verb,np -> { + s = \\b,vh => + let + na = if_then_Str b [] "na" ; + nahim = if_then_Str b [] "nhyN" ; + in + case vh of { + VPTense VPGenPres (Ag g n p) => + {fin = copula CPresent n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! VF Imperf p n g ; neg = nahim} ; + VPTense VPImpPast (Ag g n p) => + {inf = np.s ! NPObj; inf2 = verb.s ! VF Perf Pers1 Sg g ; fin =[] ; neg = nahim} ; + VPTense VPFut (Ag g n p) => {fin = copula CFuture n p g ; inf = np.s ! NPObj; inf2 = verb.s ! VF Subj p n g ; neg = nahim} ; +-- {fin = copula CPast n p g ; inf = verb.s ! Pat1 (VF1 Perf Pers1 n Masc) ; neg = nahim} ; + VPTense VPContPres (Ag g n p) => + {fin = copula CPresent n p g ; + inf = np.s ! NPObj ; inf2 = verb.s ! Root ++ raha g n ; neg = nahim} ; + VPTense VPContPast (Ag g n p) => + {fin = copula CPast n p g ; + inf = np.s ! NPObj ; inf2 = verb.s ! Root ++ raha g n ; neg = nahim} ; + VPTense VPContFut (Ag g n p) => + {fin = copula CFuture n p g ; inf =np.s ! NPObj ; inf2 = verb.s ! Root ++ raha g n ++ hw p n ; neg = nahim} ; + VPTense VPPerfPres (Ag g n p) => + {fin = copula CPresent n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! Root ++ cka g n ; neg = nahim} ; + VPTense VPPerfPast (Ag g n p) => + {fin = copula CPast n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! Root ++ cka g n ; neg = nahim} ; + VPTense VPPerfFut (Ag g n p) => + {fin = copula CFuture n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! Root ++ cka g n ++ hw p n ; neg = nahim} ; + VPTense VPPerfPresCont (Ag g n p) => + {fin = copula CPresent n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! VF Imperf Pers1 n g ++ raha g n ; neg = nahim} ; + VPTense VPPerfPastCont (Ag g n p) => + {fin = copula CPast n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! VF Imperf Pers1 n g ++ raha g n ; neg = nahim} ; + VPTense VPPerfFutCont (Ag g n p) => + {fin = copula CFuture n p g ; inf = np.s ! NPObj ; inf2 = verb.s ! VF Imperf Pers1 n g ++ raha g n ++ hw p n ; neg = nahim} ; + VPTense VPSubj (Ag _ n p) => {inf = "Xayd" ++ np.s ! NPObj ; inf2 = verb.s ! VF Subj p n Masc ; fin = [] ; neg = na}; + +-- VPInf => {fin = verb.s ! Pat1 Root1 ; inf = [] ; neg = na} ; + _ => {fin = verb.s ! Root ; inf = [] ; inf2 = []; neg = na} + }; + + + obj = {s = verb.s ! Inf ; a = np.a} ; +-- subj = VIntrans ; + subj = VTrans ; + inf = verb.s ! Inf; + ad = []; + comp = \\_ => []; + } ; +-} + raha : Gender -> Number -> Str = \g,n -> + (regAdjective "rha").s ! n ! g ! Dir ! Posit ; +-- (regAdjective "rha").s !Adj1 (AdjF1 g n Dir) ; + cka : Gender -> Number -> Str = \g,n -> + (regAdjective "cka").s ! n ! g ! Dir ! Posit ; +-- (regAdjective "cka").s !Adj1 (AdjF1 g n Dir) ; + + hw : UPerson -> Number -> Str = \pp,n -> + case of { + => "hwN"; + <_,Pl> => "hwN"; + <_,_> => "hw" + }; + + predAux : Aux -> VPH = \verb -> { + s = \\b,vh,ord => + let na = + case b of + { Pos => []; + Neg => "na" }; + nahim = + case b of + { Pos => []; + Neg => "nhyN" }; + q = + case ord of + { ODir => []; + OQuest => "kya" }; +-- na = if_then_Str b [] "na" ; +-- nahim = if_then_Str b [] "nhyN" ; + inf = verb.inf ; + --fin = verb.pres ! b ! agr ; + --finp = verb.pres ! Pos ! agr ; + part = verb.ppart ; + + in + case vh of { + VPTense VPGenPres (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = part; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPImpPast (Ag g n p) => + {fin = copula CPast n p g ; inf2 = part ; inf = []; neg = nahim ; quest = q} ; +-- {fin = copula CPast n p g ; inf = verb.s ! Pat1 (VF1 Perf Pers1 n Masc) ; neg = nahim ; quest = q} ; + VPTense VPFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPContPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part ++ raha g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPContPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ++ raha g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPContFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ raha g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPres (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = part ++ "rh" ++ cka g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPast (Ag g n p) => + {fin = copula CPast n p g ; inf2 = part ++ "rh" ++ cka g n ; inf = []; neg = nahim ; quest = q} ; + VPTense VPPerfFut (Ag g n p) => + {fin = copula CFuture n p g ; inf2 = part ++ "rh" ++ cka g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPresCont (Ag g n p) => + {fin = copula CPresent n p g ; inf2 = part ++ raha g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfPastCont (Ag g n p) => + {fin = copula CPast n p g ; inf2 = part ++ raha g n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPPerfFutCont (Ag g n p) => + {fin = copula CFuture n p g ; inf2 = part ++ raha g n ++ hw p n ; inf = [] ; neg = nahim ; quest = q} ; + VPTense VPSubj (Ag g n p) => {fin = copula CPresent n p g ++ part ; inf2 = [] ; inf = "Xayd" ; neg = nahim ; quest = []} ; + + _ => {fin = part ; inf = [] ; inf2 = []; neg = na ; quest = []} ---- + } ; + obj = {s = [] ; a = defaultAgr} ; + subj = VIntrans ; +-- subj = VTrans ; + inf = verb.inf; + ad = []; + comp = \\_ => [] + } ; + + + + Aux = { + --pres : Polarity => Agr => Str ; + --past : Polarity => Agr => Str ; --# notpresent + inf,ppart,prpart : Str + } ; + + auxBe : Aux = { + + inf = "" ; + ppart = "" ; + prpart = "" + } ; + + + Clause : Type = {s : VPHTense => Polarity => Order => Str} ; + mkClause : NP -> VPH -> Clause = \np,vp -> { + s = \\vt,b,ord => + let + subjagr : NPCase * Agr = case vt of { + VPImpPast => case vp.subj of { + VTrans => ; + VTransPost => ; + _ => + } ; + _ => + } ; + subj = subjagr.p1 ; + agr = subjagr.p2 ; + vps = vp.s ! b ! VPTense vt agr ! ord ; + in + vps.quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vps.inf ++ vps.neg ++ vps.inf2 ++ vps.fin +-- np.s ! subj ++ vps.inf ++ vp.comp ! np.a ++ vps.neg ++ vps.inf2 ++ vps.fin +-- np.s ! subj ++ vp.comp ! np.a ++ vp.obj.s ++ vps.neg ++ vps.inf ++ vps.fin + } ; + + mkSClause : Str -> Agr -> VPH -> Clause = + \subj,agr,vp -> { + s = \\t,b,o => + let + vps = vp.s ! b ! VPTense t agr ! o ; + in + vps.quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vps.inf ++ vps.neg ++ vps.inf2 ++ vps.fin + } ; + + + + + + insertObj : (Agr => Str) -> VPH -> VPH = \obj1,vp -> { + s = vp.s ; + obj = vp.obj ; + subj = vp.subj ; + inf = vp.inf; + ad = vp.ad; + comp = \\a => vp.comp ! a ++ obj1 ! a + -- s2 = \\a => vp.s2 ! a ++ obj ! a + } ; + + insertObjc : (Agr => Str) -> VPHSlash -> VPHSlash = \obj,vp -> + insertObj obj vp ** {c2 = vp.c2} ; + + infVP : Bool -> VPH -> Agr -> Str = \isAux,vp,a -> + vp.obj.s ++ vp.inf ++ + case isAux of {True => [] ; False => ""} ++ vp.comp ! a ; + + insertObject : NP -> VPHSlash -> VPH = \np,vps -> { + s = vps.s ; + obj = {s = vps.obj.s ++ np.s ! objVType vps.c2.c ++ vps.c2.s ; a = np.a} ; +-- obj = {s = vps.obj.s ++ vps.c2.s ++ np.s ! objVType vps.c2.c ; a = np.a} ; + subj = vps.c2.c ; + inf = vps.inf; + ad = vps.ad; + comp = vps.comp + } ; + + insertObjPre : (Agr => Str) -> VPHSlash -> VPH = \obj,vp -> { + s = vp.s ; + obj = vp.obj ; + inf = vp.inf ; + subj = vp.subj ; + ad = vp.ad ; + comp = \\a => obj ! a ++ vp.c2.s ++ vp.comp ! a + } ; + + insertAdV : Str -> VPH -> VPH = \ad,vp -> { + s = vp.s ; + obj = vp.obj ; + inf = vp.inf ; + subj = vp.subj; + ad = vp.ad ++ ad ; + comp = \\a => vp.comp ! a + } ; + conjThat : Str = "kh" ; + + + + +} + diff --git a/lib/src/urdu/SentenceUrd.gf b/lib/src/urdu/SentenceUrd.gf new file mode 100644 index 000000000..66f35f29e --- /dev/null +++ b/lib/src/urdu/SentenceUrd.gf @@ -0,0 +1,97 @@ +concrete SentenceUrd of Sentence = CatUrd ** open Prelude, ResUrd in { + + flags optimize=all_subs ; + + lin + + PredVP np vp = mkClause np vp ; +-- PredVP np vp = np.s!NPC Sg Pers1 Dir ++ vp.s ! Pat1 Inf1 ; + + PredSCVP sc vp = mkSClause sc.s (defaultAgr) vp ; +-- +-- ImpVP vp = { +-- s = \\pol,n => +-- let +-- agr = AgP2 (numImp n) ; +-- verb = infVP True vp agr ; +-- dont = case pol of { +-- CNeg True => "don't" ; +-- CNeg False => "do" ++ "not" ; +-- _ => [] +-- } +-- in +-- dont ++ verb +-- } ; +-- + SlashVP np vp = + mkClause np vp ** {c2 = vp.c2} ; + + AdvSlash slash adv = { + s = \\t,p,o => adv.s ++ slash.s ! t ! p ! o ; +-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ; + c2 = slash.c2 + } ; +-- + SlashPrep cl prep = cl ** {c2 = { s = prep.s ! PP Sg Masc ; c = VIntrans}} ; +-- +-- SlashVS np vs slash = +-- mkClause (np.s ! Nom) np.a +-- (insertObj (\\_ => conjThat ++ slash.s) (predV vs)) ** +-- {c2 = slash.c2} ; + + EmbedS s = {s = conjThat ++ s.s} ; + EmbedQS qs = {s = qs.s ! QIndir} ; + EmbedVP vp = {s = infVP False vp defaultAgr} ; --- agr + + UseCl temp p cl = + { s = case of { + => temp.s ++ p.s ++ cl.s ! VPGenPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPImpPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPContPres ! p.p ! ODir; + => temp.s ++ p.s ++ cl.s ! VPContPast ! p.p ! ODir + + }; + } ; + UseQCl temp p cl = { + s = \\q => case of { + => temp.s ++ p.s ++ cl.s ! VPGenPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPPerfPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPImpPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPPerfPast ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPPerfFut ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPContPres ! p.p ! q; + => temp.s ++ p.s ++ cl.s ! VPContPast ! p.p ! q + + }; + } ; + UseRCl temp p rcl = { + s = \\q => case of { + => temp.s ++ p.s ++ rcl.s ! VPGenPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPPerfPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPImpPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPPerfPast ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPPerfFut ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPContPres ! p.p ! ODir ! q; + => temp.s ++ p.s ++ rcl.s ! VPContPast ! p.p ! ODir ! q + }; + c = rcl.c + } ; +-- UseSlash t a p cl = { +-- s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! ctr p.p ! ODir ; +-- c2 = cl.c2 +-- } ; +-- + AdvS a s = {s = a.s ++ "," ++ s.s} ; +-- +-- RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ; +-- +-- oper +-- ctr = contrNeg True ; -- contracted negations + +} diff --git a/lib/src/urdu/StructuralUrd.gf b/lib/src/urdu/StructuralUrd.gf new file mode 100644 index 000000000..2b4c2ac3b --- /dev/null +++ b/lib/src/urdu/StructuralUrd.gf @@ -0,0 +1,137 @@ +concrete StructuralUrd of Structural = CatUrd ** + open MorphoUrd, ParadigmsUrd, Prelude in { + + flags optimize=all ; + + lin +-- above_Prep = ss "awpr" ; +-- after_Prep = ss "after" ; + all_Predet = ss "tmam" ; + almost_AdA, almost_AdN = ss "tqryba" ; + although_Subj = ss "agrch-" ; + always_AdV = ss "hmyXh" ; + and_Conj = sd2 [] "awr" ** {n = Pl} ; +-----b and_Conj = ss "and" ** {n = Pl} ; + because_Subj = ss "kywnkh-" ; +-- before_Prep = ss "before" ; +-- behind_Prep = ss "behind" ; +-- between_Prep = ss "between" ; + both7and_DConj = sd2 "dwnwN" "awr" ** {n = Pl} ; + but_PConj = ss "lykn" ; +-- by8agent_Prep = ss "by" ; +-- by8means_Prep = ss "by" ; +can_VV = mkV "skna" ** { isAux = True} ; +-- can8know_VV, can_VV = { +-- s = table { +-- VVF VInf => ["be able to"] ; +-- VVF VPres => "can" ; +-- VVF VPPart => ["been able to"] ; +-- VVF VPresPart => ["being able to"] ; +-- VVF VPast => "could" ; --# notpresent +-- VVPastNeg => "couldn't" ; --# notpresent +-- VVPresNeg => "can't" +-- } ; +-- isAux = True +-- } ; +-- during_Prep = ss "during" ; + either7or_DConj = sd2 "kwy ayk" "or" ** {n = Sg} ; +-- everybody_NP = regNP "everybody" Sg ; + every_Det = mkDet "hr" "hr" "hr" "hr" Sg; +-- everything_NP = regNP "everything" Sg ; + everywhere_Adv = ss "hr jgh" ; + few_Det = mkDet "cnd" "cnd" "cnd" "cnd" Pl ; + first_Ord = ss "pehla" ; --DEPRECATED +-- for_Prep = ss "for" ; +-- from_Prep = ss "from" ; +-- he_Pron = personalPronoun P3 Sg ** {a = Ag Masc Sg P3} ; + here_Adv = ss "yhaN" ; + here7to_Adv = ss ["yhaN pr"] ; + here7from_Adv = ss ["yhaN sE"] ; + how_IAdv = ss "how" ; + how8many_IDet = makeIDet "ktnE" "ktny" Pl ; + if_Subj = ss "if" ; +-- in8front_Prep = ss ["in front of"] ; + i_Pron = personalPN "myN"; +-- i_Pron = personalPronoun P1 Sg ** {a = Ag Masc Sg P1} ; +-- in_Prep = ss "meN" ; +-- it_Pron = mkNP "it" "it" "its" Sg P3 Neutr ; + less_CAdv = {s = "km" ; p = ""} ; + many_Det = mkDet "bht zyadh" "bht zyadh" "bht zyadh" "bht zyadh" Pl ; +-- more_CAdv = ss "zyadh-" ; + most_Predet = ss "zyadh tr" ; + much_Det = mkDet "bht" "bht" "bht" "bht" Sg ; +-- must_VV = { +-- s = table { +-- VVF VInf => ["have to"] ; +-- VVF VPres => "must" ; +-- VVF VPPart => ["had to"] ; +-- VVF VPresPart => ["having to"] ; +-- VVF VPast => ["had to"] ; --# notpresent +-- VVPastNeg => ["hadn't to"] ; --# notpresent +-- VVPresNeg => "mustn't" +-- } ; +-- isAux = True +-- } ; +-----b no_Phr = ss "no" ; + no_Utt = ss "nhyN" ; +-- on_Prep = ss "on" ; +------ one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED + only_Predet = ss "srf" ; +-- or_Conj = sd2 [] "or" ** {n = Sg} ; +-- otherwise_PConj = ss "othewise" ; +-- part_Prep = ss "of" ; + please_Voc = ss "mhrbani" ; +-- possess_Prep = ss "of" ; + quite_Adv = ss "khamosh" ; +-- she_Pron = mkNP "she" "her" "her" Sg P3 Fem ; + so_AdA = ss "so" ; +-- somebody_NP = regNP "somebody" Sg ; + someSg_Det = mkDet "kch-" "kch-" "kch-" "kch-" Sg ; + somePl_Det = mkDet "kch-" "kch-" "kch-" "kch-" Pl ; +-- something_NP = regNP "something" Sg ; + somewhere_Adv = ss "khin pr" ; +-- that_Quant = mkQuant "that" "those" ; + there_Adv = ss "whaN" ; + there7to_Adv = ss "whaN pr" ; +-- there7from_Adv = ss ["from there"] ; +-- therefore_PConj = ss "therefore" ; +-- they_Pron = mkNP "they" "them" "their" Pl P3 Masc ; ---- + this_Quant = demoPN "yh" "as" "an"; + that_Quant = demoPN "wh" "us" "un"; +-- this_Quant = mkQuant "this" "these" ; +-- through_Prep = ss "through" ; + too_AdA = ss "bht" ; +-- to_Prep = ss "to" ; +-- under_Prep = ss "under" ; + very_AdA = ss "bht" ; + want_VV = mkV "cahna" ** { isAux = True} ; +-- want_VV = P.mkVV (P.regV "want") ; +-- we_Pron = personalPronoun P1 Pl ** {a = Ag Masc Pl P1} ; +-- whatPl_IP = makeIntPronForm; + whatSg_IP = mkIP "kya" "kis" "kis" Sg Masc ; + whatPl_IP = mkIP "kya" "kin" "kin" Pl Masc ; +-- when_IAdv = ss "when" ; +-- when_Subj = ss "when" ; + where_IAdv = ss "khaN" ; +-- which_IQuant = {s = \\_ => "which"} ; +-- whichPl_IDet = makeDet "kwn sa" "kwon sy" "kwn sE" "kwn sy" ; +-- whichSg_IDet = makeDet "kwn sa" "kwon sy" "kwn sE" "kwn sy" ; + whoSg_IP = mkIP "kwn" "kis" "kis" Sg Masc ; + whoPl_IP = mkIP "kwn" "kn" "knhwN" Pl Masc ; +-- why_IAdv = ss "why" ; +-- without_Prep = ss "without" ; + with_Prep = makePrep "kE sath-" "kE sath-" "kE sath-" "kE sath-" Sg ; +-----b yes_Phr = ss "yes" ; + yes_Utt = ss "haN" ; +-- youSg_Pron = mkNP "you" "you" "your" Sg P2 Masc ; +-- youPl_Pron = mkNP "you" "you" "your" Pl P2 Masc ; +-- youPol_Pron = mkNP "you" "you" "your" Sg P2 Masc ; +-- +-- + oper + mkQuant : Str -> Str -> {s : Number => Str} = \x,y -> { + s = table Number [x ; y] + } ; + +} + diff --git a/lib/src/urdu/VerbUrd.gf b/lib/src/urdu/VerbUrd.gf new file mode 100644 index 000000000..dfabde90c --- /dev/null +++ b/lib/src/urdu/VerbUrd.gf @@ -0,0 +1,42 @@ +concrete VerbUrd of Verb = CatUrd ** open ResUrd in { + + flags optimize=all_subs ; + + lin + UseV v = predV v ; + SlashV2a v = predV v ** {c2 = v.c2} ; + Slash2V3 v np = + insertObjc (\\_ => np.s ! NPObj ++ v.c3 ) (predV v ** {c2 = {s = v.c2 ; c = VTrans}}) ; + Slash3V3 v np = + insertObjc (\\_ => np.s ! NPObj ++ v.c2) (predV v ** {c2 = {s = v.c3 ; c = VTrans}}) ; + + ComplVV v vp = insertObj (\\a => infVP v.isAux vp a) (predV v) ; +-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ; +-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ; + ComplVA v ap = insertObj (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v) ; + SlashV2V v vp = insertObjc (\\a => infVP v.isAux vp a) (predVc v) ; +-- SlashV2S v s = insertObjc (\\_ => conjThat ++ s.s) (predVc v) ; +-- SlashV2Q v q = insertObjc (\\_ => q.s ! QIndir) (predVc v) ; + SlashV2A v ap = insertObjc (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v ** {c2 = {s = "kw" ; c = VTrans}}) ; ---- + ComplSlash vp np = insertObject np vp ; + SlashVV vv vp = + insertObj (\\a => infVP vv.isAux vp a) (predV vv) ** + {c2 = vp.c2} ; + SlashV2VNP vv np vp = + insertObjPre (\\_ => np.s ! NPObj ) + (insertObjc (\\a => infVP vv.isAux vp a) (predVc vv)) ** + {c2 = vp.c2} ; + UseComp comp = insertObj comp.s (predAux auxBe) ; + + AdvVP vp adv = insertObj (\\_ => adv.s) vp ; + + AdVVP adv vp = insertAdV adv.s vp ; +-- ReflVP v = insertObjPre (\\a => v.c2 ++ reflPron ! a) v ; +-- PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ; + + CompAP ap ={s = \\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit } ; + CompNP np = {s = \\_ => np.s ! NPObj} ; + CompAdv a = {s = \\_ => a.s} ; + + +}