From 1c00d693ad6a20050b42ebd87e193b853661df13 Mon Sep 17 00:00:00 2001 From: aarne Date: Wed, 7 May 2008 08:57:07 +0000 Subject: [PATCH] ergatives with postpos complements in Hindi --- lib/resource-1.4/deva | 1 + lib/resource-1.4/hindi/AdjectiveHin.gf | 12 ++-- lib/resource-1.4/hindi/CatHin.gf | 4 +- lib/resource-1.4/hindi/Deva.hs | 7 ++- lib/resource-1.4/hindi/LexiconHin.gf | 10 ++-- lib/resource-1.4/hindi/NounHin.gf | 11 ++-- lib/resource-1.4/hindi/ParadigmsHin.gf | 2 +- lib/resource-1.4/hindi/ResHin.gf | 73 +++++++++++++++++-------- lib/resource-1.4/hindi/StructuralHin.gf | 12 ++-- lib/resource-1.4/hindi/VerbHin.gf | 2 +- 10 files changed, 82 insertions(+), 52 deletions(-) create mode 100644 lib/resource-1.4/deva diff --git a/lib/resource-1.4/deva b/lib/resource-1.4/deva new file mode 100644 index 000000000..84d03498d --- /dev/null +++ b/lib/resource-1.4/deva @@ -0,0 +1 @@ +runghc hindi/Deva.hs $1 diff --git a/lib/resource-1.4/hindi/AdjectiveHin.gf b/lib/resource-1.4/hindi/AdjectiveHin.gf index bd272a5cd..b016a2b9d 100644 --- a/lib/resource-1.4/hindi/AdjectiveHin.gf +++ b/lib/resource-1.4/hindi/AdjectiveHin.gf @@ -1,11 +1,9 @@ concrete AdjectiveHin of Adjective = CatHin ** open ResHin, Prelude in { --- --- lin --- --- PositA a = { --- s = \\_ => a.s ! AAdj Posit ; --- isPre = True --- } ; + + lin + + PositA a = a ; + -- ComparA a np = { -- s = \\_ => a.s ! AAdj Compar ++ "than" ++ np.s ! Nom ; -- isPre = False diff --git a/lib/resource-1.4/hindi/CatHin.gf b/lib/resource-1.4/hindi/CatHin.gf index fb5b7adb4..1f8046f0b 100644 --- a/lib/resource-1.4/hindi/CatHin.gf +++ b/lib/resource-1.4/hindi/CatHin.gf @@ -44,7 +44,7 @@ concrete CatHin of Cat = CommonX ** open ResHin, Prelude in { -- ---- Adjective -- --- AP = {s : Agr => Str ; isPre : Bool} ; + AP = ResHin.Adjective ; -- ---- Noun -- @@ -78,7 +78,7 @@ concrete CatHin of Cat = CommonX ** open ResHin, Prelude in { -- VV = {s : VVForm => Str ; isAux : Bool} ; -- V2V = Verb ** {c2 : Str ; isAux : Bool} ; -- - A = {s : Gender => Number => Case => Str} ; + A = ResHin.Adjective ; --- {s : Gender => Number => Case => Str} ; -- A2 = {s : AForm => Str ; c2 : Str} ; -- N = {s : Number => Case => Str ; g : Gender} ; diff --git a/lib/resource-1.4/hindi/Deva.hs b/lib/resource-1.4/hindi/Deva.hs index e5085d126..436add11b 100644 --- a/lib/resource-1.4/hindi/Deva.hs +++ b/lib/resource-1.4/hindi/Deva.hs @@ -1,7 +1,7 @@ main = interact udeva udeva :: String -> String -udeva = encodeUTF8 . str2deva +udeva = unlines . map (unwords . map (encodeUTF8 . str2deva) . words) . lines str2deva :: String -> String str2deva s = map toEnum $ case chop s of @@ -9,6 +9,8 @@ str2deva s = map toEnum $ case chop s of _ -> [] chop s = case s of + ['-'] -> [s] + '-' :cs -> let (c:r) = chop cs in ('-':c) : r -- to force initial vowel v:':':cs -> [v,':'] : chop cs v:'.':cs -> [v,'.'] : chop cs c:'a':cs -> [c] : chop cs @@ -17,6 +19,7 @@ chop s = case s of encodeInit :: String -> Int encodeInit s = case s of + '-':c -> encodeInit c "a" -> 0x0905 "a:" -> 0x0906 "i" -> 0x0907 @@ -91,6 +94,8 @@ encode s = case s of " " -> space "\n" -> fromEnum '\n' + '-':c -> encodeInit c + _ -> 0x093e --- a: diff --git a/lib/resource-1.4/hindi/LexiconHin.gf b/lib/resource-1.4/hindi/LexiconHin.gf index a3948e497..3d8152d8f 100644 --- a/lib/resource-1.4/hindi/LexiconHin.gf +++ b/lib/resource-1.4/hindi/LexiconHin.gf @@ -20,7 +20,7 @@ concrete LexiconHin of Lexicon = CatHin ** -- become_VA = mkVA (irregV "become" "became" "become") ; -- beer_N = regN "beer" ; -- beg_V2V = mkV2V (regDuplV "beg") noPrep toP ; --- big_A = duplADeg "big" ; + big_A = mkA "baRa:" ; -- bike_N = regN "bike" ; -- bird_N = regN "bird" ; -- black_A = regADeg "black" ; @@ -30,7 +30,7 @@ concrete LexiconHin of Lexicon = CatHin ** -- boot_N = regN "boot" ; -- boss_N = mkN human (regN "boss") ; boy_N = mkN "laRka:" ; --- bread_N = regN "bread" ; + bread_N = mkN "roTi:" ; -- break_V2 = dirV2 (irregV "break" "broke" "broken") ; -- broad_A = regADeg "broad" ; -- brother_N2 = mkN2 (mkN masculine (mkN "brother")) (mkPrep "of") ; @@ -84,7 +84,7 @@ concrete LexiconHin of Lexicon = CatHin ** girl_N = mkN "laRki:" ; -- glove_N = regN "glove" ; -- gold_N = regN "gold" ; --- good_A = mkADeg "good" "better" "best" "well" ; + good_A = mkA "acCa:" ; go_V = mkV "cal" ; -- green_A = regADeg "green" ; -- harbour_N = regN "harbour" ; @@ -143,7 +143,7 @@ concrete LexiconHin of Lexicon = CatHin ** -- radio_N = regN "radio" ; -- rain_V0 = mkV0 (regV "rain") ; -- read_V2 = dirV2 (irregV "read" "read" "read") ; --- red_A = duplADeg "red" ; + red_A = mkA "la:l" ; -- religion_N = regN "religion" ; -- restaurant_N = regN "restaurant" ; -- river_N = regN "river" ; @@ -332,7 +332,7 @@ concrete LexiconHin of Lexicon = CatHin ** -- cut_V2 = dirV2 IrregHin.cut_V ; -- fear_V2 = dirV2 (regV "fear") ; -- fight_V2 = dirV2 fight_V ; --- hit_V2 = dirV2 hit_V ; + hit_V2 = mkV2 (mkV "ma:r") "ko" ; -- hold_V2 = dirV2 hold_V ; -- hunt_V2 = dirV2 (regV "hunt") ; -- kill_V2 = dirV2 (regV "kill") ; diff --git a/lib/resource-1.4/hindi/NounHin.gf b/lib/resource-1.4/hindi/NounHin.gf index 164561afa..7a30d724e 100644 --- a/lib/resource-1.4/hindi/NounHin.gf +++ b/lib/resource-1.4/hindi/NounHin.gf @@ -112,11 +112,12 @@ concrete NounHin of Noun = CatHin ** open ResHin, Prelude in { -- g = f.g ; -- c2 = f.c3 -- } ; --- --- AdjCN ap cn = { --- s = \\n,c => preOrPost ap.isPre (ap.s ! agrgP3 n cn.g) (cn.s ! n ! c) ; --- g = cn.g --- } ; + + AdjCN ap cn = { + s = \\n,c => ap.s ! cn.g ! n ! c ++ cn.s ! n ! c ; + g = cn.g + } ; + -- RelCN cn rs = { -- s = \\n,c => cn.s ! n ! c ++ rs.s ! agrgP3 n cn.g ; -- g = cn.g diff --git a/lib/resource-1.4/hindi/ParadigmsHin.gf b/lib/resource-1.4/hindi/ParadigmsHin.gf index 659f01143..c35d74f92 100644 --- a/lib/resource-1.4/hindi/ParadigmsHin.gf +++ b/lib/resource-1.4/hindi/ParadigmsHin.gf @@ -56,7 +56,7 @@ oper mkV2 : V -> V2 = \v -> v ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ; mkV2 : V -> Str -> V2 - = \v,p -> v ** {c2 = {s = p ; c = VIntrans} ; lock_V2 = <>} ; + = \v,p -> v ** {c2 = {s = p ; c = VTransPost} ; lock_V2 = <>} ; } ; diff --git a/lib/resource-1.4/hindi/ResHin.gf b/lib/resource-1.4/hindi/ResHin.gf index 320c07e5a..2fb97bdb9 100644 --- a/lib/resource-1.4/hindi/ResHin.gf +++ b/lib/resource-1.4/hindi/ResHin.gf @@ -57,6 +57,7 @@ resource ResHin = ParamX ** open Prelude in { | VPerf Gender Number | VSubj Number Person | VFut Number Person Gender + | VAbs | VReq | VImp | VReqFut @@ -88,18 +89,25 @@ resource ResHin = ParamX ** open Prelude in { VFut Sg _ g => ss2 + ga Sg g ; VFut Pl P2 g => sp2 + ga Pl g ; VFut Pl _ g => sp3 + ga Pl g ; + VAbs => stem + "kar" ; --- ke VReq => r ; VImp => stem + "o" ; VReqFut => stem + "iega:" } } ; - regVerb : Str -> Verb = \cal -> mkVerb - (cal + "na:") cal - (cal + "ta:") (cal + "te") (cal + "ti:") (cal + "ti:") - (cal + "a:") (cal + "e") (cal + "i:") (cal + "i:*") - (cal + "u:~") (cal + "e") (cal + "o") (cal + "e*") - (cal + "ie") ; + regVerb : Str -> Verb = \cal -> + let caly : Str = case cal of { + _ + "a:" => cal + "y" ; + _ => cal + } + in + mkVerb + (cal + "na:") cal + (cal + "ta:") (cal + "te") (cal + "ti:") (cal + "ti:") + (caly + "a:") (caly + "e") (caly + "i:") (caly + "i:*") + (caly + "u:~") (caly + "e") (caly + "o") (caly + "e*") + (caly + "i-e") ; param CTense = CPresent | CPast | CFuture ; @@ -167,12 +175,12 @@ resource ResHin = ParamX ** open Prelude in { | VPStem ; - VType = VIntrans | VTrans ; + VType = VIntrans | VTrans | VTransPost ; oper VPH : Type = { s : Bool => VPHForm => {fin, inf, neg : Str} ; - obj : Str ; + obj : {s : Str ; a : Agr} ; subj : VType ; comp : Agr => Str } ; @@ -188,6 +196,12 @@ resource ResHin = ParamX ** open Prelude in { {fin = copula CPresent n p g ; inf = verb.s ! VImpf g n ; neg = nahim} ; VPTense VPImpPast (Ag g n p) => {fin = copula CPast n p g ; inf = verb.s ! VImpf g n ; neg = nahim} ; + VPTense VPContPres (Ag g n p) => + {fin = copula CPresent n p g ; + inf = verb.s ! VStem ++ raha g n ; neg = nahim} ; + VPTense VPContPast (Ag g n p) => + {fin = copula CPast n p g ; + inf = verb.s ! VStem ++ raha g n ; neg = nahim} ; VPTense VPPerf (Ag g n _) => {fin = verb.s ! VPerf g n ; inf = [] ; neg = nahim} ; VPTense VPPerfPres (Ag g n p) => @@ -199,26 +213,25 @@ resource ResHin = ParamX ** open Prelude in { VPInf => {fin = verb.s ! VStem ; inf = [] ; neg = na} ; _ => {fin = verb.s ! VStem ; inf = [] ; neg = na} ---- } ; - obj = [] ; + obj = {s = [] ; a = defaultAgr} ; subj = VIntrans ; comp = \\_ => [] } ; + raha : Gender -> Number -> Str = \g,n -> + (regAdjective "raha:").s ! g ! n ! Dir ; + VPHSlash = VPH ** {c2 : Compl} ; Clause : Type = {s : VPHTense => Bool => Str} ; Compl : Type = {s : Str ; c : VType} ; - insertObject : NP -> VPHSlash -> VPH = \np,vp -> { - s = \\b,vh => case of { - => - vp.s ! b ! VPTense VPPerf np.a ; -- ergative: agr to object - _ => vp.s ! b ! vh - } ; - obj = vp.obj ++ np.s ! NPC Obl ++ vp.c2.s ; - subj = vp.c2.c ; - comp = vp.comp + insertObject : NP -> VPHSlash -> VPH = \np,vps -> { + s = vps.s ; + obj = {s = vps.obj.s ++ np.s ! NPC Obl ++ vps.c2.s ; a = np.a} ; + subj = vps.c2.c ; + comp = vps.comp } ; param @@ -228,6 +241,8 @@ resource ResHin = ParamX ** open Prelude in { oper agrP3 : Gender -> Number -> Agr = \g,n -> Ag g n P3 ; + defaultAgr : Agr = agrP3 Masc Sg ; + npcase2case : NPCase -> Case = \npc -> case npc of { NPC c => c ; NPErg => Obl @@ -240,16 +255,26 @@ resource ResHin = ParamX ** open Prelude in { NP : Type = {s : NPCase => Str ; a : Agr} ; +--- param +--- PronCase = PCase Case | PObj | PPoss ; +--- oper +--- personalPronoun : Person -> Number -> {s : PronCase => Str} = \p,n -> + + + mkClause : NP -> VPH -> Clause = \np,vp -> { s = \\vt,b => let - vps = vp.s ! b ! VPTense vt np.a ; - subj = case of { - => NPErg ; - _ => NPC Dir - } + subjagr : NPCase * Agr = case of { + => ; + => ; + _ => + } ; + subj = subjagr.p1 ; + agr = subjagr.p2 ; + vps = vp.s ! b ! VPTense vt agr ; in - np.s ! subj ++ vp.obj ++ vp.comp ! np.a ++ vps.neg ++ vps.inf ++ vps.fin + np.s ! subj ++ vp.obj.s ++ vp.comp ! np.a ++ vps.neg ++ vps.inf ++ vps.fin } ; diff --git a/lib/resource-1.4/hindi/StructuralHin.gf b/lib/resource-1.4/hindi/StructuralHin.gf index 1e363e879..3f647ee1d 100644 --- a/lib/resource-1.4/hindi/StructuralHin.gf +++ b/lib/resource-1.4/hindi/StructuralHin.gf @@ -1,9 +1,9 @@ concrete StructuralHin of Structural = CatHin ** open MorphoHin, (P = ParadigmsHin), Prelude in { --- --- flags optimize=all ; --- --- lin + + flags optimize=all ; + + lin -- above_Prep = ss "above" ; -- after_Prep = ss "after" ; -- all_Predet = ss "all" ; @@ -50,8 +50,8 @@ concrete StructuralHin of Structural = CatHin ** -- how8many_IDet = mkDeterminer Pl ["how many"] ; -- if_Subj = ss "if" ; -- in8front_Prep = ss ["in front of"] ; --- i_Pron = mkNP "I" "me" "my" Sg P1 Masc ; --- in_Prep = ss "in" ; +-- i_Pron = mkNP "I" "me" "my" Sg P1 Masc ; + in_Prep = ss "me*" ; -- it_Pron = mkNP "it" "it" "its" Sg P3 Neutr ; -- less_CAdv = ss "less" ; -- many_Det = mkDeterminer Pl "many" ; diff --git a/lib/resource-1.4/hindi/VerbHin.gf b/lib/resource-1.4/hindi/VerbHin.gf index fab0f26e9..c2abf824d 100644 --- a/lib/resource-1.4/hindi/VerbHin.gf +++ b/lib/resource-1.4/hindi/VerbHin.gf @@ -32,7 +32,7 @@ concrete VerbHin of Verb = CatHin ** open ResHin in { -- (insertObjc (\\a => infVP vv.isAux vp a) (predVc vv)) ** -- {c2 = vp.c2} ; -- --- UseComp comp = insertObj comp.s (predAux auxBe) ; +-- UseComp comp = insertComplement comp.s (predAux auxBe) ; -- -- AdvVP vp adv = insertObj (\\_ => adv.s) vp ; --