1
0
forked from GitHub/gf-core

Shafqat's Urdu modules added

This commit is contained in:
aarne
2010-01-15 09:09:02 +00:00
parent b318698372
commit cd3e40a2d8
20 changed files with 3617 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
concrete AdjectiveUrd of Adjective = CatUrd ** open ResUrd, Prelude in {
lin
PositA a = a ;
UseComparA a = a;
ComparA a np = {
s = \\n,g,c,d => np.s ! NPC Obl ++ "sE" ++ a.s ! n ! g ! c ! d ;
-- isPre = False
} ;
---- $SuperlA$ belongs to determiner syntax in $Noun$.
ComplA2 a np = {
s = \\n,g,c,d => np.s ! NPC Obl ++ a.c2 ++ a.s ! n ! g ! c ! d ;
-- isPre = False
} ;
-- ReflA2 a = {
-- s = \\n,g,c,d => a.s ! n ! g ! c ! d ++ reflPron ! ag ;
-- isPre = False
-- } ;
SentAP ap sc = {
s = \\n,g,c,d => ap.s ! n ! g ! c ! d ++ sc.s ;
-- isPre = False
} ;
AdAP ada ap = {
s = \\n,g,c,d => ada.s ++ ap.s ! n ! g ! c ! d ;
-- isPre = ap.isPre
} ;
UseA2 a = a ;
CAdvAP cadv ap np = {
s = \\n,g,c,d => cadv.s ++ ap.s ! n ! g ! c ! d ++ cadv.p ++ np.s ! NPC Dir ;
};
}

20
lib/src/urdu/AdverbUrd.gf Normal file
View File

@@ -0,0 +1,20 @@
concrete AdverbUrd of Adverb = CatUrd ** open ResUrd, Prelude in {
lin
PositAdvAdj a = {s = a.s ! Sg ! Masc ! Obl ! Posit} ;
ComparAdvAdj cadv a np = {
s = np.s ! NPObj ++ cadv.p ++ cadv.s ++ a.s ! Sg ! Masc ! Obl ! Posit;
} ;
ComparAdvAdjS cadv a s = {
s = cadv.p ++ cadv.s ++ a.s ! Sg ! Masc ! Obl ! Posit ++ s.s;
} ;
PrepNP prep np = {s = np.s ! NPObj ++ prep.s ! PP (giveNumber np.a) (giveGender np.a) } ;
AdAdv ada adv = { s = ada.s ++ adv.s} ;
SubjS = cc2 ;
AdnCAdv cadv = {s = "sE" ++ cadv.s} ;
}

102
lib/src/urdu/CatUrd.gf Normal file
View File

@@ -0,0 +1,102 @@
concrete CatUrd of Cat = CommonX ** open ResUrd, Prelude in {
flags optimize=all_subs ;
lincat
------ Tensed/Untensed
S = {s : Str} ;
QS = {s : QForm => Str} ;
-- RS = { s: Str} ;
RS = {s : Agr => Str ; c : Case} ; -- c for it clefts
-- SSlash = {s : Str ; c2 : Str} ;
---- Sentence
-- Cl = Str;
Cl = ResUrd.Clause ;
ClSlash = {
s : ResUrd.VPHTense => Polarity => Order => Str ;
-- s : ResUrd.Tense => Anteriority => CPolarity => Order => Str ;
c2 : ResUrd.Compl
-- c2 : Str
} ;
Imp = {s : CPolarity => ImpForm => Str} ;
---- Question
QCl = {s : ResUrd.VPHTense => Polarity => QForm => Str} ;
-- QCl = {s : ResUrd.Tense => Anteriority => CPolarity => QForm => Str} ;
IP = {s: Case => Str ; g : Gender ; n : Number};
-- IP = {s : Number => Case => Str} ;
-- IComp = {s : Str} ;
IDet = {s :Gender => Str ; n : Number} ;
-- IQuant = {s : Number => Str} ;
---- Relative
RCl = {
s : ResUrd.VPHTense => Polarity => Order => Agr => Str ;
c : Case
} ;
RP = {s: Number => Case => Str ; a:RAgr};
-- RP = {s : RCase => Str ; a : RAgr} ;
---- Verb
-- VP = ResUrd.Verb;
VP = ResUrd.VPH ;
VPSlash = ResUrd.VPHSlash ;
Comp = {s : Agr => Str} ;
---- Adjective
AP = ResUrd.Adjective ;
-- AP = {s: Number => Gender => Case = Str};
---- Noun
CN = ResUrd.Noun ;
NP = ResUrd.NP ;
Pron = {s : PersPronForm => Str; a : Agr} ;
-- Pron = {s : PronCase => Str ; a : Agr} ;
Det = {s:Determiner => Str ; n : Number};
-- Det = {s : Gender => Case => Str ; n : Number} ;
Predet, Ord = {s : Str} ;
Num = Str;
-- Num = {s : Str ; n : Number} ;
-- Card = {s : Str; n : Number} ;
Quant = {s:DemPronForm => Str ; a : Agr};
-- Quant = {s : Number => Gender => Case => Str} ;
Art = {s : Str} ;
---- Numeral
-- Numeral = {s : CardOrd => Str ; n : Number} ;
-- Digits = {s : CardOrd => Str ; n : Number ; tail : DTail} ;
---- Structural
Conj = {s1,s2 : Str ; n : Number} ;
-----b Conj = {s : Str ; n : Number} ;
-----b DConj = {s1,s2 : Str ; n : Number} ;
Subj = {s : Str} ;
Prep = {s : Proposition => Str ; n : Number} ;
---- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = ResUrd.Verb ; -- = {s : VForm => Str} ;
V2, V2A, V2Q, V2S = ResUrd.Verb ** {c2 : Compl} ;
-- V2, V2A, V2Q, V2S = ResUrd.Verb; -- ** {c2 : Str} ;
V3 = ResUrd.Verb ** {c2, c3 : Str} ;
VV = ResUrd.Verb ** { isAux : Bool} ;
-- VV = {s : VVForm => Str ; isAux : Bool} ;
V2V = ResUrd.Verb ** {c1 : Str ; c2 : Str ; isAux : Bool} ;
A = ResUrd.Adjective ; --- {s : Gender => Number => Case => Str} ;
A2 = {s : Number => Gender => Case => Degree => Str ; c2 : Str} ;
N = {s : Number => Case => Str ; g : Gender} ;
N2 = {s : Number => Case => Str ; g : Gender} ** {c2 : Proposition => Str} ;
N3 = {s : Number => Case => Str ; g : Gender} ** {c2 : Proposition => Str ; c3 : Str} ;
PN = {s : Case => Str ; g : Gender} ;
--
}

View File

