Hebrew mini resource by Dana Dannells

This commit is contained in:
aarne
2011-08-14 16:49:19 +00:00
parent 065178a64d
commit 69d0fecb7e
6 changed files with 549 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
abstract Grammar = {
cat
Cl ; NP ; VP ; AP ; CN ; Det ; N ; A ; V ; V2 ;
fun
PredVP : NP -> VP -> Cl ;
ComplV2 : V2 -> NP -> VP ;
DetCN : Det -> CN -> NP ;
ModCN : CN -> AP -> CN ;
UseV : V -> VP ;
UseN : N -> CN ;
UseA : A -> AP ;
a_Det, the_Det : Det ;
this_Det, these_Det : Det ;
i_NP, she_NP, we_NP : NP ;
}

View File

@@ -0,0 +1,97 @@
--# -path=alltenses
concrete GrammarHeb of Grammar = open ResHeb, Prelude in {
lincat
Cl = {s : ResHeb.Tense => Str} ;
VP = ResHeb.VP ; -- {v : Verb ; obj : Str} ;
NP = ResHeb.NP ; -- {s : Case => {obj : Str} ; a : Agr ; isDef : Bool ; sp : Species} ;
AP = {s : Number => Species => Gender => Str } ;
CN = ResHeb.Noun ; -- {s : Number => Species => Str ; g: Gender} ;
Det = {s : Gender => Str ; n : Number ; sp : Species; isDef : Bool} ;
N = ResHeb.Noun ; -- {s : Number => Species => Str ; g: Gender } ;
A = ResHeb.Adj ; -- {s : Number => Species => Gender => Str} ;
V = ResHeb.Verb ; -- {s : Tense => VPerNumGen => Str } ;
V2 = ResHeb.Verb2 ; -- Verb ** {c : Case} ;
lin
-- predication
PredVP np vp =
let
subj = (np.s ! Nom ).obj ;
obj = vp.obj
in {
s = \\t => subj ++ (agrV vp.v t np.a) ++ obj } ;
ComplV2 v2 np =
let
nps = np.s ! v2.c
in {
v = {s = v2.s } ;
obj = case <np.isDef> of
{ <True> => "At" ++ nps.obj; -- direct objects require the object marker 'et' and must be in definite form
_ => nps.obj }
} ;
-- determination
-- ha-Aysh ha-zwt : this woman
-- ha-bait : the house
-- ha-bait ha-ze : this house
-- ha-bait ha-yarok ha-ze : this green house
DetCN det cn = {
s = \\c => {obj = cn.s ! det.n ! det.sp ++ det.s ! cn.g } ;
isDef = det.isDef ;
sp = det.sp ;
a = Ag cn.g det.n Per3
} ;
ModCN cn ap = {
s = \\sp => table {n => cn.s ! sp ! n ++ ap.s ! sp ! n ! cn.g} ;
g = cn.g
} ;
UseV v = { v = v ; obj = [] };
UseN n = n ;
UseA adj = adj ;
a_Det = {
s = table { _ => "" } ;
n = Sg ;
sp = Indef ;
isDef = False
} ;
the_Det = {
s = table { _ => "" } ;
n = Sg ;
sp = Def ;
isDef = True
} ;
this_Det = {
s = table { Masc => "hzh" ; Fem => "hzAt" } ;
n = Sg ;
sp = Def ;
isDef = True
} ;
these_Det = {
s = table {_ => "hAlh" } ;
n = Pl ;
sp = Def ;
isDef = True
} ;
i_NP = pronNP "Any" "Awty" "ly" Masc Sg Per1 ; --both fem and masc
we_NP = pronNP "AnHnw" "Awtnw" "lnw" Masc Pl Per1; --both fem and masc
she_NP = pronNP "hyA" "Awth" "lh" Fem Sg Per3 ;
}

View File

