1
0
forked from GitHub/gf-rgl

Worked on DetQuant in Noun and Digits in Numeral

This commit is contained in:
David Bamutura
2019-05-10 14:56:02 +02:00
parent c2691eda44
commit 19870f6b38
8 changed files with 136 additions and 52 deletions

View File

@@ -1,7 +1,7 @@
--# -path=.:../prelude:../abstract:../common
concrete CatCgg of Cat = CommonX -[Adv]**
open (Res=ResCgg), Prelude in {
open (Res=ResCgg), Prelude, (Px=ParamX) in {
lincat
@@ -62,6 +62,8 @@ lincat
root : Str;
morphs : Res.VFormMini => Res.VerbMorphPos =>Str --; compl : Str -- after verb: complement, adverbs
} ;
Numeral = {s : Str ; g : Res.Gender; n: Res.Number} ;
Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ;
--VV =
{-

View File

@@ -123,6 +123,8 @@ lin
travel_V = mkV "gyend";--: V ;
walk_V = mkV "tabur"; --: V ; or kuribata
--Verbs that have a noun Phrase complement and a verb phrase complement (V2V)
--beg_V2V : V2V ;
--Adverbs
now_Adv = mkAdv "hati" AgrNo;
--far_Adv = mkAdv "hare";

View File

@@ -81,6 +81,18 @@ lin
{-What the hell does this mean?-}
ExtAdvNP np adv = {s= \\c => np.s ! c ++ embedInCommas adv.s; agr = np.agr}; -- how do I do the adverbial clause?
-- Determiner: Type = {s:Str; ntype:NounType; num:Number; pos:Position}; -- type for Determier necessary for catCgg.gf
-- The determiner has a fine-grained structure, in which a 'nucleus'
-- quantifier and an optional numeral can be discerned.
--DetQuant : Quant -> Num -> Det ; -- these five
DetQuant quant num = {s=[]; s2 = quant.s2; ntype = Incomplete; num = num.n; pos=PreDeterminer; doesAgree = quant.doesAgree}; --
--DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best
{-
Need sample quatitifiers in Runynakore. Immediate, Far, Distant. so DetQuant is commented out
-}

View File

@@ -1,7 +1,7 @@
--# -path=.:../prelude:../abstract:../common
concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits] **
open ResCgg in {
open ResCgg, Prelude in {
lincat
Digit = { s : Str; unit : { s:Str ; g : Gender; stem : Str}; ten : { s:Str ; g : Gender} };
@@ -10,19 +10,25 @@ lincat
Sub1000 = {s : Str ; g:Gender; n : Number} ;
Sub1000000 = {s : Str ; g:Gender; n : Number} ;
lin num x = x ;
lin n2 = mkNum "biri" "ibiri" ZERO_ZERO "abiri" I_MA;
lin n3 = mkNum "shatu" "ishatu" I_ZERO "ashatu" I_MA;
lin n4 = mkNum "na" "ina" I_ZERO "ana" I_MA ;
lin n5 = mkNum "taano" "itaano" I_ZERO "ataano" I_MA ;
lin n6 = mkNum "kaaga" "mukaaga" MU_MI "nkaaga" N_ZERO;
lin n7 = mkNum "shanju" "mushanju" MU_MI "nshanju" N_ZERO;
lin n8 = mkNum "naana" "munaana" MU_MI "kinaana" KI_ZERO ;
lin n9 = mkNum "enda" "mwenda" MU_MI "kyenda" KI_ZERO ;
lin num x = x ; --Numeral = {s : Res.CardOrd => Res.Agreement => Str ; n : Res.Number} ;
lin n2 = mkNum "biri" "ibiri" ZERO_ZERO "abiri" I_MA True;
lin n3 = mkNum "shatu" "ishatu" I_ZERO "ashatu" I_MA True;
lin n4 = mkNum "na" "ina" I_ZERO "ana" I_MA True;
lin n5 = mkNum "taano" "itaano" I_ZERO "ataano" I_MA True;
lin n6 = mkNum "kaaga" "mukaaga" MU_MI "nkaaga" N_ZERO False;
lin n7 = mkNum "shanju" "mushanju" MU_MI "nshanju" N_ZERO False;
lin n8 = mkNum "naana" "munaana" MU_MI "kinaana" KI_ZERO False;
lin n9 = mkNum "enda" "mwenda" MU_MI "kyenda" KI_ZERO False;
lin pot01 = mkNum "mwe" "emwe" ZERO_ZERO "ikumi" I_MA ** {n = Sg} ; -- 1
lin pot01 = {s = [];
unit ={s = "emwe"; g = ZERO_ZERO; stem ="mwe"};
ten = {s = "ikumi" ; g = I_MA};
ordinal = "kabanza";
isOrdDifferent = True;
n = Sg
}; -- 1
lin pot0 d = d ** {n = Pl} ; -- Sub10 d * 1
lin pot110 = {s = "ikumi" ; g= I_MA; n = Pl}; --10 -Sub100
lin pot111 = {s = "ikumi na emwe" ; g = ZERO_ZERO; n = Pl}; --11
@@ -40,19 +46,19 @@ lin pot2 d = let
_ => d.ten.s
};
in {s = "magana" ++ numStr; g = ZERO_ZERO} ** {n = Pl} ;
{-
lin pot2plus d e = let
unitFigure = case <d.n> of{
unitFigure = case d.n of{
Sg => "igana";
_ => "magana"
};
numStr = case <d.unit.g> of{
numStr = case d.unit.g of{
MU_MI => d.unit.s;
_ => d.ten.s
};
in {s = unitFigure ++ numStr ++ "na" ++ e.unit.s; g = ZERO_ZERO} ** {n = Pl} ; -- Sub10 -> Sub100 -> Sub1000 ; * 100 + n
-}
in {s = unitFigure ++ numStr ++ "na" ++ e.s; g = ZERO_ZERO} ** {n = Pl} ; -- Sub10 -> Sub100 -> Sub1000 ; * 100 + n
lin pot2as3 n = n ;
lin pot3 n = let
@@ -69,8 +75,8 @@ lin pot3plus n m = let
};
in { s = thousand ++ m.s; g = ZERO_ZERO; n = n.n} ;
-- numerals as sequences of digits
{-
lincat
Dig = TDigit ;
@@ -78,15 +84,15 @@ lin pot3plus n m = let
IDig d = d ** {tail = T1} ;
IIDig d i = {
s = \\o,c => d.s ! NCard ! Nom ++ commaIf i.tail ++ i.s ! o ! c ;
s = \\o,agr => d.s ! NCard ! agr ++ commaIf i.tail ++ i.s ! o ! agr ;
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_1 = mk3Dig "1" "1" Sg ;
D_2 = mkDig "2" ;
D_3 = mkDig "3" ;
D_4 = mkDig "4" ;
D_5 = mkDig "5" ;
D_6 = mkDig "6" ;
@@ -104,24 +110,22 @@ lin pot3plus n m = let
T1 => T2 ;
T2 => T3 ;
T3 => T1
} ;
};
mk2Dig : Str -> Str -> TDigit = \c,o -> mk3Dig c o Pl ;
mkDig : Str -> TDigit = \c -> mk2Dig c (c + "th") ;
mkDig : Str -> TDigit = \c -> mk2Dig c c;
mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
s = table {NCard => regGenitiveS c ; NOrd => regGenitiveS o} ;
s = table {NCard =>\\_=> c ; NOrd => mkOrdinal c } ;
n = n
} ;
TDigit = {
n : Number ;
s : CardOrd => Case => Str
s : CardOrd =>Agreement => Str;
n : Number
} ;
-}
mkOrdinal : Str -> Agreement => Str =\c -> \\agr => mkGenPrepWithIVClitic ! agr ++ c;
{-
--1 Numerals

View File

@@ -39,6 +39,21 @@ oper
mkV3 : Str -> Str ->Str -> Verb3 = \root ,s1,s2 ->mkV2 root s1 s2 ** {comp2 =[]};
};
{-
prepV2 v p = lin V2 {s = v.s ; p = v.p ; c2 = p.s ; isRefl = v.isRefl} ;
dirV2 v = prepV2 v noPrep ;
--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 -> Prep ; -- e.g. "in front of"
--mkPost : Str -> Prep ; -- e.g. "ago"
noPrep : Prepostion; -- no preposition
noPrep = mkPrep [] ;
-}
{-
--V2V verbs
mkV2V = overload {

View File

@@ -26,8 +26,8 @@ param
RI_ZERO | KU_ZERO | MU_ZERO | RU_ZERO |
KA_ZERO |ZERO_BAA | N_ZERO | KI_ZERO;
Case = Acc | Nom ; -- we need to include Gen because we shall need it with Gen Pronouns
RCase = RSuj | RObj |RGen;
PersonalPronounType = SubjM | Obj | RelSubj | RelObj |
RCase = RSuj | RObj;
PersonalPronounType = SubjM | Obj | RelSubj | RelObj |
AdjPron2 | -- aAdjectival Prefixes with initial vowel with the semantics of "the" e.g. -- omuntu o-mu-rungi
AdjPron | -- without initial vowel i.e. -- omuntu mu-rungi
--GenPron | -- different types of pronouns
@@ -661,6 +661,39 @@ oper
};
-- Genetive Preposition: simple "of" with Initil vowel
mkGenPrepWithIVClitic : Agreement => Str = table {
AgMUBAP1 n => mkClitics "owa" "aba" n;
--AgMUBAP1 Pl => "aba" ;
AgMUBAP2 n => mkClitics "owa" "aba" n; --probably an error check your grammar book
--AgMUBAP2 Pl => "aba" ;
AgP3 n MU_BA => mkClitics "owa" "aba" n;
--AgP3 Pl MU_BA => "aba" ;
AgP3 Pl ZERO_BU => mkClitic "obwa" ;
AgP3 Sg BU_MA => mkClitic "obwa" ;
AgP3 Pl (KA_BU | RU_BU) => mkClitic "obwa" ;
AgP3 Pl (KI_BI | ZERO_BI) => mkClitic "ebya" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => mkClitic "aga";
AgP3 (Sg | Pl) HA => mkClitic "aha" ; -- of place HA
AgP3 (Sg | Pl) MU => mkClitic "amwa" ; -- of place MU
AgP3 (Sg | Pl) KU => mkClitic "aya" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>mkClitic "arya" ;
AgP3 Sg (KA_ZERO | KA_BU) =>mkClitic "aka" ;
AgP3 Sg KI_BI => mkClitic "ekya" ;
AgP3 Sg (KU_ZERO | KU_MA) => mkClitic "okwa" ;
AgP3 Sg (MU_MI | MU_ZERO) => mkClitic "ogwa" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => mkClitic "orwa" ;
AgP3 Pl (ZERO_TU | KA_TU) =>mkClitic "otwa" ;
AgP3 Sg (ZERO_ZERO | N_N) =>mkClitic "eya" ;
AgP3 Pl ZERO_MI =>mkClitic "eya" ;
AgP3 Pl MU_MI => mkClitic "emi";
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) =>mkClitic "eza" ;
AgP3 Sg GU_GA => mkClitic "ogwa" ;
AgP3 Pl GU_GA => mkClitic "aga" ;
_ => mkClitic "Error mkGenPrepWithIVClitic" -- error checking for any case not catered for
};
mkRPs : RCase => Agreement =>Str = table{
RSubj => table {
AgMUBAP1 Sg => mkClitic "o";
@@ -759,14 +792,16 @@ oper
};
-- type for Determier necessary for catCgg.gf
Determiner : Type = {s : Str ; ntype : NounState ; num : Number ; pos : Position };
Determiner : Type = {s : Str ; s2: Agreement=>Str; ntype : NounState ; num : Number ; pos : Position; doesAgree: Bool };
mkDet : Str -> NounState -> Number -> Position -> Determiner
= \ det, ns, num,pos ->
{
s = det;
s2 = \\_=>[];
ntype = ns;
num = num;
pos = pos;
doesAgree = False
};
-- Pronouns must have agreement because they are used
@@ -1053,24 +1088,34 @@ oper
param
--2 For $Numeral$
CardOrd = NCard;
CardOrd = NCard | NOrd;
--DForm = Unit Gender| Ten Gender | N20_50 Gender| N60_n70 Gender; -- | hundred | thousand | tenThousand | hundredThousand | million ;
oper
mkNum : Str ->Str -> Gender ->Str-> Gender -> --Str-> Gender->Str-> Gender-> Str -> Gender
mkNum : Str ->Str -> Gender ->Str-> Gender -> Bool-> --Str-> Gender->Str-> Gender-> Str -> Gender
{
s : Str;
unit : { s:Str ; g : Gender; stem : Str};
ten : { s:Str ; g : Gender}
ten : { s:Str ; g : Gender};
ordinal :Str;
--twenty_fifty : { s:str ; g : gender; stem : Str};
--sixty_seventy : { s:str ; g : gender; stem : Str};
--eighty_ninety : { s:str ; g : gender; stem : Str};
isOrdDifferent: Bool -- If the ordinal number is different from the cardinal
} =
\biri,ibiri, g1, abiri,g2 ->
{
s = [];
unit = {s = ibiri; g = g1; stem ="biri"};
ten = {s = abiri ; g = g2};
};
\biri, ibiri, g1, abiri,g2, isOrdDifferent -> case isOrdDifferent of {
True =>{
s = [];
unit = {s = ibiri; g = g1; stem =biri};
ten = {s = abiri ; g = g2};
ordinal = "ka" + biri;
isOrdDifferent = isOrdDifferent
};
False =>{
s = [];
unit = {s = ibiri; g = g1; stem =biri};
ten = {s = abiri ; g = g2};
ordinal = [];
isOrdDifferent = isOrdDifferent
}
};
}

View File

@@ -14,14 +14,14 @@ concrete StructuralCgg of Structural = CatCgg **
-}
lin
--Determiner : Type = {s : Str ; s2: Agreement=>Str; ntype : NounState ; num : Number ; pos : Position; doesAgree: Bool };
a_Det = {s =[] ; s2 = \\_ => []; ntype = Complete; num = Sg; pos = PreDeterminer; doesAgree = False}; --: Det ; indefinite singular ---s
aPl_Det = {s =[]; s2= \\_ => []; ntype = Complete; num = Pl; pos = PreDeterminer; doesAgree = False}; -- : Det ;indefinite plural ---s
the_Det = {s =[]; s2= \\_ => []; ntype = Complete; num = Sg; pos = PreDeterminer; doesAgree = False}; --: Det ; -- definite singular ---s thePl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; --: Det ;definite plural ---s
a_Det = {s =[] ; ntype = Complete; num = Sg; pos = PreDeterminer}; --: Det ; indefinite singular ---s
aPl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; -- : Det ;indefinite plural ---s
the_Det = {s =[]; ntype = Complete; num = Sg; pos = PreDeterminer}; --: Det ; -- definite singular ---s thePl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; --: Det ;definite plural ---s
every_Det = {s = "buri"; ntype=Incomplete; num=Sg; pos=PreDeterminer} ;
few_Det = {s="kye"; ntype =Complete; num=Pl; pos=PostDeterminer} ;
many_Det ={s="ingi"; ntype =Complete; num=Pl; pos=PostDeterminer} ;
every_Det = {s ="buri"; s2 = \\_ => []; ntype=Incomplete; num=Sg; pos=PreDeterminer; doesAgree = False} ;
few_Det = {s="kye"; s2 = \\_ => []; ntype =Complete; num=Pl; pos=PostDeterminer; doesAgree = False} ;
many_Det ={s="ingi"; s2 = \\_ => []; ntype =Complete; num=Pl; pos=PostDeterminer; doesAgree = False} ;
i_Pron = mkPron "nyowe" "nyowe" (AgMUBAP1 Sg);
youSg_Pron = mkPron "iwe" "we" (AgMUBAP2 Sg);

View File

@@ -61,7 +61,11 @@ lin
comp2 = np.s ! Acc;
isRegular = v3.isRegular
};
--SlashV2V : V2V -> VP -> VPSlash ; -- beg (her) to go
--SlashV2S : V2S -> S -> VPSlash ; -- answer (to him) that it is good
--SlashV2Q : V2Q -> QS -> VPSlash ; -- ask (him) who came
--SlashV2A : V2A -> AP -> VPSlash ; -- paint (it) red
-- ComplSlash : VPSlash -> NP -> VP ; -- love it
ComplSlash vpslash np ={
s =vpslash.s;