@@ -0,0 +1,41 @@
--concrete ConjunctionUrd of Conjunction =
-- CatUrdu ** open ResUrdu, Coordination, Prelude in {
concrete ConjunctionUrd of Conjunction =
CatUrd ** open ResUrd, Coordination, Prelude in {
flags optimize=all_subs ;
lin
ConjS = conjunctDistrSS ;
ConjAdv = conjunctDistrSS ;
ConjNP conj ss = conjunctDistrTable NPCase conj ss ** {
a = conjAgr (agrP3 Masc conj.n) ss.a
} ;
ConjAP conj ss = conjunctDistrTable4 Number Gender Case Degree conj ss ; -- ** {
-- isPre = ss.isPre
-- } ;
---- These fun's are generated from the list cat's.
BaseS = twoSS ;
ConsS = consrSS comma ;
BaseAdv = twoSS ;
ConsAdv = consrSS comma ;
BaseNP x y = twoTable NPCase x y ** {a = conjAgr x.a y.a} ;
ConsNP xs x = consrTable NPCase comma xs x ** {a = conjAgr xs.a x.a} ;
BaseAP x y = twoTable4 Number Gender Case Degree x y ; -- ** {isPre = andB x.isPre y.isPre} ;
ConsAP xs x = consrTable4 Number Gender Case Degree comma xs x ;-- ** {isPre = andB xs.isPre x.isPre} ;
lincat
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[NP] = {s1,s2 : NPCase => Str ; a : Agr} ;
[AP] = {s1,s2 : Number => Gender => Case => Degree => Str} ;
}

View File

@@ -0,0 +1,164 @@
resource Coordination = open Prelude in {
param
ListSize = TwoElem | ManyElem ;
oper
ListX = {s1,s2 : Str} ;
twoStr : (x,y : Str) -> ListX = \x,y ->
{s1 = x ; s2 = y} ;
consStr : Str -> ListX -> Str -> ListX = \comma,xs,x ->
{s1 = xs.s1 ++ comma ++ xs.s2 ; s2 = x } ;
twoSS : (_,_ : SS) -> ListX = \x,y ->
twoStr x.s y.s ;
consSS : Str -> ListX -> SS -> ListX = \comma,xs,x ->
consStr comma xs x.s ;
Conjunction : Type = SS ;
ConjunctionDistr : Type = {s1 : Str ; s2 : Str} ;
conjunctX : Conjunction -> ListX -> Str = \or,xs ->
xs.s1 ++ or.s ++ xs.s2 ;
conjunctDistrX : ConjunctionDistr -> ListX -> Str = \or,xs ->
or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2 ;
conjunctSS : Conjunction -> ListX -> SS = \or,xs ->
ss (xs.s1 ++ or.s ++ xs.s2) ;
conjunctDistrSS : ConjunctionDistr -> ListX -> SS = \or,xs ->
ss (or.s1 ++ xs.s1 ++ or.s2 ++ xs.s2) ;
-- all this lifted to tables
ListTable : Type -> Type = \P -> {s1,s2 : P => Str} ;
twoTable : (P : Type) -> (_,_ : {s : P => Str}) -> ListTable P = \_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consTable : (P : Type) -> Str -> ListTable P -> {s : P => Str} -> ListTable P =
\P,c,xs,x ->
{s1 = table P {o => xs.s1 ! o ++ c ++ xs.s2 ! o} ; s2 = x.s} ;
conjunctTable : (P : Type) -> Conjunction -> ListTable P -> {s : P => Str} =
\P,or,xs ->
{s = table P {p => xs.s1 ! p ++ or.s ++ xs.s2 ! p}} ;
conjunctDistrTable :
(P : Type) -> ConjunctionDistr -> ListTable P -> {s : P => Str} = \P,or,xs ->
{s = table P {p => or.s1++ xs.s1 ! p ++ or.s2 ++ xs.s2 ! p}} ;
-- ... and to two- and three-argument tables: how clumsy! ---
ListTable2 : Type -> Type -> Type = \P,Q ->
{s1,s2 : P => Q => Str} ;
twoTable2 : (P,Q : Type) -> (_,_ : {s : P => Q => Str}) -> ListTable2 P Q =
\_,_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consTable2 :
(P,Q : Type) -> Str -> ListTable2 P Q -> {s : P => Q => Str} -> ListTable2 P Q =
\P,Q,c,xs,x ->
{s1 = table P {p => table Q {q => xs.s1 ! p ! q ++ c ++ xs.s2 ! p! q}} ;
s2 = x.s
} ;
conjunctTable2 :
(P,Q : Type) -> Conjunction -> ListTable2 P Q -> {s : P => Q => Str} =
\P,Q,or,xs ->
{s = table P {p => table Q {q => xs.s1 ! p ! q ++ or.s ++ xs.s2 ! p ! q}}} ;
conjunctDistrTable2 :
(P,Q : Type) -> ConjunctionDistr -> ListTable2 P Q -> {s : P => Q => Str} =
\P,Q,or,xs ->
{s =
table P {p => table Q {q => or.s1++ xs.s1 ! p ! q ++ or.s2 ++ xs.s2 ! p ! q}}} ;
ListTable3 : Type -> Type -> Type -> Type = \P,Q,R ->
{s1,s2 : P => Q => R => Str} ;
twoTable3 : (P,Q,R : Type) -> (_,_ : {s : P => Q => R => Str}) ->
ListTable3 P Q R =
\_,_,_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consTable3 :
(P,Q,R : Type) -> Str -> ListTable3 P Q R -> {s : P => Q => R => Str} ->
ListTable3 P Q R =
\P,Q,R,c,xs,x ->
{s1 = \\p,q,r => xs.s1 ! p ! q ! r ++ c ++ xs.s2 ! p ! q ! r ;
s2 = x.s
} ;
conjunctTable3 :
(P,Q,R : Type) -> Conjunction -> ListTable3 P Q R -> {s : P => Q => R => Str} =
\P,Q,R,or,xs ->
{s = \\p,q,r => xs.s1 ! p ! q ! r ++ or.s ++ xs.s2 ! p ! q ! r} ;
conjunctDistrTable3 :
(P,Q,R : Type) -> ConjunctionDistr -> ListTable3 P Q R ->
{s : P => Q => R => Str} =
\P,Q,R,or,xs ->
{s = \\p,q,r => or.s1++ xs.s1 ! p ! q ! r ++ or.s2 ++ xs.s2 ! p ! q ! r} ;
---------
ListTable4 : Type -> Type -> Type -> Type -> Type = \P,Q,R,T ->
{s1,s2 : P => Q => R => T => Str} ;
twoTable4 : (P,Q,R,T : Type) -> (_,_ : {s : P => Q => R => T => Str}) ->
ListTable4 P Q R T =
\_,_,_,_,x,y ->
{s1 = x.s ; s2 = y.s} ;
consTable4 :
(P,Q,R,T : Type) -> Str -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} ->
ListTable4 P Q R T =
\P,Q,R,T,c,xs,x ->
{s1 = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ c ++ xs.s2 ! p ! q ! r ! t ;
s2 = x.s
} ;
conjunctTable4 :
(P,Q,R,T : Type) -> Conjunction -> ListTable4 P Q R T -> {s : P => Q => R => T => Str} =
\P,Q,R,T,or,xs ->
{s = \\p,q,r,t => xs.s1 ! p ! q ! r ! t ++ or.s ++ xs.s2 ! p ! q ! r ! t} ;
conjunctDistrTable4 :
(P,Q,R,T : Type) -> ConjunctionDistr -> ListTable4 P Q R T ->
{s : P => Q => R => T => Str} =
\P,Q,R,T,or,xs ->
{s = \\p,q,r,t => or.s1++ xs.s1 ! p ! q ! r ! t ++ or.s2 ++ xs.s2 ! p ! q ! r ! t} ;
--------------
comma = "," ;
-- you can also do this to right-associative lists:
consrStr : Str -> Str -> ListX -> ListX = \comma,x,xs ->
{s1 = x ++ comma ++ xs.s1 ; s2 = xs.s2 } ;
consrSS : Str -> SS -> ListX -> ListX = \comma,x,xs ->
consrStr comma x.s xs ;
consrTable : (P : Type) -> Str -> {s : P => Str} -> ListTable P -> ListTable P =
\P,c,x,xs ->
{s1 = table P {o => x.s ! o ++ c ++ xs.s1 ! o} ; s2 = xs.s2} ;
consrTable2 : (P,Q : Type) -> Str -> {s : P => Q => Str} ->
ListTable2 P Q -> ListTable2 P Q =
\P,Q,c,x,xs ->
{s1 = table P {p => table Q {q => x.s ! p ! q ++ c ++ xs.s1 ! p ! q}} ;
s2 = xs.s2
} ;
consrTable4 : (P,Q,R,T : Type) -> Str -> {s : P => Q => R => T => Str} ->
ListTable4 P Q R T -> ListTable4 P Q R T =
\P,Q,R,T,c,x,xs ->
{s1 = table P {p => table Q {q => table R { r => table T {t => x.s ! p ! q ! r ! t ++ c ++ xs.s1 ! p ! q ! r ! t}}}} ;
s2 = xs.s2
} ;
} ;

View File

@@ -0,0 +1,24 @@
--# -path=.:../abstract:../common:../prelude
concrete GrammarUrd of Grammar =
NounUrd,
VerbUrd,
AdjectiveUrd,
AdverbUrd,
NumeralUrd,
SentenceUrd,
QuestionUrd,
RelativeUrd,
ConjunctionUrd,
PhraseUrd,
TextX,
StructuralUrd,
TenseX,
IdiomUrd
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;
}

46
lib/src/urdu/IdiomUrd.gf Normal file
View File

@@ -0,0 +1,46 @@
concrete IdiomUrd of Idiom = CatUrd ** open Prelude,Predef, ResUrd in {
flags optimize=all_subs ;
lin
ImpersCl vp = mkSClause " " (agrP3 Masc Sg) vp ;
GenericCl vp = mkSClause "kwy" (agrP3 Masc Sg) vp ;
CleftNP np rs =
let cl = mkSClause (np.s ! NPC rs.c) (np.a) (predAux auxBe);
in
{s = \\t,p,o => cl.s ! t ! p ! o ++ rs.s ! np.a };
-- (insertObj (\\_ => rs.s ! np.a ++ ",") (predAux auxBe));
-- (insertObj (\\_ => np.s ! NPC rs.c) (predAux auxBe))) ;
CleftAdv ad ss = { s = \\t,b,o => ad.s ++ ss.s};
-- CleftAdv ad s = mkClause ad.s (agrP3 Masc Sg)
-- (insertObj (\\_ => optStr conjThat ++ s.s)
-- (insertObj (\\_ => ad.s) (predAux auxBe))) ;
--
ExistNP np =
mkSClause "whaN" (agrP3 (fromAgr np.a).g (fromAgr np.a).n)
(insertObj (\\_ => np.s ! NPC Obl) (predAux auxBe)) ;
--
ExistIP ip =
let cl = mkSClause ("whaN" ++ ip.s ! Dir) (agrP3 ip.g ip.n) (predAux auxBe);
in {
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! ODir;
QIndir => cl.s ! t! p ! ODir
}
};
-- mkQuestion (ss (ip.s ! Nom))
-- (mkClause "there" (agrP3 ip.n) (predAux auxBe)) ;
--
-- ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
--
-- ImpPl1 vp = {s = "Aw" ++ infVP True vp (agrP1 Masc Pl)} ;
ImpPl1 vp = {s = "Aw" ++ (vp.s ! Pos ! VPTense VPFut (Ag Masc Pl Pers3_Near) ! ODir).inf2} ;
ImpP3 np vp = {s = np.s!NPC Dir ++ "kw" ++ (vp.s ! Pos ! VPImp ! ODir).inf2 ++ "dw"};
--
}

10
lib/src/urdu/LangUrd.gf Normal file
View File

@@ -0,0 +1,10 @@
--# -path=.:../abstract:../common:../prelude
concrete LangUrd of Lang =
GrammarUrd,
LexiconUrd
** {
flags startcat = Phr ; unlexer=unwords ; lexer=words ;
}

385
lib/src/urdu/LexiconUrd.gf Normal file
View File

