Punjabi morphology from Humayoun

This commit is contained in:
aarne
2010-11-04 17:03:19 +00:00
parent e745881e4a
commit 0c8944781b
12 changed files with 28196 additions and 3 deletions

View File

@@ -1,6 +1,26 @@
--# -path=.:alltenses
concrete DemoGer of Demo = LangGer **
concrete DemoGer of Demo = LangGer - [
PredetNP, PPartNP, AdvNP, RelNP, DetNP, DetQuantOrd,
NumDigits, AdNum, OrdDigits, OrdNumeral, OrdSuperl, MassNP,
ComplN2, ComplN3, UseN2, Use2N3, Use3N3, AdjCN, RelCN,
AdvCN, SentCN, ApposCN,
PassV2, CompAdv,
-- CompNP,
SlashV2V, SlashV2VNP, ---
ComparA, ComplA2, ReflA2, UseA2, UseComparA, CAdvAP, AdjOrd, SentAP, AdAP,
PredSCVP, AdvSlash, SlashPrep, SlashVS,
EmbedS, EmbedQS, EmbedVP, UseSlash, AdvS, RelS,
CompIP,
PConjConj, VocNP, UttVP,
FunRP,
nothing_NP, nobody_NP, please_Voc, otherwise_PConj, therefore_PConj, but_PConj,
language_title_Utt, whatPl_IP, whoPl_IP, if_then_Conj, either7or_DConj,
both7and_DConj, much_Det, that_Subj, no_Quant,
ImpersCl, GenericCl, CleftNP, CleftAdv, ProgrVP, ImpPl1, ImpP3,
-- ExistNP, ---
ConsNP, ConsAdv, ConsS, ConsRS, ConsAP
] **
open LangGer in {
lin

View File

@@ -10,8 +10,12 @@ NoVoc 0.98
PredVP 0.9
DetCN 0.7
UsePron 0.2
DetCN 0.8
UsePron 0.1
something_NP 0.01
somebody_NP 0.01
everything_NP 0.01
everybody_NP 0.01
SlashV2 0.8
@@ -30,3 +34,6 @@ PPos 0.7
ApposCN 0.01
ExistNP 0.0001
UseCopula 0.01
ConjS 0.1

217
lib/src/punjabi/index.html Normal file
View File

@@ -0,0 +1,217 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META NAME="generator" CONTENT="http://txt2tags.sf.net">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<LINK REL="stylesheet" TYPE="text/css" HREF="css/modernL.css">
<TITLE>Punjabi Resources in Shahmukhi script</TITLE>
</HEAD>
<BODY>
<DIV CLASS="header" ID="header">
<H1>Punjabi Resources in Shahmukhi script</H1>
<H2>2010</H2>
<H3>Muhammad Humayoun &lt;humayoun{@}gmail.com&gt;</H3>
</DIV>
<DIV CLASS="toc" ID="toc">
<UL>
<LI><A HREF="#toc1">Introduction</A>
<LI><A HREF="#toc2">Resources</A>
<LI><A HREF="#toc3">Running Morphology</A>
</UL>
</DIV>
<DIV CLASS="body" ID="body">
<A NAME="toc1"></A>
<H1>Introduction</H1>
<P>
Welcome to the homepage of Punjabi resources in Shahmukhi script. These resources are reported in the following publication and made available under <A HREF="downloads/gpl.txt">GNU General Public License</A>.
</P>
<UL>
<LI>M. Humayoun and A. Ranta. <B>Developing Punjabi Morphology, Corpus and Lexicon.</B> <I>The 24th Pacific Asia conference on Language, Information and Computation</I> (<A HREF="http://www.compling.jp/paclic24/">http://www.compling.jp/paclic24/</A>). <A HREF="downloads/Punjabi-paper-paclic24.pdf">draft</A>
</UL>
<A NAME="toc2"></A>
<H1>Resources</H1>
<UL>
<LI>An implementation of inflectional morphology for Punjabi in <A HREF="http://www.grammaticalframework.org/">GF</A>. <A HREF="morphology">Online browsing</A> or <A HREF="downloads/morphology.zip">download zip</A>
</UL>
<UL>
<LI>A corpus containing 0.9 million words (941,284), which is collected partly from Wikipedia. <A HREF="downloads/literature-wikipedia.corpus.sentence.uniq.sorted">view text</A> or <A HREF="downloads/literature-wikipedia.corpus.sentence.uniq.sorted.zip">download zip</A>
<P></P>
<LI>A lexicon of 13,600 words (named entities:63%, lemmas of inflected words:37%; a lemma is also known as a dictionary form or a base form) <A HREF="downloads/punjabi.shahmukhi.lexicon">view text</A> or <A HREF="downloads/punjabi.shahmukhi.lexicon.zip">download zip</A>. The paradigms are defined in the paper, but a detailed version with examples can be found <A HREF="downloads/Paradigms.pdf">here</A>.
<P></P>
<LI>Frequency list for Punjabi. <A HREF="downloads/literature-wikipedia.corpus.fqlist">view text</A> or <A HREF="downloads/literature-wikipedia.corpus.fqlist.zip">download zip</A>
</UL>
<A NAME="toc3"></A>
<H1>Running Morphology</H1>
<P>
First you need to install <A HREF="http://www.grammaticalframework.org/download/index.html">Grammatical Framework (GF)</A> first.
Instructions to install could be found <A HREF="http://www.grammaticalframework.org/download/index.html">here</A>.
</P>
<P>
Now to run morphology, after unzipping <CODE>morphology.zip</CODE>, run following commands in console:
</P>
<PRE>
cd morphology
gf MainPnb.gf
ma "پینا"
</PRE>
<P></P>
<P>
where ma stands for morphological analysis and <CODE>MainPnb.gf</CODE> is the main file.
</P>
<P>
To see a complete paradigm do following:
</P>
<PRE>
gf MainPnb.gf
i -retain MorphoPnb.gf
cc mkAdj1 "بَھیڑا"
</PRE>
<P></P>
<P>
The result will be as followed:
</P>
<PRE>
variants {variants {{s : ResPnb.Gender =&gt; ResPnb.Number =&gt; ResPnb.Case =&gt; Str
= table ResPnb.Gender {
ResPnb.Masc =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑا";
ResPnb.Obl =&gt; "بَھیڑے";
ResPnb.Voc =&gt; "بَھیڑیا";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑے";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
};
ResPnb.Fem =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑی";
ResPnb.Voc =&gt; "بَھیڑی";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
}
}};
{s : ResPnb.Gender =&gt; ResPnb.Number =&gt; ResPnb.Case =&gt; Str
= table ResPnb.Gender {
ResPnb.Masc =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑا";
ResPnb.Obl =&gt; "بَھیڑے";
ResPnb.Voc =&gt; "بَھیڑے";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑے";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
};
ResPnb.Fem =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑی";
ResPnb.Voc =&gt; "بَھیڑی";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
}
}}};
variants {{s : ResPnb.Gender =&gt; ResPnb.Number =&gt; ResPnb.Case =&gt; Str
= table ResPnb.Gender {
ResPnb.Masc =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑا";
ResPnb.Obl =&gt; "بَھیڑے";
ResPnb.Voc =&gt; "بَھیڑیا";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑے";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
};
ResPnb.Fem =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑی";
ResPnb.Voc =&gt; "بَھیڑیے";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
}
}};
{s : ResPnb.Gender =&gt; ResPnb.Number =&gt; ResPnb.Case =&gt; Str
= table ResPnb.Gender {
ResPnb.Masc =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑا";
ResPnb.Obl =&gt; "بَھیڑے";
ResPnb.Voc =&gt; "بَھیڑے";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑے";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
};
ResPnb.Fem =&gt; table ResPnb.Number {
ResPnb.Sg =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑی";
ResPnb.Voc =&gt; "بَھیڑیے";
ResPnb.Abl =&gt; "بَھیڑیوں"
};
ResPnb.Pl =&gt; table ResPnb.Case {
ResPnb.Dir =&gt; "بَھیڑی";
ResPnb.Obl =&gt; "بَھیڑیاں";
ResPnb.Voc =&gt; "بَھیڑیو";
ResPnb.Abl =&gt; []
}
}
}}}}
</PRE>
<P></P>
<P>
Please send your feedback and suggestions at <I>humayoun{@}gmail.com</I>
</P>
<HR NOSHADE SIZE=1>
<P>
Last update: Tue Nov 2 19:01:42 2010
</P>
</DIV>
<!-- html code generated by txt2tags 2.5 (http://txt2tags.sf.net) -->
<!-- cmdline: txt2tags -t html -\-toc index.txt -->
</BODY></HTML>

195
lib/src/punjabi/index.txt Normal file
View File

@@ -0,0 +1,195 @@
Punjabi Resources in Shahmukhi script
2010
Muhammad Humayoun <humayoun{@}gmail.com>
%!target:html
%!options(html): --toc
%!options(html): --css-sugar --style css/modernL.css
%!encoding:utf-8
%%%%%txt2tags -t html --toc index.txt
= Introduction =
Welcome to the homepage of Punjabi resources in Shahmukhi script. These resources are reported in the following publication and made available under [GNU General Public License downloads/gpl.txt].
- M. Humayoun and A. Ranta. **Developing Punjabi Morphology, Corpus and Lexicon.** //The 24th Pacific Asia conference on Language, Information and Computation// (http://www.compling.jp/paclic24/). [draft downloads/Punjabi-paper-paclic24.pdf]
= Resources =
- An implementation of inflectional morphology for Punjabi in [GF http://www.grammaticalframework.org/]. [Online browsing morphology] or [download zip downloads/morphology.zip]
- A corpus containing 0.9 million words (941,284), which is collected partly from Wikipedia. [view text downloads/literature-wikipedia.corpus.sentence.uniq.sorted] or [download zip downloads/literature-wikipedia.corpus.sentence.uniq.sorted.zip]
- A lexicon of 13,600 words (named entities:63%, lemmas of inflected words:37%; a lemma is also known as a dictionary form or a base form) [view text downloads/punjabi.shahmukhi.lexicon] or [download zip downloads/punjabi.shahmukhi.lexicon.zip]. The paradigms are defined in the paper, but a detailed version with examples can be found [here downloads/Paradigms.pdf].
- Frequency list for Punjabi. [view text downloads/literature-wikipedia.corpus.fqlist] or [download zip downloads/literature-wikipedia.corpus.fqlist.zip]
= Running Morphology =
First you need to install [Grammatical Framework (GF) http://www.grammaticalframework.org/download/index.html] first.
Instructions to install could be found [here http://www.grammaticalframework.org/download/index.html].
Now to run morphology, after unzipping ``morphology.zip``, run following commands in console:
```
cd morphology
gf MainPnb.gf
ma "پینا"
```
where ma stands for morphological analysis and ``MainPnb.gf`` is the main file.
To see a complete paradigm do following:
```
gf MainPnb.gf
i -retain MorphoPnb.gf
cc mkAdj1 "بَھیڑا"
```
The result will be as followed:
```
variants {variants {{s : ResPnb.Gender => ResPnb.Number => ResPnb.Case => Str
= table ResPnb.Gender {
ResPnb.Masc => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑا";
ResPnb.Obl => "بَھیڑے";
ResPnb.Voc => "بَھیڑیا";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑے";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
};
ResPnb.Fem => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑی";
ResPnb.Voc => "بَھیڑی";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
}
}};
{s : ResPnb.Gender => ResPnb.Number => ResPnb.Case => Str
= table ResPnb.Gender {
ResPnb.Masc => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑا";
ResPnb.Obl => "بَھیڑے";
ResPnb.Voc => "بَھیڑے";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑے";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
};
ResPnb.Fem => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑی";
ResPnb.Voc => "بَھیڑی";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
}
}}};
variants {{s : ResPnb.Gender => ResPnb.Number => ResPnb.Case => Str
= table ResPnb.Gender {
ResPnb.Masc => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑا";
ResPnb.Obl => "بَھیڑے";
ResPnb.Voc => "بَھیڑیا";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑے";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
};
ResPnb.Fem => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑی";
ResPnb.Voc => "بَھیڑیے";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
}
}};
{s : ResPnb.Gender => ResPnb.Number => ResPnb.Case => Str
= table ResPnb.Gender {
ResPnb.Masc => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑا";
ResPnb.Obl => "بَھیڑے";
ResPnb.Voc => "بَھیڑے";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑے";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
};
ResPnb.Fem => table ResPnb.Number {
ResPnb.Sg => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑی";
ResPnb.Voc => "بَھیڑیے";
ResPnb.Abl => "بَھیڑیوں"
};
ResPnb.Pl => table ResPnb.Case {
ResPnb.Dir => "بَھیڑی";
ResPnb.Obl => "بَھیڑیاں";
ResPnb.Voc => "بَھیڑیو";
ResPnb.Abl => []
}
}
}}}}
```
Please send your feedback and suggestions at //humayoun{@}gmail.com//
-------------------------------------
Last update: %%date(%c)

View File

@@ -0,0 +1,14 @@
abstract Cat = {
cat
N ;
PN ;
V1 ;
V4 ;
Adj1 ;
Adj2 ;
Adj3 ;
Adv ;
SMonth ;
} ;

View File

@@ -0,0 +1,17 @@
--# -path=.:prelude
concrete CatPnb of Cat = open ResPnb, Prelude in {
flags coding=utf8 ; optimize=all_subs;
lincat
N = Noun ;
PN = {s:Str} ;
V1 = Verb1 ;
V4 = Verb4 ;
Adj1 = Adjective1 ;
Adj2 = Adjective2 ;
Adj3 = {s:Str} ;
Adv = {s:Str} ;
SMonth = {s:Str} ;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
abstract Main =
Cat,
Lexicon
**{ } ;

View File

@@ -0,0 +1,6 @@
--# -path=.:prelude
concrete MainPnb of Main =
LexiconPnb
** {
flags coding=utf8 ; optimize=all;
} ;

View File

@@ -0,0 +1,484 @@
--# -path=.:prelude
--
----1 A Simple Punjabi Resource Morphology
----
---- Muhammad Humayoun 2010
----
---- This resource morphology contains definitions needed in the resource
---- syntax. To build a lexicon, it is better to use $ParadigmsPnb$, which
---- gives a higher-level access to this module.
--
resource MorphoPnb = Cat ** open ResPnb, Prelude, Predef in {
flags optimize=noexpand ;
coding = utf8;
oper
------------------------------------------------------------------
----Nouns
------------------------------------------------------------------
mkN : (x1,_,_,_,_,_,_,x8 : Str) -> Gender -> Noun =
\sd,so,sv,sa, pd,po,pv,pa, g -> {
s = table {
Sg => table {
Dir => sd ;
Obl => so ;
Voc => sv ;
Abl => sa
} ;
Pl => table {
Dir => pd ;
Obl => po ;
Voc => pv ;
Abl => pa
}
} ;
g = g
} ;
{-
1. masculine nouns end with alif, choTi_hay, ain
Arabic nouns ends with h. also taken as Masc
e.g.
koRa, munda, wela, bistra, braamda
brqa',
-}
mkN01 : Str -> Noun ;
mkN01 koRa = let end = last (koRa) ;
koR = if_then_else Str (eq end "ع") koRa (tk 1 koRa)
in mkN (koRa) (koR+"ے") (koR+"یا") (koR+"یوں")
(koR+"ے") (koR+"یاں") (koR+"یو") ""
Masc ;
-- 2. msculine: gher, shehar, din, des, huth
mkN02 : Str -> Noun ;
mkN02 gher = mkN (gher) (gher) (variants{gher; gher+"ا"}) (gher+"وں")
(gher) (gher+"اں") (gher+"و") ""
Masc ;
-- 3. sekhi, kuRi, boli
mkN03 : Str -> Noun ;
mkN03 kuRi = mkN (kuRi) (kuRi) (kuRi+"ے") ""
(kuRi+"اں") (kuRi+"اں") (kuRi+"وں") ""
Fem ;
-- 4. gal, saltanat, tareekh, shaksiat, kitab
mkN04 : Str -> Noun ;
mkN04 gal = mkN (gal) (gal) (variants{gal; gal+"ے"}) (gal+"وں")
(gal+"اں") (gal+"اں") (gal+"و") ""
Fem ;
-- 5. maaN
mkN05 : Str -> Noun ;
mkN05 maaN = let maa = tk 1 maaN
in mkN (maaN) (maaN) (variants{(maa+"ئے");(maa+"وے")}) (maa+"واں")
(maa+"واں") (maa+"واں") (maa+"وو") ""
Fem ;
-- 6. kunwaN
mkN06 : Str -> Noun ;
mkN06 kunwaN = let kunw = tk 2 kunwaN
in mkN (kunwaN) (kunw+"یں") (kunw+"یں") (kunw+"وں")
(kunw+"یں") (kunw+"یاں") (kunw+"بو") ""
Masc ;
-- 7. merd
mkN07 : Str -> Noun ;
mkN07 merd = mkN (merd) (merd) (merd) ""
(merd) (merd+"اں") (merd+"و") ""
Masc ;
-- 8. aaTa,
mkN08 : Str -> Noun ;
mkN08 aaTa = let aaT = tk 1 aaTa
in mkN (aaTa) (aaT+"ے") (variants{aaT+"ے"; aaT+"یا"}) (aaT+"یوں")
(aaTa) (aaT+"ے") (variants{aaT+"ے"; aaT+"یا"}) ""
Masc ;
--9. lok
mkN09 : Str -> Noun ;
mkN09 lok = mkN "" "" "" ""
(lok) (lok+"ا") (lok+"و") ""
Masc ;
--10. Masc. no inflection
mkN10 : Str -> Noun ;
mkN10 x = mkN x x x x
x x x ""
Masc ;
--11. Fem. no inflection
mkN11 : Str -> Noun ;
mkN11 x = mkN x x x x
x x x ""
Fem ;
------------------------------------------------------------------
----Verbs
------------------------------------------------------------------
--1. Basic stem form, direct & indirect causatives exists
-- v1 nechna nechaana nechwana
mkV1 : (_,_,_: Str) -> Verb1 = \inf, c1, c2 ->
let root = (tk 2 inf) ;
root1 = (tk 2 c1) ;
root2 = (tk 2 c2) ;
in {
s = table {
Root => root ;
Inf => inf ;
Inf_Fem => ((tk 1 inf) + "ی") ;
Inf_Obl => (tk 1 inf) ;
Ablative => ((tk 1 inf) + "وں") ;
Caus1_Inf => c1 ;
Caus1_Fem => ((tk 1 c1) + "ی") ;
Caus1_Obl => (tk 1 c1) ;
Caus1_Ablative => ((tk 1 c1) + "وں") ;
Caus2_Inf => c2 ;
Caus2_Fem => ((tk 1 c2) + "ی") ;
Caus2_Obl => (tk 1 c2) ;
Caus2_Ablative => ((tk 1 c2) + "وں") ;
MVF1 tense person number gender => (mkCmnVF root tense person number gender).s ;
Caus1 tense person number gender => (mkCmnVF root1 tense person number gender).s ;
Caus2 tense person number gender => (mkCmnVF root2 tense person number gender).s
}
} ;
mkCmnVF : Str -> Tense -> Person -> Number -> Gender -> {s:Str}= \root,t,p,n,g ->
{s = case (last root) of {
("ا"|"آ"|"و"|"ی") => (mkCmnVF1 root t p n g).s ;
_ => (mkCmnVF2 root t p n g).s
}
};
mkCmnVF1 : Str -> Tense -> Person -> Number -> Gender -> {s:Str}= \root,t,p,n,g ->
{s = let nadaa = root + "ندا" ; --root + variants{"ندا";"وندا"};
nadii = root + "ندی" ; --root + variants{"ندی";"وندی"} ;
nade = root + "ندے" ; --root + variants{"ندے";"وندے"} ;
nadiiaaN = root + "ندیاں" --root + variants{"ندیاں";"وندیاں"}
in
case <t,p,n,g> of {
<Subj,Pers1, Sg,_> => root + "واں" ;
<Subj,Pers1, Pl,_> => root + "ئے" ;
<Subj,Pers2_Casual, Sg,_> => root ;
<Subj,Pers2_Casual, Pl,_> => root + "ؤ" ;
<Subj,Pers2_Respect, _, _> => root + "ؤ" ;
<Subj,_, Sg,_> => root + "ئے" ;
<Subj,_, Pl,_> => root+"ن" ;
<Perf, Pers1, Sg,Masc> => root + "یا" ;
<Perf, Pers1, Sg,Fem> => root + "ئی" ;
<Perf, Pers1, Pl,Masc> => root + "ئے" ;
<Perf, Pers1, Pl,Fem> => root + "ئیاں" ;
<Perf, Pers2_Casual, Sg,Masc> => root + "یا" ;
<Perf, Pers2_Casual, Sg,Fem> => root + "ئی" ;
<Perf, Pers2_Casual, Pl,Masc> => root + "ئے" ;
<Perf, Pers2_Casual, Pl,Fem> => root + "ئیاں" ;
<Perf, Pers2_Respect,_,_> => root + "ئے" ;
<Perf, _, Sg,Masc> => root + "یا" ;
<Perf, _, Sg,Fem> => root + "ئی" ;
<Perf, _, Pl,Masc> => root + "ئے" ;
<Perf, _, Pl,Fem> => root + "ئیاں" ;
<Imperf, Pers1, Sg, Masc> => nadaa ;
<Imperf, Pers1, Sg, Fem> => nadii ;
<Imperf, Pers1, Pl, Masc> => nade ;
<Imperf, Pers1, Pl, Fem> => nadiiaaN ;
<Imperf, Pers2_Casual, Sg, Masc> => nadaa ;
<Imperf, Pers2_Casual, Sg, Fem> => nadii ;
<Imperf, Pers2_Casual, Pl, Masc> => nade ;
<Imperf, Pers2_Casual, Pl, Fem> => nadiiaaN ;
<Imperf, Pers2_Respect, Sg, _> => nade ;
<Imperf, Pers2_Respect, Pl, Masc> => nade ;
<Imperf, Pers2_Respect, Pl, Fem> => variants {nade;nadiiaaN} ;
<Imperf, _, Sg, Masc> => nadaa ;
<Imperf, _, Sg, Fem> => nadii ;
<Imperf, _, Pl, Masc> => nade ;
<Imperf, _, Pl, Fem> => nadiiaaN
}
} ;
mkCmnVF2 : Str -> Tense -> Person -> Number -> Gender -> {s:Str}= \root,t,p,n,g ->
{s = let daa = root + "دا" ;
dii = root + "دی" ;
de = root + "دے" ;
diiaaN = root + "دیاں"
in
case <t,p,n,g> of {
<Subj,Pers1, Sg,_> => root + "اں" ;
<Subj,Pers1, Pl,_> => root+"ئے" ;
<Subj,Pers2_Casual, Sg,_> => root ;
<Subj,Pers2_Casual, Pl,_> => root + "و" ;
<Subj,Pers2_Respect, _, _> => root + "و" ;
<Subj,_, Sg,_> => root + "ے" ;
<Subj,_, Pl,_> => root+"ن" ;
<Perf, Pers1, Sg,Masc> => root+"یا";
<Perf, Pers1, Sg,Fem> => root + "ی" ;
<Perf, Pers1, Pl,Masc> => root + "ے" ;
<Perf, Pers1, Pl,Fem> => root + "یاں" ;
<Perf, Pers2_Casual, Sg,Masc> => root+"یا";
<Perf, Pers2_Casual, Sg,Fem> => root + "ی" ;
<Perf, Pers2_Casual, Pl,Masc> => root + "ے" ;
<Perf, Pers2_Casual, Pl,Fem> => root + "یاں" ;
<Perf, Pers2_Respect,_,_> => root + "ے" ;
<Perf, _, Sg,Masc> => root+"یا" ;
<Perf, _, Sg,Fem> => root + "ی" ;
<Perf, _, Pl,Masc> => root + "ے" ;
<Perf, _, Pl,Fem> => root + "یاں" ;
<Imperf, Pers1, Sg, Masc> => daa ;
<Imperf, Pers1, Sg, Fem> => dii ;
<Imperf, Pers1, Pl, Masc> => de ;
<Imperf, Pers1, Pl, Fem> => diiaaN ;
<Imperf, Pers2_Casual, Sg, Masc> => daa ;
<Imperf, Pers2_Casual, Sg, Fem> => dii ;
<Imperf, Pers2_Casual, Pl, Masc> => de ;
<Imperf, Pers2_Casual, Pl, Fem> => diiaaN ;
<Imperf, Pers2_Respect, Sg, _> => de ;
<Imperf, Pers2_Respect, Pl, Masc> => de ;
<Imperf, Pers2_Respect, Pl, Fem> => variants {de;diiaaN} ;
<Imperf, _, Sg, Masc> => daa ;
<Imperf, _, Sg, Fem> => dii ;
<Imperf, _, Pl, Masc> => de ;
<Imperf, _, Pl, Fem> => diiaaN
}
} ;
--v4
mkV4 : Str -> Verb4 = \inf ->
let root = (tk 2 inf);
in { s = table {
Root4 => root ;
Inf4 => inf ;
Inf_Fem4 => ((tk 1 inf) + "ی") ;
Inf_Obl4 => (tk 1 inf) ;
Ablative4 => ((tk 1 inf) + "وں") ;
MVF4 tense person number gender => (mkCmnVF root tense person number gender).s
}
} ;
----------------------------------------------------------------
mkPN : Str -> {s:Str} = \x -> {s = x};
mkAdj3 : Str -> {s:Str} = \x -> {s = x};
mkAdv : Str -> {s:Str} = \x -> {s = x};
mkAdj1 : Str -> Adjective1 ;
mkAdj1 piilaa = let end = last (piilaa) ;
piil = if_then_else Str (eq end "ع") piilaa (tk 1 piilaa)
in adj1 (piilaa) (piil+"ے") (variants{piil+"یا"; piil+"ے"}) (piil+"یوں") (piil+"ے") (piil+"یاں") (piil+"یو") ""
(piil++"ی") (piil++"ی") (variants{piil+"ی" ; piil+"یے"}) (piil+"یوں") (piil++"ی") (piil++"یاں") (piil++"یو") "" ;
adj1 :(x1,_,_,_,_,_,_, _,_,_,_,_,_,_,_, x16 : Str) -> {s : Gender => Number => Case => Str} =
\msd,mso,msv,msa, mpd,mpo,mpv,mpa, fsd,fso,fsv,fsa, fpd,fpo,fpv,fpa -> {
s = table {
Masc => (cmnAdj msd mso msv msa mpd mpo mpv mpa).s ;
Fem => (cmnAdj fsd fso fsv fsa fpd fpo fpv fpa).s
}
};
mkAdj2 : Str -> Adjective2 ;
mkAdj2 romii = cmnAdj romii romii (romii+"ا") (romii+"یوں")
romii (romii++"اں") (romii++"و") "" ;
cmnAdj : (x1,_,_,_,_,_,_,x8 : Str) -> {s : Number => Case => Str} =
\sd,so,sv,sa, pd,po,pv,pa -> {
s = table {
Sg => table {
Dir => sd ;
Obl => so ;
Voc => sv ;
Abl => sa
} ;
Pl => table {
Dir => pd ;
Obl => po ;
Voc => pv ;
Abl => pa
}
}
} ;
}
{-
----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 -> Preposition = \str -> {s = str};
----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)yN" "m(o)j'|h" "" "t(o)w " "t(o)j|h" "t(o)w " "t(o)m" "t(o)m" "t(o)m" "Ap" "Ap" "Ap" "y(i)h" "a(i)s" "" "w(o)h" "a(o)s" ""
"h(a)m" "h(a)m" "" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "t(o)m" "Ap" "Ap" "Ap" "y(i)h" "a(i)n" "" "w(o)h" "a(o)n" "" ;
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
}
};
-}

View File

@@ -0,0 +1,56 @@
--# -path=.:prelude
--
--1 Punjabi auxiliary operations.
--
-- This module contains operations that are needed to make the
-- morphology work.
resource ResPnb = open Prelude, Predef in {
flags optimize = noexpand ;
coding = utf8;
param
Number = Sg | Pl ;
Case = Dir | Obl | Voc | Abl ;
Gender = Masc | Fem ;
Tense = Subj | Perf | Imperf;
Person = Pers1
| Pers2_Casual
| Pers2_Respect
| Pers3_Near
| Pers3_Distant;
VerbForm1 =
MVF1 Tense Person Number Gender -- 3*5*2*2=60
| Caus1 Tense Person Number Gender -- 60
| Caus2 Tense Person Number Gender -- 60
| Inf | Inf_Fem | Inf_Obl | Ablative -- 13
| Caus1_Inf | Caus1_Fem | Caus1_Obl | Caus1_Ablative
| Caus2_Inf | Caus2_Fem | Caus2_Obl | Caus2_Ablative
| Root ;
VerbForm4 =
MVF4 Tense Person Number Gender
| Inf4 | Inf_Fem4 | Inf_Obl4 | Ablative4
| Root4 ;
oper
CommonVF = {s : Tense => Person => Number => Gender => Str} ;
Noun = {s : Number => Case => Str ; g : Gender} ;
Verb1 = {s : VerbForm1 => Str} ;
Verb4 = {s : VerbForm4 => Str} ;
Adjective1 = {s : Gender => Number => Case => Str} ;
Adjective2 = {s : Number => Case => Str} ;
--Preposition = {s : Str};
--DemPronForm = {s : Number => Gender => Case => Str};
--PossPronForm = {s : Number => Gender => Case => Str};
--Determiner = {s : Number => Gender => Str ; n : Number};
-- a useful oper
eq : Str -> Str -> Bool = \s1,s2-> (pbool2bool (eqStr s1 s2)) ;
}