ParseHinUrd

This commit is contained in:
virk.shafqat
2012-06-18 07:50:26 +00:00
parent fe34a29f4f
commit 0deb6d8587
15 changed files with 165 additions and 135 deletions

View File

@@ -34,8 +34,9 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
VPPerfPresCont => {fin = copula CPresent n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ;
VPPerfPastCont => {fin = copula CPast n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ;
VPPerfFutCont => {fin = [] ; inf = Prelude.glue ((vp.s ! VPTense VPPres agr).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPSubj => case vp.prog of { True => {fin = (vp.s ! VPTense VPFutr agr).inf ++ hw p n ; inf = "शायद" } ;
_ => {fin = (vp.s ! VPTense VPFutr agr).inf ; inf = "शायद" } }
-- VPSubj => case vp.prog of { True => {fin = (vp.s ! VPTense VPFutr agr).inf ++ hw p n ; inf = "शायद" } ;
VPSubj => case vp.prog of { True => {fin = Prelude.glue ((vp.s ! VPTense VPFutr agr).inf ++ hw p n) (copula CFuture n p g) ; inf =[] } ;
_ => {fin = Prelude.glue (vp.s ! VPTense VPFutr agr).inf (copula CFuture n p g); inf = [] } }
};
@@ -54,8 +55,8 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
Neg => "नहीं" };
in
case vt of {
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};
VPSubj => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vp.cvp ++ na ++ vps.inf ++ vps.fin ++ vp.embComp ;
_ => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vp.cvp ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp};
} ;
@@ -79,7 +80,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
VPPerfPresCont => {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPPerfPastCont => {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPPerfFutCont => {fin = [] ; inf = Prelude.glue ((vp.s ! VPStem).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPSubj => {fin = insertSubj p (vp.s ! VPStem).inf ; inf = "शायद" }
VPSubj => {fin = Prelude.glue (insertSubj p (vp.s ! VPStem).inf) (copula CFuture n p g ); inf = [] }
};
@@ -97,8 +98,8 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
Neg => "नहीं" };
in
case t of {
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};
VPSubj => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vp.cvp ++ na ++ vps.inf ++ vps.fin ++ vp.embComp;
_ => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vp.cvp ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp};
} ;
np2pronCase ppf npc a = case npc of {
@@ -127,7 +128,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
waN = "वाँ" ; -- check with prasad
hE = "हे" ;
comma = "," ;
indfArt = "एक" ; -- check with prasad
indfArt = "" ; -- removed
kwd = "ख़ुद" ; -- check with prasad
oper

View File

@@ -346,7 +346,8 @@ oper
Inf_Fem => inf_fem
}
} ;
cvp = []
} ;
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)य") (drop 5 str) (drop 2 str); st = if_then_else Str (eq a1 "(a)य") (b ++ "(i)"++th) (if_then_else Str (eq a2 "य") (b ++ th) str)
@@ -400,54 +401,54 @@ oper
mkPastInd : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g ->
{s = let roo = root ;
a = case (last root) of {
"ा"|"ो"|"ी" => "या" ;
"े" => (tk 1 roo) + "िया" ;
_ => "ा"
"ा"|"ो"|"ी" => roo + "या" ;
"े" => (tk 1 roo) + "िया" ; --* here is the problem
_ => roo + "ा"
} ;
y = case (last root) of {
"ा"|"ो" => "यी" ;
"ी" => "" ;
"ा"|"ो" => roo + "यी" ;
"ी" => roo ;
"े" => (tk 1 roo) + "ी" ;
"िय" => (tk 2 roo) + "ी" ;
_ => "ी"
_ => roo + "ी"
} ;
e = case (last root) of {
"ा"|"ो"|"ी"|"क" => "ये" ;
"ा"|"ो"|"ी"|"क" => roo + "ये" ;
"े" => (tk 1 roo) + "ी" ;
_ => "े"
_ => roo + "े"
} ;
yN = case (last root) of {
"ा"|"ो"|"ी" => "यीँ" ;
"ा"|"ो"|"ी" => roo + "यीँ" ;
"िय" => (tk 2 roo) + "ी" ;
"े" => (tk 1 roo) + "ीँ" ;
_ => "यँ"
_ => roo + "यँ"
} ;
in
case <p,n,g> of {
<Pers1,Sg,Masc> => roo+a ;
<Pers1,Sg,Fem> => roo+y ;
<Pers1,Pl,Masc> => roo+e ;
<Pers1,Pl,Fem> => roo+yN ;
<Pers1,Sg,Masc> => a ; --*
<Pers1,Sg,Fem> => y ;
<Pers1,Pl,Masc> => e ;
<Pers1,Pl,Fem> => yN ;
<Pers2_Casual,Sg,Masc> => roo+a ;
<Pers2_Casual,Sg,Fem> => roo+y ;
<Pers2_Casual,Pl,Masc> => roo+e ;
<Pers2_Casual,Pl,Fem> => roo+yN ;
<Pers2_Casual,Sg,Masc> => a ; --*
<Pers2_Casual,Sg,Fem> => y ;
<Pers2_Casual,Pl,Masc> => e ;
<Pers2_Casual,Pl,Fem> => yN ;
<Pers2_Familiar,Sg,Masc> => roo+e ;
<Pers2_Familiar,Sg,Fem> => roo+y; --variants{roo+y ; roo+yN} ;
<Pers2_Familiar,Pl,Masc> => roo+e ;
<Pers2_Familiar,Pl,Fem> => roo+yN ;
<Pers2_Familiar,Sg,Masc> => e ;
<Pers2_Familiar,Sg,Fem> => y; --variants{roo+y ; roo+yN} ;
<Pers2_Familiar,Pl,Masc> => e ;
<Pers2_Familiar,Pl,Fem> => yN ;
<Pers2_Respect,Sg,Masc> => roo+e ;
<Pers2_Respect,Sg,Fem> => roo+yN; --variants{roo+yN ; roo+y} ;
<Pers2_Respect,Pl,Masc> => roo+e ;
<Pers2_Respect,Pl,Fem> => roo+yN ;
<_,Sg,Masc> => roo + a;
<_,Sg,Fem> => roo+y ;
<_,Pl,Masc> => roo + e;
<_,Pl,Fem> => roo+yN
<Pers2_Respect,Sg,Masc> => e ;
<Pers2_Respect,Sg,Fem> => yN; --variants{roo+yN ; roo+y} ;
<Pers2_Respect,Pl,Masc> => e ;
<Pers2_Respect,Pl,Fem> => yN ;
<_,Sg,Masc> => a; --*
<_,Sg,Fem> => y ;
<_,Pl,Masc> => e;
<_,Pl,Fem> => yN
} ;
} ;