@@ -0,0 +1,385 @@
--# -path=.:prelude
concrete LexiconUrd of Lexicon = CatUrd **
--open ResUrd, Prelude in {
open ParadigmsUrd, Prelude in {
flags
optimize=values ;
lin
airplane_N = mkN "jhaz" ;
-- answer_V2S = mkV_3 (mkCmpdVerb (mkN "jwab" ) "dyna" ) (mkCmpdVerb (mkN "jwab") "dlwana") ;
answer_V2S = mkV2 (mkV (mkCmpdVerb (mkN "jwab" ) "dyna" )) ;
apartment_N = mkN "kmrh" ;
apple_N = mkN "syb" ;
art_N = mkN "fn" ;
ask_V2Q = mkV2 (mkV "pwch-na") ;
baby_N = mkN "bch" ;
bad_A = mkA "bra" ;
bank_N = mkN "bank" ;
beautiful_A = mkA "KwbSwrt" ;
become_VA = mkV "bnna";
beer_N = mkN "beer" ;
beg_V2V = mkV2V (mkV "mangna") "sE" "kh" False;
big_A = mkA "bRa" ;
bike_N = mkN "saycl" feminine ;
bird_N = mkN "prndh" ;
black_A = mkA "kala" ;
-- black_A = mkA "kala" ;
blue_A = mkA "nyla" ;
boat_N = mkN "kXty" ;
book_N = mkN "ktab" feminine ;
-- boot_N = mkN "boot" ;
-- boss_N = mkN human (mkN "boss") ;
boy_N = mkN "lRka" ;
bread_N = mkN "rwty" ;
break_V2 = mkV2 (mkV "twRna") ;
broad_A = mkA "kh-la" ;
-- brother_N2 = mkN2 (mkN "bh-ay") (mkPrep "ka") ; --not correct
brown_A = mkA "nswary" ;
butter_N = mkN "mkh-n" ;
buy_V2 = mkV2 (mkV "Krydna");
camera_N = mkN "kymrh" ;
cap_N = mkN "twpy" ;
car_N = mkN "gaRy" ;
carpet_N = mkN "tpay^y" ;
cat_N = mkN "bly" ;
-- ceiling_N = mkN "ceiling" ;
chair_N = mkN "krsy" ;
cheese_N = mkN "pnyr" feminine ;
child_N = mkN "bch" ;
-- church_N = mkN "church" ;
city_N = mkN "Xhr" ;
clean_A = mkA "Saf" ;
clever_A = mkA "hwXyar" ;
-- close_V2 = mkV2 (mkV (mkCmpdVerb1 (mkN "bnd" ) (mkV "krna")));
coat_N = mkN "kwT" ;
cold_A = mkA "Th-nDa" ;
come_V = mkV "Ana" ;
computer_N = mkN "kmpywTr" ;
country_N = mkN "mlk" ;
cousin_N = mkN (mkCmpdNoun (mkN "cca") (mkN "zad")) ; -- a compund noun made of two nouns
cow_N = mkN "gaE" feminine ;
die_V = mkV "mrna" ;
dirty_A = mkA "gnda" ;
distance_N3 = mkN3 (mkN "faSlh") (mkPrep "ka" "ky" "kE" "ky" singular) "sE" ;
doctor_N = mkN "mealj" ;
dog_N = mkN "kta" ;
door_N = mkN "drwzh" ;
drink_V2 = mkV2 (mkV "pyna");
easy_A2V = mkA "Asan" "" ;
eat_V2 = mkV2 (mkV "kh-ana") "kw" ;
-- empty_A = mkA "Kaly" ;
enemy_N = mkN "dXmn" ;
factory_N = mkN "karKanh" ;
father_N2 = mkN2 (mkN "aba") (mkPrep "ka" "ky" "kE" "ky" singular) ;
fear_VS = mkV "drna";
find_V2 = mkV2 (mkV "pana") ;
fish_N = mkN "mch-ly" ;
floor_N = mkN "frX" ;
forget_V2 = mkV2 (mkV "bh-wlna") ;
fridge_N = mkN "fryg" ;
friend_N = mkN "dwst" masculine ;
fruit_N = mkN "ph-l" ;
-- fun_AV = mkAV (regA "fun") ;
garden_N = mkN "baG" ;
girl_N = mkN "lRky" ;
glove_N = mkN "dstanh" ;
gold_N = mkN "swna" ;
good_A = mkA "ach-a" ;
go_V = mkV "jana" ;
green_A = mkA "sbz" ;
-- harbour_N = mkN "harbour" ;
hate_V2 = mkV2 (mkV (mkCmpdVerb (mkN "nfrt" ) "krna" )) ;
hat_N = mkN "twpy" ;
-- have_V2 = dirV2 (mk5V "have" "has" "had" "had" "having") ;
hear_V2 = mkV2 (mkV "snna") ;
hill_N = mkN "phaRy" ;
hope_VS = mkV (mkCmpdVerb (mkN "amyd" ) "krna" );
horse_N = mkN "gh-wRa" ;
hot_A = mkA "grm" ;
house_N = mkN "gh-r" ;
important_A = mkA "ahm" ;
industry_N = mkN "Snet" feminine ;
-- iron_N = mkN "iron" ;
king_N = mkN "badXah" ;
know_V2 = mkV2 (mkV "janna") ;
lake_N = mkN "jh-yl" feminine ;
-- lamp_N = mkN "lamp" ;
learn_V2 = mkV2 (mkV "sykh-na") ;
leather_N = mkN "cmRa" ;
-- leave_V2 = dirV2 (irregV "leave" "left" "left") ;
like_V2 = mkV2 (mkV (mkCmpdVerb (mkN "psnd" ) "krna" ));
listen_V2 = mkV2 (mkV "snna") ;
live_V = mkV "rhna" ; ---- touch
long_A = mkA "lmba" ;
lose_V2 = mkV2 (mkV (mkCmpdVerb (mkN "kh-w" ) "dyna" )) ;
love_N = mkN "mHbt" ;
love_V2 = mkV2 (mkV (mkCmpdVerb (mkN "pyar" ) "krna" )) ;
man_N = mkN "Admy" ; -- not correct according to rules should be discussed
married_A2 = mkA "Xady krna" "sE" ;
meat_N = mkN "gwXt" ;
milk_N = mkN "dwdh-" ;
moon_N = mkN "cand" ;
-- mother_N2 = mkN "maN" feminine ; -- not covered need to be discussed
mountain_N = mkN "phaRy" ;
music_N = mkN "mwsyqy" ;
narrow_A = mkA "baryk" ;
new_A = mkA "nya" ;
newspaper_N = mkN "aKbar" ;
oil_N = mkN "tyl" ;
old_A = mkA "bwRh-a" ;
open_V2 = mkV2 (mkV "kh-wlna") ;
paint_V2A = mkV2 (mkV (mkCmpdVerb (mkN "rng" ) "krna" )) ;
paper_N = mkN "kaGz" ;
-- paris_PN = mkPN (mkN nonhuman (mkN "Paris")) ;
peace_N = mkN "amn" ;
pen_N = mkN "pnsl" ;
planet_N = mkN "syarh" ;
-- plastic_N = mkN "plastic" ;
play_V2 = mkV2 (mkV "kh-ylna") ;
-- policeman_N = mkN masculine (mkN "policeman" "policemen") ;
-- priest_N = mkN human (mkN "priest") ;
-- probable_AS = mkAS (regA "probable") ;
queen_N = mkN "Xhzady" ;
-- radio_N = mkN "radio" ;
rain_V0 = mkV (mkCmpdVerb (mkN "barX" ) "hwna" ) ;
read_V2 = mkV2 (mkV "pRh-na");
red_A = mkA "lal" ;
religion_N = mkN "mzhb" ;
-- restaurant_N = mkN "restaurant" ;
river_N = mkN "drya" masculine ;
rock_N = mkN "cTan" ;
roof_N = mkN "ch-t" masculine ;
-- rubber_N = mkN "rubber" ;
run_V = mkV "dwRna" ;
say_VS = mkV "khna" ;
school_N = mkN "skwl" ;
-- science_N = mkN "science" ;
sea_N = mkN "smndr" ;
seek_V2 = mkV2 (mkV (mkCmpdVerb (mkN "tlaX" ) "krna" )) ;
see_V2 = mkV2 (mkV "dykh-na") ;
sell_V3 = mkV3 (mkV "bycna") "kw" "";
send_V3 = mkV3 (mkV "bh-yjna") "kw" "";
sheep_N = mkN "bh-yR" feminine ;
ship_N = mkN "jhaz" ;
shirt_N = mkN "qmyZ-" feminine;
shoe_N = mkN "jwta" ;
shop_N = mkN "dwkan" feminine ;
short_A = mkA "ch-wTa" ;
silver_N = mkN "candy" ;
sister_N = mkN "bhn" feminine ;
sleep_V = mkV "swna" ;
small_A = mkA "ch-wTa" ;
snake_N = mkN "sanp" ;
sock_N = mkN "jrab" feminine ;
speak_V2 = mkV2 (mkV "bwlna") ;
star_N = mkN "stara" ;
-- steel_N = mkN "steel" ;
stone_N = mkN "pth-r" ;
stove_N = mkN "cwlha" ;
student_N = mkN (mkCmpdNoun (mkN "t-alb") (mkN "elm")) ;
stupid_A = mkA "aHmq" ;
sun_N = mkN "swrj" ;
-- switch8off_V2 = dirV2 (partV (regV "switch") "off") ;
-- switch8on_V2 = dirV2 (partV (regV "switch") "on") ;
table_N = mkN "myz" feminine ;
talk_V3 = mkV3 (mkV "bwlna") "sE" "kE barE meN";
teacher_N = mkN "istad" ;
teach_V2 = mkV2 (mkV "pRh-na") ;
television_N = mkN "telywyzn" ;
thick_A = mkA "mwTa" ;
thin_A = mkA "ptla" ;
train_N = mkN "gaRy" ;
-- travel_V = mkV
travel_V = mkV (mkCmpdVerb (mkN "sfr" ) "krna" ) ;
tree_N = mkN "drKt" masculine ;
-- ---- trousers_N = mkN "trousers" ;
ugly_A = mkA "bdSwrt" ;
understand_V2 = mkV2 (mkV "smjh-na") ;
-- university_N = mkN "university" ;
village_N = mkN "gawN" ;
wait_V2 = mkV2 (mkV (mkCmpdVerb (mkN "antz-ar" ) "krna" )) ;
walk_V = mkV "clna" ;
warm_A = mkA "grm" ;
war_N = mkN "jng" ;
-- watch_V2 = dirV2 (regV "watch") ;
-- water_N = mkN "water" ; -- not covered masculine ending with y
white_A = mkA "sfyd" ;
window_N = mkN "kh-Rky" ;
wine_N = mkN "Xrab" feminine ;
win_V2 = mkV2 (mkV "jytna") ;
woman_N = mkN "ewrt" feminine ;
-- wonder_VQ = (mkCmpdVerb (mkN "Heran" ) "hwna" ) (mkCmpdVerb (mkN "Heran") "hwna") (mkCmpdVerb (mkN "Heran") "krwana") ;
wood_N = mkN "lkRy" ;
write_V2 = mkV2 (mkV "lkh-na") ;
yellow_A = mkA "pyla" ;
young_A = mkA "jwan" ;
--
do_V2 = mkV2 (mkV "krna") ;
-- now_Adv = mkAdv "now" ;
-- already_Adv = mkAdv "already" ;
song_N = mkN "gana" ;
-- add_V3 = mkV (mkCmpdVerb (mkN "aZ-afh" ) "krna" ) ;
number_N = mkN "hndsh" ;
put_V2 = mkV2 (mkV "Dalna") ;
stop_V = mkV "rkna" ;
jump_V = mkV "ch-langna" ;
--
-- left_Ord = ss "left" ;
-- right_Ord = ss "right" ;
-- far_Adv = mkA "dwr" ;
correct_A = mkA "Syh" ;
dry_A = mkA "KXk" ;
-- dull_A = mkA "nalik" ;
-- full_A = regA "full" ;
heavy_A = mkA "bh-ary" ;
near_A = mkA "qryb" ;
-- rotten_A = (regA "rotten") ;
round_A = mkA "gwl" ;
sharp_A = mkA "tyz" ;
smooth_A = mkA "hmwar" ;
straight_A = mkA "sydh-a" ;
wet_A = mkA "gyla" ; ----
wide_A = mkA "kh-la" ;
animal_N = mkN "janwr" ;
ashes_N = mkN "rakh-" feminine; -- FIXME: plural only?
back_N = mkN "qmr" feminine ;
-- bark_N = mkN "bark" ;
belly_N = mkN "dh-ny" ;
blood_N = mkN "Kwn" ;
bone_N = mkN "hDy" ;
breast_N = mkN "ch-aty" ;
cloud_N = mkN "badl" ;
day_N = mkN "dn" ;
dust_N = mkN "dh-wl" ;
ear_N = mkN "kan" ;
earth_N = mkN "zmyn" feminine ;
egg_N = mkN "anDh" ;
eye_N = mkN "Ankh-" feminine ;
fat_N = mkN "mwta" ;
feather_N = mkN "pr" ;
fingernail_N = mkN "naKn" ;
fire_N = mkN "Ag" feminine ;
flower_N = mkN "ph-wl" ;
fog_N = mkN "dh-nd" feminine ;
foot_N = mkN "pawN" ; -- not properly covered need to be discussed
forest_N = mkN "njgl" ;
grass_N = mkN "gh-s" feminine ;
-- guts_N = mkN "gut" ; -- FIXME: no singular
hair_N = mkN "bal" ;
hand_N = mkN "hath-" ;
head_N = mkN "sr" ;
heart_N = mkN "dl" ;
horn_N = mkN "gh-nty" ;
husband_N = mkN "Xwhr" ;
ice_N = mkN "brf" feminine ;
knee_N = mkN "khny" ;
leaf_N = mkN "pth" ;
leg_N = mkN "tang" feminine ;
liver_N = mkN "jgr" ;
louse_N = mkN "gh-r" ;
mouth_N = mkN "mnh" ;
name_N = mkN "nam" ;
neck_N = mkN "grdn" feminine ;
night_N = mkN "rat" feminine ;
nose_N = mkN "nak" ;
person_N = mkN "XKS" ;
rain_N = mkN "barX" feminine ;
road_N = mkN "sRk" ;
root_N = mkN "gR" feminine ;
rope_N = mkN "rsy" ;
salt_N = mkN "nmk" feminine ;
sand_N = mkN "ryt" feminine ;
seed_N = mkN "byj" ;
skin_N = mkN "jld" feminine ;
sky_N = mkN "Asman" ;
smoke_N = mkN "dh-waN"; -- singular masc nouns ending with aN,wN yet to be implemented
snow_N = mkN "brf" feminine ;
stick_N = mkN "ch-Ry" ;
tail_N = mkN "dm" ;
tongue_N = mkN "zban" feminine ;
tooth_N = mkN "dant" masculine;
wife_N = mkN "bywy" ;
wind_N = mkN "Andh-y" ;
wing_N = mkN "pr" ;
worm_N = mkN "grm" ;
year_N = mkN "sal" ;
blow_V = mkV "clna" ;
breathe_V = mkV (mkCmpdVerb (mkN "sans" ) "lyna" ) ;
burn_V = mkV "jlna" ;
dig_V = mkV "kh-wdna" ;
fall_V = mkV "grna" ;
float_V = mkV "tyrna" ;
flow_V = mkV "bhna" ;
fly_V = mkV "aRna" ;
freeze_V = mkV "jmna";
give_V3 = mkV3 (mkV "dyna") "kw" "";
laugh_V = mkV "hnsna" ;
-- lie_N = mkN "jh-wt" masculine ;
-- lie_V = mkV_3 (mkCmpd lie_N "bwlna") (mkCmpd lie_N "bwlwana") ;
-- lie_V = mkV_3 (mkCmpdVerb (mkN "jh-wt" masculine) "bwlna" ) (mkCmpdVerb (mkN "jh-wt" masculine) "bwlwana") ;
lie_V = mkV (mkCmpdVerb (mkN "jh-wt" masculine) "bwlna" );
play_V = mkV "kh-ylna" ;
sew_V = mkV "syna" ;
sing_V = mkV "gana" ;
sit_V = mkV "byTh-na" ;
-- smell_V = regV "smell" ;
-- spit_V = IrregUrd.spit_V ;
-- stand_V = IrregUrd.stand_V ;
swell_V = mkV "swjh-na" ;
swim_V = mkV "tyrna" ;
think_V = mkV "swcna" ;
turn_V = mkV "mRna";
-- vomit_V = regV "vomit" ;
--
bite_V2 = mkV2 (mkV "katna") ;
count_V2 = mkV2 (mkV "gnna") ;
cut_V2 = mkV2 (mkV "katna") ;
fear_V2 = mkV2 (mkV "Drna") ;
fight_V2 = mkV2 (mkV "lRna") ;
hit_V2 = mkV2 (mkV (mkCmpdVerb (mkN "th-wkr" ) "marna" ));
hold_V2 = mkV2 (mkV "pkRna") ;
hunt_V2 = mkV2 (mkV (mkCmpdVerb (mkN "Xkar" ) "krna" ));
kill_V2 = mkV2 (mkV (mkCmpdVerb (mkN "mar" ) "Dalna" )) ;
pull_V2 = mkV2 (mkV "kh-ncna");
-- push_V2 = dirV2 (regV "push") ;
rub_V2 = mkV2 (mkV "rgRna") ;
-- scratch_V2 = dirV2 (regV "scratch") ;
-- split_V2 = dirV2 split_V ;
-- squeeze_V2 = dirV2 (regV "squeeze") ;
-- stab_V2 = dirV2 (regDuplV "stab") ;
suck_V2 = mkV2 (mkV "cwsna") ;
throw_V2 = mkV2 (mkV "ph-ynkna") ;
tie_V2 = mkV2 (mkV "bandh-na") ;
wash_V2 = mkV2 (mkV "dh-wna") ;
-- wipe_V2 = dirV2 (regV "wipe") ;
--
---- other_A = regA "other" ;
--
-- grammar_N = mkN "grammar" ;
language_N = mkN "zban" feminine ;
rule_N = mkN "aSwl" ;
--
---- added 4/6/2007
john_PN = mkPN "jon" ;
question_N = mkN "swal" ;
-- ready_A = regA "ready" ;
reason_N = mkN "wjh" feminine ;
-- today_Adv = mkAdv "today" ;
-- uncertain_A = regA "uncertain" ;
--
--oper
-- aboutP = mkPrep "about" ;
-- atP = mkPrep "at" ;
-- forP = mkPrep "for" ;
-- fromP = mkPrep "from" ;
-- inP = mkPrep "in" ;
-- onP = mkPrep "on" ;
-- toP = mkPrep "to" ;
--
}

196
lib/src/urdu/MorphoUrd.gf Normal file
View File

@@ -0,0 +1,196 @@
--# -path=.:../../prelude
--
----1 A Simple Urdu Resource Morphology
----
---- Aarne Ranta, Shafqat Virk 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 MorphoUrd = ResUrd ** 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 [] ;
--
--
}

