diff --git a/lib/src/urdu/AdjectiveUrd.gf b/lib/src/urdu/AdjectiveUrd.gf index 75c1c4e9a..dab9c807a 100644 --- a/lib/src/urdu/AdjectiveUrd.gf +++ b/lib/src/urdu/AdjectiveUrd.gf @@ -7,29 +7,24 @@ concrete AdjectiveUrd of Adjective = CatUrd ** open ResUrd, Prelude in { 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 --- } ; + ReflA2 a = { + s = \\n,g,c,d => a.s ! n ! g ! c ! d ++ RefPron ++ "sE" ; + } ; 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 ; @@ -37,5 +32,7 @@ concrete AdjectiveUrd of Adjective = CatUrd ** open ResUrd, Prelude in { CAdvAP cadv ap np = { s = \\n,g,c,d => cadv.s ++ ap.s ! n ! g ! c ! d ++ cadv.p ++ np.s ! NPC Dir ; }; + + AdjOrd ord = { s = \\_,_,_,_ => ord.s ; }; } diff --git a/lib/src/urdu/AdverbUrd.gf b/lib/src/urdu/AdverbUrd.gf index 112edf9c3..589d264e6 100644 --- a/lib/src/urdu/AdverbUrd.gf +++ b/lib/src/urdu/AdverbUrd.gf @@ -9,7 +9,7 @@ concrete AdverbUrd of Adverb = CatUrd ** open ResUrd, Prelude in { 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) } ; + PrepNP prep np = {s = np.s ! NPObj ++ prep.s } ; AdAdv ada adv = { s = ada.s ++ adv.s} ; diff --git a/lib/src/urdu/CatUrd.gf b/lib/src/urdu/CatUrd.gf index dfbb826c0..3a03d5696 100644 --- a/lib/src/urdu/CatUrd.gf +++ b/lib/src/urdu/CatUrd.gf @@ -7,28 +7,21 @@ concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in { 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} ; + SSlash = {s : Str ; c2 : ResUrd.Compl} ; ---- 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} ; + QCl = {s : ResUrd.VPHTense => Polarity => 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} ; @@ -39,7 +32,6 @@ concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in { c : Case } ; RP = {s: Number => Case => Str ; a:RAgr}; --- RP = {s : RCase => Str ; a : RAgr} ; ---- Verb @@ -50,28 +42,24 @@ concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in { ---- Adjective AP = ResUrd.Adjective ; --- AP = {s: Number => Gender => Case = Str}; + ---- Noun CN = ResUrd.Noun ; NP = ResUrd.NP ; - Pron = {s : PersPronForm => Str; a : Agr} ; - - Det = {s:Determiner => Str ; n : Number}; - - - Predet, Ord = {s : Str} ; --- Num = Str; + Pron = {s : Case => Str ; ps : Str ; a : Agr}; + Det = ResUrd.Determiner ; + Predet = {s : Str} ; Num = {s : Str ; n : Number} ; Card = {s : Str; n : Number} ; - Quant = {s:DemPronForm => Str ; a : Agr}; --- Quant = {s : Number => Gender => Case => Str} ; + Ord = {s : Str; n : Number} ; + Quant = {s:Number => Gender => Case => Str ; a:Agr}; Art = {s : Str} ; ---- Numeral Numeral = {s : CardOrd => Str ; n : Number} ; --- Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ; + Digits = {s : CardOrd => Str ; n : Number } ; ---- Structural @@ -79,24 +67,19 @@ concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in { -----b Conj = {s : Str ; n : Number} ; -----b DConj = {s1,s2 : Str ; n : Number} ; Subj = {s : Str} ; - Prep = {s : Proposition => Str ; n : Number} ; - + Prep = ResUrd.Preposition; ---- 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} ; + N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str ; c3 : Str } ; + N3 = {s : Number => Case => Str ; g : Gender} ** {c2 : Str ; c3 : Str ; c4 : Str} ; PN = {s : Case => Str ; g : Gender} ; --- + } diff --git a/lib/src/urdu/ConjunctionUrd.gf b/lib/src/urdu/ConjunctionUrd.gf index e9832c6cb..22b13c9d9 100644 --- a/lib/src/urdu/ConjunctionUrd.gf +++ b/lib/src/urdu/ConjunctionUrd.gf @@ -17,9 +17,8 @@ concrete ConjunctionUrd of Conjunction = a = conjAgr (agrP3 Masc conj.n) ss.a } ; - ConjAP conj ss = conjunctDistrTable4 Number Gender Case Degree conj ss ; -- ** { --- isPre = ss.isPre --- } ; + ConjAP conj ss = conjunctDistrTable4 Number Gender Case Degree conj ss ; + ConjRS conj rs = conjunctDistrTable Agr conj rs ** { c = rs.c}; ---- These fun's are generated from the list cat's. @@ -28,7 +27,9 @@ concrete ConjunctionUrd of Conjunction = BaseAdv = twoSS ; ConsAdv = consrSS comma ; BaseNP x y = twoTable NPCase x y ** {a = conjAgr x.a y.a} ; + BaseRS x y = twoTable Agr x y ** {c = x.c}; ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a} ; + ConsRS xs x = consrTable Agr comma xs x ** { c = xs.c}; 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} ; @@ -37,5 +38,6 @@ concrete ConjunctionUrd of Conjunction = [Adv] = {s1,s2 : Str} ; [NP] = {s1,s2 : NPCase => Str ; a : Agr} ; [AP] = {s1,s2 : Number => Gender => Case => Degree => Str} ; + [RS] = {s1,s2 : Agr => Str ; c : Case}; } diff --git a/lib/src/urdu/IdiomUrd.gf b/lib/src/urdu/IdiomUrd.gf index 8ecf08061..b8436b2e5 100644 --- a/lib/src/urdu/IdiomUrd.gf +++ b/lib/src/urdu/IdiomUrd.gf @@ -1,6 +1,7 @@ concrete IdiomUrd of Idiom = CatUrd ** open Prelude,Predef, ResUrd in { flags optimize=all_subs ; + flags coding = utf8; lin ImpersCl vp = mkSClause " " (agrP3 Masc Sg) vp ; @@ -11,19 +12,12 @@ concrete IdiomUrd of Idiom = CatUrd ** open Prelude,Predef, ResUrd in { 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 { @@ -32,15 +26,13 @@ concrete IdiomUrd of Idiom = CatUrd ** open Prelude,Predef, ResUrd in { 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 ! VPTense VPFutr (Ag Masc Pl Pers3_Near)).inf2} ; --- ImpP3 np vp = {s = np.s!NPC Dir ++ "kw" ++ (vp.s ! VPImp ).inf2 ++ "dw"}; --- + + ProgrVP vp = insertObj (\\a => vp.obj.s ++ vp.ad ++ vp.comp ! a ++ (vp.s ! VPStem).inf ++ raha (fromAgr a).g (fromAgr a).n ) (predAux auxBe) ; + + + ImpPl1 vp = {s = "Aw" ++ infVP True vp (agrP1 Masc Pl)} ; + ImpP3 np vp = {s = np.s!NPC Dir ++ "kw" ++ (vp.s ! VPImp ).inf ++ "dw"}; + } diff --git a/lib/src/urdu/LexiconUrd.gf b/lib/src/urdu/LexiconUrd.gf index 73d0d2c6b..935ce4745 100644 --- a/lib/src/urdu/LexiconUrd.gf +++ b/lib/src/urdu/LexiconUrd.gf @@ -6,6 +6,7 @@ concrete LexiconUrd of Lexicon = CatUrd ** flags optimize=values ; + coding = utf8; lin airplane_N = mkN "jhaz" ; @@ -20,22 +21,21 @@ concrete LexiconUrd of Lexicon = CatUrd ** beautiful_A = mkA "KwbSwrt" ; become_VA = mkV "bnna"; beer_N = mkN "beer" ; - beg_V2V = mkV2V (mkV "mangna") "sE" "kh" False; + beg_V2V = mkV2V (compoundV "altja" (mkV "krna")) "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") ; + boot_N = mkN "jwta" ; + boss_N = mkN "Sahb" ; 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 + brother_N2 = mkN2 (mkN "bh-ay") (mkPrep "ka") "kE" ; --not correct brown_A = mkA "nswary" ; butter_N = mkN "mkh-n" ; buy_V2 = mkV2 (mkV "Krydna"); @@ -44,36 +44,35 @@ concrete LexiconUrd of Lexicon = CatUrd ** car_N = mkN "gaRy" ; carpet_N = mkN "tpay^y" ; cat_N = mkN "bly" ; --- ceiling_N = mkN "ceiling" ; + ceiling_N = mkN "ch-t" feminine ; chair_N = mkN "krsy" ; cheese_N = mkN "pnyr" feminine ; child_N = mkN "bch" ; --- church_N = mkN "church" ; + church_N = mkCmpdNoun "grja" (mkN "gh-r") ; city_N = mkN "Xhr" ; clean_A = mkA "Saf" ; - clever_A = mkA "hwXyar" ; - + clever_A = mkA "hwXyar" ; close_V2 = mkV2 (compoundV "bnd" do_V2); 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 + cousin_N = mkCmpdNoun "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" ; + distance_N3 = mkN3 (mkN "faSlh") (mkPrep "ka") "kE" "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") "" ; --- empty_A = mkA "Kaly" ; + empty_A = mkA "Kaly" ; enemy_N = mkN "dXmn" ; factory_N = mkN "karKanh" ; - father_N2 = mkN2 (mkN "aba") (mkPrep "ka" "ky" "kE" "ky" singular) ; + father_N2 = mkN2 (mkN "aba") (mkPrep "ka") "kE" ; fear_VS = mkV "drna"; find_V2 = mkV2 (mkV "pana") ; fish_N = mkN "mch-ly" ; @@ -90,7 +89,7 @@ concrete LexiconUrd of Lexicon = CatUrd ** good_A = mkA "ach-a" ; go_V = mkV "jana" ; green_A = mkA "sbz" ; --- harbour_N = mkN "harbour" ; + harbour_N = mkCmpdNoun "bndr" (mkN "gah") ; hate_V2 = mkV2 (compoundV "nfrt" do_V2) ; hat_N = mkN "twpy" ; -- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ; @@ -102,27 +101,28 @@ concrete LexiconUrd of Lexicon = CatUrd ** house_N = mkN "gh-r" ; important_A = mkA "ahm" ; industry_N = mkN "Snet" feminine ; --- iron_N = mkN "iron" ; + iron_N = mkN "lwha" ; king_N = mkN "badXah" ; know_V2 = mkV2 (mkV "janna") ; + know_VS = mkV "janna"; lake_N = mkN "jh-yl" feminine ; --- lamp_N = mkN "lamp" ; + lamp_N = mkN "lymp" ; learn_V2 = mkV2 (mkV "sykh-na") ; leather_N = mkN "cmRa" ; --- leave_V2 = dirV2 (irregV "leave" "left" "left") ; + leave_V2 = mkV2 (mkV "jana") ; like_V2 = mkV2 (compoundV "psnd" do_V2); listen_V2 = mkV2 (mkV "snna") ; live_V = mkV "rhna" ; ---- touch long_A = mkA "lmba" ; lose_V2 = mkV2 (compoundV "kh-w" do_V2) ; love_N = mkN "mHbt" ; - love_V2 = mkV2 (compoundV "pyar" do_V2) ; + love_V2 = mkV2 (compoundV "pyar" do_V2) "kw"; 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 + mother_N2 = mkN2 (mkN "maN") (mkPrep "ky") "kE"; -- not covered need to be discussed mountain_N = mkN "phaRy" ; music_N = mkN "mwsyqy" ; narrow_A = mkA "baryk" ; @@ -133,30 +133,30 @@ concrete LexiconUrd of Lexicon = CatUrd ** open_V2 = mkV2 (mkV "kh-wlna") ; paint_V2A = mkV2 (compoundV "rng" do_V2) ; paper_N = mkN "kaGz" ; --- paris_PN = mkPN (mkN nonhuman (mkN "Paris")) ; + paris_PN = mkPN "Pyrs" ; peace_N = mkN "amn" ; pen_N = mkN "pnsl" ; planet_N = mkN "syarh" ; --- plastic_N = mkN "plastic" ; + plastic_N = mkN "plasTk" ; play_V2 = mkV2 (mkV "kh-ylna") ; --- policeman_N = mkN masculine (mkN "policeman" "policemen") ; --- priest_N = mkN human (mkN "priest") ; + policeman_N = mkCmpdNoun "pwlys" (mkN "wala") ; + priest_N = (mkN "pyGmbr") ; -- probable_AS = mkAS (regA "probable") ; queen_N = mkN "Xhzady" ; --- radio_N = mkN "radio" ; + radio_N = mkN "ryDyw" ; rain_V0 = compoundV "barX" (mkV "hwna" ) ; read_V2 = mkV2 (mkV "pRh-na"); red_A = mkA "lal" ; religion_N = mkN "mzhb" ; --- restaurant_N = mkN "restaurant" ; + restaurant_N = mkN "hwTl" ; river_N = mkN "drya" masculine ; rock_N = mkN "cTan" ; roof_N = mkN "ch-t" masculine ; --- rubber_N = mkN "rubber" ; + rubber_N = mkN "rbR" ; run_V = mkV "dwRna" ; say_VS = mkV "khna" ; school_N = mkN "skwl" ; --- science_N = mkN "science" ; + science_N = mkN "sans" ; sea_N = mkN "smndr" ; seek_V2 = mkV2 (compoundV "tlaX" do_V2) ; see_V2 = mkV2 (mkV "dykh-na") ; @@ -176,14 +176,14 @@ concrete LexiconUrd of Lexicon = CatUrd ** sock_N = mkN "jrab" feminine ; speak_V2 = mkV2 (mkV "bwlna") ; star_N = mkN "stara" ; --- steel_N = mkN "steel" ; + steel_N = mkN "styl" ; stone_N = mkN "pth-r" ; stove_N = mkN "cwlha" ; - student_N = mkN (mkCmpdNoun (mkN "t-alb") (mkN "elm")) ; + student_N = mkCmpdNoun "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") ; + switch8off_V2 = mkV2 (mkV "clana") ; + switch8on_V2 = mkV2 (compoundV "bnd" do_V2) ; table_N = mkN "myz" feminine ; talk_V3 = mkV3 (mkV "bwlna") "sE" "kE barE meN"; teacher_N = mkN "istad" ; @@ -192,51 +192,49 @@ concrete LexiconUrd of Lexicon = CatUrd ** thick_A = mkA "mwTa" ; thin_A = mkA "ptla" ; train_N = mkN "gaRy" ; --- travel_V = mkV travel_V = (compoundV "sfr" do_V2) ; tree_N = mkN "drKt" masculine ; -- ---- trousers_N = mkN "trousers" ; ugly_A = mkA "bdSwrt" ; understand_V2 = mkV2 (mkV "smjh-na") ; --- university_N = mkN "university" ; + university_N = mkN "ywnywrsTy" ; village_N = mkN "gawN" ; wait_V2 = mkV2 (compoundV "antz-ar" do_V2) ; 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 + watch_V2 = mkV2 (mkV "dykh-na") ; + water_N = mkN "pany" ; -- 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") ; + wonder_VQ = compoundV "Heran" (mkV "hwna") ; 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" ; + now_Adv = mkAdv "ab" ; + already_Adv = mkAdv "phlE hy" ; song_N = mkN "gana" ; add_V3 = mkV3 (compoundV "aZ-afh" do_V2) "" "" ; 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" ; + + left_Ord = {s = "bayaN" ; n = singular}; + right_Ord = {s= "dayaN" ; n = singular}; + far_Adv = mkAdv "dwr" ; correct_A = mkA "Syh" ; dry_A = mkA "KXk" ; --- dull_A = mkA "nalik" ; --- full_A = regA "full" ; + dull_A = mkA "nalik" ; + full_A = mkA "mkml" ; heavy_A = mkA "bh-ary" ; near_A = mkA "qryb" ; --- rotten_A = (regA "rotten") ; + rotten_A = mkA "Krab" ; round_A = mkA "gwl" ; sharp_A = mkA "tyz" ; smooth_A = mkA "hmwar" ; @@ -246,7 +244,7 @@ concrete LexiconUrd of Lexicon = CatUrd ** animal_N = mkN "janwr" ; ashes_N = mkN "rakh-" feminine; -- FIXME: plural only? back_N = mkN "qmr" feminine ; --- bark_N = mkN "bark" ; + bark_N = mkN "bark" ; belly_N = mkN "dh-ny" ; blood_N = mkN "Kwn" ; bone_N = mkN "hDy" ; @@ -267,7 +265,7 @@ concrete LexiconUrd of Lexicon = CatUrd ** 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 + guts_N = mkN "gut" ; -- FIXME: no singular hair_N = mkN "bal" ; hand_N = mkN "hath-" ; head_N = mkN "sr" ; @@ -323,15 +321,14 @@ concrete LexiconUrd of Lexicon = CatUrd ** 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 ; + smell_V = mkV "swngna" ; + spit_V = mkV "th-wkna" ; + stand_V = compoundV "kh-RE" (mkV "hwna" ); swell_V = mkV "swjh-na" ; swim_V = mkV "tyrna" ; think_V = mkV "swcna" ; turn_V = mkV "mRna"; --- vomit_V = regV "vomit" ; --- + vomit_V = compoundV "alty" (mkV "krna") ; bite_V2 = mkV2 (mkV "katna") ; count_V2 = mkV2 (mkV "gnna") ; cut_V2 = mkV2 (mkV "katna") ; @@ -342,41 +339,31 @@ concrete LexiconUrd of Lexicon = CatUrd ** hunt_V2 = mkV2 (compoundV "Xkar" do_V2); kill_V2 = mkV2 (compoundV "mar" (mkV "Dalna" )) ; pull_V2 = mkV2 (mkV "kh-ncna"); --- push_V2 = dirV2 (regV "push") ; + push_V2 = mkV2 (mkV "dh-kylna") "kw" ; rub_V2 = mkV2 (mkV "rgRna") ; --- scratch_V2 = dirV2 (regV "scratch") ; --- split_V2 = dirV2 split_V ; + scratch_V2 = mkV2 (mkV "kh-rcna") "kw" ; + split_V2 = mkV2 (mkV "banta") "kw" ; -- 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") ; --- + wipe_V2 = mkV2 (compoundV "Saf" (mkV "krna" )); + ---- other_A = regA "other" ; --- --- grammar_N = mkN "grammar" ; + + grammar_N = mkN "grdan" ; 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" ; --- - + today_Adv = mkAdv "Aj" ; + uncertain_A = mkA ["Gyr yqyny"] ; + } diff --git a/lib/src/urdu/MorphoUrd.gf b/lib/src/urdu/MorphoUrd.gf index 6296e93ce..b1e75ad39 100644 --- a/lib/src/urdu/MorphoUrd.gf +++ b/lib/src/urdu/MorphoUrd.gf @@ -2,195 +2,460 @@ -- ----1 A Simple Urdu Resource Morphology ---- ----- Aarne Ranta, Shafqat Virk 2009 +---- Shafqat Virk, Aarne Ranta,2009 ---- ---- This resource morphology contains definitions needed in the resource ----- syntax. To build a lexicon, it is better to use $ParadigmsHin$, which +---- syntax. To build a lexicon, it is better to use $ParadigmsUrd$, 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 --- } ; --- --- +resource MorphoUrd = ResUrd ** open Prelude,Predef in { + + flags optimize=all ; + coding = utf8; + ----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} ; --- +oper + 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") (ahsan+"at") (ahsan+"w") + Fem ; +-- (variants{ahsan+"at";ahsan+"wN"}) +-- 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 ; ----2 Determiners --- --- mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s -> --- {s = s ; n = n} ; --- + IDeterminer = {s:Gender => Str ; n : Number}; + makeDet : Str -> Str -> Str -> Str -> Number -> Determiner = \s1,s2,s3,s4,n -> { + s = table { + Sg => table { + Masc => s1 ; + Fem => s2 + } ; + Pl => table { + Masc => s3 ; + Fem => s4 + } + } ; + + n = n + }; + + makeIDet : Str -> Str -> Number -> IDeterminer = \s1,s2,n -> { + s = table { + Masc => s1; + Fem => s2 + }; + n = n + }; + +-- Proposition + + makePrep : Str -> Preposition = \str -> {s = str}; + ----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 ; --- --- --- + 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 + }; + }; + +-- DemonPronForm = {s:DemPronForm => Str}; + mkDemonPronForm : (x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12:Str) -> DemPronForm = + \y1,y2,y3,y4,y5,y6,y7,y8,y9,y10,y11,y12 -> { + s = table { + Sg => table { + Masc => table { + Dir => y1 ; + Obl => y2 ; + Voc => y3 + }; + Fem => table { + Dir => y4 ; + Obl => y5 ; + Voc => y6 + } + }; + Pl => table { + Masc => table { + Dir => y7 ; + Obl => y8 ; + Voc => y9 + }; + Fem => table { + Dir => y10 ; + Obl => y11 ; + Voc => y12 + } + } + } + }; + makeDemonPronForm : Str -> Str -> Str -> DemPronForm ; + makeDemonPronForm yeh is inn = mkDemonPronForm yeh is "" yeh is "" yeh inn "" yeh inn ""; +-- makePossPronForm myra myry hmara hmary = mkDemonPronForm myra myra myra myry myry myry hmara hmara hmara hmary hmary hmary; + + 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" "" ; + + mkPron : (x1,x2,x3:Str) -> {s:Case => Str} = + \y1,y2,y3 -> { s = + table { + Dir => y1; + Obl => y2; + Voc => y3 + } + }; + + ------- PossPronForm yet to be implemented + +-- 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 + } + }; + ----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) ; --- --- +-- defined in ResUrd + ----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 [] ; --- --- + 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"; + => root + "ty"; --variants{root+"ty" ; root+"tyN"}; + => root + "tE"; + => root+"tyN"; + => root + "tE"; + => root + "ty"; --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"|"k" => "ya" ; + _ => "a" + } ; + y = case (last root) of { + "a"|"A"|"w" => "y^y" ; + _ => "y" + } ; + e = case (last root) of { + "a"|"A"|"w"|"k" => "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 ; + => roo+y; --variants{roo+y ; roo+yN} ; + => roo+e ; + => roo+yN ; + + => roo+e ; + => roo+yN; --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 ; + => roo+w; --variants{roo+w; roo+yN; roo+yE} ; + => roo+yN; --variants{roo+yN; roo+yE} ; + <_,Sg,_> => roo+e ; + <_,Pl,_> => roo+yN + }; + }; + } diff --git a/lib/src/urdu/NounUrd.gf b/lib/src/urdu/NounUrd.gf index c99ec3554..b9c84b93a 100644 --- a/lib/src/urdu/NounUrd.gf +++ b/lib/src/urdu/NounUrd.gf @@ -4,7 +4,7 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { lin DetCN det cn = { - s = \\c => detcn2NP det.s cn c det.n ; + s = \\c => detcn2NP det cn c det.n ; a = agrP3 cn.g det.n } ; @@ -23,7 +23,6 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { RelNP np rs = { s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; --- s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ; a = np.a } ; @@ -33,46 +32,40 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { } ; DetQuantOrd quant num ord = { - s = \\ c => detquant2det quant.s num.s c ++ ord.s ; +-- s = \\ c => detquant2det quant.s num.s c ++ ord.s ; + s = \\n,g => quant.s!n!g!Dir ++ num.s ++ ord.s; n = num.n } ; - DetQuant quant num = { - s = \\c => detquant2det quant.s num.s c; + DetQuant quant num = { +-- s = \\c => detquant2det quant.s num.s c; + s = \\n,g => quant.s!n!g!Dir ++ num.s; n = num.n } ; DetNP det = { - s = \\c => det2NP det.s c ; ---- case + s = \\c => det2NP det c ; ---- case a = agrP3 Masc Sg } ; --- PossPron p = {s = \\_,_,_ => p.s ! PPoss} ; --- + PossPron p = {s = \\_,_,_ => p.ps ; a = p.a} ; + 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} ; --- + + NumDigits n = {s = n.s ! NCard ; n = n.n} ; + OrdDigits n = {s = n.s ! NOrd; n = n.n} ; + 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 --- } ; + OrdNumeral numeral = {s = numeral.s ! NOrd ; n = numeral.n} ; + + AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ; + + OrdSuperl a = {s = a.s ! Sg ! Masc ! Dir ! Superl ; n = Sg} ; + + DetArtSg art cn = { s = \\c => art.s ++ toNP (cn.s ! Sg) c ; @@ -84,8 +77,8 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { a = agrP3 cn.g Pl } ; --- DefArt = {s = []} ; --- IndefArt = {s = []} ; + DefArt = {s = \\_,_,_ => [] ; a = defaultAgr} ; + IndefArt = {s = \\_,_,_ => [] ; a =defaultAgr } ; MassNP cn = {s = \\c => toNP (cn.s ! Sg) c ; a = agrP3 cn.g Sg} ; @@ -95,27 +88,29 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { Use2N3 f = { s = f.s; g = f.g ; - c2 = f.c2 + c2 = f.c2; + c3 = f.c3 } ; Use3N3 f = { s = f.s ; g = f.g ; - c2 = f.c2 + c2 = f.c2; + c3 = f.c3 } ; --- 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 + Dir => x.s ! NPC c ++ f.c2 ++ f.s ! n ! c ; + Obl => x.s ! NPC c ++ f.c3 ++ f.s ! n ! c ; + ResUrd.Voc => x.s ! NPC c ++ f.c3 ++ f.s ! n ! c }; g = f.g; }; ComplN3 f x = { - s = \\n,c => x.s ! NPObj ++ f.c3 ++ f.s ! n ! Dir ; + s = \\n,c => x.s ! NPObj ++ f.c4 ++ f.s ! n ! Dir ; g = f.g ; - c2 = f.c2 + c2 = f.c2; + c3 = f.c3 } ; AdjCN ap cn = { @@ -128,9 +123,9 @@ concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in { 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} ; --- + + SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s ; g = cn.g} ; + + ApposCN cn np = {s = \\n,c => cn.s ! n ! Dir ++ np.s ! NPC c ; g = cn.g} ; + } diff --git a/lib/src/urdu/NumeralUrd.gf b/lib/src/urdu/NumeralUrd.gf index dbd890d35..70059c3e9 100644 --- a/lib/src/urdu/NumeralUrd.gf +++ b/lib/src/urdu/NumeralUrd.gf @@ -1,6 +1,7 @@ concrete NumeralUrd of Numeral = CatUrd ** open ResUrd in { -- By Harald Hammarström --- flags coding=devanagari ; +-- Modification for Urdu Shafqat Virk + flags coding=utf8 ; --- still old Devanagari coding @@ -8,42 +9,48 @@ param DForm = unit | ten ; param DSize = sg | r2 | r3 | r4 | r5 | r6 | r7 | r8 | r9 ; param Size = sing | less100 | more100 ; -oper LinDigit = {s : DForm => Str ; size : DSize} ; +oper LinDigit = {s : DForm => Str ; size : DSize ; n : Number} ; ---lincat Numeral = { s : Str } ; -lincat Dig = { s:Str}; + +lincat Dig = { s:Str ; n : Number}; lincat Digit = LinDigit ; -lincat Sub10 = {s : DForm => Str ; size : DSize} ; -lincat Sub100 = {s : Str ; size : Size} ; -lincat Sub1000 = {s : Str ; s2 : Str ; size : Size } ; -lincat Sub1000000 = { s : Str } ; +lincat Sub10 = {s : DForm => Str ; size : DSize ; n : Number} ; +lincat Sub100 = {s : Str ; size : Size ; n : Number} ; +lincat Sub1000 = {s : Str ; s2 : Str ; size : Size ; n : Number } ; +lincat Sub1000000 = { s : Str ; n : Number } ; -lin num x0 = - {s = \\_ => x0.s ; n = Pl} ; -- the Devana:gari environment +lin num x0 = + {s = table { + NCard => x0.s ; + NOrd => x0.s ++ "waN" -- need to use mkOrd which will make irregular ordinals but it gives path error + }; + n = x0.n + } ; +oper mkOrd : Str -> Str = + \s -> case s of { + "ek" => "phla"; + "do" => "dwsra"; + "ti:n" => "tesra"; + "ca:r" => "cwth-a"; + ("cHah"|"cHa"|"cHai") => "ch-Ta"; + _ => s ++ "waN" + }; +-- {s = \\_ => x0.s ; n = x0.n} ; --- H is for aspiration (h is a sepaarate letter) --- M is anusvara --- ~ is candrabindhu --- c is is Eng. ch in e.g chop --- cH is chH --- _: is length --- T, D, R are the retroflexes - oper mkNum : Str -> Str -> DSize -> LinDigit = \do -> \bis -> \sz -> {s = table {unit => do ; ten => bis } ; - size = sz } ; + size = sz ; n = Pl} ; ---lin n1 mkNum "ek" "gya:rah" "das" ; -lin n2 = mkNum "do" "bi:s" r2 ; -lin n3 = mkNum "ti:n" "ti:s" r3 ; -lin n4 = mkNum "ca:r" "ca:li:s" r4 ; -lin n5 = mkNum "pa:~nc" "paca:s" r5 ; -lin n6 = mkNum (variants {"cHah" ; "cHa;" ; "cHai"}) "sa:TH" r6 ; -lin n7 = mkNum "sa:t" "sattar" r7; -lin n8 = mkNum "a:TH" "assi:" r8; -lin n9 = mkNum "nau" (variants {"navve" ; "nabbe" }) r9 ; +lin n2 = mkNum "dw" "bys" r2 ; +lin n3 = mkNum "tyn" "tys" r3 ; +lin n4 = mkNum "car" "calys" r4 ; +lin n5 = mkNum "panc" "pcas" r5 ; +lin n6 = mkNum "ch-" "sath-" r6 ; +lin n7 = mkNum "sat" "str" r7; +lin n8 = mkNum "Ath-" "asy" r8; +lin n9 = mkNum "nw" "nwE" r9 ; oper mkR : Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> DSize => Str = \a1 -> \a2 -> \a3 -> \a4 -> \a5 -> \a6 -> \a7 -> \a8 -> \a9 -> table { sg => a1 + "ah" ; @@ -58,60 +65,63 @@ oper mkR : Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> Str -> DSize } ; oper rows : DSize => DSize => Str = table { - sg => mkR "gya:r" "ikk" "ikat" "ekt" "ikya:v" "ik" "ik" "iky" "iky" ; - r2 => mkR "ba:r" "ba:" "bat" "bay" "ba:v" "ba:" "ba" "bay" "b" ; - r3 => mkR "ter" "te" "taiM" "taiMt" "tirp" "tir" "ti" "tir" "tir" ; - r4 => mkR "caud" "caub" "cauM" "cav" "caup" "cauM" "cau" "caur" "caur" ; - r5 => mkR "paMdr" "pacc" "paiM" "paiMt" "pacp" "paiM" "pac" "pac" "pac" ; - r6 => mkR "sol" "cHabb" "cHat" "cHiy" "cHapp" "cHiya:" "cHi" "cHiy" "cHiy" ; - r7 => mkR (variants { "sattr" ; "satr"}) "satta:v" "saiM" "saiMt" "satta:" "sar" "sat" (variants {"satt" ; "sat" }) "satt" ; - r8 => mkR "aTHa:r" "aTTHa:" "aR" "aRt" "aTTHa:v" "aR" "aTH" (variants { "aTTH" ; "aTH" }) "aTTH" ; - r9 => table {sg => "unni:s" ; r2 => "unati:s" ; r3 => "unata:li:s" ; - r4 => "unaca:s" ; r5 => "unasaTH" ; r6 => "unahattar" ; - r7 => (variants{"unna:si:" ; "unya:si:"}) ; - r8 => "nava:si:" ; r9 => "ninya:nave" } + sg => mkR "gyarh" "ikk" "ikat" "ekt" "ikyaw" "ik" "ik" "iky" "iky" ; + r2 => mkR "barh" "bay" "bat" "bay" "baw" "ba" "ba" "bay" "b" ; + r3 => mkR "tyr" "ty" "tyn" "tnt" "trp" "try" "t" "tr" "tr" ; + r4 => mkR "cwd" "cwb" "cwn" "cwa" "cww" "cwn" "cwh" "cwr" "cwr" ; + r5 => mkR "pnd" "pcy" "pyn" "pnta" "pcp" "pyn" "ph" "pc" "pc" ; + r6 => mkR "swl" "ch-b" "ch-t" "ch-y" "ch-p" "ch-ya" "ch-" "ch-y" "ch-y" ; + r7 => mkR "str" "sta" "syn" "snt" "staw" "sta" "sr" "st" "sta" ; + r8 => mkR "ath-ar" "ath-ay" "aR" "aRt" "ath-aw" "aR" "ath-" "ath-" "ath-" ; + r9 => table {sg => "anys" ; r2 => "antys" ; r3 => "antalys" ; + r4 => "ancas" ; r5 => "ansth-" ; r6 => "anhtr" ; + r7 => "anasy" ; + r8 => "ananwE" ; r9 => "nnanwE" } } ; oper ss : Str -> {s : Str} = \s -> {s = s} ; -lin pot01 = {s = table {unit => "ek" ; _ => "dummy" } ; size = sg} ; +lin pot01 = {s = table {unit => "ayk" ; _ => "dummy" } ; size = sg ; n = Sg} ; lin pot0 d = d ; -lin pot110 = {s = "das" ; size = less100} ; -lin pot111 = {s = rows ! sg ! sg ; size = less100} ; -lin pot1to19 d = {s = rows ! d.size ! sg ; size = less100} ; -lin pot0as1 n = {s = n.s ! unit ; size = table {sg => sing ; _ => less100} ! n.size } ; +lin pot110 = {s = "das" ; size = less100 ; n = Pl} ; +lin pot111 = {s = rows ! sg ! sg ; size = less100 ; n = Pl} ; +lin pot1to19 d = {s = rows ! d.size ! sg ; size = less100 ; n = d.n} ; +lin pot0as1 n = {s = n.s ! unit ; size = table {sg => sing ; _ => less100} ! n.size ; n = n.n } ; -lin pot1 d = {s = d.s ! ten ; size = less100} ; -lin pot1plus d e = {s = rows ! e.size ! d.size ; size = less100} ; +lin pot1 d = {s = d.s ! ten ; size = less100 ; n = d.n} ; +lin pot1plus d e = {s = rows ! e.size ! d.size ; size = less100 ; n = d.n} ; -lin pot1as2 n = {s = n.s ; s2 = "dummy" ; size = n.size } ; +lin pot1as2 n = {s = n.s ; s2 = "dummy" ; size = n.size ; n = n.n} ; lin pot2 d = {s = (mksau (d.s ! unit) d.size) ; - s2 = d.s ! unit ++ "la:kH" ; size = more100} ; + s2 = d.s ! unit ++ "lakh-" ; size = more100 ; n = d.n} ; lin pot2plus d e = {s = (mksau (d.s ! unit) d.size) ++ e.s ; - s2 = (d.s ! unit) ++ "la:kH" ++ (mkhazar e.s e.size) ; - size = more100} ; + s2 = (d.s ! unit) ++ "lakh-" ++ (mkhazar e.s e.size) ; + size = more100 ; n = d.n} ; -lin pot2as3 n = {s = n.s } ; +lin pot2as3 n = {s = n.s ; n = n.n} ; lin pot3 n = {s = table { sing => ekhazar ; - less100 => n.s ++ "haza:r" ; - more100 => n.s2 } ! n.size} ; + less100 => n.s ++ "hzar" ; + more100 => n.s2 } ! n.size ; n = n.n} ; lin pot3plus n m = {s = table {sing => ekhazar ; - less100 => n.s ++ "haza:r" ; - more100 => n.s2 } ! n.size ++ m.s} ; + less100 => n.s ++ "hzar" ; + more100 => n.s2 } ! n.size ++ m.s ; n = n.n} ; -lin D_0 = { s = "0"}; -lin D_1 = { s = "1"}; -lin D_2 = { s = "2"}; -lin D_3 = { s = "3"}; -lin D_4 = { s = "4"}; -lin D_5 = { s = "5"}; -lin D_6 = { s = "6"}; -lin D_7 = { s = "7"}; -lin D_8 = { s = "8"}; -lin D_9 = { s = "9"}; -oper ekhazar : Str = variants {"haza:r" ; "ek" ++ "haza:r"} ; -oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {sing => ekhazar ; _ => s ++ "haza:r"} ! sz ; -oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "sau" ; _ => s ++ "sau"} ! sz ; +lin D_0 = { s = "0" ; n = Sg}; +lin D_1 = { s = "1" ; n = Sg}; +lin D_2 = { s = "2" ; n = Pl}; +lin D_3 = { s = "3" ; n = Pl}; +lin D_4 = { s = "4" ; n = Pl}; +lin D_5 = { s = "5" ; n = Pl}; +lin D_6 = { s = "6" ; n = Pl}; +lin D_7 = { s = "7" ; n = Pl}; +lin D_8 = { s = "8" ; n = Pl}; +lin D_9 = { s = "9" ; n = Pl}; +lin IDig d = { s = \\_ => d.s ; n = d.n} ; +lin IIDig d dg = { s = \\df => dg.s ! df ++ d.s ; n = Pl }; -- need to use + rather than ++, but gives error need to discuss + +oper ekhazar : Str = variants {"hzar" ; "ayk" ++ "hzar"} ; +oper mkhazar : Str -> Size -> Str = \s -> \sz -> table {sing => ekhazar ; _ => s ++ "hzar"} ! sz ; +oper mksau : Str -> DSize -> Str = \s -> \sz -> table {sg => "sw" ; _ => s ++ "sw"} ! sz ; } diff --git a/lib/src/urdu/ParadigmsUrd.gf b/lib/src/urdu/ParadigmsUrd.gf index 6b19bf6e8..8b0c4e3dd 100644 --- a/lib/src/urdu/ParadigmsUrd.gf +++ b/lib/src/urdu/ParadigmsUrd.gf @@ -32,22 +32,25 @@ oper 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 } ; + mkN2 : N -> Prep -> Str -> N2; + mkN2 = \n,p,c -> n ** {lock_N2 = <> ; c2 = p.s ; c3 = c } ; + + mkN3 : N -> Prep -> Str -> Str-> N3 ; + mkN3 = \n,p,q,r -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q ; c4 = r} ; + +-- Compound Nouns + mkCmpdNoun : Str -> N -> N + = \s,noun -> {s =\\n,c => s ++ noun.s ! n ! c ; g = noun.g ; lock_N = <>}; + - --- 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 = <>}; +-- Proper names + mkPN : Str -> PN = \s -> let n = regNoun s in {s = n.s ! Sg ; g = n.g ; lock_PN = <>} ; + personalPN : Str -> Str -> Str -> Str -> Number -> Gender -> UPerson -> Pron = \s1,s2,s3,sp,nn,g,p -> let n = mkPron s1 s2 s3 in {s = n.s ; a = toAgr nn p g ; ps = sp ; 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 { @@ -59,8 +62,7 @@ oper --2 Verbs --- mkV = overload { - mkV : Str -> V + mkV : Str -> V = \s -> mkVerb s ** {lock_V = <>} ; mkV2 = overload { @@ -72,197 +74,49 @@ oper = \v,p -> v ** {c2 = {s = p ; c = VTrans} ; lock_V2 = <>} ; } ; - + mkV3 : V -> Str -> Str -> V3; + mkV3 v p q = v ** { c2 = p ; c3 = q ; lock_V3 = <>} ; + mkV2V : V -> Str -> Str -> Bool -> V2V ; + mkV2V v s1 s2 b = v ** {isAux = b ; c1 = s1 ; c2 = s2 ; lock_V2V = <>} ; + -- compund verbs - compoundV = overload { + compoundV = overload { compoundV : Str -> V -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; compoundV : Str -> V2 -> V = \s,v -> {s = \\vf => s ++ v.s ! vf ; lock_V = <>} ; }; - - 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 ; --- + mkAdv : Str -> Adv = \str -> {s = str ; lock_Adv = <>}; + ----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. --- + + mkPrep : Str -> Prep ; + mkPrep str = makePrep str ; + +--2 Conjunctions + mkConj : overload { + mkConj : Str -> Conj ; -- and (plural agreement) + mkConj : Str -> Number -> Conj ; -- or (agrement number given as argument) + mkConj : Str -> Str -> Conj ; -- both ... and (plural) + mkConj : Str -> Str -> Number -> Conj ; -- either ... or (agrement number given as argument) + } ; + mkConj = overload { + mkConj : Str -> Conj = \y -> mk2Conj [] y plural ; + mkConj : Str -> Number -> Conj = \y,n -> mk2Conj [] y n ; + mkConj : Str -> Str -> Conj = \x,y -> mk2Conj x y plural ; + mkConj : Str -> Str -> Number -> Conj = mk2Conj ; + } ; + + mk2Conj : Str -> Str -> Number -> Conj = \x,y,n -> + lin Conj (sd2 x y ** {n = n}) ; + -- mkV0 : V -> V0 ; -- mkVS : V -> VS ; -- mkV2S : V -> Prep -> V2S ; --- mkVV : V -> VV ; - mkV2V : V -> Str -> Str -> Bool -> V2V ; + mkVV : V -> VV = \v -> lin VV (v ** {isAux = False}); + + -- mkV2V : V -> Prep -> Prep -> V2V ; -- mkVA : V -> VA ; -- mkV2A : V -> Prep -> V2A ; @@ -297,286 +151,5 @@ oper -- 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/QuestionUrd.gf b/lib/src/urdu/QuestionUrd.gf index fb1c0d606..82979df5a 100644 --- a/lib/src/urdu/QuestionUrd.gf +++ b/lib/src/urdu/QuestionUrd.gf @@ -1,6 +1,6 @@ concrete QuestionUrd of Question = CatUrd ** open ResUrd, Prelude in { --- flags optimize=all_subs ; + coding = utf8; lin @@ -12,25 +12,30 @@ concrete QuestionUrd of Question = CatUrd ** open ResUrd, Prelude in { }; 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} ; + let cl = mkSClause ("") (Ag qp.g qp.n Pers3_Near) vp; + qp1 = qp.s ! Dir; + qp2 = qp.s ! Obl ++ "nE" in { s = \\t,p,o => case t of { - VPImpPast => cl2.s ! t ! p ! ODir; - _ => cl.s ! t ! p ! ODir + VPImpPast => qp2 ++ cl.s ! t ! p ! ODir; + _ => qp1 ++ cl.s ! t ! p ! ODir } }; --- QuestSlash ip slash = --- mkQuestion (ss (slash.c2 ++ ip.s ! Acc)) slash ; --- --- stranding in ExratHin + QuestSlash ip slash = + let ip1 = ip.s ! Dir; + ip2 = ip.s ! Obl ++ "nE" + in { + s = \\t,p,o => case t of { + VPImpPast => ip2 ++ slash.s ! t ! p ! ODir; + _ => ip1 ++ slash.s ! t ! p ! ODir + } + }; 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); + 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; @@ -38,7 +43,7 @@ concrete QuestionUrd of Question = CatUrd ** open ResUrd, Prelude in { } }; - PrepIP p ip = {s = ip.s ! Voc ++ p.s ! PP ip.n ip.g } ; + PrepIP p ip = {s = ip.s ! ResUrd. Voc ++ p.s } ; AdvIP ip adv = { s = \\c => adv.s ++ ip.s ! c ; diff --git a/lib/src/urdu/RelativeUrd.gf b/lib/src/urdu/RelativeUrd.gf index 04aeac94f..813e3c325 100644 --- a/lib/src/urdu/RelativeUrd.gf +++ b/lib/src/urdu/RelativeUrd.gf @@ -1,6 +1,7 @@ concrete RelativeUrd of Relative = CatUrd ** open ResUrd in { flags optimize=all_subs ; + coding = utf8; lin @@ -30,7 +31,7 @@ concrete RelativeUrd of Relative = CatUrd ** open ResUrd 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"). @@ -44,7 +45,7 @@ concrete RelativeUrd of Relative = CatUrd ** open ResUrd in { } ; -} FunRP p np rp = { - s = \\n,c => rp.s ! n ! c ++ np.s ! NPC c ++ p.s ! PP n (giveGender np.a) ; + s = \\n,c => rp.s ! n ! c ++ np.s ! NPC c ++ p.s ; a = RAg np.a } ; @@ -52,17 +53,15 @@ concrete RelativeUrd of Relative = CatUrd ** open ResUrd in { s = table { Sg => table { - Dir => "jw" ; - Obl => "js" ; - Voc => "js" + ResUrd.Dir => "jw" ; + ResUrd.Obl => "js" ; + ResUrd.Voc => "js" }; Pl => table { - Dir => "jw" ; - Obl => "jn" ; - Voc => "jn" + ResUrd.Dir => "jw" ; + ResUrd.Obl => "jn" ; + ResUrd.Voc => "jn" } --- RPrep Neutr => "jn" ; --- RPrep _ => "whom" }; a = RNoAg } ; diff --git a/lib/src/urdu/ResUrd.gf b/lib/src/urdu/ResUrd.gf index ec5c82e2e..416ca5387 100644 --- a/lib/src/urdu/ResUrd.gf +++ b/lib/src/urdu/ResUrd.gf @@ -8,6 +8,7 @@ resource ResUrd = ParamX ** open Prelude,Predef in { flags optimize=all ; + coding = utf8; param Case = Dir | Obl | Voc ; @@ -22,7 +23,7 @@ resource ResUrd = ParamX ** open Prelude,Predef in { Order = ODir | OQuest ; - --2 For $Relative$ +--2 For $Relative$ RAgr = RNoAg | RAg Agr ; RCase = RC Number Case ; @@ -34,633 +35,30 @@ resource ResUrd = ParamX ** open Prelude,Predef in { ----------------------------------------- -- 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 - ---------------------------------------------- - - + +------------------------------------------- +--Verbs +------------------------------------------- - VerbForm = VF VTense UPerson Number Gender + VerbForm = VF VTense UPerson Number Gender | Inf | Root | Inf_Obl | Inf_Fem; - - 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"|"k" => "ya" ; - _ => "a" - } ; - y = case (last root) of { - "a"|"A"|"w" => "y^y" ; - _ => "y" - } ; - e = case (last root) of { - "a"|"A"|"w"|"k" => "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 - }; - }; - - + Preposition = {s : Str}; + DemPronForm = {s : Number => Gender => Case => Str}; + PossPronForm = {s : Number => Gender => Case => Str}; + Determiner = {s : Number => Gender => Str ; n : Number}; -- 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 ----------------------------------------------- @@ -762,93 +160,44 @@ resource ResUrd = ParamX ** open Prelude,Predef in { - ------------------------------------------------------ - -- 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 - }; + RefPron : Str; + RefPron = "Kwd"; - ---------------------------------------------- - -- 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" + np2pronCase : (Case => Str) -> NPCase -> Str = \ppf,npc -> case npc of { + NPC c => ppf ! c; + NPObj => ppf ! Dir ; + NPErg => ppf ! Obl ++ "ne" } ; - toNP : ( Case => Str) -> NPCase -> Str = \pn, npc -> case npc of { NPC c => pn ! c ; NPObj => pn ! Dir ; 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" + detcn2NP : (Determiner) -> Noun -> NPCase -> Number -> Str = \dt,cn,npc,nn -> case npc of { + NPC c => dt.s ! Sg ! Masc ++ cn.s ! nn ! Dir ; + NPObj => dt.s ! Sg ! Masc ++ cn.s ! nn ! Dir ; + NPErg => dt.s ! 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" + det2NP : (Determiner) -> NPCase -> Str = \dt,npc -> case npc of { + NPC c => dt.s ! Sg ! Masc ; + NPObj => dt.s ! Sg ! Masc ; + NPErg => dt.s ! 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 -> - + toAgr : Number -> UPerson -> Gender -> Agr = \n,p,g -> Ag g n p; @@ -861,10 +210,7 @@ resource ResUrd = ParamX ** open Prelude,Predef in { in toAgr (conjNumber a.n b.n) --- (conjUPerson a.p b.p) a.g ; - b.p a.g; - - + b.p a.g; giveNumber : Agr -> Number =\a -> case a of { Ag _ n _ => n @@ -872,10 +218,7 @@ resource ResUrd = ParamX ** open Prelude,Predef in { 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 ; @@ -892,14 +235,11 @@ resource ResUrd = ParamX ** open Prelude,Predef in { 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 { @@ -971,8 +311,8 @@ resource ResUrd = ParamX ** open Prelude,Predef in { VPPTense = VPPres |VPPast - |VPFutr - |VPGen; + |VPFutr; + VPHTense = VPGenPres -- impf hum nahim "I go" | VPImpPast -- impf Ta nahim "I went" @@ -987,7 +327,6 @@ resource ResUrd = ParamX ** open Prelude,Predef in { | VPPerfPastCont | VPPerfFutCont | VPSubj -- subj na "I may go" --- | VPImp ; VPHForm = @@ -1009,61 +348,34 @@ resource ResUrd = ParamX ** open Prelude,Predef in { } ; VPH : Type = { --- s : Polarity => VPHForm => Order => {fin, inf,inf2, neg,quest : Str} ; - s : VPHForm => {fin, inf,inf2 : Str} ; --- s : Verb; + s : VPHForm => {fin, inf : Str} ; obj : {s : Str ; a : Agr} ; subj : VType ; comp : Agr => Str; inf : Str; - ad : Str + ad : Str; + embComp : Str ; } ; VPHSlash = VPH ** {c2 : Compl} ; Compl : Type = {s : Str ; c : VType} ; - - - predV : Verb -> VPH = \verb -> { s = \\vh => case vh of { - VPTense VPPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! VF Imperf p n g; inf = [] } ; - VPTense VPPast (Ag g n p) => {fin = [] ; inf2 =verb.s ! VF Perf p n g ; inf = []} ; - VPTense VPFutr (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! VF Subj p n g ; inf = [] } ; - VPTense VPGen (Ag g n p) => {fin = []; inf2 = verb.s ! Root ; inf = [] } ; - VPImp => {fin = verb.s ! Root ; inf = [] ; inf2 = verb.s ! Inf_Obl}; - _ => {fin = [] ; inf2 = verb.s ! Root ; inf = [] } + VPTense VPPres (Ag g n p) => {fin = copula CPresent n p g ; inf = verb.s ! VF Imperf p n g } ; + VPTense VPPast (Ag g n p) => {fin = [] ; inf =verb.s ! VF Perf p n g} ; + VPTense VPFutr (Ag g n p) => {fin = copula CFuture n p g ; inf = verb.s ! VF Subj p n g } ; + VPStem => {fin = [] ; inf = verb.s ! Root}; + _ => {fin = [] ; inf = verb.s ! Root} }; - - {- - case vh of { - VPTense VPGenPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! VF Imperf p n g; inf = [] } ; - VPTense VPImpPast (Ag g n p) => {fin = [] ; inf2 =verb.s ! VF Perf p n g ; inf = []} ; - VPTense VPFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! VF Subj p n g ; inf = [] } ; - VPTense VPContPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! Root ++ raha g n ; inf = [] } ; - VPTense VPContPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = verb.s ! Root ++ raha g n ; inf = [] } ; --- VPTense VPContFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! Root ++ raha g n ++ hw p n ; inf = [] } ; - VPTense VPPerfPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! Root ++ cka g n ; inf = [] } ; - VPTense VPPerfPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = verb.s !Root ++ cka g n ; inf = [] } ; - VPTense VPPerfFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = verb.s ! Root ++ cka g n ++ hw p n ; inf = [] } ; --- VPTense VPPerfPresCont (Ag g n p) => {fin = copula CPresent n p g ; inf2 = verb.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; --- VPTense VPPerfPastCont (Ag g n p) => {fin = copula CPast n p g ; inf2 = verb.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; --- 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 = [] } ; --- VPTense VPSubj (Ag g n p) => {fin = [] ++ verb.s ! VF Subj p n g ; inf2 = [] ; inf = "Xayd" } ; - - VPImp => {fin = verb.s ! Root ; inf = [] ; inf2 = verb.s ! Inf_Obl}; - _ => {fin = [] ; inf2 = verb.s ! Root ; inf = []} ---- - } ; - - -} --- s = verb; obj = {s = [] ; a = defaultAgr} ; subj = VTrans ; inf = verb.s ! Inf; ad = []; - comp = \\_ => [] + embComp = []; + comp = \\_ => [] } ; predVc : (Verb ** {c2,c1 : Str}) -> VPHSlash = \verb -> @@ -1072,10 +384,9 @@ resource ResUrd = ParamX ** open Prelude,Predef in { 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 { @@ -1089,52 +400,26 @@ resource ResUrd = ParamX ** open Prelude,Predef in { let inf = verb.inf ; - --fin = verb.pres ! b ! agr ; - --finp = verb.pres ! Pos ! agr ; - part = verb.ppart ; + part = verb.ppart ; in case vh of { - VPTense VPPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part; inf = [] } ; - VPTense VPPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ; inf = []} ; - VPTense VPFutr (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ hw p n ; inf = [] } ; - VPTense VPGen (Ag g n p) => {fin = [] ; inf = "rh" ; inf2 = part}; - _ => {fin = part ; inf = [] ; inf2 = []} + VPTense VPPres (Ag g n p) => {fin = copula CPresent n p g ; inf = part } ; + VPTense VPPast (Ag g n p) => {fin = copula CPast n p g ; inf = part } ; + VPTense VPFutr (Ag g n p) => {fin = copula CFuture n p g ; inf = part ++ hw p n } ; + VPStem => {fin = [] ; inf = "rh" }; + _ => {fin = part ; inf = [] } }; - -{- - VPTense VPGenPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part; inf = [] } ; - VPTense VPImpPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ; inf = []} ; - VPTense VPFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ hw p n ; inf = [] } ; - VPTense VPContPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part ++ raha g n ; inf = [] } ; - VPTense VPContPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ++ raha g n ; inf = []} ; - VPTense VPContFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ raha g n ++ hw p n ; inf = [] } ; - VPTense VPPerfPres (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part ++ "rh" ++ cka g n ; inf = [] } ; - VPTense VPPerfPast (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ++ "rh" ++ cka g n ; inf = []} ; --- VPTense VPPerfFut (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ "rh" ++ cka g n ++ hw p n ; inf = [] } ; --- VPTense VPPerfPresCont (Ag g n p) => {fin = copula CPresent n p g ; inf2 = part ++ raha g n ; inf = []} ; --- VPTense VPPerfPastCont (Ag g n p) => {fin = copula CPast n p g ; inf2 = part ++ raha g n ; inf = []} ; --- VPTense VPPerfFutCont (Ag g n p) => {fin = copula CFuture n p g ; inf2 = part ++ raha g n ++ hw p n ; inf = [] } ; --- VPTense VPSubj (Ag g n p) => {fin = copula CPresent n p g ++ part ; inf2 = [] ; inf = "Xayd" } ; - - _ => {fin = part ; inf = [] ; inf2 = []} ---- - } ; - --} --- s = {s = \\_ => " "}; obj = {s = [] ; a = defaultAgr} ; subj = VIntrans ; inf = verb.inf; ad = []; + embComp = []; comp = \\_ => [] } ; - - Aux = { - --pres : Polarity => Agr => Str ; - --past : Polarity => Agr => Str ; --# notpresent - inf,ppart,prpart : Str + inf,ppart,prpart : Str } ; auxBe : Aux = { @@ -1142,7 +427,6 @@ resource ResUrd = ParamX ** open Prelude,Predef in { ppart = "" ; prpart = "" } ; - Clause : Type = {s : VPHTense => Polarity => Order => Str} ; mkClause : NP -> VPH -> Clause = \np,vp -> { @@ -1162,44 +446,30 @@ resource ResUrd = ParamX ** open Prelude,Predef in { p = (fromAgr agr).p; g = (fromAgr agr).g; vps = case vt of { -{- VPGenPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! VF Imperf p n g; inf = [] } ; - VPImpPast => {fin = [] ; inf2 = vp.s.s ! VF Perf p n g ; inf = []} ; - VPFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! VF Subj p n g ; inf = [] } ; - VPContPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! Root ++ raha g n ; inf = [] } ; - VPContPast => {fin = copula CPast n p g ; inf2 = vp.s.s ! Root ++ raha g n ; inf = [] } ; - VPContFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! Root ++ raha g n ++ hw p n ; inf = [] } ; - VPPerfPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! Root ++ cka g n ; inf = [] } ; - VPPerfPast => {fin = copula CPast n p g ; inf2 = vp.s.s !Root ++ cka g n ; inf = [] } ; - VPPerfFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! Root ++ cka g n ++ hw p n ; inf = [] } ; - VPPerfPresCont => {fin = copula CPresent n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; - VPPerfPastCont => {fin = copula CPast n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; - VPPerfFutCont => {fin = copula CFuture n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ++ hw p n ; inf = [] } ; - VPSubj => {fin = [] ++ vp.s.s ! VF Subj p n g ; inf2 = [] ; inf = "Xayd" } ; - VPImp => {fin = vp.s.s ! Root ; inf = [] ; inf2 = vp.s.s ! Inf_Obl} - }; --} + VPGenPres => vp.s ! VPTense VPPres agr ; VPImpPast => vp.s ! VPTense VPPast agr ; VPFut => vp.s ! VPTense VPFutr agr ; - VPContPres => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = [] } ; + VPContPres => + {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPContPast => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = [] } ; + {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPContFut => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ++ hw p n ; inf = [] } ; + {fin = copula CFuture n p g ; inf = (vp.s ! VPStem).inf ++ raha g n ++ hw p n} ; VPPerfPres => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ; inf = [] } ; + {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ; VPPerfPast => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ; inf = [] } ; + {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ; VPPerfFut => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ++ hw p n ; inf = [] } ; + {fin = copula CFuture n p g ; inf = (vp.s ! VPStem).inf ++ cka g n ++ hw p n } ; VPPerfPresCont => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPPres agr).inf2 ++ raha g n ; inf = [] } ; + {fin = copula CPresent n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ; VPPerfPastCont => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPPres agr).inf2 ++ raha g n ; inf = [] } ; + {fin = copula CPast n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ; VPPerfFutCont => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPPres agr).inf2 ++ raha g n ++ hw p n ; inf = [] } ; - VPSubj => vp.s ! VPTense VPGen agr + {fin = copula CFuture n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n ++ hw p n } ; + VPSubj => {fin = insertSubj p (vp.s ! VPStem).inf ; inf = "xayd" } + }; @@ -1217,8 +487,8 @@ resource ResUrd = ParamX ** open Prelude,Predef in { Neg => "nhyN" }; in case vt of { - VPSubj => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vps.inf ++ na ++ vps.inf2 ++ vps.fin; - _ => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vps.inf ++ nahim ++ vps.inf2 ++ vps.fin}; + VPSubj => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ na ++ vps.inf ++ vps.fin ++ vp.embComp ; + _ => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp}; } ; @@ -1230,45 +500,29 @@ resource ResUrd = ParamX ** open Prelude,Predef in { p = (fromAgr agr).p; g = (fromAgr agr).g; vps = case t of { -{- VPGenPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! VF Imperf p n g; inf = [] } ; - VPImpPast => {fin = [] ; inf2 = vp.s.s ! VF Perf p n g ; inf = []} ; - VPFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! VF Subj p n g ; inf = [] } ; - VPContPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! Root ++ raha g n ; inf = [] } ; - VPContPast => {fin = copula CPast n p g ; inf2 = vp.s.s ! Root ++ raha g n ; inf = [] } ; - VPContFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! Root ++ raha g n ++ hw p n ; inf = [] } ; - VPPerfPres => {fin = copula CPresent n p g ; inf2 = vp.s.s ! Root ++ cka g n ; inf = [] } ; - VPPerfPast => {fin = copula CPast n p g ; inf2 = vp.s.s !Root ++ cka g n ; inf = [] } ; - VPPerfFut => {fin = copula CFuture n p g ; inf2 = vp.s.s ! Root ++ cka g n ++ hw p n ; inf = [] } ; - VPPerfPresCont => {fin = copula CPresent n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; - VPPerfPastCont => {fin = copula CPast n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ; inf = [] } ; - VPPerfFutCont => {fin = copula CFuture n p g ; inf2 = vp.s.s ! VF Imperf p n g ++ raha g n ++ hw p n ; inf = [] } ; - VPSubj => {fin = [] ++ vp.s.s ! VF Subj p n g ; inf2 = [] ; inf = "Xayd" } ; - VPImp => {fin = vp.s.s ! Root ; inf = [] ; inf2 = vp.s.s ! Inf_Obl} - }; --} - - VPGenPres => vp.s ! VPTense VPPres agr ; + VPGenPres => vp.s ! VPTense VPPres agr ; VPImpPast => vp.s ! VPTense VPPast agr ; VPFut => vp.s ! VPTense VPFutr agr ; VPContPres => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = [] } ; + {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPContPast => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = []} ; + {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPContFut => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ++ hw p n ; inf = [] } ; + {fin = copula CFuture n p g ; inf = (vp.s ! VPStem).inf ++ raha g n ++ hw p n } ; VPPerfPres => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ; inf = [] } ; + {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ; VPPerfPast => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ; inf = []} ; + {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ; VPPerfFut => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ cka g n ++ hw p n ; inf = [] } ; + {fin = copula CFuture n p g ; inf = (vp.s ! VPStem).inf ++ cka g n ++ hw p n } ; VPPerfPresCont => - {fin = copula CPresent n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = []} ; + {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPPerfPastCont => - {fin = copula CPast n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ; inf = []} ; + {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ; VPPerfFutCont => - {fin = copula CFuture n p g ; inf2 = (vp.s ! VPTense VPGen agr).inf2 ++ raha g n ++ hw p n ; inf = [] } ; - VPSubj => vp.s ! VPTense VPGen agr + {fin = copula CFuture n p g ; inf = (vp.s ! VPStem).inf ++ raha g n ++ hw p n } ; + VPSubj => {fin = insertSubj p (vp.s ! VPStem).inf ; inf = "xayd" } + }; quest = @@ -1285,38 +539,60 @@ resource ResUrd = ParamX ** open Prelude,Predef in { Neg => "nhyN" }; in case t of { - VPSubj => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vps.inf ++ na ++ vps.inf2 ++ vps.fin; - _ => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vps.inf ++ nahim ++ vps.inf2 ++ vps.fin}; + VPSubj => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ na ++ vps.inf ++ vps.fin ++ vp.embComp; + _ => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp}; } ; - - - - - + + insertSubj : UPerson -> Str -> Str = \p,s -> + case p of { Pers1 => s ++ "wN" ; _ => s ++ "E"}; + insertObj : (Agr => Str) -> VPH -> VPH = \obj1,vp -> { s = vp.s ; obj = vp.obj ; subj = vp.subj ; inf = vp.inf; ad = vp.ad; + embComp = vp.embComp; comp = \\a => vp.comp ! a ++ obj1 ! a - -- s2 = \\a => vp.s2 ! a ++ obj ! a + } ; + insertVV : Str -> VPH -> VPH = \obj1,vp -> { + s = vp.s ; + obj = vp.obj ; + subj = vp.subj ; + inf = vp.inf; + ad = vp.ad; + embComp = vp.embComp; + comp = \\a => vp.comp ! a ++ obj1 + } ; + + insertObj2 : (Str) -> VPH -> VPH = \obj1,vp -> { + s = vp.s; + obj = vp.obj ; + subj = vp.subj ; + inf = vp.inf; + ad = vp.ad; + embComp = vp.embComp ++ obj1; + comp = vp.comp + } ; insertObjc : (Agr => Str) -> VPHSlash -> VPHSlash = \obj,vp -> insertObj obj vp ** {c2 = vp.c2} ; + insertObjc2 : Str -> VPHSlash -> VPHSlash = \obj,vp -> + insertObj2 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 ; + vp.obj.s ++ vp.inf ++ vp.comp ! a ; + infVV : Bool -> VPH -> Str = \isAux,vp -> + case isAux of {False => vp.inf ; True => (vp.s ! VPImp).fin }; 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; + embComp = vps.embComp; comp = vps.comp } ; @@ -1326,6 +602,7 @@ resource ResUrd = ParamX ** open Prelude,Predef in { inf = vp.inf ; subj = vp.subj ; ad = vp.ad ; + embComp = vp.embComp; comp = \\a => obj ! a ++ vp.c2.s ++ vp.comp ! a } ; @@ -1335,7 +612,8 @@ resource ResUrd = ParamX ** open Prelude,Predef in { inf = vp.inf ; subj = vp.subj; ad = vp.ad ++ ad ; - comp = \\a => vp.comp ! a + embComp = vp.embComp; + comp = vp.comp } ; conjThat : Str = "kh" ; diff --git a/lib/src/urdu/SentenceUrd.gf b/lib/src/urdu/SentenceUrd.gf index 66f35f29e..33c0445ff 100644 --- a/lib/src/urdu/SentenceUrd.gf +++ b/lib/src/urdu/SentenceUrd.gf @@ -1,43 +1,42 @@ concrete SentenceUrd of Sentence = CatUrd ** open Prelude, ResUrd in { flags optimize=all_subs ; + coding = utf8; 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 --- } ; --- + + ImpVP vp = { + s = \\pol,n => + let + agr = Ag Masc (numImp n) Pers2_Casual ; + verb = infVP True vp agr ; + dont = case pol of { + CNeg True => "mt" ; + CNeg False => "nh" ; + _ => [] + } + 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} ; + + SlashPrep cl prep = cl ** {c2 = { s = prep.s ; c = VIntrans}} ; + + SlashVS np vs slash = + mkClause np + (insertObj2 (conjThat ++ slash.s) (predV vs)) ** + {c2 = slash.c2} ; EmbedS s = {s = conjThat ++ s.s} ; EmbedQS qs = {s = qs.s ! QIndir} ; @@ -82,16 +81,23 @@ concrete SentenceUrd of Sentence = CatUrd ** open Prelude, ResUrd in { }; 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 + UseSlash temp p clslash = { + s = case of { + => temp.s ++ p.s ++ clslash.s ! VPGenPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPPerfPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPImpPast ! p.p ! ODir ; + => temp.s ++ p.s ++ clslash.s ! VPPerfPast ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPPerfFut ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPContPres ! p.p ! ODir; + => temp.s ++ p.s ++ clslash.s ! VPContPast ! p.p ! ODir + }; + c2 = clslash.c2 + } ; + + AdvS a s = {s = a.s ++ s.s} ; + + RelS s r = {s = s.s ++ r.s ! agrP3 Masc Sg} ; + SSubjS s sj s = { s = s.s ++ sj.s ++ s.s}; } diff --git a/lib/src/urdu/StructuralUrd.gf b/lib/src/urdu/StructuralUrd.gf index a15831972..16771612f 100644 --- a/lib/src/urdu/StructuralUrd.gf +++ b/lib/src/urdu/StructuralUrd.gf @@ -1,63 +1,50 @@ concrete StructuralUrd of Structural = CatUrd ** - open MorphoUrd, ParadigmsUrd, Prelude in { + open MorphoUrd, ParadigmsUrd, Prelude, NounUrd in { flags optimize=all ; + coding = utf8; lin --- above_Prep = ss "awpr" ; --- after_Prep = ss "after" ; + above_Prep = ss "awpr" ; + after_Prep = ss "kE bed" ; 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" ; + before_Prep = ss "phlE" ; + behind_Prep = ss "pych-E" ; + between_Prep = ss "drmyaN" ; 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" ; + by8agent_Prep = ss "" ; + by8means_Prep = ss "" ; + can8know_VV,can_VV = mkV "skna" ** { isAux = True} ; + during_Prep = ss ["kE drmyaN"] ; 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 ; + everybody_NP = MassNP (UseN (ParadigmsUrd.mkN "hr kwy" "hr kwy" "hr kwy" "hr kwy" "hr kwy" "hr kwy" Masc )); -- not a good way coz need to include NounUrd + every_Det = mkDet "hr" "hr" "hr" "hr" Sg; + everything_NP = MassNP (UseN (ParadigmsUrd.mkN "hr cyz" "hr cyz" "hr cyzw" "sb cyzyN" "sb cyzwN" "sb cyzw" Masc )); 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} ; + first_Ord = {s = "pehla" ; n = Sg} ; --DEPRECATED + for_Prep = ss "kylyE" ; + from_Prep = ss "sE" ; + he_Pron = personalPN "wh" "as" "" "as ka" Sg Masc Pers3_Distant ; 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 ; + if_Subj = ss "agr" ; + in8front_Prep = ss ["kE samnE"] ; + i_Pron = personalPN "myN" "mjh-" "" "myra" Sg Masc Pers1; + in_Prep = ss "meN" ; + it_Pron = personalPN "yh" "yh" "yh" "as ka" Sg Masc Pers3_Near; less_CAdv = {s = "km" ; p = ""} ; many_Det = mkDet "bht zyadh" "bht zyadh" "bht zyadh" "bht zyadh" Pl ; --- more_CAdv = ss "zyadh-" ; + more_CAdv = {s = "zyadh-" ; p = "" } ; most_Predet = ss "zyadh tr" ; much_Det = mkDet "bht" "bht" "bht" "bht" Sg ; -- must_VV = { @@ -74,64 +61,69 @@ can_VV = mkV "skna" ** { isAux = True} ; -- } ; -----b no_Phr = ss "no" ; no_Utt = ss "nhyN" ; --- on_Prep = ss "on" ; ------- one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED + on_Prep = ss "pr" ; +-- one_Quant = demoPN "ayk" "ayk" "ayk" ; -- DEPRECATED only_Predet = ss "srf" ; --- or_Conj = sd2 [] "or" ** {n = Sg} ; --- otherwise_PConj = ss "othewise" ; --- part_Prep = ss "of" ; + or_Conj = sd2 [] "ya" ** {n = Sg} ; + otherwise_PConj = ss "ya ph-r" ; + part_Prep = ss "" ; please_Voc = ss "mhrbani" ; --- possess_Prep = ss "of" ; + possess_Prep = ss "ka" ; quite_Adv = ss "khamosh" ; --- she_Pron = mkNP "she" "her" "her" Sg P3 Fem ; + she_Pron = personalPN "wh" "as" "wh" "as ky" Sg Fem Pers3_Distant ; so_AdA = ss "so" ; --- somebody_NP = regNP "somebody" Sg ; + somebody_NP = MassNP (UseN (ParadigmsUrd.mkN "kwy" "kwy" "kwy" "kwy" "kwy" "kwy" Masc )); someSg_Det = mkDet "kch-" "kch-" "kch-" "kch-" Sg ; somePl_Det = mkDet "kch-" "kch-" "kch-" "kch-" Pl ; --- something_NP = regNP "something" Sg ; + something_NP = MassNP (UseN (ParadigmsUrd.mkN "kwy cyz" "kwy cyz" "kwy cyz" "kh- cyzyN" "kh- cyzwN" "kh- cyzw" Masc )); somewhere_Adv = ss "khin pr" ; --- that_Quant = mkQuant "that" "those" ; + that_Quant = demoPN "wh" "as" "an" ; + that_Subj = ss "kh"; 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 ; ---- + there7from_Adv = ss ["whaN sE"] ; + therefore_PConj = ss "as lyE" ; + they_Pron = personalPN "wh" "wh" "wh" "an ka" Pl Masc Pers3_Distant ; ---- this_Quant = demoPN "yh" "as" "an"; - that_Quant = demoPN "wh" "us" "un"; --- this_Quant = mkQuant "this" "these" ; --- through_Prep = ss "through" ; + through_Prep = ss ["myN sE"] ; too_AdA = ss "bht" ; --- to_Prep = ss "to" ; --- under_Prep = ss "under" ; + to_Prep = ss "kw" ; + under_Prep = ss "nycE" ; 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; + want_VV = mkV "cahna" ** { isAux = False} ; + we_Pron = personalPN "hm" "hm" "hm" "hmara" Pl Masc Pers1 ; whatSg_IP = mkIP "kya" "kis" "kis" Sg Masc ; whatPl_IP = mkIP "kya" "kin" "kin" Pl Masc ; --- when_IAdv = ss "when" ; --- when_Subj = ss "when" ; + when_IAdv = ss "kb" ; + when_Subj = ss "kb" ; where_IAdv = ss "khaN" ; which_IQuant = {s = \\_ => "kwn sy"} ; -- whichPl_IDet = makeDet "kwn sa" "kwn sy" "kwn sE" "kwn sy" ; -- whichSg_IDet = makeDet "kwn sa" "kwn 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" ; + why_IAdv = ss "kywN" ; + without_Prep = ss ["kE bGyr"] ; + with_Prep = ss ["kE sath-"] ; +-- yes_Phr = ss "haN" ; 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] - } ; + youSg_Pron = personalPN "tm" "tm" "tm" "tmh-ara" Sg Masc Pers2_Casual ; + youPl_Pron = personalPN "tm" "tm" "tm" "tmh-ara" Pl Masc Pers2_Casual ; + youPol_Pron = personalPN "Ap" "AP" "AP" "Ap ka" Sg Masc Pers2_Respect ; + no_Quant = demoPN " kwy nhyN" "kwy nhyN" "kwy nhyN" ; + not_Predet = {s="nhyN"} ; + if_then_Conj = sd2 "agr" "tw" ** {n = Sg} ; + at_least_AdN = ss ["km az km"] ; + at_most_AdN = ss ["zyadh sE zyadh"]; + nothing_NP = MassNP (UseN (ParadigmsUrd.mkN "kwy cyz nhyN" "kwy cyz nhyN" "kwy cyz nhyN" "kwy cyz nhyN" "kwy cyz nhyN" "kwy cyz nhyN" Masc )); + except_Prep = ss "swaE" ; + nobody_NP = MassNP (UseN (ParadigmsUrd.mkN "kwy nhyN" "kwy nhyN" "kwy nhyN" "kwy nhyN" "kwy nhyN" "kwy nhyN" Masc )); + + as_CAdv = {s = "etna" ; p = "jtna"} ; + + have_V2 = mkV2 (mkV "rakh-na") "" ; + + language_title_Utt = ss "ardw" ; } diff --git a/lib/src/urdu/VerbUrd.gf b/lib/src/urdu/VerbUrd.gf index d650d095e..b052c6f42 100644 --- a/lib/src/urdu/VerbUrd.gf +++ b/lib/src/urdu/VerbUrd.gf @@ -4,20 +4,19 @@ concrete VerbUrd of Verb = CatUrd ** open ResUrd in { lin UseV v = predV v ; - SlashV2a v = predV v ** {c2 = v.c2} ; + SlashV2a v = predV v ** {c2 = {s = v.c2.s ; c = VIntrans}} ; Slash2V3 v np = insertObjc (\\_ => np.s ! NPObj ++ v.c3 ) (predV v ** {c2 = {s = v.c2 ; c = VTrans}}) ; Slash3V3 v np = insertObjc (\\_ => np.s ! NPC Obl ++ 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) ; + ComplVV v vp = insertVV (infVV v.isAux vp) (predV v) ; + ComplVS v s = insertObj2 (conjThat ++ s.s) (predV v) ; + ComplVQ v q = insertObj2 (conjThat ++ 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) (predV v ** {c2 = {s = "" ; c = VTrans}}) ; - SlashV2Q v q = insertObjc (\\_ => conjThat ++ q.s ! QIndir) (predV v ** {c2 = {s = "" ; c = VTrans}}) ; - SlashV2A v ap = insertObjc (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v ** {c2 = {s = "kw" ; c = VTrans}}) ; ---- + SlashV2V v vp = insertVV ((vp.s!VPImp).inf++"ky") (predV v) **{c2 = {s = "sE" ; c = VIntrans}} ; + SlashV2S v s = insertObjc2 (conjThat ++ s.s) (predV v ** {c2 = {s = "kw" ; c = VIntrans}}) ; + SlashV2Q v q = insertObjc2 (conjThat ++ q.s ! QIndir) (predV v ** {c2 = {s = "sE" ; c = VIntrans}}) ; + SlashV2A v ap = insertObjc (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v ** {c2 = {s = "kw" ; c = VIntrans}}) ; ---- ComplSlash vp np = insertObject np vp ; SlashVV vv vp = insertObj (\\a => infVP vv.isAux vp a) (predV vv) ** @@ -31,9 +30,8 @@ concrete VerbUrd of Verb = CatUrd ** open ResUrd in { 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) ; - + ReflVP v = insertObjPre (\\_ => RefPron) v ; + PassV2 v = predV v ; -- need to be fixed CompAP ap ={s = \\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit } ; CompNP np = {s = \\_ => np.s ! NPObj} ; CompAdv a = {s = \\_ => a.s} ;