@@ -0,0 +1,41 @@
resource PatternsHeb = {
flags coding=utf8 ;
oper
C1aC2aC3ti = {C1 ="" ; C1C2=""; C2C3 =""; C3="ty"};
C1aC2aC3nu = { C1 = "" ; C1C2=""; C2C3 =""; C3="nw"};
C1aC2aC3ta = { C1 = "" ; C1C2=""; C2C3 =""; C3="ta"};
C1aC2aC3t = { C1 = "" ; C1C2=""; C2C3 =""; C3="t"};
C1aC2aC3tem = { C1 = "" ; C1C2=""; C2C3 =""; C3="teM"};
C1aC2aC3ten = { C1 = "" ; C1C2=""; C2C3 =""; C3="teN"};
C1aC2aC3 = { C1 = "" ; C1C2=""; C2C3 =""; C3=""};
C1aC2aC3a = { C1 = "" ; C1C2=""; C2C3 =""; C3="h"};
C1aC2aC3u = { C1 = "" ; C1C2=""; C2C3 =""; C3="w"};
C1oC2eC3 = { C1 = "" ; C1C2="w"; C2C3 =""; C3=""};
C1oC2eC3et = { C1 = "" ; C1C2="w"; C2C3 =""; C3="t"};
C1oC2C3im = { C1 = "" ; C1C2="w"; C2C3 =""; C3="yM"};
C1oC2C3ot = { C1 = "" ; C1C2="w"; C2C3 =""; C3="wt"};
eC1C2oC3 = { C1 = "y" ; C1C2=""; C2C3 =""; C3=""};
niC1C2oC3 = { C1 = "n" ; C1C2=""; C2C3 =""; C3=""};
tiC1C2oC3 = { C1 = "t" ; C1C2=""; C2C3 =""; C3=""};
tiC1C2eC3i = { C1 = "t" ; C1C2=""; C2C3 ="e"; C3="y"};
tiC1C2eC3o = { C1 = "t" ; C1C2=""; C2C3 ="e"; C3="w"};
yiC1C2oC3 = { C1 = "y" ; C1C2=""; C2C3 =""; C3=""};
yiC1C2eC3u = { C1 = "y" ; C1C2=""; C2C3 =""; C3="w"};
hiC1C2aC3ti = {C1 ="h" ; C1C2=""; C2C3 =""; C3="ty"};
hiC1C2aC3nu = { C1 = "h" ; C1C2=""; C2C3 =""; C3="nw"};
hiC1C2aC3ta = { C1 = "h" ; C1C2=""; C2C3 =""; C3="ta"};
hiC1C2aC3t = { C1 = "h" ; C1C2=""; C2C3 =""; C3="t"};
hiC1C2aC3tem= { C1 = "h" ; C1C2=""; C2C3 =""; C3="teM"};
hiC1C2aC3ten = { C1 = "h" ; C1C2=""; C2C3 =""; C3="teN"};
hiC1C2iC3= { C1 = "h" ; C1C2=""; C2C3 ="y"; C3=""};
hiC1C2iC3a= { C1 = "h" ; C1C2=""; C2C3 ="y"; C3="h"};
hiC1C2iC3u = { C1 = "h" ; C1C2=""; C2C3 ="y"; C3="w"};
}

View File

