ergatives with postpos complements in Hindi

This commit is contained in:
aarne
2008-05-07 08:57:07 +00:00
parent c4a3cd633e
commit 1c00d693ad
10 changed files with 82 additions and 52 deletions

1
lib/resource-1.4/deva Normal file
View File

@@ -0,0 +1 @@
runghc hindi/Deva.hs $1

View File

@@ -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

View File

@@ -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} ;

View File

@@ -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:

View File

@@ -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") ;

View File

@@ -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

View File

@@ -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 = <>} ;
} ;

View File

@@ -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 <vp.c2.c,vh> of {
<VTrans, VPTense VPPerf _> =>
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 <vp.subj,vt> of {
<VTrans,VPPerf> => NPErg ;
_ => NPC Dir
}
subjagr : NPCase * Agr = case <vp.subj,vt> of {
<VTrans,VPPerf> => <NPErg, vp.obj.a> ;
<VTransPost,VPPerf> => <NPErg, defaultAgr> ;
_ => <NPC Dir, np.a>
} ;
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
} ;

View File

@@ -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" ;

View File

@@ -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 ;
--