View File

@@ -103,8 +103,8 @@ oper
-- compund verbs
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 = <>} ;
compoundV : Str -> V -> V = \s,v -> {s = \\vf => v.s ! vf ; cvp = s ; lock_V = <>} ;
compoundV : Str -> V2 -> V = \s,v -> {s = \\vf => v.s ! vf ; cvp = s ; lock_V = <>} ;
};

View File

@@ -34,8 +34,9 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
VPPerfPresCont => {fin = copula CPresent n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ;
VPPerfPastCont => {fin = copula CPast n p g ; inf = (vp.s ! VPTense VPPres agr).inf ++ raha g n } ;
VPPerfFutCont => {fin = [] ; inf = Prelude.glue ((vp.s ! VPTense VPPres agr).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPSubj => case vp.prog of { True => {fin = (vp.s ! VPTense VPFutr agr).inf ++ hw p n ; inf = "s*a:yd" } ;
_ => {fin = (vp.s ! VPTense VPFutr agr).inf ; inf = "s*a:yd" } }
-- VPSubj => case vp.prog of { True => {fin = (vp.s ! VPTense VPFutr agr).inf ++ hw p n ; inf = "s*a:yd" } ;
VPSubj => case vp.prog of { True => {fin = Prelude.glue ((vp.s ! VPTense VPFutr agr).inf ++ hw p n) (copula CFuture n p g) ; inf =[] } ;
_ => {fin = Prelude.glue (vp.s ! VPTense VPFutr agr).inf (copula CFuture n p g); inf = [] } }
};
@@ -54,8 +55,8 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
Neg => "nahi:m." };
in
case vt of {
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};
VPSubj => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vp.cvp ++ na ++ vps.inf ++ vps.fin ++ vp.embComp ;
_ => quest ++ np.s ! subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! np.a ++ vp.cvp ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp};
} ;
@@ -79,7 +80,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
VPPerfPresCont => {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPPerfPastCont => {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPPerfFutCont => {fin = [] ; inf = Prelude.glue ((vp.s ! VPStem).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPSubj => {fin = insertSubj p (vp.s ! VPStem).inf ; inf = "s*a:yd" }
VPSubj => {fin = Prelude.glue (insertSubj p (vp.s ! VPStem).inf) (copula CFuture n p g ); inf = [] }
};
@@ -97,8 +98,8 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
Neg => "nahi:m." };
in
case t of {
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};
VPSubj => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vp.cvp ++ na ++ vps.inf ++ vps.fin ++ vp.embComp;
_ => quest ++ subj ++ vp.obj.s ++ vp.ad ++ vp.comp ! agr ++ vp.cvp ++ nahim ++ vps.inf ++ vps.fin ++ vp.embComp};
} ;
np2pronCase ppf npc a = case npc of {
@@ -127,7 +128,7 @@ Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
waN = "va:n~" ; -- check with prasad
hE = "he:" ;
comma = "," ;
indfArt = "E:k" ; -- check with prasad
indfArt = "" ; -- removed
kwd = "xud" ; -- check with prasad
oper

View File

@@ -346,7 +346,8 @@ oper
Inf_Fem => inf_fem
}
} ;
cvp = []
} ;
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)
@@ -400,54 +401,54 @@ oper
mkPastInd : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g ->
{s = let roo = root ;
a = case (last root) of {
"a:"|"o:"|"i:" => "ya:" ;
"e:" => (tk 1 roo) + "iya:" ;
_ => "a:"
"a:"|"o:"|"i:" => roo + "ya:" ;
"e:" => (tk 1 roo) + "iya:" ; --* here is the problem
_ => roo + "a:"
} ;
y = case (last root) of {
"a:"|"o:" => "yi:" ;
"i:" => "" ;
"a:"|"o:" => roo + "yi:" ;
"i:" => roo ;
"e:" => (tk 1 roo) + "i:" ;
"iy" => (tk 2 roo) + "i:" ;
_ => "i:"
_ => roo + "i:"
} ;
e = case (last root) of {
"a:"|"o:"|"i:"|"k" => "ye:" ;
"a:"|"o:"|"i:"|"k" => roo + "ye:" ;
"e:" => (tk 1 roo) + "i:" ;
_ => "e:"
_ => roo + "e:"
} ;
yN = case (last root) of {
"a:"|"o:"|"i:" => "yi:n~" ;
"a:"|"o:"|"i:" => roo + "yi:n~" ;
"iy" => (tk 2 roo) + "i:" ;
"e:" => (tk 1 roo) + "i:n~" ;
_ => "yn~"
_ => roo + "yn~"
} ;
in
case <p,n,g> of {
<Pers1,Sg,Masc> => roo+a ;
<Pers1,Sg,Fem> => roo+y ;
<Pers1,Pl,Masc> => roo+e ;
<Pers1,Pl,Fem> => roo+yN ;
<Pers1,Sg,Masc> => a ; --*
<Pers1,Sg,Fem> => y ;
<Pers1,Pl,Masc> => e ;
<Pers1,Pl,Fem> => yN ;
<Pers2_Casual,Sg,Masc> => roo+a ;
<Pers2_Casual,Sg,Fem> => roo+y ;
<Pers2_Casual,Pl,Masc> => roo+e ;
<Pers2_Casual,Pl,Fem> => roo+yN ;
<Pers2_Casual,Sg,Masc> => a ; --*
<Pers2_Casual,Sg,Fem> => y ;
<Pers2_Casual,Pl,Masc> => e ;
<Pers2_Casual,Pl,Fem> => yN ;
<Pers2_Familiar,Sg,Masc> => roo+e ;
<Pers2_Familiar,Sg,Fem> => roo+y; --variants{roo+y ; roo+yN} ;
<Pers2_Familiar,Pl,Masc> => roo+e ;
<Pers2_Familiar,Pl,Fem> => roo+yN ;
<Pers2_Familiar,Sg,Masc> => e ;
<Pers2_Familiar,Sg,Fem> => y; --variants{roo+y ; roo+yN} ;
<Pers2_Familiar,Pl,Masc> => e ;
<Pers2_Familiar,Pl,Fem> => yN ;
<Pers2_Respect,Sg,Masc> => roo+e ;
<Pers2_Respect,Sg,Fem> => roo+yN; --variants{roo+yN ; roo+y} ;
<Pers2_Respect,Pl,Masc> => roo+e ;
<Pers2_Respect,Pl,Fem> => roo+yN ;
<_,Sg,Masc> => roo + a;
<_,Sg,Fem> => roo+y ;
<_,Pl,Masc> => roo + e;
<_,Pl,Fem> => roo+yN
<Pers2_Respect,Sg,Masc> => e ;
<Pers2_Respect,Sg,Fem> => yN; --variants{roo+yN ; roo+y} ;
<Pers2_Respect,Pl,Masc> => e ;
<Pers2_Respect,Pl,Fem> => yN ;
<_,Sg,Masc> => a; --*
<_,Sg,Fem> => y ;
<_,Pl,Masc> => e;
<_,Pl,Fem> => yN
} ;
} ;