@@ -0,0 +1,351 @@
--# -path=alltenses
-- (c) 2011 Dana Dannells
-- Licensed under LGPL
-- Compiled with GF version 3.2
resource ResHeb = open PatternsHeb, Prelude, Predef in {
flags coding=utf8 ;
param
Number = Sg | Pl | Dl ;
Gender = Masc | Fem ;
Species = Def | Indef ;
Case = Nom | Acc | Dat ;
Agr = Ag Gender Number Person;
Person = Per1 | Per2 | Per3 ;
Voice = Active | Passive | Reflexive ;
VPerNumGen = Vp1Sg | Vp1Pl | Vp2Sg Gender | Vp2Pl Gender | Vp3Sg Gender | Vp3Pl Gender ;
Tense = Perf | Part | Imperf ;
oper
VP = {v : Verb ; obj : Str} ; -- obj value to deal with direct objects
NP = {s : Case => {obj : Str} ; a : Agr ; isDef : Bool ; sp : Species };
-------------------------------------------------
-- Auxiliaries
-- Pronouns modify nouns in a noun phrase, they agree
-- in gender and number with the head noun.
pronNP : (s,a,d : Str) -> Gender -> Number -> Person -> NP =
\s,a,d,g,n,p -> {
s =
table {
Nom => {obj = s} ;
Acc => {obj = a} ;
Dat => {obj = []}
};
isDef = False ;
sp = Indef ;
a = Ag g n p
} ;
-------------------------------------------------
-- Predication
agrV : Verb -> Tense -> Agr -> Str = \v,t,a -> case a of {
Ag g n p => v.s ! t ! (chooseForm g n p)
} ;
chooseForm : Gender -> Number -> Person -> VPerNumGen = \g,n,p->
case <g,n,p> of {
<_,Sg,Per1> => Vp1Sg;
<_,Pl,Per1> => Vp1Pl;
<_,Sg,Per2> => Vp2Sg g ;
<_,Pl,Per2> => Vp2Pl g ;
<_,Sg,Per3> => Vp3Sg g ;
<_,Pl,Per3> => Vp3Pl g ;
_ => Vp3Sg Masc
};
-------------------------------------------------
-- Roots and patterns for verbs
oper
Pattern : Type = {C1, C1C2, C2C3, C3 : Str};
Root : Type = {C1,C2,C3 : Str}; -- most verb roots consist of three consonants
Root4 : Type = Root ** {C4 : Str}; -- for verb roots with four consonants
-------------------------------------------------
-- Morphology
oper
Noun : Type = {s : Number => Species => Str ; g : Gender} ;
Adj : Type = {s : Number => Species => Gender => Str} ;
Verb : Type = {s : Tense => VPerNumGen => Str } ;
Verb2 : Type = Verb ** {c : Case} ;
-------------------------------------------------
-- Nouns
-- Nouns have different endings,
-- some are also duals: his- anashim, bait- batim, bat-banot.
oper
mkNoun : (bait,batim,batimD : Str) -> Gender -> Noun = \bait,batim,batimD,g -> {
s = table {
Sg => table{Indef => bait ; Def => defH bait};
Pl => table{Indef => batim ; Def => defH batim} ;
Dl => table{Indef => batimD ; Def => defH batimD}
};
g=g ;
};
-- For some nouns it is not possible to infer the gender from the pefix,
-- depending on the gender, a noun can either end with yM or wt.
regNoun2 : Str -> Gender -> Noun = \root,g ->
case root of {
heret + c@? => table {
Masc => mkNoun root (heret + replaceLastLet (c) + "yM" ) ("") g;
Fem => mkNoun root (heret + replaceLastLet (c) + "wt") ("") g
} ! g
} ;
-- For regular nouns, it is possible to infer the gender from the pefix.
regNoun : Str -> Noun =
\root -> case root of {
malc + "h" => mkNoun root (malc + "wt") ("") Fem ;
mecon + "yt" => mkNoun root (mecon + "ywt") ("") Fem ; -- (it -> iyot)
khan + "wt" => mkNoun root (khan + "ywt") ("") Fem; -- (ut -> uyot)
tsalakh + "t" => mkNoun root (tsalakh + "wt") ("") Fem ; -- (at -> ot)
_ => mkNoun root (root + "yM") ("") Masc
} ;
mkN = overload {
mkN : (root: Str) -> Noun = regNoun ;
mkN : (kaf : Str) -> Gender-> Noun = regNoun2 ;
mkN : (bait, batim : Str) -> Gender -> Noun = \bait,batim -> mkNoun bait batim "";
mkN : (regel, raglayim, raglaim : Str) -> Gender -> Noun = mkNoun ;
} ;
replaceLastLet : Str -> Str = \c ->
case c of {"P" => "p" ; "M" => "m" ; "N" => "n" ; "Z." => "Z" ; "K" => "k"; _ => c} ;
-------------------------------------------------
-- Adjectives
-- Adjectives are formed either linearly,
-- by adding a suffix without affecting the stem
-- or discontinuously, by adding feminine or plural marker
-- that requires a shift of stress in the word and certain
-- vowel deletions and modifications.
oper
regA : Str -> Adj = \root
-> case root of { kaTan + c@? =>
mkAdj root (kaTan + replaceLastLet (c) + "h") (kaTan +
replaceLastLet (c) + "yM") (kaTan + replaceLastLet (c) + "wt")
};
regA2 : Str -> Adj = \bwleT
-> mkAdj bwleT ( bwleT + "t") ( bwleT + "yM" ) (bwleT + "wt" );
mkAdj : (_,_,_,_ : Str) -> Adj = \tov,tova,tovim,tovot -> {
s = table {
Sg => table {
Indef => table { Masc => tov ; Fem => tova } ;
Def => table { Masc => defH tov ; Fem => defH tova }
} ;
_ => table {
Indef => table {Masc => tovim ; Fem => tovot } ;
Def => table { Masc => defH tovim ; Fem => defH tovot }
}
}
};
-------------------------------------------------
-- Determination
defH : Str -> Str = \cn ->
case cn of {_ => "h" + cn};
-------------------------------------------------
-- Verbs
-- The way of forming verbs follows the traditional
-- Hebrew pattern group classification, called Binyanim.
-- Each pattern has a three consonant slot structure with special
-- inflectional characteristics.
-- Verbs are formed by a [root + pattern] combination.
oper
dirV2: Verb -> Verb2 =\v ->
{
s = v.s ;
c = Acc
};
mkVPaal : Str -> Verb = \v ->
let root = getRoot v
in {s = table {
Perf => table {
Vp1Sg => appPattern root C1aC2aC3ti ;
Vp1Pl => appPattern root C1aC2aC3nu ;
Vp2Sg Masc => appPattern root C1aC2aC3ta ;
Vp2Sg Fem => appPattern root C1aC2aC3t ;
Vp2Pl Masc => appPattern root C1aC2aC3tem ;
Vp2Pl Fem => appPattern root C1aC2aC3ten ;
Vp3Sg Masc => appPattern root C1aC2aC3 ;
Vp3Sg Fem => appPattern root C1aC2aC3a ;
Vp3Pl Masc => appPattern root C1aC2aC3u ;
Vp3Pl Fem => appPattern root C1aC2aC3u
} ;
Part => table {
Vp1Sg => appPattern root C1oC2eC3 ;
Vp1Pl => appPattern root C1oC2C3im ;
Vp2Sg Masc => appPattern root C1oC2eC3 ;
Vp2Sg Fem => appPattern root C1oC2eC3et ;
Vp2Pl Masc => appPattern root C1oC2C3im ;
Vp2Pl Fem => appPattern root C1oC2C3ot ;
Vp3Sg Masc => appPattern root C1oC2eC3;
Vp3Sg Fem => appPattern root C1oC2eC3et ;
Vp3Pl Masc => appPattern root C1oC2C3im ;
Vp3Pl Fem => appPattern root C1oC2C3ot
} ;
Imperf => table {
Vp1Sg => appPattern root eC1C2oC3 ;
Vp1Pl => appPattern root niC1C2oC3 ;
Vp2Sg Masc => appPattern root tiC1C2oC3 ;
Vp2Sg Fem => appPattern root tiC1C2eC3i ;
Vp2Pl Masc => appPattern root tiC1C2eC3o ;
Vp2Pl Fem => appPattern root tiC1C2eC3o ;
Vp3Sg Masc => appPattern root yiC1C2oC3 ;
Vp3Sg Fem => appPattern root tiC1C2oC3 ;
Vp3Pl Masc => appPattern root yiC1C2eC3u ;
Vp3Pl Fem => appPattern root yiC1C2eC3u
}
}
};
mkVHifhil : Str -> Verb = \v ->
let root = getRoot v
in {s = table {
Perf => table {
Vp1Sg => appPattern root hiC1C2aC3ti ;
Vp1Pl => appPattern root hiC1C2aC3nu ;
Vp2Sg Masc => appPattern root hiC1C2aC3ta ;
Vp2Sg Fem => appPattern root hiC1C2aC3t ;
Vp2Pl Masc => appPattern root hiC1C2aC3tem ;
Vp2Pl Fem => appPattern root hiC1C2aC3ten ;
Vp3Sg Masc => appPattern root hiC1C2iC3 ;
Vp3Sg Fem => appPattern root hiC1C2iC3a ;
Vp3Pl Masc => appPattern root hiC1C2iC3u ;
Vp3Pl Fem => appPattern root hiC1C2iC3u
} ;
Part => table {
Vp1Sg => appPattern root C1oC2eC3 ;
Vp1Pl => appPattern root C1oC2C3im ;
Vp2Sg Masc => appPattern root C1oC2eC3 ;
Vp2Sg Fem => appPattern root C1oC2eC3et ;
Vp2Pl Masc => appPattern root C1oC2C3im ;
Vp2Pl Fem => appPattern root C1oC2C3ot ;
Vp3Sg Masc => appPattern root C1oC2eC3;
Vp3Sg Fem => appPattern root C1oC2eC3et ;
Vp3Pl Masc => appPattern root C1oC2C3im ;
Vp3Pl Fem => appPattern root C1oC2C3ot
};
Imperf => table {
Vp1Sg => appPattern root eC1C2oC3 ;
Vp1Pl => appPattern root niC1C2oC3 ;
Vp2Sg Masc => appPattern root tiC1C2oC3 ;
Vp2Sg Fem => appPattern root tiC1C2eC3i ;
Vp2Pl Masc => appPattern root tiC1C2eC3o ;
Vp2Pl Fem => appPattern root tiC1C2eC3o ;
Vp3Sg Masc => appPattern root yiC1C2oC3 ;
Vp3Sg Fem => appPattern root tiC1C2oC3 ;
Vp3Pl Masc => appPattern root yiC1C2eC3u ;
Vp3Pl Fem => appPattern root yiC1C2eC3u
}
}
} ;
mkVHifhil2 : Str -> Verb = \v ->
let root = getRoot v
in {s = table {
Perf => table {
Vp1Sg => appPattern2 root hiC1C2aC3ti ;
Vp1Pl => appPattern2 root hiC1C2aC3nu ;
Vp2Sg Masc => appPattern2 root hiC1C2aC3ta ;
Vp2Sg Fem => appPattern2 root hiC1C2aC3t ;
Vp2Pl Masc => appPattern2 root hiC1C2aC3tem ;
Vp2Pl Fem => appPattern2 root hiC1C2aC3ten ;
Vp3Sg Masc => appPattern2 root hiC1C2iC3 ;
Vp3Sg Fem => appPattern2 root hiC1C2iC3a ;
Vp3Pl Masc => appPattern2 root hiC1C2iC3u ;
Vp3Pl Fem => appPattern2 root hiC1C2iC3u
} ;
Part => table {
Vp1Sg => appPattern2 root C1oC2eC3 ;
Vp1Pl => appPattern2 root C1oC2C3im ;
Vp2Sg Masc => appPattern2 root C1oC2eC3 ;
Vp2Sg Fem => appPattern2 root C1oC2eC3et ;
Vp2Pl Masc => appPattern2 root C1oC2C3im ;
Vp2Pl Fem => appPattern2 root C1oC2C3ot ;
Vp3Sg Masc => appPattern2 root C1oC2eC3;
Vp3Sg Fem => appPattern2 root C1oC2eC3et ;
Vp3Pl Masc => appPattern2 root C1oC2C3im ;
Vp3Pl Fem => appPattern2 root C1oC2C3ot
} ;
Imperf => table {
Vp1Sg => appPattern2 root eC1C2oC3 ;
Vp1Pl => appPattern2 root niC1C2oC3 ;
Vp2Sg Masc => appPattern2 root tiC1C2oC3 ;
Vp2Sg Fem => appPattern2 root tiC1C2eC3i ;
Vp2Pl Masc => appPattern2 root tiC1C2eC3o ;
Vp2Pl Fem => appPattern2 root tiC1C2eC3o ;
Vp3Sg Masc => appPattern2 root yiC1C2oC3 ;
Vp3Sg Fem => appPattern2 root tiC1C2oC3 ;
Vp3Pl Masc => appPattern2 root yiC1C2eC3u ;
Vp3Pl Fem => appPattern2 root yiC1C2eC3u
}
}
};
appPattern : Root -> Pattern -> Str = \r,p ->
p.C1 + r.C1 + p.C1C2 + r.C2 + p.C2C3 + r.C3 + p.C3 ;
-- remove the first letter
appPattern2 : Root -> Pattern -> Str = \r,p ->
p.C1 + p.C1C2 + r.C2 + p.C2C3 + r.C3 + p.C3 ;
getRoot : Str -> Root = \s -> case s of {
C1@? + C2@? + C3 => {C1 = C1 ; C2 = C2 ; C3 = C3} ;
_ => Predef.error ("cannot get root from" ++ s)
} ;
}