136
lib/src/urdu/NounUrd.gf Normal file
View File

@@ -0,0 +1,136 @@
concrete NounUrd of Noun = CatUrd ** open ResUrd, Prelude in {
flags optimize=all_subs ;
lin
DetCN det cn = {
s = \\c => detcn2NP det.s cn c det.n ;
a = agrP3 cn.g det.n
} ;
UsePN pn = {s = \\c => toNP pn.s c ; a = agrP3 pn.g Sg} ;
UsePron p = {s = \\c => np2pronCase p.s c ; a = p.a} ;
PredetNP pred np = {
s = \\c => pred.s ++ np.s ! c ;
a = np.a
} ;
PPartNP np v2 = {
s = \\c => v2.s ! VF Imperf Pers1 Sg Fem ++ np.s ! c ;
a = np.a
} ;
RelNP np rs = {
s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
-- s = \\c => np.s ! c ++ "," ++ rs.s ! np.a ;
a = np.a
} ;
AdvNP np adv = {
s = \\c => np.s ! c ++ adv.s ;
a = np.a
} ;
DetQuantOrd quant num ord = {
s = \\ c => detquant2det quant.s num c ++ ord.s ;
n = Sg
} ;
DetQuant quant num = {
s = \\c => detquant2det quant.s num c;
n = Sg
} ;
DetNP det = {
s = \\c => det2NP det.s c ; ---- case
a = agrP3 Masc Sg
} ;
-- PossPron p = {s = \\_,_,_ => p.s ! PPoss} ;
--
-- NumSg = {s = []; n = Sg} ;
-- NumPl = {s = []; n = Pl} ;
-- NumCard n = n ** {hasCard = True} ;
--
-- NumDigits n = {s = n.s ! NCard ; n = n.n} ;
-- OrdDigits n = {s = n.s ! NOrd} ;
--
-- NumNumeral numeral = {s = numeral.s ! NCard; n = numeral.n} ;
-- OrdNumeral numeral = {s = numeral.s ! NOrd} ;
--
-- AdNum adn num = {s = adn.s ++ num.s ; n = num.n} ;
--
-- OrdSuperl a = {s = a.s ! AAdj Superl} ;
--
-- DetArtOrd art num ord = {
-- s = art.s ! num.hasCard ! num.n ++ num.s ++ ord.s ;
-- n = num.n
-- } ;
--
-- DetArtCard art card = {
-- s = art.s ! True ! card.n ++ card.s ;
-- n = card.n
-- } ;
DetArtSg art cn = {
s = \\c => art.s ++ toNP (cn.s ! Sg) c ;
a = agrP3 cn.g Sg
} ;
DetArtPl art cn = {
s = \\c => art.s ++ toNP (cn.s ! Pl) c ;
a = agrP3 cn.g Pl
} ;
-- DefArt = {s = []} ;
-- IndefArt = {s = []} ;
MassNP cn = {s = \\c => toNP (cn.s ! Sg) c ; a = agrP3 cn.g Sg} ;
UseN n = n ;
UseN2 n = { s = n.s ; g = n.g };
Use2N3 f = {
s = f.s;
g = f.g ;
c2 = f.c2
} ;
Use3N3 f = {
s = f.s ;
g = f.g ;
c2 = f.c2
} ;
-- ComplN2 f x = {s = \\n,c => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c ; g = f.g} ;
ComplN2 f x = {s = \\n,c => case c of {
Dir => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c ;
Obl => x.s ! NPC c ++ f.c2! PP Pl f.g ++ f.s ! n ! c ;
Voc => x.s ! NPC c ++ f.c2! PP (giveNumber x.a) f.g ++ f.s ! n ! c
};
g = f.g;
};
ComplN3 f x = {
s = \\n,c => x.s ! NPObj ++ f.c3 ++ f.s ! n ! Dir ;
g = f.g ;
c2 = f.c2
} ;
AdjCN ap cn = {
s = \\n,c => ap.s ! n ! cn.g ! c ! Posit ++ 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
-- } ;
AdvCN cn ad = {s = \\n,c => cn.s ! n ! c ++ ad.s ; g = cn.g} ;
--
-- SentCN cn sc = {s = \\n,c => cn.s ! n ! c ++ sc.s ; g = cn.g} ;
--
-- ApposCN cn np = {s = \\n,c => cn.s ! n ! Nom ++ np.s ! c ; g = cn.g} ;
--
}

View File

