mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-12 12:42:50 -06:00
Hindi and Urdu as refactored to Hindustani by Shafqat
This commit is contained in:
@@ -1,196 +1,460 @@
|
||||
--# -path=.:../../prelude
|
||||
--
|
||||
----1 A Simple Hindi Resource Morphology
|
||||
----
|
||||
---- Aarne Ranta 2002 -- 2005
|
||||
----
|
||||
---- This resource morphology contains definitions needed in the resource
|
||||
---- syntax. To build a lexicon, it is better to use $ParadigmsHin$, which
|
||||
---- gives a higher-level access to this module.
|
||||
--
|
||||
resource MorphoHin = ResHin ** 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
|
||||
-- } ;
|
||||
--
|
||||
--
|
||||
----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} ;
|
||||
--
|
||||
----2 Determiners
|
||||
--
|
||||
-- mkDeterminer : Number -> Str -> {s : Str ; n : Number} = \n,s ->
|
||||
-- {s = s ; n = n} ;
|
||||
--
|
||||
----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 ; ---
|
||||
--
|
||||
--
|
||||
----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) ;
|
||||
--
|
||||
--
|
||||
----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 [] ;
|
||||
--
|
||||
--
|
||||
}
|
||||
--# -path=.:../../prelude:../abstract:../common:../../prelude
|
||||
--
|
||||
----1 A Simple Hinu Resource Morphology
|
||||
----
|
||||
---- 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
|
||||
---- gives a higher-level access to this module.
|
||||
--
|
||||
resource MorphoHin = ResHin ** open Prelude,Predef,ParamX,CommonHindustani in {
|
||||
flags optimize=all ;
|
||||
coding = utf8;
|
||||
|
||||
----2 Nouns
|
||||
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 {
|
||||
_ + "य" => mkN05 (s);
|
||||
_ + (""|"े"|"ह") => mkN01 (s);
|
||||
_ + "य" => mkN03 (s);
|
||||
_ + ("ं"|"wं") => mkN04 (s);
|
||||
_ + "w^" => mkN12 (s);
|
||||
_ => regNoun2 (s)
|
||||
};
|
||||
regNoun2 : Str -> Noun;
|
||||
regNoun2 s = let c = if_then_else Bool (eq (last s) "" ) True (if_then_else Bool (eq (last s) "ह") True (if_then_else Bool (eq (last s) "े") 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) "" ) True (if_then_else Bool (eq (dp 2 s) "ं") True (if_then_else Bool (eq (dp 2 s) "wं") True False))
|
||||
in case <s,g,c> of {
|
||||
<_ + "त",Fem,_> => mkN10 (s);
|
||||
<_ + "त",Masc,_> => mkN02 (s);
|
||||
<_ + "w",Masc,_> => mkN11 (s);
|
||||
<_ + "w",Fem,_> => mkN07 (s);
|
||||
<_ + "य",Fem,_> => mkN05 (s);
|
||||
<_ + "य",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 "े") lRka (tk 1 lRka)
|
||||
in mkNoun (lRka) (lRk+"ै") (lRk+"ै")
|
||||
(lRk+"ै") (lRk+"wं") (lRk+"w")
|
||||
Masc ;
|
||||
|
||||
-- masculine nouns does not end with a, h, e, an
|
||||
|
||||
mkN02 : Str -> Noun ;
|
||||
mkN02 mrd = let mrdwN = mrd+"wं" ;
|
||||
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+"ं" ;
|
||||
krsywN = krsy+"wं" ;
|
||||
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 {
|
||||
"" => let bla = n
|
||||
in mkNoun bla bla bla
|
||||
(bla+"y^यं") (bla+"w^ं") (bla+"w^")
|
||||
Fem ;
|
||||
_ => let maN = n ; -- ends with aN and wN
|
||||
ma = tk 1 maN
|
||||
in mkNoun maN maN maN
|
||||
(ma+"y^यं") (ma+"w^ं") (ma+"w^ं")
|
||||
Fem
|
||||
|
||||
};
|
||||
--feminine nouns end with ya
|
||||
|
||||
mkN05 : Str -> Noun ;
|
||||
mkN05 gRya = let gRy = (tk 1 gRya)
|
||||
in mkNoun gRya gRya gRya
|
||||
(gRya+"ं") (gRy+"wं") (gRy+"w")
|
||||
Fem ;
|
||||
|
||||
-- feminine nouns end with w
|
||||
|
||||
mkN07 : Str -> Noun ;
|
||||
mkN07 khshbw = mkNoun khshbw khshbw khshbw
|
||||
(khshbw + "y^यं") (khshbw + "w^ं") (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+"यं") (ndamt+"wं") (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^यं") (rya+"w^ं") rya
|
||||
Fem ;
|
||||
|
||||
-- feminine nouns that do not end with a, N, w, wN
|
||||
|
||||
mkN08 : Str -> Noun ;
|
||||
mkN08 ktab = mkNoun ktab ktab ktab
|
||||
(ktab+"यं") (ktab+"wं") (ktab+"w")
|
||||
Fem ;
|
||||
|
||||
-- Loan arabic feminine nouns
|
||||
|
||||
mkN09 : Str -> Noun ;
|
||||
mkN09 ahsan = mkNoun ahsan ahsan ahsan
|
||||
(ahsan+"त") (ahsan+"त") (ahsan+"w")
|
||||
Fem ;
|
||||
-- (variants{ahsan+"त";ahsan+"wं"})
|
||||
-- Loan persian maculine nouns end with w
|
||||
|
||||
mkN11 : Str -> Noun ;
|
||||
mkN11 alw = mkNoun alw alw alw
|
||||
alw (alw+"w^ं") (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
|
||||
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 -> Str -> Preposition = \s1,s2 -> {s = table { Masc => s1 ; Fem => s2 } } ** { lock_Prep = <>};
|
||||
|
||||
----2 Pronouns
|
||||
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)यं" "m(o)j'|ह" "" "t(o)w " "t(o)j|ह" "t(o)w " "t(o)म" "t(o)म" "t(o)म" "ाप" "ाप" "ाप" "y(i)ह" "a(i)स" "" "w(o)ह" "a(o)स" ""
|
||||
"h(a)म" "h(a)म" "" "t(o)म" "t(o)म" "t(o)म" "t(o)म" "t(o)म" "t(o)म" "ाप" "ाप" "ाप" "y(i)ह" "a(i)न" "" "w(o)ह" "a(o)न" "" ;
|
||||
|
||||
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
|
||||
-- defined in ResUrd
|
||||
|
||||
----3 Verbs
|
||||
CommonVF = {s : VTense => UPerson => Number => Gender => Str} ;
|
||||
|
||||
mkVerb : (x1: Str) -> Verb = \inf ->
|
||||
let root = (tk 2 inf); inf_obl = ((tk 1 inf) + "ै"); inf_fem = ((tk 1 inf) + "य")
|
||||
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)य") (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)
|
||||
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 {
|
||||
""|"ा"|"w" => root + "w^ं" ;
|
||||
_ => root + "wं"
|
||||
};
|
||||
form2 = case (last root) of {
|
||||
""|"ा"|"w" => root + "y^ं" ;
|
||||
_ => root + "यं"
|
||||
};
|
||||
in
|
||||
case <t,p,n,g> of {
|
||||
<Subj,Pers1,Sg,_> => form1 ;
|
||||
<Subj,Pers1,Pl,_> => form2 ;
|
||||
<Subj,_,_,_> => (mkImpert root p n g).s ;
|
||||
<Perf,_,_,_> => case root of {
|
||||
"हw" => (mkPastInd root p n g).s ;
|
||||
"ज" => (mkPastInd "गय" p n g).s ;
|
||||
"कर" => (mkPastInd "क" p n g).s ;
|
||||
"दै" => (mkPastInd "द" p n g).s ;
|
||||
"लै" => (mkPastInd "ल" p n g).s ;
|
||||
_ => (mkPastInd root p n g).s };
|
||||
<Imperf,Pers2_Familiar,Sg,Masc> => root + "तै";
|
||||
<Imperf,Pers2_Familiar,Sg,Fem> => root + "तय"; --variants{root+"तय" ; root+"तयं"};
|
||||
<Imperf,Pers2_Familiar,Pl,Masc> => root + "तै";
|
||||
<Imperf,Pers2_Familiar,Pl,Fem> => root+"तयं";
|
||||
<Imperf,Pers2_Respect,Sg,Masc> => root + "तै";
|
||||
<Imperf,Pers2_Respect,Sg,Fem> => root + "तय"; --variants{root+"तय" ; root+"तयं"};
|
||||
<Imperf,Pers2_Respect,Pl,Masc> => root + "तै";
|
||||
<Imperf,Pers2_Respect,Pl,Fem> => root+"तयं";
|
||||
<Imperf,_,Sg,Masc> => root+"त";
|
||||
<Imperf,_,Sg,Fem> => root+"तय";
|
||||
<Imperf,_,Pl,Masc> => root+"ते";
|
||||
<Imperf,_,Pl,Fem> => root+"तयं"
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
mkPastInd : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g ->
|
||||
{s = let roo = root ;
|
||||
a = case (last root) of {
|
||||
""|"ा"|"w"|"क" => "य" ;
|
||||
_ => ""
|
||||
} ;
|
||||
y = case (last root) of {
|
||||
""|"ा"|"w" => "y^य" ;
|
||||
_ => "य"
|
||||
} ;
|
||||
e = case (last root) of {
|
||||
""|"ा"|"w"|"क" => "y^ै" ;
|
||||
_ => "ै"
|
||||
} ;
|
||||
yN = case (last root) of {
|
||||
""|"ा"|"w" => "y^यं" ;
|
||||
_ => "यं"
|
||||
} ;
|
||||
|
||||
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 ;
|
||||
|
||||
<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_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_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
|
||||
|
||||
} ;
|
||||
} ;
|
||||
|
||||
mkImpert : Str -> UPerson -> Number -> Gender -> {s:Str} = \root,p,n,g ->
|
||||
{s = let roo = root ;
|
||||
w = case (last root) of {
|
||||
""|"ा"|"w" => "w^" ;
|
||||
_ => "w"
|
||||
} ;
|
||||
yN = case (last root) of {
|
||||
""|"ा"|"w" => "y^यं" ;
|
||||
_ => "यं"
|
||||
} ;
|
||||
yE = case (last root) of {
|
||||
""|"ा"|"w" => "y^यै" ;
|
||||
_ => "यै"
|
||||
} ;
|
||||
e = case (last root) of {
|
||||
""|"ा"|"w" => "y^ै" ;
|
||||
_ => "ै"
|
||||
} in
|
||||
case <p,n,g> of {
|
||||
<Pers1,_,_> => ""; --nonExist ;
|
||||
<Pers2_Casual,Sg,_> => root ;
|
||||
<Pers2_Casual,Pl,_> => roo+w ;
|
||||
<Pers2_Familiar,_,_> => roo+w ;
|
||||
<Pers2_Respect,Sg,_> => roo+w; --variants{roo+w; roo+yN; roo+yE} ;
|
||||
<Pers2_Respect,Pl,_> => roo+yN; --variants{roo+yN; roo+yE} ;
|
||||
<_,Sg,_> => roo+e ;
|
||||
<_,Pl,_> => roo+yN
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user