View File

@@ -0,0 +1,11 @@
abstract Test = Grammar ** {
fun
man_N, woman_N, house_N, leg_N, store_N, chair_N, eyes_N, spoon_N: N ;
big_A, small_A, green_A, delicious_A, italian_A : A ;
write_V, walk_V, finish_V, arrive_V , express_V: V ;
love_V2, please_V2 : V2 ;
};

View File

@@ -0,0 +1,29 @@
--# -path=alltenses
concrete TestHeb of Test = GrammarHeb ** open ResHeb in {
flags
coding=utf8 ;
lin
man_N = mkN "Ays" "AnsyM" Masc;
woman_N = mkN "Aysh" "nsyM" Fem ;
house_N = mkN "byt" "btyM" Masc;
leg_N = mkN "rgl" "rglyyM" "rglyyM" Fem;
store_N = mkN "Hnwt" "Hnwywt" Fem;
chair_N = mkN "kSA" "kSAwt" Masc;
eyes_N = mkN "OyN" "OynyyM" "OynyyM" Fem;
spoon_N = mkN "kP" Fem;
big_A = regA "gdwl";
small_A = regA "qTN";
green_A = regA "yrwq";
delicious_A = regA2 "nhdr";
italian_A = regA2 "AyTlqy";
write_V = mkVPaal "ktb" ;
finish_V = mkVPaal "gmr" ;
walk_V = mkVPaal "ZOd" ;
arrive_V = mkVHifhil2 "ngO" ;
express_V = mkVHifhil2 "nbO" ;
love_V2 = dirV2 (mkVPaal "Ahb") ;
please_V2 = dirV2 (mkVPaal "Spq") ;
}