@@ -0,0 +1,95 @@
concrete NumeralUrd of Numeral = CatUrd ** open ResUrd in {
--
--lincat
-- Digit = {s : DForm => CardOrd => Str} ;
-- Sub10 = {s : DForm => CardOrd => Str ; n : Number} ;
-- Sub100 = {s : CardOrd => Str ; n : Number} ;
-- Sub1000 = {s : CardOrd => Str ; n : Number} ;
-- Sub1000000 = {s : CardOrd => Str ; n : Number} ;
--
--lin num x = x ;
--lin n2 = let two = mkNum "two" "twelve" "twenty" "second" in
-- {s = \\f,c => case <f,c> of {
-- <teen,NOrd> => "twelfth" ;
-- _ => two.s ! f ! c
-- }
-- } ;
--
--lin n3 = mkNum "three" "thirteen" "thirty" "third" ;
--lin n4 = mkNum "four" "fourteen" "forty" "fourth" ;
--lin n5 = mkNum "five" "fifteen" "fifty" "fifth" ;
--lin n6 = regNum "six" ;
--lin n7 = regNum "seven" ;
--lin n8 = mkNum "eight" "eighteen" "eighty" "eighth" ;
--lin n9 = mkNum "nine" "nineteen" "ninety" "ninth" ;
--
--lin pot01 = mkNum "one" "eleven" "ten" "first" ** {n = Sg} ;
--lin pot0 d = d ** {n = Pl} ;
--lin pot110 = regCardOrd "ten" ** {n = Pl} ;
--lin pot111 = regCardOrd "eleven" ** {n = Pl} ;
--lin pot1to19 d = {s = d.s ! teen} ** {n = Pl} ;
--lin pot0as1 n = {s = n.s ! unit} ** {n = n.n} ;
--lin pot1 d = {s = d.s ! ten} ** {n = Pl} ;
--lin pot1plus d e = {
-- s = \\c => d.s ! ten ! NCard ++ "-" ++ e.s ! unit ! c ; n = Pl} ;
--lin pot1as2 n = n ;
--lin pot2 d = {s = \\c => d.s ! unit ! NCard ++ mkCard c "hundred"} ** {n = Pl} ;
--lin pot2plus d e = {
-- s = \\c => d.s ! unit ! NCard ++ "hundred" ++ "and" ++ e.s ! c ; n = Pl} ;
--lin pot2as3 n = n ;
--lin pot3 n = {
-- s = \\c => n.s ! NCard ++ mkCard c "thousand" ; n = Pl} ;
--lin pot3plus n m = {
-- s = \\c => n.s ! NCard ++ "thousand" ++ m.s ! c ; n = Pl} ;
--
---- numerals as sequences of digits
--
-- lincat
-- Dig = TDigit ;
--
-- lin
-- IDig d = d ** {tail = T1} ;
--
-- IIDig d i = {
-- s = \\o => d.s ! NCard ++ commaIf i.tail ++ i.s ! o ;
-- n = Pl ;
-- tail = inc i.tail
-- } ;
--
-- D_0 = mkDig "0" ;
-- D_1 = mk3Dig "1" "1st" Sg ;
-- D_2 = mk2Dig "2" "2nd" ;
-- D_3 = mk2Dig "3" "3rd" ;
-- D_4 = mkDig "4" ;
-- D_5 = mkDig "5" ;
-- D_6 = mkDig "6" ;
-- D_7 = mkDig "7" ;
-- D_8 = mkDig "8" ;
-- D_9 = mkDig "9" ;
--
-- oper
-- commaIf : DTail -> Str = \t -> case t of {
-- T3 => "," ;
-- _ => []
-- } ;
--
-- inc : DTail -> DTail = \t -> case t of {
-- T1 => T2 ;
-- T2 => T3 ;
-- T3 => T1
-- } ;
--
-- mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
-- mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ;
--
-- mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
-- s = table {NCard => c ; NOrd => o} ;
-- n = n
-- } ;
--
-- TDigit = {
-- n : Number ;
-- s : CardOrd => Str
-- } ;
--
}

View File

