factorUrdandAddDictGer

This commit is contained in:
virk.shafqat
2013-03-18 14:42:10 +00:00
parent c823b7fd91
commit 4fd9c860f3
7 changed files with 337 additions and 470 deletions

View File

@@ -1,10 +1,10 @@
interface DiffHindustani = open Prelude in {
oper
addErgative : Str -> Str -> Str ;
-- mkClause : NP -> VPH -> Clause ;
-- mkSClause : Str -> Agr -> VPH -> Clause ;
mkClause : NP -> VPH -> Clause ;
mkSClause : Str -> Agr -> VPH -> Clause ;
np2pronCase : (Case => Str) -> NPCase -> Agr -> Str ;
-- np2pronCase : (Case => Str) -> NPCase -> Agr -> Str ;
conjThat : Str ; -- = "kh" ;
insertSubj : UPerson -> Str -> Str ;
@@ -25,6 +25,11 @@ interface DiffHindustani = open Prelude in {
indfArt : Str ;
nE : Str ;
hE : Str ;
na : Str ;
nahen : Str ;
xayad : Str ;
kya : Str ;
copula : CTense -> Number -> UPerson -> Gender -> Str ;
raha : Gender -> Number -> Str ;

View File

@@ -184,7 +184,116 @@ param
comp = verb.comp ;
cvp = verb.cvp
} ;
Clause : Type = {s : VPHTense => Polarity => Order => Str} ;
mkClause : NP -> VPH -> Clause = \np,vp -> {
s = \\vt,b,ord =>
let
subjagr : NPCase * Agr = case vt of {
VPImpPast => case vp.subj of {
VTrans => <NPErg, vp.obj.a> ;
VTransPost => <NPErg, defaultAgr> ;
_ => <NPC Dir, np.a>
} ;
_ => <NPC Dir, np.a>
} ;
subj = subjagr.p1 ;
agr = subjagr.p2 ;
n = (fromAgr agr).n;
p = (fromAgr agr).p;
g = (fromAgr agr).g;
vps = case vt of {
VPGenPres => vp.s ! VPTense VPPres agr ;
VPImpPast => vp.s ! VPTense VPPast agr ;
VPFut => case vp.prog of { True => {fin = [] ;inf = addErgative ((vp.s ! VPTense VPFutr agr).inf ++ hw p n) ((vp.s ! VPTense VPFutr agr).fin) } ;
_ => {fin = [] ; inf = addErgative (vp.s ! VPTense VPFutr agr).inf (vp.s ! VPTense VPFutr agr).fin }} ;
VPContPres => {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPContPast => {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPContFut => {fin = [] ; inf = addErgative ((vp.s ! VPStem).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPPerfPres => {fin = copula CPresent n p g ; inf = (vp.s ! VPTense VPPerf agr).inf } ;
VPPerfPast => {fin = copula CPast n p g ; inf = (vp.s ! VPTense VPPerf agr).inf } ;
VPPerfFut => {fin = [] ; inf = addErgative ((vp.s ! VPTense VPPerf agr).inf ++ hw p n) (copula CFuture n p g) } ;
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 = addErgative ((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 = xayad } ;
VPSubj => case vp.prog of { True => {fin = addErgative ((vp.s ! VPTense VPFutr agr).inf ++ hw p n) (copula CFuture n p g) ; inf =[] } ;
_ => {fin = addErgative (vp.s ! VPTense VPFutr agr).inf (copula CFuture n p g); inf = [] } }
};
quest =
case ord of
{ ODir => [];
OQuest => kya };
na =
case b of
{ Pos => [];
Neg => na };
nahim =
case b of
{ Pos => [];
Neg => nahen };
in
case vt of {
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};
} ;
mkSClause : Str -> Agr -> VPH -> Clause =
\subj,agr,vp -> {
s = \\t,b,ord =>
let
n = (fromAgr agr).n;
p = (fromAgr agr).p;
g = (fromAgr agr).g;
vps = case t of {
VPGenPres => vp.s ! VPTense VPPres agr ;
VPImpPast => vp.s ! VPTense VPPast agr ;
VPFut => {fin = [] ; inf = addErgative (vp.s ! VPTense VPFutr agr).inf ((vp.s ! VPTense VPFutr agr).fin) } ;
VPContPres => {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPContPast => {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ raha g n } ;
VPContFut => {fin = [] ; inf = addErgative ((vp.s ! VPStem).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPPerfPres => {fin = copula CPresent n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ;
VPPerfPast => {fin = copula CPast n p g ; inf = (vp.s ! VPStem).inf ++ cka g n } ;
VPPerfFut => {fin = [] ; inf = addErgative ((vp.s ! VPStem).inf ++ cka g n ++ hw p n) (copula CFuture n p g) } ;
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 = addErgative ((vp.s ! VPStem).inf ++ raha g n ++ hw p n) (copula CFuture n p g) } ;
VPSubj => {fin = addErgative (insertSubj p (vp.s ! VPStem).inf) (copula CFuture n p g ); inf = [] }
};
quest =
case ord of
{ ODir => [];
OQuest => kya };
na =
case b of
{ Pos => [];
Neg => na };
nahim =
case b of
{ Pos => [];
Neg => nahen };
in
case t of {
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 : (Case => Str) -> NPCase -> Agr -> Str ;
np2pronCase ppf npc a = case npc of {
NPC c => ppf ! c;
NPObj => ppf ! Obl ;
NPErg =>case (fromAgr a).p of {
(Pers3_Near|Pers3_Distant) => addErgative (ppf ! Obl) nE; -- in hindi in case of pronouns nE is tagged to pron rather than a separate word
_ => addErgative (ppf ! Dir) nE
}
} ;
insertObj : (Agr => Str) -> VPH -> VPH = \obj1,vp -> {
s = vp.s ;