@@ -0,0 +1,613 @@
--# -path=.:../abstract:../../prelude:../common
--
----1 Urdu Lexical Paradigms
resource ParadigmsUrd = open
Predef,
Prelude,
MorphoUrd,
CatUrd
in {
--2 Parameters
oper
masculine : Gender ;
feminine : Gender ;
singular : Number;
plural : Number;
singular = Sg ; plural = Pl;
masculine = Masc ; feminine = Fem ; --i
--2 Nouns
mkN = overload {
mkN : Str -> N
= \s -> regNoun s ** {lock_N = <>} ;
mkN : Str -> Gender -> N
= \s,g -> reggNoun s g ** {lock_N = <>} ;
mkN : (x1,_,_,_,_,x6 : Str) -> Gender -> N
= \sd,so,sv,pd,po,pv,g -> mkNoun sd so sv pd po pv g ** {lock_N = <>} ;
} ;
mkN2 : N -> Prep -> N2;
mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s } ;
--mkN02 : Str -> Noun ;
--mkN02 mrd = let mrdwN = mrd+"wN" ;
-- mrdw = tk 1 mrdwN
-- in mkNoun mrd mrd mrd
-- mrd mrdwN mrdw
-- Masc ;
-- mkPN = overload {
mkPN : Str -> PN = \s -> let n = regNoun s in {s = n.s ! Sg ; g = n.g ; lock_PN = <>} ;
-- mkPN : N -> Gender -> PN = \n,g -> {s = n.s ! Sg ; g = g ; lock_PN = <>} ;
-- } ;
-- personalPN : Pron;
personalPN : Str -> Pron = \s -> let n = makePersPron in {s = n.s ; a = personalAgr ; lock_Pron = <>};
demoPN : Str -> Str -> Str -> Quant = \s1,s2,s3 -> let n = makeDemonPronForm s1 s2 s3 in {s = n.s ; a = defaultAgr ; lock_Quant = <>};
mkDet : Str -> Str -> Str -> Str -> Number -> Det = \s1,s2,s3,s4,nb -> let dt = makeDet s1 s2 s3 s4 nb in {s = dt.s ; n = nb ; lock_Det = <>};
mkIP : (x1,x2,x3:Str) -> Number -> Gender -> IP = \s1,s2,s3,n,g -> let p = mkIntPronForm s1 s2 s3 in { s = p.s ; n = n ; g = g ; lock_IP = <>};
-- mkIP : (x1,x2,x3,x4,x5,x6:Str) -> IP = \s1,s2,s3,s4,s5,s6 -> let n = makeDemPron s1 s2 s3 s4 s5 s6 in { s = n.s ; a = defaultAgr ; lock_IP = <>};
--2 Adjectives
mkA = overload {
mkA : Str-> A
= \s -> regAdjective s ** {lock_A = <>} ;
mkA : Str -> Str -> A2
= \a,c -> let n = regAdjective a in {s = n.s; c2 = c} ** {lock_A2 = <>} ;
-- mkADeg1 : Str -> A
-- = \s -> adjDeg1 s ** {lock_A = <>} ;
-- mkA : (x1,_,x3 : Str) -> A
-- = \msd,m,f -> mkAdjective msd m f ** {lock_A = <>} ;
} ;
--2 Verbs
-- mkV = overload {
mkV : Str -> V
= \s -> mkVerb s ** {lock_V = <>} ;
-- mkV_3 : Str -> Str -> V
-- = \s,t -> mkVerb3 s t ** {lock_V = <>} ;
-- mkV_2 : Str -> Str -> V
-- = \s,c1 -> mkVerb2 s c1 ** {lock_V = <>} ;
-- mkV_1_2 : Str -> Str -> Str -> V
-- = \s,c1,c2 -> mkVerb1_2 s c1 c2 ** {lock_V = <>} ;
-- mkV : (x1,_,_,_,_,_,_,_,_,_,_,_,_,_,x15 : Str) -> V
-- = \inf,stem,ims,imp,ifs,ifp,pms,pmp,pfs,pfp,ss1,ss2,sp2,sp3,r ->
-- mkVerb inf stem ims imp ifs ifp pms pmp pfs pfp ss1 ss2 sp2 sp3 r **
-- {lock_V = <>} ;
-- } ;
mkV2 = overload {
mkV2 : Str -> V2
= \s -> mkVerb s ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ;
mkV2 : V -> V2
= \v -> v ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ;
mkV2 : V -> Str -> V2
= \v,p -> v ** {c2 = {s = p ; c = VTransPost} ; lock_V2 = <>} ;
} ;
--mkV2 = overload {
-- mkV2 : Str -> V2
-- = \s -> mkVerb s ** { lock_V2 = <>} ;
-- mkV2 : V -> V2
-- = \v -> v ** {c2 = {s = [] ; c = VTrans} ; lock_V2 = <>} ;
-- mkV2 : V -> Str -> V2
-- = \v,p -> v ** {c2 = {s = p ; c = VTransPost} ; lock_V2 = <>} ;
-- } ;
-- compund verbs
mkCmpdVerb1 : N -> V -> Str =
\n,v -> n.s ! Sg ! Dir ++ v.s ! Inf ;
mkCmpdVerb = overload {
mkCmpdVerb : N -> Str -> Str
= \n,x -> n.s ! Sg ! Dir ++ x;
};
mkCmpdNoun = overload {
mkCmpdNoun : N -> N -> Str
= \n1,n2 -> n1.s ! Sg ! Dir ++ n2.s ! Sg ! Dir;
};
----3 Compound nouns
----
---- A compound noun is an uninflected string attached to an inflected noun,
---- such as "baby boom", "chief executive officer".
--
-- mkN : Str -> N -> N
-- } ;
--
--
----3 Relational nouns
----
---- Relational nouns ("daughter of x") need a preposition.
--
-- mkN2 : N -> Prep -> N2 ;
--
---- The most common preposition is "of", and the following is a
---- shortcut for regular relational nouns with "of".
--
-- regN2 : Str -> N2 ;
--
---- Use the function $mkPrep$ or see the section on prepositions below to
---- form other prepositions.
----
---- Three-place relational nouns ("the connection from x to y") need two prepositions.
--
mkN3 : N -> Prep -> Str -> N3 ;
--
--
--
----3 Proper names and noun phrases
----
---- Proper names, with a regular genitive, are formed from strings.
--
-- mkPN : overload {
--
-- mkPN : Str -> PN ;
--
---- Sometimes a common noun can be reused as a proper name, e.g. "Bank"
--
-- mkPN : N -> PN
-- } ;
--
--
----2 Adjectives
--
-- mkA : overload {
--
---- For regular adjectives, the adverbial and comparison forms are derived. This holds
---- even for cases with the variations "happy - happily - happier - happiest",
---- "free - freely - freer - freest", and "rude - rudest".
--
-- mkA : (happy : Str) -> A ;
--
---- However, the duplication of the final consonant cannot be predicted,
---- but a separate case is used to give the comparative
--
-- mkA : (fat,fatter : Str) -> A ;
--
---- As many as four forms may be needed.
--
-- mkA : (good,better,best,well : Str) -> A
-- } ;
--
---- To force comparison to be formed by "more - most",
---- the following function is used:
--
-- compoundA : A -> A ; -- -/more/most ridiculous
--
--
--
----3 Two-place adjectives
----
---- Two-place adjectives need a preposition for their second argument.
--
-- mkA2 : A -> Prep -> A2 ;
--
--
--
----2 Adverbs
--
---- Adverbs are not inflected. Most lexical ones have position
---- after the verb. Some can be preverbal (e.g. "always").
--
-- mkAdv : Str -> Adv ;
-- mkAdV : Str -> AdV ;
--
---- Adverbs modifying adjectives and sentences can also be formed.
--
-- mkAdA : Str -> AdA ;
--
----2 Prepositions
----
---- A preposition as used for rection in the lexicon, as well as to
---- build $PP$s in the resource API, just requires a string.
--
mkPrep : Str -> Str -> Str -> Str -> Number -> Prep ;
-- noPrep : Prep ;
--
---- (These two functions are synonyms.)
--
----2 Verbs
----
--
---- Verbs are constructed by the function $mkV$, which takes a varying
---- number of arguments.
--
-- mkV : overload {
--
---- The regular verb function recognizes the special cases where the last
---- character is "y" ("cry-cries" but "buy-buys") or a sibilant
---- ("kiss-"kisses", "jazz-jazzes", "rush-rushes", "munch - munches",
---- "fix - fixes").
--
-- mkV : (cry : Str) -> V ;
--
---- Give the present and past forms for regular verbs where
---- the last letter is duplicated in some forms,
---- e.g. "rip - ripped - ripping".
--
-- mkV : (stop, stopped : Str) -> V ;
--
---- There is an extensive list of irregular verbs in the module $IrregularHin$.
---- In practice, it is enough to give three forms,
---- e.g. "drink - drank - drunk".
--
-- mkV : (drink, drank, drunk : Str) -> V ;
--
---- Irregular verbs with duplicated consonant in the present participle.
--
-- mkV : (run, ran, run, running : Str) -> V ;
--
---- Except for "be", the worst case needs five forms: the infinitive and
---- the third person singular present, the past indicative, and the
---- past and present participles.
--
-- mkV : (go, goes, went, gone, going : Str) -> V
-- };
--
---- Verbs with a particle.
---- The particle, such as in "switch on", is given as a string.
--
-- partV : V -> Str -> V ;
--
---- Reflexive verbs.
---- By default, verbs are not reflexive; this function makes them that.
--
-- reflV : V -> V ;
--
----3 Two-place verbs
----
---- Two-place verbs need a preposition, except the special case with direct object.
---- (transitive verbs). Notice that a particle comes from the $V$.
--
-- mkV2 : overload {
-- mkV2 : V -> Prep -> V2 ; -- believe in
-- mkV2 : V -> V2 -- kill
-- };
--
----3 Three-place verbs
----
---- Three-place (ditransitive) verbs need two prepositions, of which
---- the first one or both can be absent.
--
mkV3 : V -> Str -> Str -> V3;
-- dirV3 : V-> Str -> V3;
-- mkV3 : V -> Prep -> Prep -> V3 ; -- speak, with, about
-- dirV3 : V -> Prep -> V3 ; -- give,_,to
-- dirdirV3 : V -> V3 ; -- give,_,_
--
----3 Other complement patterns
----
---- Verbs and adjectives can take complements such as sentences,
---- questions, verb phrases, and adjectives.
--
-- mkV0 : V -> V0 ;
-- mkVS : V -> VS ;
-- mkV2S : V -> Prep -> V2S ;
-- mkVV : V -> VV ;
mkV2V : V -> Str -> Str -> Bool -> V2V ;
-- mkV2V : V -> Prep -> Prep -> V2V ;
-- mkVA : V -> VA ;
-- mkV2A : V -> Prep -> V2A ;
-- mkVQ : V -> VQ ;
-- mkV2Q : V -> Prep -> V2Q ;
--
-- mkAS : A -> AS ;
-- mkA2S : A -> Prep -> A2S ;
-- mkAV : A -> AV ;
-- mkA2V : A -> Prep -> A2V ;
--
---- Notice: Categories $V0, AS, A2S, AV, A2V$ are just $A$.
---- $V0$ is just $V$; the second argument is treated as adverb.
--
-- V0 : Type ;
-- AS, A2S, AV, A2V : Type ;
--
----.
----2 Definitions of paradigms
----
---- The definitions should not bother the user of the API. So they are
---- hidden from the document.
--
-- Gender = MorphoHin.Gender ;
-- Number = MorphoHin.Number ;
-- Case = MorphoHin.Case ;
-- human = Masc ;
-- nonhuman = Neutr ;
-- masculine = Masc ;
-- feminine = Fem ;
-- singular = Sg ;
-- plural = Pl ;
-- nominative = Nom ;
-- genitive = Gen ;
--
-- Preposition : Type = Str ; -- obsolete
--
-- regN = \ray ->
-- let rays = add_s ray
-- in
-- mk2N ray rays ;
--
--
-- add_s : Str -> Str = \w -> case w of {
-- _ + ("io" | "oo") => w + "s" ; -- radio, bamboo
-- _ + ("s" | "z" | "x" | "sh" | "ch" | "o") => w + "es" ; -- bus, hero
-- _ + ("a" | "o" | "u" | "e") + "y" => w + "s" ; -- boy
-- x + "y" => x + "ies" ; -- fly
-- _ => w + "s" -- car
-- } ;
--
-- mk2N = \man,men ->
-- let mens = case last men of {
-- "s" => men + "'" ;
-- _ => men + "'s"
-- }
-- in
-- mk4N man men (man + "'s") mens ;
--
-- mk4N = \man,men,man's,men's ->
-- mkNoun man man's men men's ** {g = Neutr ; lock_N = <>} ;
--
-- genderN g man = {s = man.s ; g = g ; lock_N = <>} ;
--
-- compoundN s n = {s = \\x,y => s ++ n.s ! x ! y ; g=n.g ; lock_N = <>} ;
--
-- mkPN = overload {
-- mkPN : Str -> PN = regPN ;
-- mkPN : N -> PN = nounPN
-- } ;
--
--
-- mkN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ;
-- regN2 n = mkN2 (regN n) (mkPrep "of") ;
mkN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q} ;
--
----3 Relational common noun phrases
----
---- In some cases, you may want to make a complex $CN$ into a
---- relational noun (e.g. "the old town hall of").
--
-- cnN2 : CN -> Prep -> N2 ;
-- cnN3 : CN -> Prep -> Prep -> N3 ;
--
---- This is obsolete.
-- cnN2 = \n,p -> n ** {lock_N2 = <> ; c2 = p.s} ;
-- cnN3 = \n,p,q -> n ** {lock_N3 = <> ; c2 = p.s ; c3 = q.s} ;
--
-- regPN n = regGenPN n human ;
-- regGenPN n g = nameReg n g ** {g = g ; lock_PN = <>} ;
-- nounPN n = {s = n.s ! singular ; g = n.g ; lock_PN = <>} ;
--
-- mk2A a b = mkAdjective a a a b ** {lock_A = <>} ;
-- regA a = regADeg a ** {lock_A = <>} ;
--
-- mkA2 a p = a ** {c2 = p.s ; lock_A2 = <>} ;
--
-- ADeg = A ; ----
--
-- mkADeg a b c d = mkAdjective a b c d ** {lock_A = <>} ;
--
-- regADeg happy =
-- let
-- happ = init happy ;
-- y = last happy ;
-- happie = case y of {
-- "y" => happ + "ie" ;
-- "e" => happy ;
-- _ => happy + "e"
-- } ;
-- happily : Str = case happy of {
-- _ + "y" => happ + "ily" ;
-- _ + "ll" => happy + "y" ;
-- _ => happy + "ly"
-- } ;
-- in mkADeg happy (happie + "r") (happie + "st") happily ;
--
-- duplADeg fat =
-- mkADeg fat
-- (fat + last fat + "er") (fat + last fat + "est") (fat + "ly") ;
--
-- compoundADeg a =
-- let ad = (a.s ! AAdj Posit)
-- in mkADeg ad ("more" ++ ad) ("most" ++ ad) (a.s ! AAdv) ;
--
-- adegA a = a ;
--
-- mkAdv x = ss x ** {lock_Adv = <>} ;
-- mkAdV x = ss x ** {lock_AdV = <>} ;
-- mkAdA x = ss x ** {lock_AdA = <>} ;
--
mkPrep sgm sgf plm plf n = let p = makePrep sgm sgf plm plf n in { s = p.s ; n = n ; lock_Prep = <>} ;
-- noPrep = mkPrep [] ;
--
-- mk5V a b c d e = mkVerb a b c d e ** {s1 = [] ; lock_V = <>} ;
--
-- regV cry =
-- let
-- cr = init cry ;
-- y = last cry ;
-- cries = (regN cry).s ! Pl ! Nom ; -- !
-- crie = init cries ;
-- cried = case last crie of {
-- "e" => crie + "d" ;
-- _ => crie + "ed"
-- } ;
-- crying = case y of {
-- "e" => case last cr of {
-- "e" => cry + "ing" ;
-- _ => cr + "ing"
-- } ;
-- _ => cry + "ing"
-- }
-- in mk5V cry cries cried cried crying ;
--
-- reg2V fit fitted =
-- let fitt = Predef.tk 2 fitted ;
-- in mk5V fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing") ;
--
-- regDuplV fit =
-- case last fit of {
-- ("a" | "e" | "i" | "o" | "u" | "y") =>
-- Predef.error (["final duplication makes no sense for"] ++ fit) ;
-- t =>
-- let fitt = fit + t in
-- mk5V fit (fit + "s") (fitt + "ed") (fitt + "ed") (fitt + "ing")
-- } ;
--
-- irregV x y z = let reg = (regV x).s in
-- mk5V x (reg ! VPres) y z (reg ! VPresPart) ** {s1 = [] ; lock_V = <>} ;
--
-- irreg4V x y z w = let reg = (regV x).s in
-- mk5V x (reg ! VPres) y z w ** {s1 = [] ; lock_V = <>} ;
--
-- irregDuplV fit y z =
-- let
-- fitting = (regDuplV fit).s ! VPresPart
-- in
-- mk5V fit (fit + "s") y z fitting ;
--
-- partV v p = verbPart v p ** {lock_V = <>} ;
-- reflV v = {s = v.s ; part = v.part ; lock_V = v.lock_V ; isRefl = True} ;
--
-- prepV2 v p = v ** {s = v.s ; s1 = v.s1 ; c2 = p.s ; lock_V2 = <>} ;
-- dirV2 v = prepV2 v noPrep ;
--
mkV3 v p q = v ** { c2 = p ; c3 = q ; lock_V3 = <>} ;
-- mkV3 v p q = v ** {s = v.s ; s1 = v.s1 ; c2 = p.s ; c3 = q.s ; lock_V3 = <>} ;
-- dirV3 v p = mkV3 v noPrep p ;
-- dirdirV3 v = dirV3 v noPrep ;
--
-- mkVS v = v ** {lock_VS = <>} ;
-- mkVV v = {
-- s = table {VVF vf => v.s ! vf ; _ => variants {}} ;
-- isAux = False ; lock_VV = <>
-- } ;
-- mkVQ v = v ** {lock_VQ = <>} ;
--
-- V0 : Type = V ;
---- V2S, V2V, V2Q : Type = V2 ;
-- AS, A2S, AV : Type = A ;
-- A2V : Type = A2 ;
--
-- mkV0 v = v ** {lock_V = <>} ;
-- mkV2S v p = prepV2 v p ** {lock_V2S = <>} ;
mkV2V v s1 s2 b = v ** {isAux = b ; c1 = s1 ; c2 = s2 ; lock_V2V = <>} ;
-- mkV2V v p t = prepV2 v p ** {isAux = False ; lock_V2V = <>} ;
-- mkVA v = v ** {lock_VA = <>} ;
-- mkV2A v p = prepV2 v p ** {lock_V2A = <>} ;
-- mkV2Q v p = prepV2 v p ** {lock_V2Q = <>} ;
--
-- mkAS v = v ** {lock_A = <>} ;
-- mkA2S v p = mkA2 v p ** {lock_A = <>} ;
-- mkAV v = v ** {lock_A = <>} ;
-- mkA2V v p = mkA2 v p ** {lock_A2 = <>} ;
--
--
---- pre-overload API and overload definitions
--
-- mk4N : (man,men,man's,men's : Str) -> N ;
-- regN : Str -> N ;
-- mk2N : (man,men : Str) -> N ;
-- genderN : Gender -> N -> N ;
-- compoundN : Str -> N -> N ;
--
-- mkN = overload {
-- mkN : (man,men,man's,men's : Str) -> N = mk4N ;
-- mkN : Str -> N = regN ;
-- mkN : (man,men : Str) -> N = mk2N ;
-- mkN : Gender -> N -> N = genderN ;
-- mkN : Str -> N -> N = compoundN
-- } ;
--
--
-- mk2A : (free,freely : Str) -> A ;
-- regA : Str -> A ;
--
-- mkA = overload {
-- mkA : Str -> A = regA ;
-- mkA : (fat,fatter : Str) -> A = \fat,fatter ->
-- mkAdjective fat fatter (init fatter + "st") (fat + "ly") ** {lock_A = <>} ;
-- mkA : (good,better,best,well : Str) -> A = \a,b,c,d ->
-- mkAdjective a b c d ** {lock_A = <>}
-- } ;
--
-- compoundA = compoundADeg ;
--
--
-- mk5V : (go, goes, went, gone, going : Str) -> V ;
-- regV : (cry : Str) -> V ;
-- reg2V : (stop, stopped : Str) -> V;
-- irregV : (drink, drank, drunk : Str) -> V ;
-- irreg4V : (run, ran, run, running : Str) -> V ;
--
-- -- Use reg2V instead
-- regDuplV : Str -> V ;
-- -- Use irreg4V instead
-- irregDuplV : (get, got, gotten : Str) -> V ;
--
-- mkV = overload {
-- mkV : (cry : Str) -> V = regV ;
-- mkV : (stop, stopped : Str) -> V = reg2V ;
-- mkV : (drink, drank, drunk : Str) -> V = irregV ;
-- mkV : (run, ran, run, running : Str) -> V = irreg4V ;
-- mkV : (go, goes, went, gone, going : Str) -> V = mk5V
-- };
--
-- prepV2 : V -> Prep -> V2 ;
-- dirV2 : V -> V2 ;
--
-- mkV2 = overload {
-- mkV2 : V -> Prep -> V2 = prepV2;
-- mkV2 : V -> V2 = dirV2
-- };
--
--
------ obsolete
--
---- Comparison adjectives may two more forms.
--
-- ADeg : Type ;
--
-- mkADeg : (good,better,best,well : Str) -> ADeg ;
--
---- The regular pattern recognizes two common variations:
---- "-e" ("rude" - "ruder" - "rudest") and
---- "-y" ("happy - happier - happiest - happily")
--
-- regADeg : Str -> ADeg ; -- long, longer, longest
--
---- However, the duplication of the final consonant is nor predicted,
---- but a separate pattern is used:
--
-- duplADeg : Str -> ADeg ; -- fat, fatter, fattest
--
---- If comparison is formed by "more", "most", as in general for
---- long adjective, the following pattern is used:
--
-- compoundADeg : A -> ADeg ; -- -/more/most ridiculous
--
---- From a given $ADeg$, it is possible to get back to $A$.
--
-- adegA : ADeg -> A ;
--
--
-- regPN : Str -> PN ;
-- regGenPN : Str -> Gender -> PN ; -- John, John's
--
---- Sometimes you can reuse a common noun as a proper name, e.g. "Bank".
--
-- nounPN : N -> PN ;
--
--
--
}

25
lib/src/urdu/PhraseUrd.gf Normal file
View File

@@ -0,0 +1,25 @@
concrete PhraseUrd of Phrase = CatUrd ** open Prelude, ResUrd in {
lin
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
UttS s = s ;
UttQS qs = {s = qs.s ! QDir} ;
UttImpSg pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg False} ;
UttImpPl pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Pl False} ;
UttImpPol pol imp = {s = pol.s ++ imp.s ! contrNeg True pol.p ! ImpF Sg True} ;
UttIP ip = {s = ip.s ! Dir} ; --- Acc also
UttIAdv iadv = iadv ;
UttNP np = {s = np.s ! NPC Dir} ;
UttVP vp = {s = infVP False vp (agrP3 Masc Sg)} ;
UttAdv adv = adv ;
UttCN cn = {s = cn.s ! Sg ! Dir};
NoPConj = {s = []} ;
PConjConj conj = {s = conj.s2} ; ---
NoVoc = {s = []} ;
VocNP np = {s = np.s ! NPC Dir} ;
}

View File

@@ -0,0 +1,69 @@
concrete QuestionUrd of Question = CatUrd ** open ResUrd, Prelude in {
--
flags optimize=all_subs ;
lin
QuestCl cl = {
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! OQuest;
QIndir => "agr" ++ cl.s ! t! p ! ODir
}
};
QuestVP qp vp =
let cl = mkSClause (qp.s ! Dir) (Ag qp.g qp.n Pers3_Near) vp;
cl2 = mkSClause (qp.s ! Obl ++ "nE" ) (Ag qp.g Sg Pers3_Near) vp
-- in {s = \\t,p,o => cl.s ! t ! p ! ODir} ;
in { s = \\t,p,o => case t of {
VPImpPast => cl2.s ! t ! p ! ODir;
_ => cl.s ! t ! p ! ODir
}
};
-- QuestSlash ip slash =
-- mkQuestion (ss (slash.c2 ++ ip.s ! Acc)) slash ;
-- --- stranding in ExratHin
QuestIAdv iadv cl = {
s = \\t,p,_ => iadv.s ++ cl.s ! t ! p ! ODir;
};
QuestIComp icomp np =
let cl = mkSClause (np.s ! NPC Dir ++ icomp.s) np.a (predAux auxBe);
in {
s = \\t,p,qf => case qf of {
QDir => cl.s ! t ! p ! ODir;
QIndir => cl.s ! t! p ! ODir
}
};
PrepIP p ip = {s = ip.s ! Voc ++ p.s ! PP ip.n ip.g } ;
AdvIP ip adv = {
s = \\c => adv.s ++ ip.s ! c ;
n = ip.n;
g = ip.g;
} ;
IdetCN idet cn = {
s = \\c => idet.s ! cn.g ++ cn.s ! idet.n ! c ;
g = cn.g;
n = idet.n;
} ;
IdetIP idet = {
s = \\_ => idet.s ! Masc ;
n = idet.n;
g = Masc;
} ;
-- IdetQuant idet num = {
-- s = idet.s ! num.n ++ num.s ;
-- n = num.n
-- } ;
--
CompIAdv a = a ;
CompIP p = ss (p.s ! Dir) ;
}

View File

@@ -0,0 +1,70 @@
concrete RelativeUrd of Relative = CatUrd ** open ResUrd in {
flags optimize=all_subs ;
lin
RelCl cl = {
s = \\t,p,o,agr => case <t,giveNumber agr> of {
<VPImpPast,Sg> => "js" ++ cl.s ! t ! p ! o ;
<VPImpPast,Pl> => "jn" ++ cl.s ! t ! p ! o ;
<_,_> => "jw" ++ cl.s ! t ! p ! o
};
c = Dir
} ;
RelVP rp vp = {
s = \\t,p,o,ag =>
let
agr = case rp.a of {
RNoAg => ag ;
RAg a => a
} ;
cl = mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp;
-- cl = case t of {
-- VPImpPast => mkSClause (rp.s ! (giveNumber agr) ! Obl) agr vp;
-- _ => mkSClause (rp.s ! (giveNumber agr) ! Dir) agr vp
-- };
in
cl.s ! t ! p ! ODir ;
c = Dir
} ;
--
---- Pied piping: "at which we are looking". Stranding and empty
---- relative are defined in $ExtraHin.gf$ ("that we are looking at",
---- "we are looking at").
--
RelSlash rp slash = {
s = \\t,p,o,agr => rp.s ! (giveNumber agr) ! Dir ++ slash.c2.s ++ slash.s ! t ! p ! o ;--case t of {
-- VPImpPast => rp.s ! (giveNumber agr) Obl ++ slash.c2.s ++ slash.s ! t ! p ! o ;
-- _ => rp.s ! (giveNumber agr) Dir ++ slash.c2.s ++ slash.s ! t ! p ! o
-- };
c = Dir
} ;
FunRP p np rp = {
s = \\n,c => rp.s ! n ! c ++ np.s ! NPC c ++ p.s ! PP n (giveGender np.a) ;
a = RAg np.a
} ;
IdRP = {
s = table {
Sg => table {
Dir => "jw" ;
Obl => "js" ;
Voc => "js"
};
Pl => table {
Dir => "jw" ;
Obl => "jn" ;
Voc => "jn"
}
-- RPrep Neutr => "jn" ;
-- RPrep _ => "whom"
};
a = RNoAg
} ;
}

1304
lib/src/urdu/ResUrd.gf Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,97 @@
concrete SentenceUrd of Sentence = CatUrd ** open Prelude, ResUrd in {
flags optimize=all_subs ;
lin
PredVP np vp = mkClause np vp ;
-- PredVP np vp = np.s!NPC Sg Pers1 Dir ++ vp.s ! Pat1 Inf1 ;
PredSCVP sc vp = mkSClause sc.s (defaultAgr) vp ;
--
-- ImpVP vp = {
-- s = \\pol,n =>
-- let
-- agr = AgP2 (numImp n) ;
-- verb = infVP True vp agr ;
-- dont = case pol of {
-- CNeg True => "don't" ;
-- CNeg False => "do" ++ "not" ;
-- _ => []
-- }
-- in
-- dont ++ verb
-- } ;
--
SlashVP np vp =
mkClause np vp ** {c2 = vp.c2} ;
AdvSlash slash adv = {
s = \\t,p,o => adv.s ++ slash.s ! t ! p ! o ;
-- s = \\t,a,b,o => slash.s ! t ! a ! b ! o ++ adv.s ;
c2 = slash.c2
} ;
--
SlashPrep cl prep = cl ** {c2 = { s = prep.s ! PP Sg Masc ; c = VIntrans}} ;
--
-- SlashVS np vs slash =
-- mkClause (np.s ! Nom) np.a
-- (insertObj (\\_ => conjThat ++ slash.s) (predV vs)) **
-- {c2 = slash.c2} ;
EmbedS s = {s = conjThat ++ s.s} ;
EmbedQS qs = {s = qs.s ! QIndir} ;
EmbedVP vp = {s = infVP False vp defaultAgr} ; --- agr
UseCl temp p cl =
{ s = case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPGenPres ! p.p ! ODir;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfPres ! p.p ! ODir;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPImpPast ! p.p ! ODir;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfPast ! p.p ! ODir;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VPFut ! p.p ! ODir;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfFut ! p.p ! ODir;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VPContPres ! p.p ! ODir;
<Cond,Anter> => temp.s ++ p.s ++ cl.s ! VPContPast ! p.p ! ODir
};
} ;
UseQCl temp p cl = {
s = \\q => case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ cl.s ! VPGenPres ! p.p ! q;
<Pres,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfPres ! p.p ! q;
<Past,Simul> => temp.s ++ p.s ++ cl.s ! VPImpPast ! p.p ! q;
<Past,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfPast ! p.p ! q;
<Fut,Simul> => temp.s ++ p.s ++ cl.s ! VPFut ! p.p ! q;
<Fut,Anter> => temp.s ++ p.s ++ cl.s ! VPPerfFut ! p.p ! q;
<Cond,Simul> => temp.s ++ p.s ++ cl.s ! VPContPres ! p.p ! q;
<Cond,Anter> => temp.s ++ p.s ++ cl.s ! VPContPast ! p.p ! q
};
} ;
UseRCl temp p rcl = {
s = \\q => case <temp.t,temp.a> of {
<Pres,Simul> => temp.s ++ p.s ++ rcl.s ! VPGenPres ! p.p ! ODir ! q;
<Pres,Anter> => temp.s ++ p.s ++ rcl.s ! VPPerfPres ! p.p ! ODir ! q;
<Past,Simul> => temp.s ++ p.s ++ rcl.s ! VPImpPast ! p.p ! ODir ! q;
<Past,Anter> => temp.s ++ p.s ++ rcl.s ! VPPerfPast ! p.p ! ODir ! q;
<Fut,Simul> => temp.s ++ p.s ++ rcl.s ! VPFut ! p.p ! ODir ! q;
<Fut,Anter> => temp.s ++ p.s ++ rcl.s ! VPPerfFut ! p.p ! ODir ! q;
<Cond,Simul> => temp.s ++ p.s ++ rcl.s ! VPContPres ! p.p ! ODir ! q;
<Cond,Anter> => temp.s ++ p.s ++ rcl.s ! VPContPast ! p.p ! ODir ! q
};
c = rcl.c
} ;
-- UseSlash t a p cl = {
-- s = t.s ++ a.s ++ p.s ++ cl.s ! t.t ! a.a ! ctr p.p ! ODir ;
-- c2 = cl.c2
-- } ;
--
AdvS a s = {s = a.s ++ "," ++ s.s} ;
--
-- RelS s r = {s = s.s ++ "," ++ r.s ! agrP3 Sg} ;
--
-- oper
-- ctr = contrNeg True ; -- contracted negations
}

View File

@@ -0,0 +1,137 @@
concrete StructuralUrd of Structural = CatUrd **
open MorphoUrd, ParadigmsUrd, Prelude in {
flags optimize=all ;
lin
-- above_Prep = ss "awpr" ;
-- after_Prep = ss "after" ;
all_Predet = ss "tmam" ;
almost_AdA, almost_AdN = ss "tqryba" ;
although_Subj = ss "agrch-" ;
always_AdV = ss "hmyXh" ;
and_Conj = sd2 [] "awr" ** {n = Pl} ;
-----b and_Conj = ss "and" ** {n = Pl} ;
because_Subj = ss "kywnkh-" ;
-- before_Prep = ss "before" ;
-- behind_Prep = ss "behind" ;
-- between_Prep = ss "between" ;
both7and_DConj = sd2 "dwnwN" "awr" ** {n = Pl} ;
but_PConj = ss "lykn" ;
-- by8agent_Prep = ss "by" ;
-- by8means_Prep = ss "by" ;
can_VV = mkV "skna" ** { isAux = True} ;
-- can8know_VV, can_VV = {
-- s = table {
-- VVF VInf => ["be able to"] ;
-- VVF VPres => "can" ;
-- VVF VPPart => ["been able to"] ;
-- VVF VPresPart => ["being able to"] ;
-- VVF VPast => "could" ; --# notpresent
-- VVPastNeg => "couldn't" ; --# notpresent
-- VVPresNeg => "can't"
-- } ;
-- isAux = True
-- } ;
-- during_Prep = ss "during" ;
either7or_DConj = sd2 "kwy ayk" "or" ** {n = Sg} ;
-- everybody_NP = regNP "everybody" Sg ;
every_Det = mkDet "hr" "hr" "hr" "hr" Sg;
-- everything_NP = regNP "everything" Sg ;
everywhere_Adv = ss "hr jgh" ;
few_Det = mkDet "cnd" "cnd" "cnd" "cnd" Pl ;
first_Ord = ss "pehla" ; --DEPRECATED
-- for_Prep = ss "for" ;
-- from_Prep = ss "from" ;
-- he_Pron = personalPronoun P3 Sg ** {a = Ag Masc Sg P3} ;
here_Adv = ss "yhaN" ;
here7to_Adv = ss ["yhaN pr"] ;
here7from_Adv = ss ["yhaN sE"] ;
how_IAdv = ss "how" ;
how8many_IDet = makeIDet "ktnE" "ktny" Pl ;
if_Subj = ss "if" ;
-- in8front_Prep = ss ["in front of"] ;
i_Pron = personalPN "myN";
-- i_Pron = personalPronoun P1 Sg ** {a = Ag Masc Sg P1} ;
-- in_Prep = ss "meN" ;
-- it_Pron = mkNP "it" "it" "its" Sg P3 Neutr ;
less_CAdv = {s = "km" ; p = ""} ;
many_Det = mkDet "bht zyadh" "bht zyadh" "bht zyadh" "bht zyadh" Pl ;
-- more_CAdv = ss "zyadh-" ;
most_Predet = ss "zyadh tr" ;
much_Det = mkDet "bht" "bht" "bht" "bht" Sg ;
-- must_VV = {
-- s = table {
-- VVF VInf => ["have to"] ;
-- VVF VPres => "must" ;
-- VVF VPPart => ["had to"] ;
-- VVF VPresPart => ["having to"] ;
-- VVF VPast => ["had to"] ; --# notpresent
-- VVPastNeg => ["hadn't to"] ; --# notpresent
-- VVPresNeg => "mustn't"
-- } ;
-- isAux = True
-- } ;
-----b no_Phr = ss "no" ;
no_Utt = ss "nhyN" ;
-- on_Prep = ss "on" ;
------ one_Quant = mkDeterminer Sg "one" ; -- DEPRECATED
only_Predet = ss "srf" ;
-- or_Conj = sd2 [] "or" ** {n = Sg} ;
-- otherwise_PConj = ss "othewise" ;
-- part_Prep = ss "of" ;
please_Voc = ss "mhrbani" ;
-- possess_Prep = ss "of" ;
quite_Adv = ss "khamosh" ;
-- she_Pron = mkNP "she" "her" "her" Sg P3 Fem ;
so_AdA = ss "so" ;
-- somebody_NP = regNP "somebody" Sg ;
someSg_Det = mkDet "kch-" "kch-" "kch-" "kch-" Sg ;
somePl_Det = mkDet "kch-" "kch-" "kch-" "kch-" Pl ;
-- something_NP = regNP "something" Sg ;
somewhere_Adv = ss "khin pr" ;
-- that_Quant = mkQuant "that" "those" ;
there_Adv = ss "whaN" ;
there7to_Adv = ss "whaN pr" ;
-- there7from_Adv = ss ["from there"] ;
-- therefore_PConj = ss "therefore" ;
-- they_Pron = mkNP "they" "them" "their" Pl P3 Masc ; ----
this_Quant = demoPN "yh" "as" "an";
that_Quant = demoPN "wh" "us" "un";
-- this_Quant = mkQuant "this" "these" ;
-- through_Prep = ss "through" ;
too_AdA = ss "bht" ;
-- to_Prep = ss "to" ;
-- under_Prep = ss "under" ;
very_AdA = ss "bht" ;
want_VV = mkV "cahna" ** { isAux = True} ;
-- want_VV = P.mkVV (P.regV "want") ;
-- we_Pron = personalPronoun P1 Pl ** {a = Ag Masc Pl P1} ;
-- whatPl_IP = makeIntPronForm;
whatSg_IP = mkIP "kya" "kis" "kis" Sg Masc ;
whatPl_IP = mkIP "kya" "kin" "kin" Pl Masc ;
-- when_IAdv = ss "when" ;
-- when_Subj = ss "when" ;
where_IAdv = ss "khaN" ;
-- which_IQuant = {s = \\_ => "which"} ;
-- whichPl_IDet = makeDet "kwn sa" "kwon sy" "kwn sE" "kwn sy" ;
-- whichSg_IDet = makeDet "kwn sa" "kwon sy" "kwn sE" "kwn sy" ;
whoSg_IP = mkIP "kwn" "kis" "kis" Sg Masc ;
whoPl_IP = mkIP "kwn" "kn" "knhwN" Pl Masc ;
-- why_IAdv = ss "why" ;
-- without_Prep = ss "without" ;
with_Prep = makePrep "kE sath-" "kE sath-" "kE sath-" "kE sath-" Sg ;
-----b yes_Phr = ss "yes" ;
yes_Utt = ss "haN" ;
-- youSg_Pron = mkNP "you" "you" "your" Sg P2 Masc ;
-- youPl_Pron = mkNP "you" "you" "your" Pl P2 Masc ;
-- youPol_Pron = mkNP "you" "you" "your" Sg P2 Masc ;
--
--
oper
mkQuant : Str -> Str -> {s : Number => Str} = \x,y -> {
s = table Number [x ; y]
} ;
}

42
lib/src/urdu/VerbUrd.gf Normal file
View File

@@ -0,0 +1,42 @@
concrete VerbUrd of Verb = CatUrd ** open ResUrd in {
flags optimize=all_subs ;
lin
UseV v = predV v ;
SlashV2a v = predV v ** {c2 = v.c2} ;
Slash2V3 v np =
insertObjc (\\_ => np.s ! NPObj ++ v.c3 ) (predV v ** {c2 = {s = v.c2 ; c = VTrans}}) ;
Slash3V3 v np =
insertObjc (\\_ => np.s ! NPObj ++ v.c2) (predV v ** {c2 = {s = v.c3 ; c = VTrans}}) ;
ComplVV v vp = insertObj (\\a => infVP v.isAux vp a) (predV v) ;
-- ComplVS v s = insertObj (\\_ => conjThat ++ s.s) (predV v) ;
-- ComplVQ v q = insertObj (\\_ => q.s ! QIndir) (predV v) ;
ComplVA v ap = insertObj (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v) ;
SlashV2V v vp = insertObjc (\\a => infVP v.isAux vp a) (predVc v) ;
-- SlashV2S v s = insertObjc (\\_ => conjThat ++ s.s) (predVc v) ;
-- SlashV2Q v q = insertObjc (\\_ => q.s ! QIndir) (predVc v) ;
SlashV2A v ap = insertObjc (\\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit) (predV v ** {c2 = {s = "kw" ; c = VTrans}}) ; ----
ComplSlash vp np = insertObject np vp ;
SlashVV vv vp =
insertObj (\\a => infVP vv.isAux vp a) (predV vv) **
{c2 = vp.c2} ;
SlashV2VNP vv np vp =
insertObjPre (\\_ => np.s ! NPObj )
(insertObjc (\\a => infVP vv.isAux vp a) (predVc vv)) **
{c2 = vp.c2} ;
UseComp comp = insertObj comp.s (predAux auxBe) ;
AdvVP vp adv = insertObj (\\_ => adv.s) vp ;
AdVVP adv vp = insertAdV adv.s vp ;
-- ReflVP v = insertObjPre (\\a => v.c2 ++ reflPron ! a) v ;
-- PassV2 v = insertObj (\\_ => v.s ! VPPart) (predAux auxBe) ;
CompAP ap ={s = \\a => ap.s ! giveNumber a ! giveGender a ! Dir ! Posit } ;
CompNP np = {s = \\_ => np.s ! NPObj} ;
CompAdv a = {s = \\_ => a.s} ;
}