Merge pull request #264 from bamutra/master

Rukiga gf-rgl
This commit is contained in:
Inari Listenmaa
2019-07-24 05:55:52 +03:00
committed by GitHub
32 changed files with 123652 additions and 0 deletions

68
src/rukiga/AdjectiveCgg.gf Executable file
View File

@@ -0,0 +1,68 @@
--# -path=.:../prelude:../abstract:../common
concrete AdjectiveCgg of Adjective = CatCgg **
open ResCgg, Prelude, ParamX in {
lin
PositA a = {s=\\_=> a.s; position= a.position; isProper = a.isProper; isPrep = a.isPrep};
-- The superlative use is covered in $Ord$.
--AdjOrd : Ord -> AP ; -- warmest
AdjOrd ord = {s= \\agr => ord.s!agr ; position= ord.position; isProper = False; isPrep = False};
-- UseComparA : A -> AP ; -- warmer
-- note: using ho means a little bigger.
--UseComparA a ={s =\\_ => a.s ++ BIND ++ "ho" ++ "kukira"; position1= a.position1; isProper = a.isProper; isPrep = a.isPrep};
UseComparA a ={s =\\_ => a.s ++ "kukira"; position= a.position; isProper = a.isProper; isPrep = a.isPrep};
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
{-NOTE: AdA is an adjective modifying adverb-}
--AdAP : AdA -> AP -> AP ; -- very warm
AdAP ada ap = case ada.position of {
Pre => {s = \\agr => ada.s ++ ap.s!agr ; position= ap.position; isProper = ap.isProper; isPrep = ap.isPrep};
Post => {s = \\agr => ap.s ! agr ++ ada.s; position= ap.position; isProper = ap.isProper; isPrep = ap.isPrep}
};
{-
abstract Adjective = Cat ** {
fun
-- The principal ways of forming an adjectival phrase are
-- positive, comparative, relational, reflexive-relational, and
-- elliptic-relational.
PositA : A -> AP ; -- warm
ComparA : A -> NP -> AP ; -- warmer than I
ComplA2 : A2 -> NP -> AP ; -- married to her
ReflA2 : A2 -> AP ; -- married to itself
UseA2 : A2 -> AP ; -- married
UseComparA : A -> AP ; -- warmer
CAdvAP : CAdv -> AP -> NP -> AP ; -- as cool as John
-- The superlative use is covered in $Ord$.
AdjOrd : Ord -> AP ; -- warmest
-- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives.
SentAP : AP -> SC -> AP ; -- good that she is here
-- An adjectival phrase can be modified by an *adadjective*, such as "very".
AdAP : AdA -> AP -> AP ; -- very warm
-- It can also be postmodified by an adverb, typically a prepositional phrase.
AdvAP : AP -> Adv -> AP ; -- warm by nature
-- The formation of adverbs from adjectives (e.g. "quickly") is covered
-- in [Adverb Adverb.html]; the same concerns adadjectives (e.g. "extremely").
-}
}

65
src/rukiga/AdverbCgg.gf Executable file
View File

@@ -0,0 +1,65 @@
--# -path=.:../prelude:../abstract:../common
concrete AdverbCgg of Adverb = CatCgg **
open ResCgg, Prelude in {
lin
--PrepNP : Prep -> NP -> Adv -- Verb Phrase modifyingadverb such as everywhere
--adverb of place pg 118 part (c)
-- some prepositions can only operate with CN but not PN
-- how can we distinguish NPs i.e if they are CN or PN?
-- because aha is used for CN while aha-ri is used for PN Omubazi
-- nigukora ahari John
-- The nounPhrase must carry information about its derivation
{-Assumed that a PrepNP is always Acc-}
PrepNP prep np = {s = prep.s ++ np.s ! Acc; agr = AgrNo}; -- aha meza
--PositAdvAdj : A -> Adv ; -- warmly
--"Impossible to implement because each is lexically different word."
{-
PositAdvAdj a = case <a.isProper, a.position1> of {
<True, True> =>{ s= a}
<False, False> =>
<True, False> =>
<_,_> =>
};
-}
{-
abstract Adverb = Cat ** {
fun
-- The two main ways of forming adverbs are from adjectives and by
-- prepositions from noun phrases.
PositAdvAdj : A -> Adv ; -- warmly
PrepNP : Prep -> NP -> Adv ; -- in the house
-- Comparative adverbs have a noun phrase or a sentence as object of
-- comparison.
ComparAdvAdj : CAdv -> A -> NP -> Adv ; -- more warmly than John
ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
-- Adverbs can be modified by 'adadjectives', just like adjectives.
AdAdv : AdA -> Adv -> Adv ; -- very quickly
-- Like adverbs, adadjectives can be produced by adjectives.
PositAdAAdj : A -> AdA ; -- extremely
-- Subordinate clauses can function as adverbs.
SubjS : Subj -> S -> Adv ; -- when she sleeps
-- Comparison adverbs also work as numeral adverbs.
AdnCAdv : CAdv -> AdN ; -- less (than five)
-}
}

242
src/rukiga/CatCgg.gf Executable file
View File

@@ -0,0 +1,242 @@
--# -path=.:../prelude:../abstract:../common
concrete CatCgg of Cat = CommonX -[Adv,IAdv, AdA]**
open (Res=ResCgg), Prelude, (Px=ParamX), Predef in {
lincat
Imp = {s : Res. ImpPol=> Str} ;
QS = {s : Str} ;
-- Note: SS is a shorthand for {s:Str}, defined in Prelude.gf
-- You must change some of the lincats (e.g., for NP, Det and Pron) so that everything works
S = SS ; -- declarative sentence e.g. "she lived here"
Cl = Res.Clause ; -- declarative clause, with all tenses e.g. "she looks at this"
--Questions
QCl = Res.Clause ** {posibleSubAgr: Res.Agreement =>Str} ;
IComp =
{
s : Str;
--other:Str; Has been deleted but note that there are several words for asking questions
n : Res.INumber;
requiresSubjPrefix: Bool;
requiresIPPrefix: Bool;
usesAux : Bool;
endOfSentence : Bool
} ;
IP = {s :Str ; n : Res.INumber; isVerbSuffix: Bool; requiresIPPrefix: Bool; aux:Str; endOfSentence:Bool}; -- other holds the Idet without a prefix
IAdv = {s : Str ; requiresSubjPrefix: Bool; endOfSentence:Bool};
IDet = {s : Str ; n : Res.Number; requiresSubjPrefix: Bool};
IQuant = {s : Res.Number =>Str ; requiresSubjPrefix: Bool};
RS = {s :Res.RForm => Str} ; -- relative e.g. "in which she lived"
V,VS, VQ, VA = Res.Verb ; --change to {verb : Str ; comp = []} -- one-place verb e.g. "sleep"
V2,V2Q, V2S = Res.Verb2;
V2A,V3 = Res.Verb3; -- three-place verb e.g. "show"
VP = Res.VerbPhrase ; -- verb phrase e.g. "is very warm"
N = Res.Noun ; -- common noun e.g. "house"
CN = Res.Noun ; -- common noun (without determiner) e.g. "red house"
NP = Res.NounPhrase; -- noun phrase (subject or object) e.g. "the red house"
Pron = Res.Pronoun ; -- personal pronoun e.g. "she"
Det = Res.Determiner ; -- determiner phrase e.g. "those seven"
Quant = {s : Res.Pronoun; s2 :Res.Agreement => Str; doesAgree : Bool; isPron: Bool} ; -- quantifier ('nucleus' of Det) e.g. "this/these"
Num = Res.Numer ; -- number determining element e.g. "seven"
AP = {s :Res.Agreement=> Str ; position : Res.Position; isProper : Bool; isPrep: Bool};--Res.AdjectivalPhrase;
A = Res.Adjective;
Comp = Res.Comp; -- complement of copula, such as AP e.g. "very warm"
Adv = Res.Adverb; --Verb Phrase modifying adverb
VPSlash = Res.VPSlash;
PN = Res.ProperNoun; -- ProperNoun : Type = {s: Str ; a:Agreement ; isPlace : Bool};
Conj = Res.Conjunction; -- Conjunction: Type = {s : AgrConj =>Str ;s2 : Str ; n : Number} ; -- conjunction e.g. "and"
-- see Structural for explanation of this structure
Predet = {s : Str ; s2 : Str; isMWE : Bool; isInflected : Bool}; -- predeterminer (prefixed Quant) e.g. "all"
RP = {s : Res.RCase => Res.Agreement => Str ; rObjVariant2: Res.Agreement => Str} ;
RCl ={
s : Str ; --subject
--subAgr:Res.Agreement;
rp: Res.RCase => Res.Agreement => Str; -- could delete this
--rObjVariant2: Res.Agreement => Str;
agr : Res.AgrExist;
pres :Str;
perf :Str;
root : Str;
--morphs : Res.VFormMini => Res.VerbMorphPos =>Str;
compl : Str; -- after verb: complement, adverbs
isCompApStem : Bool;
whichRel: Res.RForm
} ;
--VPSlash ={s:Str; morphs: VMorphs}; --VPSlash ; -- verb phrase missing complement e.g. "give to John"
--ClSlash;-- clause missing NP (S/NP in GPSG) e.g. "she looks at"
ClSlash = {
s : Str ; --subject
subjAgr : Res.Agreement;
root : Str;
pres: Str;
perf:Str;
--morphs : Res.VFormMini => Res.VerbMorphPos =>Str; --; compl : Str -- after verb: complement, adverbs
ap:Str;
isRegular:Bool;
adv:Str;
adV:Str;
complType: Res.ComplType;
} ;
Numeral = {s : Res.CardOrd=>Res.Agreement=> Str ; g : Res.Gender; n: Res.Number} ;
Digits = {s : Res.CardOrd => Res.Agreement=>Str ; n : Res.Number ; tail : Px.DTail} ;
Ord = {s :Res.Agreement=>Str; position:Res.Position} ;
Card = {s :Res.Agreement=>Str; n : Res.Number} ;
DAP = Res.Determiner ;
N2 = Res.Noun ** {c2 : Res.Agreement =>Str}; -- relational noun e.g. "son"
Prep = Res.Preposition; -- preposition, or just case e.g. "in"
N3 = N2 ** {c3 : Res.Agreement =>Str};
VV = Res.Verb ** {inf:Str; whenUsed: Res.VVMood}; --inf is the other verb
AdA = {s:Str; position:Res.Position};
linref
Cl =\cl -> cl.s ++ Res.mkSubjClitic cl.subjAgr ++ cl.root ++ BIND ++ cl.pres ++ cl.compl;
QCl =\qcl -> qcl.s ++ qcl.posibleSubAgr ! (Res.mkAgreement Res.MU_BA Res.P3 Res.Sg) ++ qcl.root ++ BIND ++ qcl.pres;
VP =\vp -> vp.adv ++ vp.s ++ BIND ++ vp.pres ++ vp.comp ++vp.comp2 ++ vp.ap;
VPSlash =\vpslash -> vpslash.s ++ BIND ++ vpslash.pres;
--1 Cat: the Category System
-- The category system is central to the library in the sense
-- that the other modules ($Adjective$, $Adverb$, $Noun$, $Verb$ etc)
-- communicate through it. This means that a e.g. a function using
-- $NP$s in $Verb$ need not know how $NP$s are constructed in $Noun$:
-- it is enough that both $Verb$ and $Noun$ use the same type $NP$,
-- which is given here in $Cat$.
--
-- Some categories are inherited from [``Common`` Common.html].
-- The reason they are defined there is that they have the same
-- implementation in all languages in the resource (typically,
-- just a string). These categories are
-- $AdA, AdN, AdV, Adv, Ant, CAdv, IAdv, PConj, Phr$,
-- $Pol, SC, Tense, Text, Utt, Voc, Interj$.
--
-- Moreover, the list categories $ListAdv, ListAP, ListNP, ListS$
-- are defined on $Conjunction$ and only used locally there.
{-
abstract Cat = Common ** {
cat
--2 Sentences and clauses
-- Constructed in [Sentence Sentence.html], and also in
-- [Idiom Idiom.html].
S ; -- declarative sentence e.g. "she lived here"
QS ; -- question e.g. "where did she live"
RS ; -- relative e.g. "in which she lived"
Cl ; -- declarative clause, with all tenses e.g. "she looks at this"
ClSlash;-- clause missing NP (S/NP in GPSG) e.g. "she looks at"
SSlash ;-- sentence missing NP e.g. "she has looked at"
Imp ; -- imperative e.g. "look at this"
--2 Questions and interrogatives
-- Constructed in [Question Question.html].
QCl ; -- question clause, with all tenses e.g. "why does she walk"
IP ; -- interrogative pronoun e.g. "who"
IComp ; -- interrogative complement of copula e.g. "where"
IDet ; -- interrogative determiner e.g. "how many"
IQuant; -- interrogative quantifier e.g. "which"
--2 Relative clauses and pronouns
-- Constructed in [Relative Relative.html].
RCl ; -- relative clause, with all tenses e.g. "in which she lives"
RP ; -- relative pronoun e.g. "in which"
--2 Verb phrases
-- Constructed in [Verb Verb.html].
VP ; -- verb phrase e.g. "is very warm"
Comp ; -- complement of copula, such as AP e.g. "very warm"
VPSlash ; -- verb phrase missing complement e.g. "give to John"
--2 Adjectival phrases
-- Constructed in [Adjective Adjective.html].
AP ; -- adjectival phrase e.g. "very warm"
--2 Nouns and noun phrases
-- Constructed in [Noun Noun.html].
-- Many atomic noun phrases e.g. "everybody"
-- are constructed in [Structural Structural.html].
-- The determiner structure is
-- ``` Predet (QuantSg | QuantPl Num) Ord
-- as defined in [Noun Noun.html].
CN ; -- common noun (without determiner) e.g. "red house"
NP ; -- noun phrase (subject or object) e.g. "the red house"
Pron ; -- personal pronoun e.g. "she"
Det ; -- determiner phrase e.g. "those seven"
Predet ; -- predeterminer (prefixed Quant) e.g. "all"
Quant ; -- quantifier ('nucleus' of Det) e.g. "this/these"
Num ; -- number determining element e.g. "seven"
Card ; -- cardinal number e.g. "seven"
ACard ; -- adjective like cardinal e.g. "few", "many"
Ord ; -- ordinal number (used in Det) e.g. "seventh"
DAP ; -- determiner with adjective e.g. "three small"
--2 Numerals
-- Constructed in [Numeral Numeral.html].
Numeral ; -- cardinal or ordinal in words e.g. "five/fifth"
Digits ; -- cardinal or ordinal in digits e.g. "1,000/1,000th"
--2 Structural words
-- Constructed in [Structural Structural.html].
Conj ; -- conjunction e.g. "and"
---b DConj ; -- distributed conjunction e.g. "both - and"
Subj ; -- subjunction e.g. "if"
Prep ; -- preposition, or just case e.g. "in"
--2 Words of open classes
-- These are constructed in [Lexicon Lexicon.html] and in
-- additional lexicon modules.
V ; -- one-place verb e.g. "sleep"
V2 ; -- two-place verb e.g. "love"
V3 ; -- three-place verb e.g. "show"
VV ; -- verb-phrase-complement verb e.g. "want"
VS ; -- sentence-complement verb e.g. "claim"
VQ ; -- question-complement verb e.g. "wonder"
VA ; -- adjective-complement verb e.g. "look"
V2V ; -- verb with NP and V complement e.g. "cause"
V2S ; -- verb with NP and S complement e.g. "tell"
V2Q ; -- verb with NP and Q complement e.g. "ask"
V2A ; -- verb with NP and AP complement e.g. "paint"
A ; -- one-place adjective e.g. "warm"
A2 ; -- two-place adjective e.g. "divisible"
N ; -- common noun e.g. "house"
N2 ; -- relational noun e.g. "son"
N3 ; -- three-place relational noun e.g. "connection"
PN ; -- proper name e.g. "Paris"
-- DEPRECATED: QuantSg, QuantPl
--- QuantSg ;-- quantifier ('nucleus' of sing. Det) e.g. "every"
--- QuantPl ;-- quantifier ('nucleus' of plur. Det) e.g. "many"
-}
}

16
src/rukiga/CompatibilityCgg.gf Executable file
View File

@@ -0,0 +1,16 @@
--# -path=.:../prelude:../abstract:../common
concrete CompatibilityCgg of Compatibility = CatCgg **
open Prelude, ResCgg in {
{-
abstract Compatibility = Cat ** {
fun
NumInt : Int -> Num ; -- 57
OrdInt : Int -> Ord ; -- 57
-}
}

105
src/rukiga/ConjunctionCgg.gf Executable file
View File

@@ -0,0 +1,105 @@
--# -path=.:../prelude:../abstract:../common
concrete ConjunctionCgg of Conjunction = CatCgg **
open ResCgg, Coordination, Prelude in {
lincat
[NP] = {s1,s2 :Case => Str ; agr : Agreement};
[CN] = {s1,s2 : Number => NounState => Str; gender:Gender};
[AP] = {s1,s2 : Agreement=> Str ; position : Position; isProper : Bool; isPrep: Bool};
[RS] = {s1,s2 : RForm => Str};
--[IAdv] = {s1,s2 : Str} ;
{-
[S] = {s1,s2 : Str} ;
[Adv] = {s1,s2 : Str} ;
[AdV] = {s1,s2 : Str} ;
[RS] = {s1,s2 : Agr => Str ; c : NPCase};
[CN] = {s1,s2 : Number => Case => Str};
[DAP] = {s1,s2 : Str ; n : Number};
-}
{-
--1 Conjunction: Coordination
-- Coordination is defined for many different categories; here is
-- a sample. The rules apply to *lists* of two or more elements,
-- and define two general patterns:
-- - ordinary conjunction: X,...X and X
-- - distributed conjunction: both X,...,X and X
--
--
-- $VP$ conjunctions are not covered here, because their applicability
-- depends on language. Some special cases are defined in
-- [``Extra`` ../abstract/Extra.gf].
abstract Conjunction = Cat ** {
--2 Rules
fun
ConjS : Conj -> ListS -> S ; -- he walks and she runs
ConjRS : Conj -> ListRS -> RS ; -- who walks and whose mother runs
ConjAP : Conj -> ListAP -> AP ; -- cold and warm
ConjNP : Conj -> ListNP -> NP ; -- she or we
ConjAdv : Conj -> ListAdv -> Adv ; -- here or there
ConjAdV : Conj -> ListAdV -> AdV ; -- always or sometimes
ConjIAdv : Conj -> ListIAdv -> IAdv ; -- where and with whom
ConjCN : Conj -> ListCN -> CN ; -- man and woman
ConjDet : Conj -> ListDAP -> Det ; -- his or her
--2 Categories
-- These categories are only used in this module.
cat
[S]{2} ;
[RS]{2} ;
[Adv]{2} ;
[AdV]{2} ;
[NP]{2} ;
[AP]{2} ;
[IAdv]{2} ;
[CN] {2} ;
[DAP] {2} ;
--2 List constructors
-- The list constructors are derived from the list notation and therefore
-- not given explicitly. But here are their type signatures:
-- overview
BaseC : C -> C -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S
ConsC : C -> [C] -> [C] ; --- for C = AdV, Adv, AP, CN, Det, IAdv, NP, RS, S
-- complete list
BaseAP : AP -> AP -> ListAP ; -- red, white
ConsAP : AP -> ListAP -> ListAP ; -- red, white, blue
BaseAdV : AdV -> AdV -> ListAdV ; -- always, sometimes
ConsAdV : AdV -> ListAdV -> ListAdV ; -- always, sometimes, never
BaseAdv : Adv -> Adv -> ListAdv ; -- here, there
ConsAdv : Adv -> ListAdv -> ListAdv ; -- here, there, everywhere
BaseCN : CN -> CN -> ListCN ; -- man, woman
ConsCN : CN -> ListCN -> ListCN ; -- man, woman, child
BaseIAdv : IAdv -> IAdv -> ListIAdv ; -- where, when
ConsIAdv : IAdv -> ListIAdv -> ListIAdv ; -- where, when, why
BaseNP : NP -> NP -> ListNP ; -- John, Mary
ConsNP : NP -> ListNP -> ListNP ; -- John, Mary, Bill
BaseRS : RS -> RS -> ListRS ; -- who walks, whom I know
ConsRS : RS -> ListRS -> ListRS ; -- who wals, whom I know, who is here
BaseS : S -> S -> ListS ; -- John walks, Mary runs
ConsS : S -> ListS -> ListS ; -- John walks, Mary runs, Bill swims
-}
}

23
src/rukiga/DictCggAbs.gf Normal file
View File

@@ -0,0 +1,23 @@
abstract DictEngAbs = Cat ** {
{- --beginning of comment
fun
{-
--since this is a structural word, maybe take it to
Extend module for structural as you have done for Dict.
We have ahandi = at another place whic has no English equivalent.
-}
------ Structural words
{-aditions-}
here1_Adv; -- hanu
here2_Adv; -- hanuuya --exactly here or here with emphasis
there1_Adv; -- hariya
outside_Adv; -- aheeru
near_Adv; --haihi
hare_Adv; --far
-} --end of comment
}

View File

@@ -0,0 +1,97 @@
abstract ExtraStructuralAbs = Cat ** {
fun
--Pronouns additional
it_N_N_Sg_Pron : Pron;
it_N_N_Pl_Pron : Pron;
it_KU_MA _Sg_Pron : Pron ;
it_KU_MA_Pl_Pron : Pron;
it_BU_MA_Sg_Pron : Pron;
it_BU_MA_Pl_Pron : Pron;
it_RU_BU_Sg_Pron : Pron;
it_RU_BU_Pl_Pron : Pron;
it_GU_GA_Sg_Pron : Pron;
it_GU_GA_Pl_Pron : Pron;
it_ZERO_ZERO_Sg_Pron : Pron; --what do you do with this?
it_ZERO_ZERO_Pl_Pron : Pron; --what would you do with this?
it_MU_MI_Sg_Pron : Pron;
it_MU_MI_Pl_Pron : Pron;
it_RI_MA_Sg_Pron : Pron;
it_RI_MA_Pl_Pron : Pron;
it_I_MA_Sg_Pron : Pron;
it_I_MA_Pl_Pron : Pron;
it_KA_BU_Sg_Pron : Pron;
it_KA_BU_Pl_Pron : Pron;
it_KA_TU_Sg_Pron : Pron;
it_KA_TU_Pl_Pron : Pron;
it_RU_N_Sg_Pron : Pron;
it_RU_N_Pl_Pron : Pron;
it_RU_MA_Sg_Pron : Pron;
it_RU_MA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron;
it_HA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron; -- might have to remove this.
it_HA_Pl_Pron : Pron;
it_MU_Sg_Pron : Pron;
it_MU_Pl_Pron : Pron;
it_KU_Sg_Pron : Pron;
it_KU_Pl_Pron : Pron;
--it_ZERO_BU_Sg_Pron : Pron;
it_ZERO_BU_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_MA_Sg_Pron : Pron;
it_ZERO_MA_Pl_Pron : Pron;
--it_ZERO_MI_Sg_Pron : Pron;
it_ZERO_MI_Pl_Pron : Pron;
--it_ZERO_TU_Sg_Pron : Pron;
it_ZERO_TU_Pl_Pron : Pron;
--it_ZERO_N_Sg_Pron : Pron;
it_ZERO_N_Pl_Pron : Pron;
it_I_ZERO_Sg_Pron : Pron;
--it_I_ZERO_Pl_Pron : Pron;
it_RI_ZERO_Sg_Pron : Pron;
--it_RI_ZERO_Pl_Pron : Pron;
it_KU_ZERO_Sg_Pron : Pron;
--it_KU_ZERO_Pl_Pron : Pron;
it_MU_ZERO_Sg_Pron : Pron;
it_MU_ZERO_Pl_Pron : Pron;
it_RU_ZERO_Sg_Pron : Pron;
--it_RU_ZERO_Pl_Pron : Pron;
it_KA_ZERO_Sg_Pron : Pron;
--it_KA_ZERO_Pl_Pron : Pron;
it_ZERO_BAA_Sg_Pron : Pron;
--it_ZERO_BAA_Pl_Pron : Pron;
}

View File

@@ -0,0 +1,97 @@
abstract ExtraStructuralAbs = Cat ** {
fun
--Pronouns additional
it_N_N_Sg_Pron : Pron;
it_N_N_Pl_Pron : Pron;
it_KU_MA _Sg_Pron : Pron ;
it_KU_MA_Pl_Pron : Pron;
it_BU_MA_Sg_Pron : Pron;
it_BU_MA_Pl_Pron : Pron;
it_RU_BU_Sg_Pron : Pron;
it_RU_BU_Pl_Pron : Pron;
it_GU_GA_Sg_Pron : Pron;
it_GU_GA_Pl_Pron : Pron;
it_ZERO_ZERO_Sg_Pron : Pron; --what do you do with this?
it_ZERO_ZERO_Pl_Pron : Pron; --what would you do with this?
it_MU_MI_Sg_Pron : Pron;
it_MU_MI_Pl_Pron : Pron;
it_RI_MA_Sg_Pron : Pron;
it_RI_MA_Pl_Pron : Pron;
it_I_MA_Sg_Pron : Pron;
it_I_MA_Pl_Pron : Pron;
it_KA_BU_Sg_Pron : Pron;
it_KA_BU_Pl_Pron : Pron;
it_KA_TU_Sg_Pron : Pron;
it_KA_TU_Pl_Pron : Pron;
it_RU_N_Sg_Pron : Pron;
it_RU_N_Pl_Pron : Pron;
it_RU_MA_Sg_Pron : Pron;
it_RU_MA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron;
it_HA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron; -- might have to remove this.
it_HA_Pl_Pron : Pron;
it_MU_Sg_Pron : Pron;
it_MU_Pl_Pron : Pron;
it_KU_Sg_Pron : Pron;
it_KU_Pl_Pron : Pron;
--it_ZERO_BU_Sg_Pron : Pron;
it_ZERO_BU_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_MA_Sg_Pron : Pron;
it_ZERO_MA_Pl_Pron : Pron;
--it_ZERO_MI_Sg_Pron : Pron;
it_ZERO_MI_Pl_Pron : Pron;
--it_ZERO_TU_Sg_Pron : Pron;
it_ZERO_TU_Pl_Pron : Pron;
--it_ZERO_N_Sg_Pron : Pron;
it_ZERO_N_Pl_Pron : Pron;
it_I_ZERO_Sg_Pron : Pron;
--it_I_ZERO_Pl_Pron : Pron;
it_RI_ZERO_Sg_Pron : Pron;
--it_RI_ZERO_Pl_Pron : Pron;
it_KU_ZERO_Sg_Pron : Pron;
--it_KU_ZERO_Pl_Pron : Pron;
it_MU_ZERO_Sg_Pron : Pron;
it_MU_ZERO_Pl_Pron : Pron;
it_RU_ZERO_Sg_Pron : Pron;
--it_RU_ZERO_Pl_Pron : Pron;
it_KA_ZERO_Sg_Pron : Pron;
--it_KA_ZERO_Pl_Pron : Pron;
it_ZERO_BAA_Sg_Pron : Pron;
--it_ZERO_BAA_Pl_Pron : Pron;
}

View File

@@ -0,0 +1,97 @@
abstract ExtraStructuralCggAbs = Cat ** {
fun
--Pronouns additional
it_N_N_Sg_Pron : Pron;
it_N_N_Pl_Pron : Pron;
it_KU_MA _Sg_Pron : Pron ;
it_KU_MA_Pl_Pron : Pron;
it_BU_MA_Sg_Pron : Pron;
it_BU_MA_Pl_Pron : Pron;
it_RU_BU_Sg_Pron : Pron;
it_RU_BU_Pl_Pron : Pron;
it_GU_GA_Sg_Pron : Pron;
it_GU_GA_Pl_Pron : Pron;
it_ZERO_ZERO_Sg_Pron : Pron; --what do you do with this?
it_ZERO_ZERO_Pl_Pron : Pron; --what would you do with this?
it_MU_MI_Sg_Pron : Pron;
it_MU_MI_Pl_Pron : Pron;
it_RI_MA_Sg_Pron : Pron;
it_RI_MA_Pl_Pron : Pron;
it_I_MA_Sg_Pron : Pron;
it_I_MA_Pl_Pron : Pron;
it_KA_BU_Sg_Pron : Pron;
it_KA_BU_Pl_Pron : Pron;
it_KA_TU_Sg_Pron : Pron;
it_KA_TU_Pl_Pron : Pron;
it_RU_N_Sg_Pron : Pron;
it_RU_N_Pl_Pron : Pron;
it_RU_MA_Sg_Pron : Pron;
it_RU_MA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron;
it_HA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron; -- might have to remove this.
it_HA_Pl_Pron : Pron;
it_MU_Sg_Pron : Pron;
it_MU_Pl_Pron : Pron;
it_KU_Sg_Pron : Pron;
it_KU_Pl_Pron : Pron;
--it_ZERO_BU_Sg_Pron : Pron;
it_ZERO_BU_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_MA_Sg_Pron : Pron;
it_ZERO_MA_Pl_Pron : Pron;
--it_ZERO_MI_Sg_Pron : Pron;
it_ZERO_MI_Pl_Pron : Pron;
--it_ZERO_TU_Sg_Pron : Pron;
it_ZERO_TU_Pl_Pron : Pron;
--it_ZERO_N_Sg_Pron : Pron;
it_ZERO_N_Pl_Pron : Pron;
it_I_ZERO_Sg_Pron : Pron;
--it_I_ZERO_Pl_Pron : Pron;
it_RI_ZERO_Sg_Pron : Pron;
--it_RI_ZERO_Pl_Pron : Pron;
it_KU_ZERO_Sg_Pron : Pron;
--it_KU_ZERO_Pl_Pron : Pron;
it_MU_ZERO_Sg_Pron : Pron;
it_MU_ZERO_Pl_Pron : Pron;
it_RU_ZERO_Sg_Pron : Pron;
--it_RU_ZERO_Pl_Pron : Pron;
it_KA_ZERO_Sg_Pron : Pron;
--it_KA_ZERO_Pl_Pron : Pron;
it_ZERO_BAA_Sg_Pron : Pron;
--it_ZERO_BAA_Pl_Pron : Pron;
}

View File

@@ -0,0 +1,101 @@
concrete ExtraStructuralCggAbsCgg of ExtraStructuralCggAbs = CatCgg ** open ResCgg {
{-
lin
--Pronouns additional
it_N_N_Sg_Pron : Pron;
it_N_N_Pl_Pron : Pron;
it_KU_MA _Sg_Pron : Pron ;
it_KU_MA_Pl_Pron : Pron;
it_BU_MA_Sg_Pron : Pron;
it_BU_MA_Pl_Pron : Pron;
it_RU_BU_Sg_Pron : Pron;
it_RU_BU_Pl_Pron : Pron;
it_GU_GA_Sg_Pron : Pron;
it_GU_GA_Pl_Pron : Pron;
it_ZERO_ZERO_Sg_Pron : Pron; --what do you do with this?
it_ZERO_ZERO_Pl_Pron : Pron; --what would you do with this?
it_MU_MI_Sg_Pron : Pron;
it_MU_MI_Pl_Pron : Pron;
it_RI_MA_Sg_Pron : Pron;
it_RI_MA_Pl_Pron : Pron;
it_I_MA_Sg_Pron : Pron;
it_I_MA_Pl_Pron : Pron;
it_KA_BU_Sg_Pron : Pron;
it_KA_BU_Pl_Pron : Pron;
it_KA_TU_Sg_Pron : Pron;
it_KA_TU_Pl_Pron : Pron;
it_RU_N_Sg_Pron : Pron;
it_RU_N_Pl_Pron : Pron;
it_RU_MA_Sg_Pron : Pron;
it_RU_MA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron;
it_HA_Pl_Pron : Pron;
it_HA_Sg_Pron : Pron; -- might have to remove this.
it_HA_Pl_Pron : Pron;
it_MU_Sg_Pron : Pron;
it_MU_Pl_Pron : Pron;
it_KU_Sg_Pron : Pron;
it_KU_Pl_Pron : Pron;
--it_ZERO_BU_Sg_Pron : Pron;
it_ZERO_BU_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_BI_Sg_Pron : Pron;
it_ZERO_BI_Pl_Pron : Pron;
--it_ZERO_MA_Sg_Pron : Pron;
it_ZERO_MA_Pl_Pron : Pron;
--it_ZERO_MI_Sg_Pron : Pron;
it_ZERO_MI_Pl_Pron : Pron;
--it_ZERO_TU_Sg_Pron : Pron;
it_ZERO_TU_Pl_Pron : Pron;
--it_ZERO_N_Sg_Pron : Pron;
it_ZERO_N_Pl_Pron : Pron;
it_I_ZERO_Sg_Pron : Pron;
--it_I_ZERO_Pl_Pron : Pron;
it_RI_ZERO_Sg_Pron : Pron;
--it_RI_ZERO_Pl_Pron : Pron;
it_KU_ZERO_Sg_Pron : Pron;
--it_KU_ZERO_Pl_Pron : Pron;
it_MU_ZERO_Sg_Pron : Pron;
it_MU_ZERO_Pl_Pron : Pron;
it_RU_ZERO_Sg_Pron : Pron;
--it_RU_ZERO_Pl_Pron : Pron;
it_KA_ZERO_Sg_Pron : Pron;
--it_KA_ZERO_Pl_Pron : Pron;
it_ZERO_BAA_Sg_Pron : Pron;
--it_ZERO_BAA_Pl_Pron : Pron;
-}
}

30
src/rukiga/GrammarCgg.gf Executable file
View File

@@ -0,0 +1,30 @@
--# -path=.:../prelude:../abstract:../common
concrete GrammarCgg of Grammar =
NounCgg,
VerbCgg,
AdjectiveCgg,
AdverbCgg,
NumeralCgg,
SentenceCgg,
QuestionCgg,
RelativeCgg,
ConjunctionCgg,
PhraseCgg,
TextX -[Adv, IAdv,AdA],
StructuralCgg,
IdiomCgg,
TenseX -[Adv,IAdv,AdA]
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;
{-
--1 Grammar: the Main Module of the Resource Grammar
-- This grammar is a collection of the different grammar modules,
-- To test the resource, import [``Lang`` Lang.html], which also contains
-- a lexicon.
-}
}

43
src/rukiga/IdiomCgg.gf Executable file
View File

@@ -0,0 +1,43 @@
--# -path=.:../prelude:../abstract:../common
concrete IdiomCgg of Idiom = CatCgg **
open Prelude, ResCgg in {
{-
--1 Idiom: Idiomatic Expressions
abstract Idiom = Cat ** {
-- This module defines constructions that are formed in fixed ways,
-- often different even in closely related languages.
fun
ImpersCl : VP -> Cl ; -- it is hot
GenericCl : VP -> Cl ; -- one sleeps
CleftNP : NP -> RS -> Cl ; -- it is I who did it
CleftAdv : Adv -> S -> Cl ; -- it is here she slept
ExistNP : NP -> Cl ; -- there is a house
ExistIP : IP -> QCl ; -- which houses are there
-- 7/12/2012 generalizations of these
ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris
ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris
ProgrVP : VP -> VP ; -- be sleeping
ImpPl1 : VP -> Utt ; -- let's go
ImpP3 : NP -> VP -> Utt ; -- let John walk
-- 3/12/2013 non-reflexive uses of "self"
SelfAdvVP : VP -> VP ; -- is at home himself
SelfAdVVP : VP -> VP ; -- is himself at home
SelfNP : NP -> NP ; -- the president himself (is at home)
-}
}

19
src/rukiga/LangCgg.gf Executable file
View File

@@ -0,0 +1,19 @@
--# -path=.:../prelude:../abstract:../common
concrete LangCgg of Lang =
GrammarCgg,
LexiconCgg
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;
{-
--1 Lang: a Test Module for the Resource Grammar
-- This grammar is for testing the resource as included in the
-- language-independent API, consisting of a grammar and a lexicon.
-- The grammar without a lexicon is [``Grammar`` Grammar.html],
-- which may be more suitable to open in applications.
-}
}

352
src/rukiga/Lexicon.gf Normal file
View File

@@ -0,0 +1,352 @@
abstract Lexicon = Cat ** {
fun
add_V3 : V3 ;
airplane_N : N ;
alas_Interj : Interj ;
already_Adv : Adv ;
animal_N : N ;
answer_V2S : V2S ;
apartment_N : N ;
apple_N : N ;
art_N : N ;
ashes_N : N ;
ask_V2Q : V2Q ;
baby_N : N ;
back_N : N ;
bad_A : A ;
bank_N : N ;
bark_N : N ;
beautiful_A : A ;
become_VA : VA ;
beer_N : N ;
beg_V2V : V2V ;
belly_N : N ;
big_A : A ;
bike_N : N ;
bird_N : N ;
bite_V2 : V2 ;
black_A : A ;
blood_N : N ;
blow_V : V ;
blue_A : A ;
boat_N : N ;
bone_N : N ;
book_N : N ;
boot_N : N ;
boss_N : N ;
boy_N : N ;
bread_N : N ;
break_V2 : V2 ;
breast_N : N ;
breathe_V : V ;
broad_A : A ;
brother_N2 : N2 ;
brown_A : A ;
burn_V : V ;
butter_N : N ;
buy_V2 : V2 ;
camera_N : N ;
cap_N : N ;
car_N : N ;
carpet_N : N ;
cat_N : N ;
ceiling_N : N ;
chair_N : N ;
cheese_N : N ;
child_N : N ;
church_N : N ;
city_N : N ;
clean_A : A ;
clever_A : A ;
close_V2 : V2 ;
cloud_N : N ;
coat_N : N ;
cold_A : A ;
come_V : V ;
computer_N : N ;
correct_A : A ;
country_N : N ;
count_V2 : V2 ;
cousin_N : N ;
cow_N : N ;
cut_V2 : V2 ;
day_N : N ;
die_V : V ;
dig_V : V ;
dirty_A : A ;
distance_N3 : N3 ;
doctor_N : N ;
dog_N : N ;
door_N : N ;
do_V2 : V2 ;
drink_V2 : V2 ;
dry_A : A ;
dull_A : A ;
dust_N : N ;
ear_N : N ;
earth_N : N ;
easy_A2V : A2 ;
eat_V2 : V2 ;
egg_N : N ;
empty_A : A ;
enemy_N : N ;
eye_N : N ;
factory_N : N ;
fall_V : V ;
far_Adv : Adv ;
father_N2 : N2 ;
fat_N : N ;
fear_VS : VS ;
fear_V2 : V2 ;
feather_N : N ;
fight_V2 : V2 ;
find_V2 : V2 ;
fingernail_N : N ;
fire_N : N ;
fish_N : N ;
float_V : V ;
floor_N : N ;
flower_N : N ;
flow_V : V ;
fly_V : V ;
fog_N : N ;
foot_N : N ;
forest_N : N ;
forget_V2 : V2 ;
freeze_V : V ;
fridge_N : N ;
friend_N : N ;
fruit_N : N ;
full_A : A ;
fun_AV : A ;
garden_N : N ;
girl_N : N ;
give_V3 : V3 ;
glove_N : N ;
gold_N : N ;
good_A : A ;
go_V : V ;
grammar_N : N ;
grass_N : N ;
green_A : A ;
guts_N : N ;
hair_N : N ;
hand_N : N ;
harbour_N : N ;
hate_V2 : V2 ;
hat_N : N ;
head_N : N ;
heart_N : N ;
hear_V2 : V2 ;
heavy_A : A ;
hill_N : N ;
hit_V2 : V2 ;
hold_V2 : V2 ;
hope_VS : VS ;
horn_N : N ;
horse_N : N ;
hot_A : A ;
house_N : N ;
hunt_V2 : V2 ;
husband_N : N ;
ice_N : N ;
important_A : A ;
industry_N : N ;
iron_N : N ;
john_PN : PN ;
jump_V : V ;
kill_V2 : V2 ;
king_N : N ;
knee_N : N ;
know_V2 : V2 ;
know_VQ : VQ ;
know_VS : VS ;
lake_N : N ;
lamp_N : N ;
language_N : N ;
laugh_V : V ;
leaf_N : N ;
learn_V2 : V2 ;
leather_N : N ;
leave_V2 : V2 ;
left_Ord : Ord ;
leg_N : N ;
lie_V : V ;
like_V2 : V2 ;
listen_V2 : V2 ;
liver_N : N ;
live_V : V ;
long_A : A ;
lose_V2 : V2 ;
louse_N : N ;
love_N : N ;
love_V2 : V2 ;
man_N : N ;
married_A2 : A2 ;
meat_N : N ;
milk_N : N ;
moon_N : N ;
mother_N2 : N2 ;
mountain_N : N ;
mouth_N : N ;
music_N : N ;
name_N : N ;
narrow_A : A ;
near_A : A ;
neck_N : N ;
new_A : A ;
newspaper_N : N ;
night_N : N ;
nose_N : N ;
now_Adv : Adv ;
number_N : N ;
oil_N : N ;
old_A : A ;
open_V2 : V2 ;
paint_V2A : V2A ;
paper_N : N ;
paris_PN : PN ;
peace_N : N ;
pen_N : N ;
person_N : N ;
planet_N : N ;
plastic_N : N ;
play_V2 : V2 ;
play_V : V ;
policeman_N : N ;
priest_N : N ;
probable_AS : A ;
pull_V2 : V2 ;
push_V2 : V2 ;
put_V2 : V2 ;
queen_N : N ;
question_N : N ;
radio_N : N ;
rain_N : N ;
rain_V0 : V ;
read_V2 : V2 ;
ready_A : A ;
reason_N : N ;
red_A : A ;
religion_N : N ;
restaurant_N : N ;
right_Ord : Ord ;
river_N : N ;
road_N : N ;
rock_N : N ;
roof_N : N ;
root_N : N ;
rope_N : N ;
rotten_A : A ;
round_A : A ;
rubber_N : N ;
rub_V2 : V2 ;
rule_N : N ;
run_V : V ;
salt_N : N ;
sand_N : N ;
say_VS : VS ;
school_N : N ;
science_N : N ;
scratch_V2 : V2 ;
sea_N : N ;
seed_N : N ;
seek_V2 : V2 ;
see_V2 : V2 ;
sell_V3 : V3 ;
send_V3 : V3 ;
sew_V : V ;
sharp_A : A ;
sheep_N : N ;
ship_N : N ;
shirt_N : N ;
shoe_N : N ;
shop_N : N ;
short_A : A ;
silver_N : N ;
sing_V : V ;
sister_N : N ;
sit_V : V ;
skin_N : N ;
sky_N : N ;
sleep_V : V ;
small_A : A ;
smell_V : V ;
smoke_N : N ;
smooth_A : A ;
snake_N : N ;
snow_N : N ;
sock_N : N ;
song_N : N ;
speak_V2 : V2 ;
spit_V : V ;
split_V2 : V2 ;
squeeze_V2 : V2 ;
stab_V2 : V2 ;
stand_V : V ;
star_N : N ;
steel_N : N ;
stick_N : N ;
stone_N : N ;
stop_V : V ;
stove_N : N ;
straight_A : A ;
student_N : N ;
stupid_A : A ;
suck_V2 : V2 ;
sun_N : N ;
swell_V : V ;
swim_V : V ;
switch8off_V2 : V2 ;
switch8on_V2 : V2 ;
table_N : N ;
tail_N : N ;
talk_V3 : V3 ;
teacher_N : N ;
teach_V2 : V2 ;
television_N : N ;
thick_A : A ;
thin_A : A ;
think_V : V ;
throw_V2 : V2 ;
tie_V2 : V2 ;
today_Adv : Adv ;
tongue_N : N ;
tooth_N : N ;
train_N : N ;
travel_V : V ;
tree_N : N ;
turn_V : V ;
ugly_A : A ;
uncertain_A : A ;
understand_V2 : V2 ;
university_N : N ;
village_N : N ;
vomit_V : V ;
wait_V2 : V2 ;
walk_V : V ;
warm_A : A ;
war_N : N ;
wash_V2 : V2 ;
watch_V2 : V2 ;
water_N : N ;
wet_A : A ;
white_A : A ;
wide_A : A ;
wife_N : N ;
wind_N : N ;
window_N : N ;
wine_N : N ;
wing_N : N ;
win_V2 : V2 ;
wipe_V2 : V2 ;
woman_N : N ;
wonder_VQ : VQ ;
wood_N : N ;
worm_N : N ;
write_V2 : V2 ;
year_N : N ;
yellow_A : A ;
young_A : A ;
}

206
src/rukiga/LexiconCgg.gf Executable file
View File

@@ -0,0 +1,206 @@
--# -path=.:../prelude:../abstract:../common
concrete LexiconCgg of Lexicon = CatCgg **
open ParadigmsCgg, ResCgg, Prelude in {
lin
--NOTE: Those commented out are not in the abstract
--burn_V = mkV "sya" ;
--die_V = mkV "fa" ;
--fly_V = mkV "guruka" ;
bird_N = mkN "ekinyonyi" KI_BI ;
boat_N = mkN "eryato" RI_MA ;
book_N = mkN "ekitabo" KI_BI ;
boy_N = mkN "omwojo" "abojo" MU_BA ;
bread_N = mkN "omugati" MU_MI;
car_N = mkN "emootoka" N_N ;
cat_N = mkN "enjangu" N_N ;
--chair_N = mkN "entebbe" N_N ;
child_N = mkN "omwana" MU_BA ;
city_N = mkN "ekibúga" KI_BI; --orurêmbo pl endêmbo
cloud_N = mkN "ekikyu" KI_BI ;
computer_N = mkN "kanyabwêngye" ZERO_ZERO ; --kanyabwêngye, embiikabwengye, kompyuta
cow_N = mkN "ente" N_N ;
dog_N = mkN "embwa" N_N ;
--person_N = mkN "omuntu" "abantu" MU_BA ;
fire_N = mkN "omuriro" MU_MI ;
fish_N = mkN "eky'ényanja" KI_BI ;
flower_N = mkN "ekimuri" KI_BI ;
friend_N = mkN "omunywâni" MU_MI ; -- omunywâni, omunyamukago, omugyenzi
girl_N = mkN "omwishiki" MU_BA ;
--shoe_N = mkN "ekaito" N_N ;
--table_N = mkN "emeza" N_N ;
--airplane_N = mkN "enyonyi" N_N ; -- mkN "endégye" N_N;
animal_N = mkN "enyamaishwa" N_N ;
apple_N = mkN "apple" ZERO_ZERO ;
baby_N = mkN "omwana" MU_BA ;
beer_N = mkN "amarwa" ZERO_MA ;
bike_N = mkN "egaari" N_N ;
bird_N = mkN "ekinyonyi" KI_BI ;
blood_N = mkN "eshágama" N_ZERO ;
grammar_N = mkN "enyómbeka y'órurími" "enyómbeka z'endími" ZERO_ZERO ; -- two words representing one word
horse_N = mkN "embaráàsi" N_N ;
house_N = mkN "enju" N_N ;
language_N = mkN "orurími" "endími" RU_N ;
man_N = mkN "omushaija" MU_BA ;
milk_N = mkN "amate" ZERO_MA ;
music_N = mkN "music" ZERO_ZERO ; -- I have not found the translation
river_N = mkN "omugyera" MU_MI ; --omurîndi,
sea_N = mkN "enyanja" N_N ;
ship_N = mkN "ekyombo" KI_BI ; -- eméèri [NC_n_n]
star_N = mkN "enyonyóòzi" N_N ;
train_N = mkN "egaari y'omwika" N_N ; -- plural would be egáàri z'omwika
tree_N = mkN "omuti" MU_MI ;
water_N = mkN "amáìzi" ZERO_MA ;
wine_N = mkN "víìnyo" ZERO_ZERO ;
woman_N = mkN "omwishiki" MU_BA ;
--Proper Nouns
john_PN = mkPN "Yohana" (AgP3 Sg MU_BA) False;
paris_PN = mkPN "Paris" (AgP3 Sg N_N) True; --Noun class for places???
--Adjectives
bad_A = mkAdjective "bi" Post False False; --False means the adjective is a stem and comes after the complete noun
--beautiful_A = mkAdjective "rungi" False;
big_A = mkAdjective "hango" Post False False;
black_A = mkAdjective "kwirangura" Post False False;
blue_A = mkAdjective "buuru" Post True True ;
clean_A = mkAdjective "yonjo" Post False False; --: A ;
cold_A = mkAdjective "rikufuka" Post False False; --: A ;
good_A =mkAdjective "rungi" Post False False; --: A ;
heavy_A = mkAdjective "rikuremeera" Post False False; --: A ; --notice ri as a verb is
hot_A = mkAdjective "rikwotsya" Post False False; -- rikutagata -- problematic words like hot we need a new set of clitics
new_A = mkAdjective "sya" Post False False; --: A ;
old_A = mkAdjective "kúru" Post False False; --: A ;
ready_A = mkAdjective "eteekateekire" Post False False; --: A ;
red_A = mkAdjective "ríkutukura" Post False False; --: A ;
small_A = mkAdjective "kye" Post False False;
warm_A = mkAdjective "rikutagata" Post False False;--: A ;
white_A = mkAdjective "rikwera" Post False False;--: A ;
yellow_A = mkAdjective "kinekye" Post True True;--: A ; or yero, or kyenju
young_A = mkAdjective "to" Post False False;--: A ;
green_A =mkAdjective "kijubwe" Post False True;
--ditransitive verbs
bite_V2 = mkV2 "rum";
break_V2 = mkV2 "hend"; --: V2 ;
buy_V2 = mkV2 "gur" ; --: V2 ;
close_V2 = mkV2 "king";
count_V2 = mkV2 "ba" "ra" "zire";
cut_V2 = mkV2 "sha" "ra" "zire";
do_V2 = mkV2 "ko" "ra" "zire";
drink_V2 = mkV2 "nyw";
eat_V2 = mkV2 "ry";
fear_V2 = mkV2 "tiin";
find_V2 = mkV2 "bon" ; --: V2 ; -- many words; kureeba, kubóna,kushanga, kumamya,kujumbura
kill_V2 = mkV2 "it"; --: V2 ;
love_V2 = mkV2 "kûnd"; --: V2 ;
read_V2 = mkV2 "shom";--: V2 ;
see_V2 = mkV2 "reeb"; --: V2 ;
teach_V2 = mkV2 "shomes" ; --: V2 ; or kwegyesa
understand_V2 = mkV2 "étegyerez"; --: V2 ;
wait_V2 = mkV2 "tegyerez"; --: V2 ;
-- ditransitive verbs
add_V3 = mkV3 "gáìt";
give_V3 = mkV3 "héére" "za" "ize";
sell_V3 = mkV3 "gu" "za" "rize";
send_V3 = mkV3 "tum" ;
talk_V3 = mkV3 "gamb";
-- Intransitive verbs
come_V = mkV "ij";
go_V = mkV "gyend"; --: V ; -- Many words: kuza, kuraba,kutoora, kugyenda=go away, kushuma=go down
jump_V = mkV "guruk" ;
play_V = mkV "záàn"; --: V ;
live_V = mkV "tuur" ; --manyF: kutuura i.e. live somewhere, stay = kuráàra
run_V = mkV "íruk"; -- : V ;
sleep_V = mkV "nyama" ; --: V ;--Kugwejegyera, kubyama
swim_V = mkV "og"; --: V ;
travel_V = mkV "gyen" "da" "zire" ;--: V ;
walk_V = mkV "ribá" "ta" "si"; --: V ; or kuribata Runynakore it is different
-- A verb whose complement is a sentence
fear_VS = mkVS (lin V (mkV "tin")); --: VS ;
hope_VS = mkVS (lin V (mkV "siga")); --: VS ; -- a bit complicated because what we normally use is nyine amatsiko i.e usin the noun. The verb should be kwesiga but this seems borrowed from Luganda
know_VS = mkVS (lin V (mkV "manya")); --: VS ;
say_VS = mkVS (lin V (mkV "gi" "ra" "zire"));--: VS ;
-- verbs whose complements are questions
know_VQ = mkVQ (lin V (mkV "many")); --: VQ ;
--wonder_VQ : VQ ;
-- Verb whose complement is an adjective
become_VA = mkVA (lin V mkBecome);--: VA ;
--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";
--today_Adv = mkAdv "erizooba" AgrNo;
father_N2 = mkN2 (mkN "tata" MU_BA) (lin Prep (mkPrep [] [] True)) ;
distance_N3 = mkN3 (mkN "orugyendo" ZERO_BU) (lin Prep (mkPrep "kurunga" "" False)) (lin Prep (mkPrep "mpáka" "" False)); --could orugyendo work in its place?
alas_Interj ={s="ryakareeba"; }; --: Interj ;
oper
aboutP = mkPrep "about" ;
atP = mkPrep "at" ;
forP = mkPrep "for" ;
fromP = mkPrep "kurunga" "" False;
inP = mkPrep "omu" "omuri" False;
onP = mkPrep "aha" "ahari" False;
toP = mkPrep "aha" [] False;
{-
--Old LexiconCgg.gf
burn_V = mkV "sya" ;
die_V = mkV "fa" ;
fly_V = mkV "guruka" ;
run_V = mkV "iruka" ;
sleep_V = mkV "byama" ;
walk_V = mkV "tabula" ;
bird_N = mkN "ekinyonyi" KI_BI ;
boat_N = mkN "eryato" RI_MA ;
book_N = mkN "ekitabo" KI_BI ;
boy_N = mkN "omwojo" "abojo" MU_BA ;
car_N = mkN "emootoka" N_N ;
chair_N = mkN "entebbe" N_N;
cloud_N = mkN "ekikyu" KI_BI ;
person_N = mkN "omuntu" "abantu" MU_BA ;
girl_N = mkN "omwishiki" MU_BA ;
shoe_N = mkN "ekaito" N_N ;
table_N = mkN "emeza" N_N ;
bad_A = mkAdjective "bi" False; --False means the adjective is a stem and comes after the complet noun
beautiful_A = mkAdjective "rungi" False;
far_Adv = mkAdv "hare";
now_Adv = mkAdv "hati";
today_Adv = mkAdv "erizooba";
bite_V2 = mkV2 "ruma";
break_V2 = mkV2 "henda";
buy_V2 = mkV2 "gura";
close_V2 = mkV2 "kinga";
count_V2 = mkV2 "bara";
cut_V2 = mkV2 "shara";
do_V2 = mkV2 "kora";
drink_V2 = mkV2 "nywa";
eat_V2 = mkV2 "rya";
fear_V2 = mkV2 "tiina";
-------------------------Differences Rukiga only--------------------
airplane_N : mkN "endegye" N_N;
-}
}

77786
src/rukiga/NP-treebank.txt Normal file

File diff suppressed because it is too large Load Diff

378
src/rukiga/NounCgg.gf Executable file
View File

@@ -0,0 +1,378 @@
--# -path=.:../prelude:../abstract:../common
concrete NounCgg of Noun = CatCgg **
open ResCgg, Prelude, Predef in {
lin
--UsePN : PN -> NP ; -- John
UsePN pn = {s = \\ _ => pn.s; agr = pn.a; nounCat = PropNoun}; -- John
{- need use of a pre -}
UsePron pron =
let default3PAgr = (AgP3 Sg KI_BI)
in case <pron.agr> of {
<(AgrYes a)> => {s = pron.s; agr = a; nounCat = ComNoun}; --: Pron -> NP ; -- he
<_> => {s = pron.third !default3PAgr; agr = default3PAgr; nounCat = ComNoun}
};
--UsePron pron = pron; -- the result of use pron is a NounPhrase
--MassNP : CN -> NP ; -- (beer)
MassNP cn = {s = \\_ =>cn.s ! Sg ! Complete; agr = AgP3 Sg cn.gender; nounCat = ComNoun}; --: CN -> NP ; -- milk
--DetCN det cn = mkDeterminer det cn; --Should be nemed mkDetCN
DetCN det cn = mkDetCN det cn; -- the man
{-
case det.pos of{
PreDeterminer =>{s = det.s ++ cn.s!det.ntype!det.num} ;
PostDeterminer=>{s = cn.s!det.ntype!det.num ++ mkNCParticles!SubjM!AgP3 det.num cn.nc + det.s}
}; --use a function because code is becoming long
-}
UseN noun = noun ;
--Noun = {s : NounType=>Number => Str ; nc : NClass} ;
--AdjCN ap cn = {s=\\ntype, num=>cn.s!ntype!num ++ ap.s!AgP3 num cn.nc; nc=cn.nc};
--AdjCN : AP -> CN -> CN ; -- big house
AdjCN ap cn =
case <ap.position, ap.isProper, > of {
<Pre, True> => {
s = \\ num, ns =>ap.s ! AgP3 num cn.gender ++ cn.s ! num ! ns ;
gender = cn.gender; nounCat = cn.nounCat
};
<Post, False> => case ap.isPrep of {
False => {
s = \\ num, ns => cn.s ! num ! ns ++ mkAdjPronIVClitic (AgP3 num cn.gender)
++ ap.s ! AgP3 Sg KI_BI;
gender = cn.gender; nounCat = cn.nounCat
};
True => {
s = \\ num, ns => (cn.s ! num ! ns) ++
mkGenPrepNoIVClitic (AgP3 num cn.gender) ++ ap.s ! AgP3 Sg KI_BI;
gender = cn.gender; nounCat = cn.nounCat
}
};
<Pre, False> => {
s = \\ num, ns => mkAdjPronIVClitic (AgP3 num cn.gender)
++ ap.s ! AgP3 num cn.gender ++ (cn.s ! num ! ns) ;
gender = cn.gender; nounCat = cn.nounCat
};
<Post, True> => {
s = \\ num, ns => (cn.s ! num ! ns) ++ ap.s ! AgP3 num cn.gender;
gender = cn.gender; nounCat = cn.nounCat
}
}; -- big house
--RelCN : CN -> RS -> CN ; -- house that John bought
RelCN cn rs = {s=\\n,ns => cn.s !n ! ns ++ rs.s! (RF RObj); gender = cn.gender; nounCat = cn.nounCat};
{-
A predeterminer is any word that modifies a noun Phrase.
These Predeterminers are found in Structural
-}
--PredetNP : Predet -> NP -> NP ; -- only the man
PredetNP predet np = let a = np.agr;
nomS = np.s ! Nom; --It does not matter which. Just pick out one.
accS = np.s ! Acc;
in
case <predet.isMWE, predet.isInflected> of {
<False, True> => {s = \\_ =>nomS ++ mkPredetPref a ++ predet.s ; agr = a; nounCat = np.nounCat};
<True, True > => {s = \\_ =>nomS ++ mkPredetPref a ++ predet.s ++
mkPredetPref a ++ predet.s2; agr = a; nounCat = np.nounCat};
<False,False> => {s = \\_ =>nomS ++ predet.s ; agr = a; nounCat = np.nounCat};
<True,False> => {s = \\_ =>nomS ++ predet.s ++ predet.s2; agr = a; nounCat = np.nounCat} -- never seen this case
};
--AdvNP : NP -> Adv -> NP ; -- Paris today
AdvNP np adv = {s= \\c => np.s ! c ++ adv.s; agr = np.agr; nounCat = np.nounCat };
--PPartNP : NP -> V2 -> NP ; -- the man seen use the Passive form of the verb see. abantu abarebirwe
PPartNP np v2 =
{s= \\c => np.s!c ++ mkSubjClitic np.agr ++ v2.s ++ BIND ++ mkVerbMorphs!VFPastPart!RestOfVerb; agr = np.agr; nounCat = np.nounCat};
{-What the hell does this mean?-}
ExtAdvNP np adv = {s= \\c => np.s ! c ++ embedInCommas adv.s; agr = np.agr; nounCat = np.nounCat}; -- how do I do the adverbial clause?
-- Determiner: Type = {s:Str; ntype:NounType; num:Number; pos:Position}; -- type for Determier necessary for catCgg.gf
RelNP np rs ={s = \\c => np.s ! c ++ rs.s! (RF RSubj); agr =np.agr; nounCat = np.nounCat};
-- 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 = case quant.isPron of {
True => {s=[]; s2 = quant.s2; ntype = Incomplete; num = num.n; pos=Pre; doesAgree = quant.doesAgree};
False => {s= quant.s.s ! Nom; s2 =\\_ =>[]; ntype = Complete; num = num.n; pos=Pre; doesAgree = quant.doesAgree} --
};
--DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best
DetQuantOrd quant num ord = {
s =[];
s2 =\\agr => mkThis!agr ++ quant.s2 ! agr ++ ord.s!agr;
ntype = Complete;
num = num.n;
pos = Pre;
doesAgree = True
};
NumSg = {s=\\_=>[]; n=Sg}; --Num
NumPl = {s=\\_=>[]; n=Pl}; --Num
--NumCard : Card -> Num ; -- one/five [explicit numeral]
NumCard card = {s =\\agr =>card.s ! agr; n=card.n };
--Quant = {s : Res.Pronoun; s2 :Res.Agreement => Str; doesAgree : Bool; isPron: Bool} ;
IndefArt = {s={s=\\_=>[]; third = \\_,_=>[];agr = AgrNo }; s2 = \\_=>[]; doesAgree = False; isPron=False};
DefArt = {s={s =\\_=>[]; third = \\_,_=>[]; agr = AgrNo }; s2 = \\_=>[]; doesAgree = False; isPron = False}; -- noun with initial vowel
--NumDigits : Digits -> Card ; -- 51
NumDigits dig = {s = dig.s!NCard ; n=dig.n};
--NumNumeral : Numeral -> Card ; -- fifty-one
NumNumeral numeral = {s=numeral.s!NCard; n=numeral.n};
--OrdDigits : Digits -> Ord ; -- 51st
OrdDigits dig ={s=dig.s!NOrd ; position = Post};
--OrdNumeral : Numeral -> Ord ; -- fifty-first
OrdNumeral numeral ={s=numeral.s!NOrd; position = Post};
--OrdSuperl : A -> Ord ; -- warmest
--Adjective : Type = {s : Str ; position : Position; isProper : Bool; isPrep: Bool};
OrdSuperl a = {s= \\c => (mkAdjPronIVClitic c) ++ BIND ++ "kukirayo" ++ "obu" ++ BIND ++ a.s; position= a.position} ;--{s= \\c => "okukirayo" ++ (mkAdjPronIVClitic c) ++ a.s ++ ++ BIND ++ "ona"; position = a.position};
-- One can combine a numeral and a superlative.
--OrdNumeralSuperl : Numeral -> A -> Ord ; -- third largest
OrdNumeralSuperl numeral a = {s= \\c => numeral.s !NOrd !c ++ "omu" ++ "kukirayo" ++ "obu" ++ BIND ++ a.s; position = a.position};
-- AdvCN : CN -> Adv -> CN ; -- house on the hill
AdvCN cn adv ={s=\\ntype,num =>cn.s!ntype!num ++ adv.s; gender=cn.gender; nounCat = cn.nounCat};
-- Pronouns have possessive forms. Genitives of other kinds
-- of noun phrases are not given here, since they are not possible
-- in e.g. Romance languages. They can be found in $Extra$ modules.
--PossPron : Pron -> Quant ; -- my (house)
PossPron pron = {s =pron; s2 =\\_=> []; doesAgree = True; isPron = True};
--3 Conjoinable determiners and ones with adjectives
--AdjDAP : DAP -> AP -> DAP ; -- the large (one)
AdjDAP dap ap =
{ s = dap.s ++ ap.s! AgP3 Sg KI_BI ; -- does no harm since they are all same strings
s2 = dap.s2;
ntype = dap.ntype ;
num = dap.num ;
pos = dap.pos;
doesAgree= True
};
--DetDAP : Det -> DAP ; -- this (or that)
DetDAP det =det;
--AdNum : AdN -> Card -> Card ; -- almost 51
AdNum adn card = {s = \\a => adn.s ++ card.s ! a; n = card.n};
--ComplN2 : N2->NP -> CN
ComplN2 n2 np =
{ s = \\n, ns => n2.s ! n ! ns ++ n2.c2 ! mkAgreement n2.gender P1 n ++ np.s !Acc;
gender=n2.gender; nounCat = n2.nounCat};
--ComplN3 : N3 -> NP -> N2 ; -- distance from this city (to Paris)
ComplN3 n3 np =
{s = \\n, ns => n3.s ! n ! ns ++ n3.c2 ! mkAgreement n3.gender P1 n ++ np.s !Acc;
c2 = n3.c3;
gender=n3.gender; nounCat = n3.nounCat}; -- we choose n3 because it is important when using the na conjunction
--2 Apposition
-- This is certainly overgenerating.
--ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y)
ApposCN cn np ={s = \\n, ns => cn.s! n!ns ++ np.s !Nom; gender = cn.gender; nounCat = cn.nounCat};
-- This is different from the partitive, as shown by many languages.
--CountNP : Det -> NP -> NP ; -- three of them, some of the boys
CountNP det np = case det.doesAgree of {
True => {s=\\c=> np.s!c ++ "emye ahari" ++ det.s2 ! np.agr; agr = np.agr; nounCat = np.nounCat};
False => {s=\\c=> np.s!c ++ det.s; agr = np.agr; nounCat = np.nounCat}
};
--Determiners can form noun phrases directly.
--DetNP : Det -> NP ; -- these five
DetNP det = case det.doesAgree of {
True => {s=\\_=> det.s2 ! AgP3 Sg KI_BI; agr = AgP3 Sg KI_BI; nounCat = ComNoun};
False => {s=\\c=> det.s; agr = AgP3 Sg KI_BI; nounCat = ComNoun}
};
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in [Verb Verb.html].
--SentCN : CN -> SC -> CN
SentCN cn sc = {s = \\ n, ns => cn.s!n!ns ++ sc.s; gender = cn.gender; nounCat = cn.nounCat};
-- Relational nouns can also be used without their arguments.
-- The semantics is typically derivative of the relational meaning.
--UseN2 : N2 -> CN ; -- mother
UseN2 n2 = {s = n2.s; gender = n2.gender; nounCat = n2.nounCat};
--Use2N3 : N3 -> N2 ; -- distance (from this city)
Use2N3 n3 = {s = n3.s; gender = n3.gender; nounCat = n3.nounCat; c2 = n3.c2};
--Use3N3 : N3 -> N2 ; -- distance (to Paris)
Use3N3 n3 = {s = n3.s; gender = n3.gender; nounCat = n3.nounCat; c2 = n3.c3};
-- (New 13/3/2013 AR; Structural.possess_Prep and part_Prep should be deprecated in favour of these.)
--PossNP : CN -> NP -> CN ; -- house of Paris, house of mine
PossNP cn np ={s =\\n,ns => cn.s! n ! ns ++ mkGenPrepNoIVClitic np.agr ++ np.s ! Nom; gender = cn.gender; nounCat = cn.nounCat};
--PartNP : CN -> NP -> CN ; -- glass of wine
PartNP cn np ={s =\\n,ns => cn.s! n ! ns ++ mkGenPrepNoIVClitic np.agr ++ np.s ! Nom; gender = cn.gender; nounCat = cn.nounCat};
{-
--1 Noun: Nouns, noun phrases, and determiners
abstract Noun = Cat ** {
--2 Noun phrases
-- The three main types of noun phrases are
-- - common nouns with determiners
-- - proper names
-- - pronouns
--
--
fun
DetCN : Det -> CN -> NP ; -- the man
UsePN : PN -> NP ; -- John
UsePron : Pron -> NP ; -- he
-- Pronouns are defined in the module [``Structural`` Structural.html].
-- A noun phrase already formed can be modified by a $Predet$erminer.
PredetNP : Predet -> NP -> NP ; -- only the man
-- A noun phrase can also be postmodified by the past participle of a
-- verb, by an adverb, or by a relative clause
PPartNP : NP -> V2 -> NP ; -- the man seen
AdvNP : NP -> Adv -> NP ; -- Paris today
ExtAdvNP: NP -> Adv -> NP ; -- boys, such as ..
RelNP : NP -> RS -> NP ; -- Paris, which is here
-- Determiners can form noun phrases directly.
DetNP : Det -> NP ; -- these five
--2 Determiners
-- 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
DetQuantOrd : Quant -> Num -> Ord -> Det ; -- these five best
-- Whether the resulting determiner is singular or plural depends on the
-- cardinal.
-- All parts of the determiner can be empty, except $Quant$, which is
-- the "kernel" of a determiner. It is, however, the $Num$ that determines
-- the inherent number.
NumSg : Num ; -- [no numeral, but marked as singular]
NumPl : Num ; -- [no numeral, but marked as plural]
NumCard : Card -> Num ; -- one/five [explicit numeral]
-- $Card$ consists of either digits or numeral words.
data
NumDigits : Digits -> Card ; -- 51
NumNumeral : Numeral -> Card ; -- fifty-one
-- The construction of numerals is defined in [Numeral Numeral.html].
-- A $Card$ can be modified by certain adverbs.
fun
AdNum : AdN -> Card -> Card ; -- almost 51
-- An $Ord$ consists of either digits or numeral words.
-- Also superlative forms of adjectives behave syntactically like ordinals.
OrdDigits : Digits -> Ord ; -- 51st
OrdNumeral : Numeral -> Ord ; -- fifty-first
OrdSuperl : A -> Ord ; -- warmest
-- One can combine a numeral and a superlative.
OrdNumeralSuperl : Numeral -> A -> Ord ; -- third largest
-- Definite and indefinite noun phrases are sometimes realized as
-- neatly distinct words (Spanish "un, unos ; el, los") but also without
-- any particular word (Finnish; Swedish definites).
IndefArt : Quant ; -- a/an
DefArt : Quant ; -- the
-- Nouns can be used without an article as mass nouns. The resource does
-- not distinguish mass nouns from other common nouns, which can result
-- in semantically odd expressions.
MassNP : CN -> NP ; -- (beer)
-- Pronouns have possessive forms. Genitives of other kinds
-- of noun phrases are not given here, since they are not possible
-- in e.g. Romance languages. They can be found in $Extra$ modules.
PossPron : Pron -> Quant ; -- my (house)
-- Other determiners are defined in [Structural Structural.html].
--2 Common nouns
-- Simple nouns can be used as nouns outright.
UseN : N -> CN ; -- house
-- Relational nouns take one or two arguments.
ComplN2 : N2 -> NP -> CN ; -- mother of the king
ComplN3 : N3 -> NP -> N2 ; -- distance from this city (to Paris)
-- Relational nouns can also be used without their arguments.
-- The semantics is typically derivative of the relational meaning.
UseN2 : N2 -> CN ; -- mother
Use2N3 : N3 -> N2 ; -- distance (from this city)
Use3N3 : N3 -> N2 ; -- distance (to Paris)
-- Nouns can be modified by adjectives, relative clauses, and adverbs
-- (the last rule will give rise to many 'PP attachment' ambiguities
-- when used in connection with verb phrases).
AdjCN : AP -> CN -> CN ; -- big house
RelCN : CN -> RS -> CN ; -- house that John bought
AdvCN : CN -> Adv -> CN ; -- house on the hill
-- Nouns can also be modified by embedded sentences and questions.
-- For some nouns this makes little sense, but we leave this for applications
-- to decide. Sentential complements are defined in [Verb Verb.html].
SentCN : CN -> SC -> CN ; -- question where she sleeps
--2 Apposition
-- This is certainly overgenerating.
ApposCN : CN -> NP -> CN ; -- city Paris (, numbers x and y)
--2 Possessive and partitive constructs
-- (New 13/3/2013 AR; Structural.possess_Prep and part_Prep should be deprecated in favour of these.)
PossNP : CN -> NP -> CN ; -- house of Paris, house of mine
PartNP : CN -> NP -> CN ; -- glass of wine
-- This is different from the partitive, as shown by many languages.
CountNP : Det -> NP -> NP ; -- three of them, some of the boys
--3 Conjoinable determiners and ones with adjectives
AdjDAP : DAP -> AP -> DAP ; -- the large (one)
DetDAP : Det -> DAP ; -- this (or that)
-}
}

38893
src/rukiga/NounPhrases.txt Normal file

File diff suppressed because it is too large Load Diff

191
src/rukiga/NumeralCgg.gf Executable file
View File

@@ -0,0 +1,191 @@
--# -path=.:../prelude:../abstract:../common
concrete NumeralCgg of Numeral = CatCgg [Numeral,Digits] **
open ResCgg, Prelude in {
lincat
Digit = { s : Str; unit : { s:Str ; g : Gender; stem : Str}; ten : { s:Str ; g : Gender} };
Sub10 = { s : Str; unit : { s:Str ; g : Gender; stem : Str}; ten : { s:Str ; g : Gender}; n:Number};
Sub100 = {s : Str ; g:Gender; n : Number} ;
Sub1000 = {s : Str ; g:Gender; n : Number} ;
Sub1000000 = {s : Str ; g:Gender; n : Number} ;
lin num x = {s = \\_,_=> x.s; g=x.g; n=x.n} ; --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 = {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
lin pot1to19 d = {s = "ikumi ne" ++ d.unit.s; g=d.unit.g } ** {n = Pl} ; --12-19
lin pot0as1 n = {s = n.unit.s; g=n.unit.g} ** {n = n.n} ; --Sub100 -- coercion of 1..9
lin pot1 d = {s = d.ten.s; g = d.ten.g} ** {n = Pl} ;
lin pot1plus d e = {s = d.ten.s ++ "na" ++ e.unit.s; g = ZERO_ZERO; n=Pl }; --Sub100 ; -- d * 10 + n
lin pot1as2 n = {s = n.s; g = ZERO_ZERO; n=n.n} ;
lin pot2 d = let
numStr = case d.unit.g of{
MU_MI => d.unit.s;
_ => d.ten.s
};
in {s = "magana" ++ numStr; g = ZERO_ZERO} ** {n = Pl} ;
lin pot2plus d e = let
unitFigure = case d.n of{
Sg => "igana";
_ => "magana"
};
numStr = case d.unit.g of{
MU_MI => d.unit.s;
_ => d.ten.s
};
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
unitFigure = case <n.n> of{
<Sg> => "rukumi";
_ => "enkumi" ++ n.s
};
in {s = unitFigure; g = ZERO_ZERO; n=n.n}; -- Sub1000 -> Sub1000000 ; -- m * 1000
lin pot3plus n m = let
thousand = case <n.n> of{
<Sg> => "akasirira";
_ => "obusirira" ++ n.s
};
in { s = thousand ++ m.s; g = ZERO_ZERO; n = n.n} ;
lincat
Dig = TDigit ;
lin
IDig d = d ** {tail = T1} ;
IIDig d i = {
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" "1" Sg ;
D_2 = mkDig "2" ;
D_3 = mkDig "3" ;
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 => BIND ++ "," ++ BIND ;
_ => BIND
} ;
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;
mk3Dig : Str -> Str -> Number -> TDigit = \c,o,n -> {
s = table {NCard =>\\_=> c ; NOrd => mkOrdinal c } ;
n = n
} ;
TDigit = {
s : CardOrd =>Agreement => Str;
n : Number
} ;
mkOrdinal : Str -> Agreement => Str =\c -> \\agr => mkGenPrepWithIVClitic ! agr ++ c;
{-
--1 Numerals
-- This grammar defines numerals from 1 to 999999.
-- The implementations are adapted from the
-- [numerals library http://www.cs.chalmers.se/~aarne/GF/examples/numerals/]
-- which defines numerals for 88 languages.
-- The resource grammar implementations add to this inflection (if needed)
-- and ordinal numbers.
--
-- *Note* 1. Number 1 as defined
-- in the category $Numeral$ here should not be used in the formation of
-- noun phrases, and should therefore be removed. Instead, one should use
-- [Structural Structural.html]$.one_Quant$. This makes the grammar simpler
-- because we can assume that numbers form plural noun phrases.
--
-- *Note* 2. The implementations introduce spaces between
-- parts of a numeral, which is often incorrect - more work on
-- (un)lexing is needed to solve this problem.
abstract Numeral = Cat [Numeral,Digits] ** {
cat
Digit ; -- 2..9
Sub10 ; -- 1..9
Sub100 ; -- 1..99
Sub1000 ; -- 1..999
Sub1000000 ; -- 1..999999
data
num : Sub1000000 -> Numeral ; -- 123456 [coercion to top category]
n2, n3, n4, n5, n6, n7, n8, n9 : Digit ;
pot01 : Sub10 ; -- 1
pot0 : Digit -> Sub10 ; -- d * 1
pot110 : Sub100 ; -- 10
pot111 : Sub100 ; -- 11
pot1to19 : Digit -> Sub100 ; -- 10 + d
pot0as1 : Sub10 -> Sub100 ; -- coercion of 1..9
pot1 : Digit -> Sub100 ; -- d * 10
pot1plus : Digit -> Sub10 -> Sub100 ; -- d * 10 + n
pot1as2 : Sub100 -> Sub1000 ; -- coercion of 1..99
pot2 : Sub10 -> Sub1000 ; -- m * 100
pot2plus : Sub10 -> Sub100 -> Sub1000 ; -- m * 100 + n
pot2as3 : Sub1000 -> Sub1000000 ; -- coercion of 1..999
pot3 : Sub1000 -> Sub1000000 ; -- m * 1000
pot3plus : Sub1000 -> Sub1000 -> Sub1000000 ; -- m * 1000 + n
-- Numerals as sequences of digits have a separate, simpler grammar
cat
Dig ; -- single digit 0..9
data
IDig : Dig -> Digits ; -- 8
IIDig : Dig -> Digits -> Digits ; -- 876
D_0, D_1, D_2, D_3, D_4, D_5, D_6, D_7, D_8, D_9 : Dig ;
-}
}

3
src/rukiga/OverloadCgg.gf Executable file
View File

@@ -0,0 +1,3 @@
--# -path=.:../prelude:../abstract:../common
resource OverloadCgg = Overload with (Grammar = GrammarCgg) ;

288
src/rukiga/ParadigmsCgg.gf Executable file
View File

@@ -0,0 +1,288 @@
--# -path=.:../prelude:../abstract:../common
resource ParadigmsCgg =
open (Predef=Predef), ResCgg, CatCgg, Prelude in {
oper
mkN : overload {
mkN : (fish : Str) -> NClass -> N ;
mkN : (man,men : Str) -> NClass -> N ;
} ;
mkV : overload {
mkV : (cry : Str) -> V ;
mkV : (cry, pres, perf :Str) -> V;
} ;
mkN = overload {
mkN : (fish : Str) -> Gender -> N
= \fish,nclass -> lin N (smartNoun fish nclass) ;
mkN : (man,men : Str) -> Gender -> N
= \man,men,nclass -> lin N (mkNoun man men nclass) ;
};
mkV = overload {
mkV : Str -> Verb
= \root -> lin V (smartVerb root); --{s =root; pres =[]; perf = []; morphs= mkVerbMorphs; isRegular = True}; --only those verbs whose conjugation involves change of last letter and are done in the same way in both runyankore and rukiga
mkV : Str -> Str ->Str -> Verb
= \root, restPres, restPerf ->lin V (mkVerb root restPres restPerf); --{s =root; pres =restPres; perf = restPerf; morphs= mkVerbMorphs; isRegular = False};
};
mkV2 = overload {
mkV2 : Str -> Verb2 = \root ->mkV root ** {comp =[]};
mkV2 : Str -> Str ->Str -> Verb2 = \root, s1, s2 ->mkV root s1 s2 ** {comp =[]};
};
mkV3 = overload {
mkV3 : Str -> Verb3 = \root ->mkV2 root ** {comp2 =[]};
mkV3 : Str -> Str ->Str -> Verb3 = \root ,s1,s2 ->mkV2 root s1 s2 ** {comp2 =[]};
};
--3 Relational nouns
mkN2 : overload {
mkN2 : Str -> N2 ; -- reg. noun, prep. "of" --%
mkN2 : N -> N2 ; -- e.g. wife of (default prep. to)
mkN2 : N -> Str -> N2 ; -- access to --%
mkN2 : N -> Prep -> N2 ; -- e.g. access to
mkN2 : Str -> Str -> N2 ; -- access to (regular noun) --%
} ;
--3 Relational nouns
mkN2 : overload {
mkN2 : Str -> N2; -- reg. noun, prep. "of" --%
mkN2 : N -> N2 ; -- e.g. wife of (default prep. to)
mkN2 : N -> Str -> N2 ; -- access to --%
mkN2 : N -> Prep -> N2 ; -- e.g. access to
mkN2 : Str -> Str -> N2 ; -- access to (regular noun) --%
} ;
mkN2 : N -> Prep -> N2 ;
mkN2 : N -> Prep -> N2 = \n,p -> case p.isGenPrep of{
False => lin N2 (n ** {c2 =\\_=> p.s}) ;
True => lin N2 (n ** {c2 = mkGenPrepWithIVClitic}) --avoiding lock_C fields
};
-- Three-place relational nouns ("the connection from x to y") need two prepositions.
mkN3 : N -> Prep -> Prep -> N3 ; -- e.g. connection from x to y
mkN3 = \n,p,q -> case <p.isGenPrep,q.isGenPrep> of{
<False,False> => lin N3 ( lin N2 (n ** {c2 =\\_=> p.s}) ** {c3 =\\_=> q.s}); --method of avoiding lock_C fields
<True, False> => n ** {c2 = mkGenPrepWithIVClitic ; c3 =\\_=> q.s; lock_N2 = <>;lock_N3 = <>} ;
<False,True> => n ** {c2 =\\_=> p.s ; c3 = mkGenPrepWithIVClitic; lock_N2 = <>;lock_N3 = <>} ;
<True,True> => n ** {c2 = mkGenPrepWithIVClitic; c3 = mkGenPrepWithIVClitic; lock_N2 = <>; lock_N3 = <>}
};
mkVS : V -> VS ; -- sentence-compl e.g. say (that S)
mkVS v = lin VS v ;
mkVQ : V -> VQ ; -- e.g. wonder (QS)
mkVQ v = lin VQ v ;
mkVA : V -> VA ; -- e.g. become (AP)
mkVA v = lin VA v ;
{-
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 {
mkV2V : Str -> V2V = \s -> lin V2V (dirV2 (regV s) ** {c3 = [] ; typ = VVAux}) ;
mkV2V : V -> V2V = \v -> lin V2V (dirV2 v ** {c3 = [] ; typ = VVAux}) ;
mkV2V : V -> Prep -> Prep -> V2V = \v,p,t -> lin V2V (prepV2 v p ** {c3 = t.s ; typ = VVAux}) ;
} ;
mkV2V : overload {
mkV2V : Str -> V2V ;
mkV2V : V -> V2V ;
mkV2V : V -> Prep -> Prep -> V2V ; -- e.g. want (noPrep NP) (to VP)
} ;
-}
--mkV = overload {
--mkV : (cry : Str) -> V
--= \cry -> lin V (mkVerb cry) ; -- what does it mean to create a lin on the fly
--};
{- Note: The following is copied from the file swahili/ParadigmsSwa.gf
--1 Swahili Lexical Paradigms
--2 Parameters
--
-- To abstract over gender names, we define the following identifiers.
oper
Animacy : Type ;
animate : Animacy ;
inanimate : Animacy ;
-- To abstract over number names, we define the following.
Number : Type ;
singular : Number ;
plural : Number ;
-- To abstract over case names, we define the following.
Case : Type ;
nominative : Case ;
locative : Case ;
-- To abstract over nounclass names, we define the following.
Gender : Type ;
m_wa : Gender ;
m_mi : Gender ;
ji_ma : Gender ;
e_ma : Gender ;
ma_ma : Gender ;
ki_vi : Gender ;
e_e : Gender ;
u_u : Gender ;
u_ma : Gender ;
u_e : Gender ;
--2 Nouns
-- Worst case: give all four forms and the semantic gender.
mkN : (mtu,watu : Str) -> Gender -> Animacy -> N ;
-- The regular function captures the variants for nouns depending on Gender and Number
regN : Str -> Gender -> Animacy -> N ;
-- In practice the worst case is just: give singular and plural nominative.
mk2N : (mtu , watu : Str) -> Gender -> Animacy -> N ;
mk2N x y g anim = mkNounIrreg x y g anim ** {lock_N = <>};
mkN2 : N -> Prep -> N2 ;
mkN2 : N -> Prep -> N2 = \n,p -> n ** {c2 = p.s ; lock_N2 = <>} ;
mkPrep : Str -> Prep ;
-- mkPrep p = {s = p ; c = CPrep PNul ; isDir = False ; lock_Prep = <>} ;
mkPrep p = {s = p ; lock_Prep = <>} ;
--3 Relational nouns
--
-- Relational nouns ("fille de x") need a case and a preposition.
-- All nouns created by the previous functions are marked as
-- $nonhuman$. If you want a $human$ noun, wrap it with the following
-- function:
-- genderN : Gender -> N -> N ;
-- For regular adjectives, the adverbial form is derived. This holds
-- even for cases with the variation "happy - happily".
regA : Str -> A ;
-- If comparison is formed by "kuliko", as usual in Swahili,
-- the following pattern is used:
compADeg : A -> A ;
--2 Definitions of paradigms
--
-- The definitions should not bother the user of the API. So they are
-- hidden from the document.
--.
Animacy = ResSwa.Animacy ;
Number = ResSwa.Number ;
Case = ResSwa.Case ;
Gender = ResSwa.Gender ;
animate = AN ;
inanimate = IN ;
singular = Sg ;
plural = Pl ;
nominative = Nom ;
locative = Loc ;
m_wa = g1_2 ;
m_mi = g3_4 ;
ji_ma = g5_6 ;
e_ma = g5a_6 ;
ma_ma = g6 ;
ki_vi = g7_8 ;
e_e = g9_10 ;
u_u = g11 ;
u_ma = g11_6 ;
u_e = g11_10 ;
VForm = ResSwa.VForm ;
-- regN x g anim = mkNomReg x g anim ** {lock_N = <>} ;
regN = \x,g,anim ->
mkNomReg x g anim ** {lock_N = <>} ;
-- mkN x y g anim = mkNounIrreg x y g anim ** {lock_N = <>} ;
mkN = \x,y,g,anim ->
mkNounIrreg x y g anim ** {lock_N = <>} ;
-- Adjectives
regA a = compADeg {
s = \\_ => (mkAdjective a).s ;
lock_A = <>} ;
compADeg a =
{
s = table {
Posit => a.s ! Posit ;
_ => \\f => a.s ! Posit ! f ++ "kuliko"
} ;
lock_A = <>} ;
-- Verbs
regV : Str -> V ;
regV = \enda -> mkV enda ** {s1 = [] ; lock_V = <>} ;
{--
mkV2 = overload {
mkV2 : Str -> V2 = \s -> dirV2 (regV s) ;
mkV2 : V -> V2 = dirV2 ;
mkV2 : V -> Prep -> V2 = mmkV2
} ;
mmkV2 : V -> Prep -> V2 ;
mmkV2 v p = v ** {c2 = p ; lock_V2 = <>} ;
dirV2 : V -> V2 = \v -> mmkV2 v "na" ;
--}
--2 Adverbs
-- Adverbs are not inflected. Most lexical ones have position
-- after the verb.
mkAdv : Str -> Adv ;
mkAdv x = ss x ** {lock_Adv = <>} ;
-}
}

115
src/rukiga/PhraseCgg.gf Executable file
View File

@@ -0,0 +1,115 @@
--# -path=.:../prelude:../abstract:../common
concrete PhraseCgg of Phrase = CatCgg ** open Prelude, ResCgg in {
lin
UttS sent = sent ;
UttQS qs = qs ; --: QS -> Utt ;-- does John walk
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
NoPConj = {s = ""} ;
NoVoc = {s = ""} ;
-- Utterances are formed from sentences, questions, and imperatives.
UttNP np = {s= np.s!Acc}; --: NP -> Utt ;
UttAdv adv = {s = adv.s}; --: Adv -> Utt ; -- in the house
UttImpSg pol imp = {s =
case pol.p of {
Pos => imp.s!ImpPos;
Neg => (mkSubjClitic (AgMUBAP2 Sg)) ++ imp.s!ImpNeg
}
};--: Pol -> Imp -> Utt ; -- (do not) walk ----s
--UttImpPl : Pol -> Imp -> Utt ; -- (don't) love yourselves
UttImpPl pol imp ={s =
case pol.p of {
Pos => imp.s!ImpPos;
Neg => (mkSubjClitic (AgMUBAP2 Pl)) ++ imp.s!ImpNeg
}
};
UttImpPol = UttImpPl;
--UttAdv : Adv -> Utt ; -- here
UttAdv adv = {s= adv.s};
--can be improved upon
UttVP vp = {s = vp.adv ++ vp.s ++ BIND ++ vp.pres ++ vp.comp ++vp.comp2 ++ vp.ap };
UttAP ap = {s=ap.s!(AgP3 Sg KI_BI)};
-- There are also 'one-word utterances'. A typical use of them is
-- as answers to questions.
-- *Note*. This list is incomplete. More categories could be covered.
-- Moreover, in many languages e.g. noun phrases in different cases
-- can be used.
--UttIP : IP -> Utt ; -- who
UttIP ip ={s=ip.s};
--UttIAdv : IAdv -> Utt ; -- why
UttIAdv iAdv = case iAdv.requiresSubjPrefix of {
True => {s= mkSubjClitic (AgP3 Sg MU_BA) ++ iAdv.s};
False => {s= iAdv.s}
};
--UttNP : NP -> Utt ; -- this man
--UttNP np = {s= np.s!Nom};
--UttAdv : Adv -> Utt ; -- here
--UttAdv adv ={s = adv.s};
--UttVP : VP -> Utt ; -- to sleep
--UttCN : CN -> Utt ; -- house
UttCN cn ={s=cn.s!Sg!Complete};
--UttCard : Card -> Utt ; -- five
UttCard card ={s = card.s!(AgP3 Sg MU_BA)};
--UttAP : AP -> Utt ; -- fine
--UttInterj : Interj -> Utt ; -- alas
UttInterj interj = let agr = AgMUBAP2 Pl in {s= mkObjClitic agr ++ interj.s};
{-
--1 Phrase: Phrases and Utterances
abstract Phrase = Cat ** {
-- When a phrase is built from an utterance it can be prefixed
-- with a phrasal conjunction (such as "but", "therefore")
-- and suffixing with a vocative (typically a noun phrase).
fun
PhrUtt : PConj -> Utt -> Voc -> Phr ; -- but come here, my friend
-- Utterances are formed from sentences, questions, and imperatives.
UttS : S -> Utt ; -- John walks
UttQS : QS -> Utt ; -- is it good
UttImpSg : Pol -> Imp -> Utt ; -- (don't) love yourself
UttImpPl : Pol -> Imp -> Utt ; -- (don't) love yourselves
UttImpPol : Pol -> Imp -> Utt ; -- (don't) sleep (polite)
-- There are also 'one-word utterances'. A typical use of them is
-- as answers to questions.
-- *Note*. This list is incomplete. More categories could be covered.
-- Moreover, in many languages e.g. noun phrases in different cases
-- can be used.
UttIP : IP -> Utt ; -- who
UttIAdv : IAdv -> Utt ; -- why
UttNP : NP -> Utt ; -- this man
UttAdv : Adv -> Utt ; -- here
UttVP : VP -> Utt ; -- to sleep
UttCN : CN -> Utt ; -- house
UttCard : Card -> Utt ; -- five
UttAP : AP -> Utt ; -- fine
UttInterj : Interj -> Utt ; -- alas
-- The phrasal conjunction is optional. A sentence conjunction
-- can also be used to prefix an utterance.
NoPConj : PConj ; -- [plain phrase without conjunction in front]
PConjConj : Conj -> PConj ; -- and
-- The vocative is optional. Any noun phrase can be made into vocative,
-- which may be overgenerating (e.g. "I").
NoVoc : Voc ; -- [plain phrase without vocative]
VocNP : NP -> Voc ; -- my friend
-}
}

260
src/rukiga/QuestionCgg.gf Executable file
View File

@@ -0,0 +1,260 @@
--# -path=.:../prelude:../abstract:../common
concrete QuestionCgg of Question = CatCgg ** open ResCgg, Prelude in {
--1 Question: Questions and Interrogative Pronouns
-- A question can be formed from a clause ('yes-no question') or
-- with an interrogative.
lin
--QuestCl : Cl -> QCl ; -- does John walk
QuestCl cl = cl ** {posibleSubAgr = mkSubjCliticTable};
--QuestVP : IP -> VP -> QCl ; -- who walks
QuestVP ip vp = {
s = ip.s;
subjAgr = NONE; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = vp.s;
pres = vp.pres;
perf = vp.perf;
--morphs = vp.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = vp.comp -- after verb: complement, adverbs
} ;
--QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love
QuestSlash ip clSlash =
let comp = case clSlash.complType of{
Ap => clSlash.ap;
Adverbial => clSlash.adv;
AdverbialVerb => clSlash.adV;
_ => []
};
in {
s = ip.s;
subjAgr = NONE; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = clSlash.s;
pres = clSlash.pres;
perf = clSlash.perf;
--morphs = clSlash.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = comp -- after verb: complement, adverbs
} ;
--QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk
QuestIAdv iadv cl =
{
s = iadv.s ++ cl.s;
subjAgr = cl.subjAgr; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = cl.s;
pres = cl.pres;
perf = cl.perf;
--morphs = cl.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = cl.compl -- after verb: complement, adverbs
} ;
--QuestIComp : IComp -> NP -> QCl ; -- where is John
{-
This function always uses the auxiliary. When we meet questions that may or may not use it, we shall
querry the usesAux field
-}
QuestIComp icomp np = case <icomp.endOfSentence, icomp.requiresSubjPrefix> of {
<True, True> =>{ --such as ta?
s = np.s ! Acc;
subjAgr = np.agr; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = be_Copula.s;
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = mkSubjCliticTable ! np.agr ++ icomp.s -- after verb: complement, adverbs
} ;
<True, False> =>{ -- such as nkahe?
s = np.s ! Acc;
subjAgr = np.agr; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = be_Copula.s;
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = icomp.s -- after verb: complement, adverbs
} ;
<_, _> => {
s = icomp.s;
subjAgr = np.agr; -- no option but to just pick one
posibleSubAgr = mkSubjCliticTable;
root = be_Copula.s;
pres = be_Copula.pres;
perf = be_Copula.perf;
--morphs = be_Copula.morphs;
{-
inf : Str;
pres : Str;
past : Str;
presPart : Str;
pastPart : Str; -- subject
--root : Str ; -- dep. on Pol,Temp, e.g. "does","sleep"
-}
compl = np.s ! Acc -- after verb: complement, adverbs
}
};
--IdetCN : IDet -> CN -> IP ; -- which five songs
IdetCN idet cn = let num = case idet.n of{
Sg => ISg;
Pl => IPl
};
in
case idet.requiresSubjPrefix of {
True => {s = cn.s!idet.n!Complete ++ mkSubjPrefix (mkAgreement cn.gender P3 idet.n) ++ idet.s; n = num; isVerbSuffix=False; requiresIPPrefix=True; aux= "ni"; endOfSentence = True};
False => { s = cn.s!idet.n!Complete ++ idet.s; isVerbSuffix=False; n=num; requiresIPPrefix=True; aux= "ni"; endOfSentence = True}
};
--IdetIP : IDet -> IP ; -- which five
--Noun Class has been ignored
IdetIP idet = let num = case idet.n of{
Sg => ISg;
Pl => IPl
};
in
{
s = idet.s ;
isVerbSuffix=False;
n=num; requiresIPPrefix=True;
aux= "ni";
endOfSentence = True
};
--IdetQuant : IQuant -> Num -> IDet ; -- which (five)
--IdetQuant iquant num = { s = iquant.s ! num.n ; requiresSubjPrefix=True};
-- Interrogative complements to copulas can be both adverbs and
-- pronouns.
--CompIAdv : IAdv -> IComp ; -- where (is it)
CompIAdv iadv =
{
s =iadv.s ;
n = INeut;
isVerbSuffix=False;
requiresSubjPrefix =False;
requiresIPPrefix=False;
aux=[];
usesAux = False;
endOfSentence=iadv.endOfSentence
};
--CompIP : IP -> IComp ; -- who (is it)
CompIP ip =
{
s = ip.s;
n = ip.n;
isVerbSuffix = ip.isVerbSuffix;
requiresSubjPrefix = False;
requiresIPPrefix = ip.requiresIPPrefix;
aux=ip.aux;
usesAux = True;
endOfSentence= ip.endOfSentence;
};
{-
--1 Question: Questions and Interrogative Pronouns
abstract Question = Cat ** {
-- A question can be formed from a clause ('yes-no question') or
-- with an interrogative.
fun
QuestCl : Cl -> QCl ; -- does John walk
QuestVP : IP -> VP -> QCl ; -- who walks
QuestSlash : IP -> ClSlash -> QCl ; -- whom does John love
QuestIAdv : IAdv -> Cl -> QCl ; -- why does John walk
QuestIComp : IComp -> NP -> QCl ; -- where is John
-- Interrogative pronouns can be formed with interrogative
-- determiners, with or without a noun.
IdetCN : IDet -> CN -> IP ; -- which five songs
IdetIP : IDet -> IP ; -- which five
-- They can be modified with adverbs.
AdvIP : IP -> Adv -> IP ; -- who in Paris
-- Interrogative quantifiers have number forms and can take number modifiers.
IdetQuant : IQuant -> Num -> IDet ; -- which (five)
-- Interrogative adverbs can be formed prepositionally.
PrepIP : Prep -> IP -> IAdv ; -- with whom
-- They can be modified with other adverbs.
AdvIAdv : IAdv -> Adv -> IAdv ; -- where in Paris
-- Interrogative complements to copulas can be both adverbs and
-- pronouns.
CompIAdv : IAdv -> IComp ; -- where (is it)
CompIP : IP -> IComp ; -- who (is it)
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
-- Wh questions with two or more question words require a new, special category.
cat
QVP ; -- buy what where
fun
ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what
AdvQVP : VP -> IAdv -> QVP ; -- lives where
AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where
QuestQVP : IP -> QVP -> QCl ; -- who buys what where
-}
}

114
src/rukiga/RelativeCgg.gf Executable file
View File

@@ -0,0 +1,114 @@
--# -path=.:../prelude:../abstract:../common
concrete RelativeCgg of Relative = CatCgg ** open Prelude, ResCgg in {
lin
{-
--IdRP : RP ; -- which
Apparently IdRP means Identity Relative Pronoun i.e. the most atomic part
of a relative pronoun. The abstract syntax seems to alude that more
Relative pronouns can be formed when such a relative subject or object marker is affixed to
a prepositional Phrase.
In Runynakore and Rukiga, relative pronouns depend on
Noun Class , Gender and the case of the noun they
refer to.
Since this involves a table of two tables, we use ResCgg to prepare all possibilities
-}
IdRP = {s = mkRPs; rObjVariant2 = mkRObjV2}; --: RP ; -- which
--RelCl : Cl -> RCl ; -- such that John loves her
-- The simplest way to form a relative clause is from a clause by
-- a pronoun similar to "such that".
RelCl cl = {
s = "kugira ngu" ++ cl.s ;
agr = AgrYes cl.subjAgr;
rp = mkRPs;
--rObjVariant2 = mkRObjV2;
pres =cl.pres;
perf =cl.perf;
root = cl.root;
--morphs = cl.morphs;
compl =cl.compl;
isCompApStem = False;
whichRel = Such_That;
}; -- such that John loves her. why does it need any case?
-- The more proper ways are from a verb phrase
-- (formed in [``Verb`` Verb.html]) or a sentence
-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]).
--RelVP : RP -> VP -> RCl ; -- who loves John
RelVP rp vp =
{
s = [];
agr = AgrNo;
rp = rp.s;
--rObjVariant2 = rp.rObjVariant2;
pres =vp.pres;
perf =vp.perf;
root = vp.s;
--morphs = vp.morphs;
compl =vp.comp;
isCompApStem = vp.isCompApStem;
whichRel = RF RSubj;
};
--RelSlash : RP -> ClSlash -> RCl ; -- whom John loves
RelSlash rp clSlash =
let comp = case clSlash.complType of{
Ap => clSlash.ap;
Adverbial => clSlash.adv;
AdverbialVerb => clSlash.adV;
_ => []
};
isCompApStem = case clSlash.complType of{
Adverbial => True;
_ => False
};
in
{
s = clSlash.s;
agr = AgrYes clSlash.subjAgr;
rp = rp.s;
--rObjVariant2 = rp.rObjVariant2;
pres = clSlash.pres;
perf = clSlash.perf;
root = clSlash.root;
--morphs = clSlash.morphs;
compl = comp;
isCompApStem = isCompApStem;
whichRel = RF RObj;
};
{-
--1 Relative clauses and pronouns
abstract Relative = Cat ** {
fun
-- The simplest way to form a relative clause is from a clause by
-- a pronoun similar to "such that".
RelCl : Cl -> RCl ; -- such that John loves her
-- The more proper ways are from a verb phrase
-- (formed in [``Verb`` Verb.html]) or a sentence
-- with a missing noun phrase (formed in [``Sentence`` Sentence.html]).
RelVP : RP -> VP -> RCl ; -- who loves John
RelSlash : RP -> ClSlash -> RCl ; -- whom John loves
-- Relative pronouns are formed from an 'identity element' by prefixing
-- or suffixing (depending on language) prepositional phrases or genitives.
IdRP : RP ; -- which
FunRP : Prep -> NP -> RP -> RP ; -- the mother of whom
-}
}

1431
src/rukiga/ResCgg.gf Executable file

File diff suppressed because it is too large Load Diff

910
src/rukiga/ResCggOld.gf Normal file
View File

@@ -0,0 +1,910 @@
--# -path=.:../prelude:../abstract:../common
-- structure of module types i.e header which defines the type of module and
-- tells what other modules it inherits also known as extension(means that a module can inherit the contents
-- of one or more modules to which new judgements are added. You can optionally inherit parts of it using
-- [comma separeted functions]) followed by ** and optionally an open statement(if the module type is concrete
-- or resource i.e open <module name>[namespace identifiers]) and then followed by a mandatory body {}
-- opening a resource means you can use its contents without inheriting them (how I do not know)
-- module types include:
-- 1.abstract modules
-- 2.concrete modules
-- 3.resource modules: these define parameter types and operations usable in several concrete syntaxes as general functions in lincat definitions
-- general structure: <module type> <module name> [of <abstrcat module name if module type is concrete>] = [<extended modules[comma, separted list of objects inherited]>] [**][open <module names[namespace identifiers]> in]{body}
resource ResCgg = ParamX ** --
open Prelude, (Predef=Predef) in {
param
NounType = Complete | Incomplete ;
Position = PostDeterminer | PreDeterminer ;
Case = Nom | Acc | Gen ;
Agr = AgP3 Number NClass | AgMUBAP1 Number |AgMUBAP2 Number ;
NClass = MU_BA | -- for human beings and deity e.g. omuntu/abantu
KI_BI | -- eki-tookye/ebi-tookye
N_N | -- nouns that do not vary their spelling with singular and plural (normally begin with "e")
KU_MA | -- okuguru / amaguru, (leave out the non plurals)okugyenda (Deverbative) / Amagyenda (Deverbative outward journey)
BU_MA |
RU_BU | -- oruro / oburo
GU_GA | -- ogushaija / agashaija --dimunitive
ZERO_ZERO | -- nouns without initial vowel nor class syllables e.g barugu, muha, sho
MU_MI | --
RI_MA |
I_MA |
KA_BU |
KA_TU | --dimunitive version of KA_BU belong to same noun class
RU_N | -- orurimi / endimi
RU_MA |
--those of place or location
HA |
MU |
KU |
--aditions
ZERO_BU |
ZERO_BI |
ZERO_MA | -- amate takes the concords of plural particle "ma"
ZERO_MI |
ZERO_TU |
ZERO_N |
I_ZERO |
RI_ZERO |
KU_ZERO |
MU_ZERO |
RU_ZERO |
ZERO_BAA | -- human relationships
KA_ZERO ; --akabi (ZERO to the right means the concords of that noun are always those of the singular as used in noun-classes KA) see KA_BU, KA_TU
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
GenPrep1 |
GenPrep2 |
GenAdj |
SStandPron ; --Self-standing pronouns
oper
Noun : Type ;
Noun = {s : NounType=>Number => Str ; nc : NClass } ;
smartNoun : Str -> NClass -> Noun
= \omuntu, g ->
case <omuntu , g> of {
-- Handling the Tone System is also another problem.
< "o" + "mu" + stem, MU_BA > => mkNoun omuntu ("aba" + stem) g ;
--special cases like omwana, omwishiki, omwojo
< "o" + "mw" + stem, MU_BA > => mkNoun omuntu (combine_morphemes "aba" stem) g ; --same as mu_ba but the "u" + "a" of the stem to form mwa
< "o" + "mu" + stem, MU_MI > => mkNoun omuntu (combine_morphemes "emi" stem) g ;
< "o" + "ru" + stem, RU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ;
< "o" + "ru" + stem, RU_N > => mkNoun omuntu (combine_morphemes "en" stem) g ; --desist from providing a singlar only but give both
< "o" + "bu" + stem, BU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ;
< "o" + "gu" + stem, GU_GA > => mkNoun omuntu (combine_morphemes "aga" stem) g ;
< "o" + ("ku" | "kw") + stem, KU_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ;
< "o" + "kw" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ;
< "o" + "ku" + stem, KU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "o" + "mu" + stem, MU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "o" + "ru" + stem, RU_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ;
< "o" + "ru" + stem, RU_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "a" + "ha" + stem, HA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "a" + "ka" + stem, KA_BU > => mkNoun omuntu (combine_morphemes "obu" stem) g ;
< "a" + "ka" + stem, KA_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "e" + "ki" + stem, KI_BI > => mkNoun omuntu (combine_morphemes "ebi" stem) g ;
< "e" + "ki" + stem, KI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "e" + "i" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" "") g ;
< "e" + "i" + stem, I_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "e" + "ri" + stem, RI_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ;
< "e" + "ri" + stem, RI_ZERO > => mkNoun omuntu (combine_morphemes "" "") g ; -- does not exist as plural
< "e" + "ry" + stem, I_MA > => mkNoun omuntu (combine_morphemes "ama" stem) g ;
-- --special cases shall be added with due course as errors are identified
<"e" + "ky" + stem, KI_BI> => mkNoun omuntu (combine_morphemes "ebi" stem) g ;
< _ ,N_N | ZERO_MA > => mkNoun omuntu omuntu g ;
--< _ ,ZERO_MA > => mkNoun omuntu ("ama" + stem) g (Predef.drop 1 omuntu);
--< _ ,> => mkNoun omuntu omuntu g (Predef.drop 1 omuntu);
<_ , ZERO_BAA> => mkNoun omuntu ("baa" + omuntu) g;
< _ ,ZERO_ZERO > => mkNoun omuntu omuntu g;
< _ ,_ > => mkNoun omuntu omuntu g -- improve as we go on.
};
{- Should be taken to Ajective concrete Syntanx-}
mkNoun : Str -> Str -> NClass -> Noun ;
mkNoun child children nc
= { s = table {Complete => table {
Sg => child ; Pl => children } ;
Incomplete => table {
Sg => Predef.drop 1 child ; Pl => Predef.drop 1 children } }; --removal of the initial vowel
nc = nc
} ;
mkN = overload {
mkN : Str -> NClass -> Noun = smartNoun ;
mkN : Str -> Str -> NClass -> Noun = mkNoun;
} ;
-- combine_morphemes need the function last to get
-- the last letter in a morphme.
-- uses Predef.length and Predef.take
-- Please use let so that you compute Predef.length once and use if then else
-- if possible
{-
last : Str -> Str ;
last = \ w ->
case (Predef.length w) of {
0 => [];
_ => Predef.drop ((Predef.length w)-1) w
} ;
-}
{-
This function tries to handle phonological-conditioning.
Usage: Use it whenever you are trying to combine morphemes especially in:
1. Pronouns
2. Verbs and verb Phrases.
3. Noun Phrases
3. Adjectival Phrases e.t.c
Given two morphemes A and B to combine,
1. compare the last letter of the first morpheme A with the first letter of the second morpheme B
2. Use parttern matching to obtain the right letters for the comnined word
Source of rules:
1. personal experience
2. Morris and Kirwan Runynakore Grammar
3. but we shall add more as we meet them during debugging
-}
combine_morphemes : Str -> Str -> Str ;
combine_morphemes = \ f, s ->
case <(Predef.dp 1 f), (Predef.take 1 s)> of {
<"n" , "r"> => f + "d" + (Predef.drop 1 s) ;
<"u" , "a" | "e" | "o" | "i"> => Predef.tk 1 f + "w" + s ;
<"i" , "a" | "e" | "o"> => Predef.tk 1 f + "y" + s ;
<"n" , "b" | "p"> => Predef.tk 1 f + "m" + s ;
<"n" , "m"> => Predef.tk 1 f + s ; -- However, note that for pronouns, the n changes to m
<"n" , "h"> => Predef.tk 1 f + "mp" + Predef.drop 1 s ;
<"i", "i"> => f + Predef.drop 1 s ;
<_ , _ > => f + s
} ;
Determiner : Type = {s : Str ; ntype : NounType ; num : Number ; pos : Position } ; -- type for Determier necessary for catCgg.gf
Pronoun : Type ={s : Str ; agr : Agr} ;
VerbPhrase : Type = { s : Agr => Polarity => Tense => Anteriority => Str};
VPSlash : Type = VerbPhrase ** { c : Str } ;
Numer : Type = { s: Str ; n : Number};
Clause : Type = {s : Polarity => Tense => Anteriority => Str};
Adv : Type = {s : Agr => Str } ; -- check pages 116-131 of grammar book
mkAdv : Str -> Adv = \ s -> { s= \\ agr => s };
ParticleForms : Type = PersonalPronounType => Agr => Str;
mkNCParticles : ParticleForms = table {
SubjM => table {
AgMUBAP1 Sg => "n" ;
AgMUBAP1 Pl => "tu" ;
AgMUBAP2 Sg => "wa" ;
AgMUBAP2 Pl => "mu" ;
AgP3 Sg MU_BA => "a" ;
AgP3 Pl MU_BA => "ba" ;
AgP3 Sg KI_BI => "ki" ;
AgP3 Pl (KI_BI | ZERO_BI) => "bi" ;
AgP3 Sg (RU_N | RU_MA | RU_ZERO | RU_BU) => "ru" ;
AgP3 Pl RU_N => "zi"; --| "i";
AgP3 Sg N_N => "e";
AgP3 Pl N_N => "zi"; --| "i";
AgP3 Sg (MU_MI | MU_ZERO) => "gu" ;
AgP3 Pl MU_MI => "e" ;
AgP3 Sg (RI_MA | RI_ZERO | I_ZERO) => "ri";
AgP3 Pl (RI_MA | BU_MA | KU_MA | ZERO_MA | I_MA |RU_MA) => "ga" ;
AgP3 Sg (KA_BU | KA_ZERO | KA_TU) => "ka" ;
AgP3 Pl (KA_BU | RU_BU) => "bu" ;
AgP3 Sg ZERO_BU => "bu" ;
AgP3 Pl ZERO_BU => "bu" ;
AgP3 Sg ZERO_BI => "bi" ;
AgP3 Sg ZERO_MA => "ga" ;
AgP3 Pl RI_ZERO => "ga" ;
AgP3 Sg KU_ZERO => "ku" ;
AgP3 Pl KU_ZERO => "ku" ;
AgP3 Pl MU_ZERO => "gu" ;
AgP3 Pl RU_ZERO => "ru" ;
AgP3 Sg ZERO_TU => "tu" ;
AgP3 Pl ZERO_TU => "tu" ;
AgP3 Sg (ZERO_MI | ZERO_ZERO) => "" ;
AgP3 Pl ZERO_MI => "e" ;
AgP3 Pl KA_ZERO => "" ;
_ => "XX" --for checking if there is some class unaccounted for
};
{-Object particle may be used as
1. a prefix: e.g mu-kwate = catch him,
2. an infix: o-mu-kwate = you catch him
-}
Obj => table {
AgMUBAP1 Sg => "n" ;
AgMUBAP1 Pl => "tu" ;
AgMUBAP2 Sg => "ku" ;
AgMUBAP2 Pl => "ba" ;
AgP3 Sg MU_BA => "mu" ;
AgP3 Pl MU_BA => "ba";
AgP3 Pl (ZERO_BU | KA_BU | KA_TU | RU_BU) => "bu" ;
AgP3 Sg BU_MA => "bu" ;
AgP3 Sg KI_BI => "ki" ;
AgP3 Pl (KI_BI | ZERO_BI) => "bi";
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ;
AgP3 (Sg | Pl) HA => "ha";
AgP3 Sg (I_ZERO | I_MA | RI_MA) => "ri" ;
AgP3 Sg (KA_ZERO | KA_BU | KA_TU) => "ka" ;
AgP3 Sg (KU_ZERO | KU_MA) => "ku" ;
{-
#comment for the following two lines
the follwing partciles are all used by Noun Classes of Place i.e. HA, KU and MU
We take the particle to be "ha" for all of them although noun class KU can use
another particle "gi" -- see Table of Concords in Appendix of Dictionary by Mpairwe and Kahangi
Note: The particles do not change with respect to gender
TODO: obtain clear examples of usage
-}
AgP3 (Sg | Pl) (HA | MU) => "ha" ;
AgP3 (Sg | Pl) KU => "ha" ; -- gi is also possible -- see comment above
AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "ru" ;
AgP3 Pl (KA_TU | ZERO_TU) => "tu" ;
AgP3 Sg (N_N | ZERO_ZERO) => "gi" ;
AgP3 Sg (MU_MI | MU_ZERO) => "gu" ;
AgP3 Pl GU_GA => "ga" ;
AgP3 Pl (MU_MI | ZERO_MI) => "gi" ;
{-
According to Mpaiwe & Kahangi in their table of concords, the particle for the plural
of noun classes N_N , ZERO_ZERO , ZERO_N & RU_N can be either "i" or "zi" depending
on object they refer to.
Problem:
However, we cannot use the | operator in strings as GF will
fail to compile to comletion.
Implication:
Some of our output strings will have the wrong object particle attached.
Even if the operator | worked, we would generate two versions of the linearized
string of which one would be right and the other wrong
What is the solution to this?
-}
AgP3 Pl (N_N | ZERO_ZERO | ZERO_N | RU_N) => "zi" ; --some cases require use of particle "i"
_ => "-" -- Hopefully exhausted all forms
};
-- who, which
RelSubj => table {
AgMUBAP1 Sg => "o" ;
AgMUBAP1 Pl => "aba" ;
AgMUBAP2 Sg => "o" ;
AgMUBAP2 Pl => "aba" ;
AgP3 Sg MU_BA => "o" ;
AgP3 Pl MU_BA => "aba" ;
AgP3 Sg BU_MA => "obu" ;
AgP3 Pl (ZERO_BU | KA_BU | RU_BU) =>"obu" ;
AgP3 Sg KI_BI => "eki" ;
AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ;
AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- better AgP3 _ (HA | MU) => "ha";
AgP3 (Sg | Pl) KU => "e" ;
AgP3 Sg (I_ZERO | I_MA | RI_ZERO | RI_MA) => "eri" ;
AgP3 Sg (KA_ZERO | KA_BU) => "aka" ;
AgP3 Sg (KU_ZERO | KU_MA) => "oku" ;
AgP3 Sg (RU_N | RU_ZERO | RU_BU | RU_MA) => "oru" ;
AgP3 Pl (ZERO_TU | KA_TU) => "otu" ;
AgP3 Pl RU_N => "ezi" ;
AgP3 Sg N_N => "ei" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | RU_N | N_N) => "ezi" ;
AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ;
AgP3 Sg (ZERO_ZERO | N_N ) => "e" ;
AgP3 Pl (MU_MI | ZERO_MI) => "e" ;
AgP3 Pl GU_GA => "aga" ;
_ => "=" -- means something forgoten i.e. debugging purposes
};
--Relative Object paticle such as whom/which found in row 13 of Table of concords in Mpairwe & Kahangi
RelObj => table {
AgMUBAP1 Sg => "ou" ;
AgMUBAP1 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator
AgMUBAP2 Sg => "ou" ;
AgMUBAP2 Pl => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator
AgP3 Sg MU_BA => "ou" ;
AgP3 Pl MU_BA => "abi" ; -- use of "abu" is also allowed (depending on what?) but omitted because of compiler issues with | operator
AgP3 Sg BU_MA => "obu" ;
AgP3 Pl (ZERO_BU | KA_BU |RU_BU) => "obu" ;
AgP3 Sg KI_BI => "eki" ;
AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ;
{-
The noun classes ZERO_MA,KU_MA,RI_MA,I_MA & BU_MA can use of Relative object particles
"agi" or "agu" (depending on noun class of clause -sure? (depending on what?)) but we
choose one "agi" because of compiler issues with | operator
Qn: Any Solutions
-}
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "agi" ;
-- of place HA & MU
--both ahi and "ahu" are valid particles for noun classes HA and MU but "ahu" omitted
--because of compiler issues with | operator
AgP3 (Sg | Pl) (HA | MU) => "ahi" ; -- better AgP3 _ (HA | MU) => "ha";
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ;
-- of place KU
AgP3 (Sg | Pl) KU => "ei" ;
--both aki and "aku" are valid particles for noun classes KA_ZERO & KA_BU but "aku" omitted
--because of compiler issues with | operator
AgP3 Sg (KA_ZERO | KA_BU) =>"aki" ;
AgP3 Sg (KU_ZERO | KU_MA) => "oku" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "ezi" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"ei" ;
AgP3 Sg (MU_MI | MU_ZERO | GU_GA) => "ogu" ;
AgP3 Pl (MU_MI | ZERO_MI) => "ei" ;
--both agi and "agu" are valid particles for noun classes GU_GA in plural but "agu" omitted
--because of compiler issues with | operator
AgP3 Pl GU_GA => "agi" ;
_ => "=" -- means something forgoten i.e. debugging purposes
};
-- Adjectival Prefixes with initial vowel with the semantics of the
AdjPron2 => table {
AgMUBAP1 Sg => "omu" ;
AgMUBAP1 Pl => "aba" ;
AgMUBAP2 Sg => "omu" ;
AgMUBAP2 Pl => "aba" ;
AgP3 Sg MU_BA => "omu" ;
AgP3 Pl MU_BA => "aba" ;
AgP3 Pl ZERO_BU => "obu" ;
AgP3 Sg BU_MA => "obu" ;
AgP3 Pl (KA_BU | RU_BU) =>"obu" ;
AgP3 Pl (KI_BI | ZERO_BI) => "ebi" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ama";
AgP3 (Sg | Pl) (HA | MU) => "aha" ; -- of place HA & MU
AgP3 (Sg | Pl) KU => "en" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"eri" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ;
AgP3 Sg KI_BI => "eki" ;
AgP3 Sg (KU_ZERO | KU_MA) => "oku" ;
AgP3 Sg (MU_MI | MU_ZERO) => "omu" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "oru" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"otu" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"en" ;
AgP3 Pl ZERO_MI => "en" ;
AgP3 Pl MU_MI => "emi";
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "en" ;
AgP3 Sg GU_GA => "ogu" ;
AgP3 Pl GU_GA => "aga" ;
_ => "XXX" -- error checking for any case not catered for
};
-- Adjectival Prefixes without initial vowel
AdjPron => table {
AgMUBAP1 Sg => "mu" ;
AgMUBAP1 Pl => "ba" ;
AgMUBAP2 Sg => "mu" ;
AgMUBAP2 Pl => "ba" ;
AgP3 Sg MU_BA => "mu" ;
AgP3 Pl MU_BA => "ba" ;
AgP3 Pl ZERO_BU => "bu";
AgP3 Sg BU_MA => "bu" ;
AgP3 Pl (KA_BU | RU_BU) =>"bu" ;
AgP3 Pl (KI_BI | ZERO_BI) => "bi" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ma" ;
AgP3 (Sg | Pl) (HA | MU) => "ha" ; -- of place HA & MU
AgP3 (Sg | Pl) KU => "n" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ri" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ;
AgP3 Sg KI_BI => "ki" ;
AgP3 Sg (KU_ZERO | KU_MA) => "ku" ;
AgP3 Sg (MU_MI | MU_ZERO) => "omu";
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "ru" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"tu" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"n" ;
AgP3 Pl ZERO_MI => "n" ;
AgP3 Pl MU_MI => "emi" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "n" ;
AgP3 Sg GU_GA => "ogu" ;
AgP3 Pl GU_GA => "aga" ;
_ => "XXX" -- for debugging purposes
} ;
--Genetive Preposition: exclusively of (with initial vowel)
GenPrep1 => table {
AgMUBAP1 Sg => "owa" ;
AgMUBAP1 Pl => "aba" ;
AgMUBAP2 Sg => "owa" ;
AgMUBAP2 Pl => "aba" ;
AgP3 Sg MU_BA => "owa" ;
AgP3 Pl MU_BA => "aba" ;
AgP3 Pl ZERO_BU => "obwa" ;
AgP3 Sg BU_MA => "obwa" ;
AgP3 Pl (KA_BU | RU_BU) =>"obwa" ;
AgP3 Pl (KI_BI | ZERO_BI) => "ebya" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "aga" ;
AgP3 (Sg | Pl) HA => "aha" ; -- of place HA
AgP3 (Sg | Pl) MU => "omwa" ; -- of place MU
AgP3 (Sg | Pl) KU => "eya" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"erya" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"aka" ;
AgP3 Sg KI_BI => "ekya" ;
AgP3 Sg (KU_ZERO | KU_MA) => "okwa" ;
AgP3 Sg (MU_MI | MU_ZERO) => "ogwa" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "orwa" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"otwa" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"eya" ;
AgP3 Pl ZERO_MI => "eya" ;
AgP3 Pl MU_MI => "eya" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "eza" ;
AgP3 Sg GU_GA => "ogwa" ;
AgP3 Pl GU_GA => "aga" ;
_ => "XYY" -- for debugging purposes
};
--Genetive Preposition: simply of without initial vowel
GenPrep2 => table {
AgMUBAP1 Sg => "wa" ;
AgMUBAP1 Pl => "ba" ;
AgMUBAP2 Sg => "wa" ;
AgMUBAP2 Pl => "ba" ;
AgP3 Sg MU_BA => "wa" ;
AgP3 Pl MU_BA => "ba" ;
AgP3 Pl ZERO_BU => "bwa" ;
AgP3 Sg BU_MA => "bwa" ;
AgP3 Pl (KA_BU | RU_BU) =>"bwa" ;
AgP3 Pl (KI_BI | ZERO_BI) => "bya" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "ga" ;
AgP3 (Sg | Pl) HA => "ha" ; -- of place HA
AgP3 (Sg | Pl) MU => "mwa" ; -- of place MU
AgP3 (Sg | Pl) KU => "ya" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"rya" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"ka" ;
AgP3 Sg KI_BI => "kya" ;
AgP3 Sg (KU_ZERO | KU_MA) => "kwa" ;
AgP3 Sg (MU_MI | MU_ZERO) => "gwa" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwa";
AgP3 Pl (ZERO_TU | KA_TU) =>"twa" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"ya" ;
AgP3 Pl ZERO_MI => "ya" ;
AgP3 Pl MU_MI => "ya" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "za" ;
AgP3 Sg GU_GA => "gwa" ;
AgP3 Pl GU_GA => "ga" ;
_ => "XYY" -- for debugging purposes
};
-- Genetive Adjective suffixes used to form genetive adjectives when conjugated to
-- the genetive prepositions particles
-- examples: ekya-{ngye}= my own or mine, ekya-{itu}= our own or ours,
-- ekya-{we}-your own or yours
GenAdj => table {
AgMUBAP1 Sg => "ngye" ;
AgMUBAP1 Pl => "itu" ;
AgMUBAP2 Sg => "we" ;
AgMUBAP2 Pl => "nyu" ;
AgP3 Sg MU_BA => "e" ;
AgP3 Pl MU_BA => "bo" ;
AgP3 Pl ZERO_BU => "bwo" ;
AgP3 Sg BU_MA => "bwo" ;
AgP3 Pl (KA_BU | RU_BU) =>"bwo" ;
AgP3 Pl (KI_BI | ZERO_BI) => "byo" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ;
AgP3 (Sg | Pl) HA => "ho" ; -- of place HA
AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU
AgP3 (Sg | Pl) KU => "yo" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ;
AgP3 Sg KI_BI => "kyo" ;
AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ;
AgP3 Sg (MU_MI | MU_ZERO) => "gwo" ;
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"two" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"two" ;
AgP3 Pl ZERO_MI => "yo" ;
AgP3 Pl MU_MI => "yo" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ;
AgP3 Sg GU_GA => "gwo" ;
AgP3 Pl GU_GA => "go" ;
_ => "XXYY" -- for debugging purposes
} ;
SStandPron => table {
AgMUBAP1 Sg =>"nyowe" ;
AgMUBAP1 Pl =>"itwe" ;
AgMUBAP2 Sg =>"iwe" ;
AgMUBAP2 Pl =>"imwe" ;
AgP3 Sg MU_BA => "uwe" ;
AgP3 Pl MU_BA => "bo" ;
AgP3 Pl ZERO_BU => "bwo" ;
AgP3 Sg BU_MA => "bwo" ;
AgP3 Pl (KA_BU | RU_BU) =>"bwo" ;
AgP3 Pl (KI_BI | ZERO_BI) => "byo" ;
AgP3 Pl (ZERO_MA | KU_MA | RI_MA | I_MA | BU_MA) => "go" ;
AgP3 (Sg | Pl) HA => "ho" ; -- of place HA
AgP3 (Sg | Pl) MU => "mwo" ; -- of place MU
AgP3 (Sg | Pl) KU => "yo" ; -- of place KU
AgP3 Sg (I_ZERO | I_MA | RI_MA) =>"ryo" ;
AgP3 Sg (KA_ZERO | KA_BU) =>"ko" ;
AgP3 Sg KI_BI => "kyo";
AgP3 Sg (KU_ZERO | KU_MA) => "kwo" ;
AgP3 Sg (MU_MI | MU_ZERO) => "gwo";
AgP3 Sg (RU_ZERO | RU_BU | RU_MA| RU_N) => "rwo" ;
AgP3 Pl (ZERO_TU | KA_TU) =>"two" ;
AgP3 Sg (ZERO_ZERO | N_N) =>"two" ;
AgP3 Pl ZERO_MI => "yo" ;
AgP3 Pl MU_MI => "yo" ;
AgP3 Pl (ZERO_ZERO | ZERO_N | N_N | RU_N) => "zo" ;
AgP3 Sg GU_GA => "gwo" ;
AgP3 Pl GU_GA => "go" ;
_ => "XXYY" -- for debugging purposes
}
} ;
{-
Operation to create Noun Phrases from a Determiner and Nouns.
In Runyankore and Rukiga, depending on the particular Determiner,
it can appear before (we call PreDeterminer) or after (PostDeterminer) the noun.
Examples:
A. PreDeterminers
1. Definite aricles: Usually using the initial vowel sufficient
2. Demonstratives: ogu muntu (This person)
3. Every: every man = "buri muntu"
B. PostDeterminers
1. Definite aricles: Usually using the initial vowel sufficient
2. Demonstratives: omuntu ogu (person this)
3. few: omuntu mu-kye
-}
NounPhrase = { s : Str ; agr : Agr } ;
{-This function should be renamed to mkDetCN-}
mkDeterminer: Determiner -> Noun -> NounPhrase = \ det, cn ->
case det.pos of {
PreDeterminer => { s = det.s ++ cn.s ! det.ntype ! det.num; agr = AgP3 det.num cn.nc} ;
PostDeterminer => { s = cn.s!det.ntype!det.num ++ mkNCParticles!SubjM!AgP3 det.num cn.nc ++ det.s; agr = AgP3 det.num cn.nc} -- There is a mistake here. If the determiner is empty, we end up with a meaningless subject particle standing alone. we can test if det.s is a string or empty.
};
{-
Operation to create scenarios in which the PRIMARY NEGATIVE MARKER
for the verb is used. The presence of this marker negates the semantics of the verb.
It is used in the PAST, Simultaneous and all other tenses.
NOTE: The Primary and Secondary markers are in complementary distribution
TO DO: Improve this!!!
-}
mkPol1Marker : Polarity => Tense => Anteriority => Str = table {
Neg => table {
Past => table {
Anter => "" ;
Simul => "ti"
} ;
_ => table {
_ => "ti"
}
} ;
Pos => \\_ => \\_ => ""
};
{-
Operation to create scenarios in which the SECONDARY NEGATIVE MARKER
for the verb is used. The presence of this marker negates the semantics of the verb.
It is used in the PAST, Anterior only.
NOTE: The Primary and Secondary markers are in complementary distribution
-}
mkPol2Marker : Polarity => Tense => Anteriority => Str = table{
Neg => table {
Past => table {
Anter => "ta";
Simul => ""
};
_ => table{
_ => ""
}
};
Pos => \\_=>\\_=> ""
} ;
{-
TO DO: stop here
-}
mkTenseMarker1 : Tense => Anteriority => Str = table{
Past => table{
Anter =>"baire";
Simul =>""
};
Pres => table{
_ =>""
};
Fut => table{
Anter => "ijakubá";-- | "zakubá";
Simul =>"ijaku"-- | "kuzaku" | "raa"
};
Cond => table{
_ => "kaa"
}
};
mkTenseMarker2:Tense=>Anteriority=>Str = table{
Past => table{
Anter =>"ire";
Simul =>"ire"
};
Pres => table{
Anter =>"ire";
Simul =>""
};
Fut => table{
Anter => "ire";
Simul =>""
};
Cond => table{
Anter => "ire";
Simul =>""
}
};
mkAuxTenseMarker: Tense =>Anteriority=>Str =table {
Past => table {
Anter =>"kaba" ;
Simul =>"baire"
};
Pres => table {
Anter =>"baire" ;
Simul =>[]
};
Fut => table {
Anter => "ryaba" ;
Simul =>"ryaba"
};
Cond => table {
Anter => "XX" ;
Simul =>"XX"
}
};
Verb : Type ;
Verb = { s : Agr => Polarity => Tense => Anteriority => Str } ;
AdjectivalPhrase : Type = { s : Agr => Str } ;
mkAdjective: Str-> Bool -> { s : Agr=> Str } = \ a , b -> case b of {
True => { s = \\ agr => a } ;
False => { s = \\ agr => let agrM = mkNCParticles ! AdjPron ! agr in
agrM + a --this is supposed to be a concatenation
}
};
Verb2 : Type = Verb **{ c : Str } ;
mkV2 : Str -> Verb2 = \s -> (mkVerb s) ** { c = [] } ;
Adjective : Type = { s : Agr => Str } ;
mkComp : AdjectivalPhrase -> VerbPhrase ; --comp means compula
mkComp comp = {
s = \\ agr , pol , tense, anter =>
let aux = mkAuxTenseMarker ! tense ! anter;
p2 = mkPol2Marker ! pol ! tense ! anter;
s = mkNCParticles ! SubjM ! agr
in aux ++ p2 + s ++ "ri" ++ comp.s!agr --why does the plus fail?
};
mkVerb : Str -> Verb ; -- write an operation for the object marker
mkVerb run = { s = \\ subjM , pol , tense , anter =>
let p1 = mkPol1Marker ! pol! tense ! anter ;
p2 = mkPol2Marker ! pol! tense ! anter ;
t1 = mkTenseMarker1 ! tense ! anter ;
t2 = mkTenseMarker2 ! tense ! anter ;
s = mkNCParticles ! SubjM !subjM
in
case < tense , anter > of {
<Past, Anter> => p1 + s + t1 ++ s + p2 + run + t2;
<Fut, _> => p1 + s + t1 ++ p2 + run + t2;
_ => (p1 + s + p2 + t1 + run + t2)
}
};
{-
Note: The following is copied from the file swahili/ResSwa.gf
-}
--1 Swahili auxiliary operations.
-- This module contains operations that are needed to make the
-- resource syntax work. To define everything that is needed to
-- implement $Test$, it moreover contains regular lexical
-- patterns needed for $Lex$.
resource ResSwa = ParamX ** open Prelude in {
--For $Noun$
-- This is the worst-case $Case$ needed for pronouns.
param Case = Nom | Loc ;
param Animacy = AN | IN ;
param Gender = g1_2 | g3_4 | g5_6 | g5a_6 | g6 | g7_8 | g9_10 | g11 | g11_6 | g11_10 ;
--2 For $Adjective$
AForm = AF Number Gender Animacy
| AA ;
-- The order of sentence is needed already in $VP$.
Order = ODir | OQuest ;
--2 For $Verb$
-- Verbs will take one of the five forms
param
VForm = VInf
| VImper Number Person
| VPres Number Gender Animacy Person
| VPast Number Gender Animacy Person
| VFut Number Gender Animacy Person;
oper
Verb : Type = {s : VForm => Str} ;
VerbForms : Type = Tense => Anteriority => Polarity => Agr => Str ;
VP : Type = {
s : VerbForms ;
s2 : Agr => Str
} ;
mkV : Str -> {s : VForm => Str} =
\cheza -> {
s = table {
VInf => case Predef.take 2 cheza of {
"ku" => cheza;
_ => "ku"+cheza
};
VImper n p => case <n,p> of{
<Sg,P2> => init cheza + "eni";
<_,_> => cheza};
VPres n g anim p => Verbprefix n g anim p + "na" + cheza;
VPast n g anim p => Verbprefix n g anim p + "li" + cheza ;
VFut n g anim p => Verbprefix n g anim p + "ta" + cheza
}
} ;
predV : Verb -> VP = \verb -> {
s = \\t,ant,b,agr =>
let
inf = verb.s ! VInf ;
imper = verb.s ! VImper agr.n agr.p;
pres = verb.s ! VPres agr.n agr.g agr.anim agr.p ;
past = verb.s ! VPast agr.n agr.g agr.anim agr.p ;
fut = verb.s ! VFut agr.n agr.g agr.anim agr.p ;
in
case <t,ant,b> of {
<_,Anter,Pos> => imper;
<Pres,Simul,Pos> => pres ;
<Past,Anter,Pos> => past ;
<Fut, Anter,Pos> => fut ;
<_,_,_> => inf
};
s2 = \\_ => []
};
Verbprefix : Number -> Gender -> Animacy -> Person -> Str = \n,g,anim,p ->
case <anim,n,g,p> of {
<AN,Sg,_,P1> => "ni" ;
<AN,Sg,_,P2> => "u" ;
<AN,Pl,_,P1> => "tu" ;
<AN,Pl,_,P2> => "m" ;
<AN,Sg,_,_> => "a" ;
<AN,Pl,_,_> => "wa" ;
<_,Sg,g1_2,_> => "a" ;
<_,Pl,g1_2,_> => "wa" ;
<_,Sg,g3_4,_> => "u" ;
<_,Pl,g3_4,_> => "i" ;
<_,Sg,g5_6,_> => "li" ;
<_,Pl,g5_6,_> => "ya" ;
<_,Sg,g5a_6,_> => "li" ;
<_,Pl,g5a_6,_> => "ya" ;
<IN,_,g6,_> => "ya" ;
<IN,Sg,g7_8,_> => "ki" ;
<IN,Pl,g7_8,_> => "vi" ;
<IN,Sg,g9_10,_> => "i" ;
<IN,Pl,g9_10,_> => "zi" ;
<IN,_,g11,_> => "u" ;
<IN,Sg,g11_6,_> => "u" ;
<IN,Pl,g11_6,_> => "ya" ;
<IN,Sg,g11_10,_> => "u" ;
<IN,Pl,g11_10,_> => "zi"
} ;
-- Auxiliary verbs have special negative forms.
param
VVForm =
VVF VForm
| VVPresNeg
| VVPastNeg --# notpresent
;
--Adjectives
oper Adj = {s : AForm => Str} ;
--2 For $Quantifiers$
-- A 3-dimensional system of quantifiers (demonstrative pronouns) based on position of object, hearer + speaker
-- need to find linguistic term to express this
param Spatial = SpHrObj | SpHr | HrObj ; --w.r.t object
-- Agreement of adjectives, verb phrases, and relative pronouns.
oper
AGR = {n : Number ; g : Gender ; anim : Animacy ; p : Person} ;
Agr : Type = {n : Number ; g : Gender ; anim : Animacy ; p : Person} ;
agr : Number -> Gender -> Animacy -> Person -> Agr = \n,g,anim,p -> {n = n ; g = g ; anim = anim ; p = p} ;
-- For $Sentence$.
Clause : Type = {
s : Tense => Anteriority => Polarity => Str
} ;
mkClause : Str -> Agr -> VP -> Clause =
\subj,agr,vp -> {
s = \\t,a,b =>
let
verb = vp.s ! t ! a ! b ! agr
in
subj ++ verb
} ;
-}
}

435
src/rukiga/SentenceCgg.gf Executable file
View File

@@ -0,0 +1,435 @@
--# -path=.:../prelude:../abstract:../common
concrete SentenceCgg of Sentence = CatCgg **
open Prelude, ResCgg in {
lin
{-creating a sentence-}
--UseCl temp pol cl = {
-- s = temp.s ++ pol.s ++ cl.s !pol.p ! temp.t ! temp.a
-- } ;
--2 Sentences
--UseCl : Temp -> Pol -> Cl -> S ; -- she had not slept
--Temp = {s : Str ; t : R.Tense ; a : R.Anteriority} ;
UseCl temp pol cl = let
subj = cl.s;
vMorphs = mkVerbMorphs;
clitic = mkSubjClitic cl.subjAgr;
presSimul = vMorphs ! VFPres; --this is not delivering the string
presAnt = vMorphs ! VFPastPart; --this is not delivering the string
root = cl.root;
presRestOfVerb = cl.pres;
pastRestOfVerb = cl.perf; --morphs ! VFPastPart ! RestOfVerb;
compl = cl.compl
in
case <temp.t,temp.a, pol.p> of {
<Pres,Simul, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Pres,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Pres,Anter, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Pres,Anter, Neg> =>{s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Past,Simul, Pos> => {s = subj ++ clitic ++ --Predef.BIND ++
root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Past,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ --Predef.BIND ++
root ++ pastRestOfVerb ++ compl};
<Past,Anter, Pos> => {s = subj ++ clitic ++ "bire" ++ clitic ++ --Predef.BIND ++
vMorphs!VFPastAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Past,Anter, Neg> =>{s = subj ++ clitic ++ "bire" ++ clitic ++ "ta"--Predef.BIND ++ ant!TAMarker
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Fut,Simul, Pos> => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Fut,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kuza ku" ++ Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Fut,Anter, Pos> => {s = subj ++ "ni" ++ Predef.BIND ++clitic ++ "za kuba" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Fut,Anter, Neg> =>{s = subj ++ "ni" ++ Predef.BIND ++ clitic ++ "za kuba" ++ clitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl};
<Cond,Simul, Pos> => {s = subj ++ clitic ++ "kaa" ++Predef.BIND ++
root ++ Predef.BIND ++ presRestOfVerb ++ compl};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Cond,Simul, Neg> => {s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++ Predef.BIND ++
root ++ presRestOfVerb ++ compl};
<Cond,Anter, Pos> => {s = subj ++ clitic ++ "kaa"--Predef.BIND ++
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Cond,Anter, Neg> =>{s = subj ++ "ti" ++ Predef.BIND ++ clitic ++ "kaa" ++Predef.BIND
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl}
}; --: Temp -> Pol -> QCl -> QS ; -- has John walked
-- These are the 2 x 4 x 4 = 16 forms generated by different
-- combinations of tense, polarity, and
-- anteriority, which are defined in [``Common`` Common.html].
UseQCl = UseCl; -- : Temp -> Pol -> Cl -> S ; -- John has not walked
QuestCl qcl = qcl; --: Cl -> QCl ; -- does John (not) walk
--UseRCl : Temp -> Pol -> RCl -> RS ; -- that had not slept
UseRCl temp pol rcl = let
subj = rcl.s; -- this could be empty
vMorphs = mkVerbMorphs;
subjClitic = case rcl.agr of {
AgrYes a => mkSubjClitic a;
_ => mkSubjClitic (AgP3 Sg MU_BA)
};
rsubjClitic = case rcl.agr of {
AgrYes a => mkRPs!RSubj! a;
_ => mkRPs!RSubj! AgP3 Sg MU_BA
};
robjClitic = case rcl.agr of {
AgrYes a => mkRPs!RObj! a;
_ => mkRPs!RObj! AgP3 Sg MU_BA
};
presSimul = vMorphs ! VFPres; --this is not delivering the string
presAnt = vMorphs ! VFPastPart; --this is not delivering the string
root = rcl.root;
presRestOfVerb = rcl.pres;
pastRestOfVerb = rcl.perf; --morphs ! VFPastPart ! RestOfVerb;
compl = rcl.compl
in {- will these strings I am introducing allow back translation? Yes, it simply depends on functions-}
case <temp.t,temp.a, pol.p> of {
<Pres,Simul, Pos> => {s = table {
RF RSubj => subj ++ rsubjClitic ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl;
RF RObj => subj ++ robjClitic ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ subjClitic ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl
}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Pres,Simul, Neg> => {
s = table {
RF RSubj => subj ++ "ti" ++ Predef.BIND ++ rsubjClitic ++ root ++ presRestOfVerb ++ compl;
RF RObj => subj ++ "ti" ++ Predef.BIND ++ robjClitic ++ root ++ presRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ subj ++ "ti" ++ Predef.BIND ++ subjClitic ++ root ++ presRestOfVerb ++ compl
}
};
<Pres,Anter, Pos> => {
s = table{
RF RSubj => subj ++ rsubjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ robjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ subj ++ subjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
<Pres,Anter, Neg> =>{
s = table {
RF RSubj => subj ++ "ti" ++ Predef.BIND ++ rsubjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ "ti" ++ Predef.BIND ++ robjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "ti" ++ Predef.BIND ++ rsubjClitic ++ vMorphs!VFPresAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
<Past,Simul, Pos> => {
s = table {
RF RSubj => subj ++ rsubjClitic ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ robjClitic ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ subjClitic ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Past,Simul, Neg> => {
s = table {
RF RSubj => subj ++ "ti" ++ Predef.BIND ++ rsubjClitic ++root ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ "ti" ++ Predef.BIND ++ robjClitic ++root ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "ti" ++ Predef.BIND ++ subjClitic ++ root ++ pastRestOfVerb ++ compl
}
};
<Past,Anter, Pos> => {
s = table {
RF RSubj => subj ++ rsubjClitic ++ "bire" ++ rsubjClitic ++ vMorphs!VFPastAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ robjClitic ++ "bire" ++ subjClitic ++ vMorphs!VFPastAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "bire" ++ subjClitic ++ vMorphs!VFPastAnt!TAMarker ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
<Past,Anter, Neg> =>{
s = table {
RF RSubj => subj ++ rsubjClitic ++ "bire" ++ subjClitic ++ "ta" ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ robjClitic ++ "bire" ++ subjClitic ++ "ta" ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "bire" ++ subjClitic ++ "ta" ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
<Fut,Simul, Pos> => {
s = table {
RF RSubj => subj ++ "ni" ++ Predef.BIND ++ rsubjClitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl;
RF RObj => subj ++ "ni" ++ Predef.BIND ++ robjClitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "ni" ++ Predef.BIND ++ robjClitic ++ "za ku" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ presRestOfVerb ++ compl
}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Fut,Simul, Neg> => {
s = table {
RF RSubj =>subj ++ "ti" ++ Predef.BIND ++ rsubjClitic ++ "kuza ku" ++ Predef.BIND ++ root ++ presRestOfVerb ++ compl;
RF RObj =>subj ++ "ti" ++ Predef.BIND ++ robjClitic ++ "kuza ku" ++ Predef.BIND ++ root ++ presRestOfVerb ++ compl;
Such_That => "Kugira ngu" ++ "ti" ++ Predef.BIND ++ subjClitic ++ "kuza ku" ++ Predef.BIND ++ root ++ presRestOfVerb ++ compl
}
};
<Fut,Anter, Pos> => {
s = table {
RF RSubj => subj ++ "ni" ++ Predef.BIND ++ rsubjClitic ++ "za kuba" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ "ni" ++ Predef.BIND ++ robjClitic ++ "za kuba" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "ni" ++ Predef.BIND ++ robjClitic ++ "za kuba" ++ Predef.BIND ++ --choice of za over ija
root ++ Predef.BIND ++ pastRestOfVerb ++ compl
}
};
<Fut,Anter, Neg> => {
s = table {
RF RSubj => subj ++ "ni" ++ Predef.BIND ++ rsubjClitic ++ "za kuba" ++ subjClitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl;
RF RObj => subj ++ "ni" ++ Predef.BIND ++ robjClitic ++ "za kuba" ++ subjClitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ "ni" ++ Predef.BIND ++ subjClitic ++ "za kuba" ++ subjClitic ++ "taka" ++ Predef.BIND ++
root ++ pastRestOfVerb ++ compl
}
};
<Cond,Simul, Pos> => {
s = table {
RF RSubj => subj ++ subjClitic ++ "kaa" ++Predef.BIND ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl;
RF RObj => subj ++ subjClitic ++ "kaa" ++Predef.BIND ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl;
Such_That => "kugira ngu" ++ subjClitic ++ "kaa" ++Predef.BIND ++ root ++ Predef.BIND ++ presRestOfVerb ++ compl
}
};
{-Note: when I use pol.s instead of ti, the word alignment instead becomes worse-}
<Cond,Simul, Neg> => { s = \\_ => subj ++ "ti" ++ Predef.BIND ++ subjClitic ++ "kaa" ++ Predef.BIND ++ root ++ presRestOfVerb ++ compl
--RF RSubj => subj ++ "ti" ++ Predef.BIND ++ subjClitic ++ "kaa" ++ Predef.BIND ++ root ++ presRestOfVerb ++ compl;
--RF RObj =>
--Such_That =>
};
<Cond,Anter, Pos> => { s = \\_ => subj ++ subjClitic ++ "kaa" ++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl};
<Cond,Anter, Neg> => {s = \\_ => subj ++ "ti" ++ Predef.BIND ++ subjClitic ++ "kaa" ++Predef.BIND
++ root ++ Predef.BIND ++ pastRestOfVerb ++ compl} --: Temp -> Pol -> QCl -> QS ; -- has John walked
};
PredVP np vp = case vp.isCompApStem of{
False => {
s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk
subjAgr = np.agr;
pres = vp.pres;
perf = vp.perf;
root = vp.s;
--morphs = vp.morphs;
{-
inf = mkVerbInrf vp.root;
pres = mkVerbPres vp.root;
past = mkVerbPast vp.root;
presPart = mkVerbPresPart vp.root;
pastPart = mkVerbPastPart vp.root; -- subject
-}
--root = vp.root ;
compl = vp.comp
};
True => {
s = np.s ! Nom; --: NP -> VP -> Cl ; -- John walks / John does not walk
subjAgr = np.agr;
pres = vp.pres;
perf = vp.perf;
root = vp.s;
--morphs = vp.morphs;
{-
inf = mkVerbInrf vp.root;
pres = mkVerbPres vp.root;
past = mkVerbPast vp.root;
presPart = mkVerbPresPart vp.root;
pastPart = mkVerbPastPart vp.root; -- subject
-}
--root = vp.root ;
compl = mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp --mkSubjClitic np.agr ++ Predef.BIND ++ vp.comp
}
};--: NP -> VP -> Cl ; -- John walks / John does not walk
{-
Note: It seems mkSubjClitic comes with a Predef.BIND already
prepared for the next token to bind.
Reason: When I add a BIND command, I get two bind tokens in the linearizations
-}
ImpVP vp = let vMorphs = mkVerbMorphs in {
s =table{
ImpPos => vp.s ++ Predef.BIND ++ vMorphs!VFInf!RestOfVerb ++ vp.comp;
ImpNeg => case vp.isCompApStem of { -- How do I make the number dynamic use case?
True =>vMorphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++
vMorphs!VFInf!RestOfVerb ++ (mkAdjPronNoIVClitic (AgMUBAP2 Sg)) ++ vp.ap;
False => vMorphs!VFPres!SecNegM ++ Predef.BIND ++ vp.s ++ Predef.BIND ++
vMorphs!VFInf!RestOfVerb ++ vp.comp
}
}
}; --: VP -> Imp ; -- walk / do not walk
-- A sentence can be modified by a relative clause referring to its contents.
--RelS : S -> RS -> S ; -- she sleeps, which is good
--2 Clauses missing object noun phrases
-- This category is a variant of the 'slash category' $S/NP$ of
-- GPSG and categorial grammars, which in turn replaces
-- movement transformations in the formation of questions
-- and relative clauses. Except $SlashV2$, the construction
-- rules can be seen as special cases of function composition, in
-- the style of CCG.
-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places.
--SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees
SlashVP np vpslash =let complTp = case <vpslash.containsAdv, vpslash.containsAdV> of {
<True, False> => Adverbial;
<False, True> => AdverbialVerb;
<False, False> => Ap;
<True, True> => Empty
};
in
{
s = np.s ! Nom;
subjAgr = np.agr;
root = vpslash.s;
pres = vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
ap = vpslash.ap;
isRegular = vpslash.isRegular;
adv = vpslash.adv;
adV = vpslash.adV;
complType = complTp
};
--AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
--SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
--SlashVS : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
{-
--1 Sentence: Sentences, Clauses, and Imperatives
abstract Sentence = Cat ** {
--2 Clauses
-- The $NP VP$ predication rule form a clause whose linearization
-- gives a table of all tense variants, positive and negative.
-- Clauses are converted to $S$ (with fixed tense) with the
-- $UseCl$ function below.
data
PredVP : NP -> VP -> Cl ; -- John walks
-- Using an embedded sentence as a subject is treated separately.
-- This can be overgenerating. E.g. "whether you go" as subject
-- is only meaningful for some verb phrases.
PredSCVP : SC -> VP -> Cl ; -- that she goes is good
--2 Clauses missing object noun phrases
-- This category is a variant of the 'slash category' $S/NP$ of
-- GPSG and categorial grammars, which in turn replaces
-- movement transformations in the formation of questions
-- and relative clauses. Except $SlashV2$, the construction
-- rules can be seen as special cases of function composition, in
-- the style of CCG.
-- *Note* the set is not complete and lacks e.g. verbs with more than 2 places.
SlashVP : NP -> VPSlash -> ClSlash ; -- (whom) he sees
AdvSlash : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today
SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks
SlashVS : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves
--2 Imperatives
-- An imperative is straightforwardly formed from a verb phrase.
-- It has variation over positive and negative, singular and plural.
-- To fix these parameters, see [Phrase Phrase.html].
ImpVP : VP -> Imp ; -- love yourselves
--2 Embedded sentences
-- Sentences, questions, and infinitival phrases can be used as
-- subjects and (adverbial) complements.
EmbedS : S -> SC ; -- that she goes
EmbedQS : QS -> SC ; -- who goes
EmbedVP : VP -> SC ; -- to go
--2 Sentences
-- These are the 2 x 4 x 4 = 16 forms generated by different
-- combinations of tense, polarity, and
-- anteriority, which are defined in [``Common`` Common.html].
fun
UseCl : Temp -> Pol -> Cl -> S ; -- she had not slept
UseQCl : Temp -> Pol -> QCl -> QS ; -- who had not slept
UseRCl : Temp -> Pol -> RCl -> RS ; -- that had not slept
UseSlash : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
-- An adverb can be added to the beginning of a sentence, either with comma ("externally")
-- or without:
AdvS : Adv -> S -> S ; -- then I will go home
ExtAdvS : Adv -> S -> S ; -- next week, I will go home
-- This covers subjunctive clauses, but they can also be added to the end.
SSubjS : S -> Subj -> S -> S ; -- I go home if she comes
-- A sentence can be modified by a relative clause referring to its contents.
RelS : S -> RS -> S ; -- she sleeps, which is good
---- A sentence can also be post-modified by a subjunct sentence.
---- ModSubjS : S -> Subj -> S -> S ; -- she sleeps, because she is old
---- cf. Adverb.SubjS
--.
-- Examples for English $S$/$Cl$:
Pres Simul Pos ODir : he sleeps
Pres Simul Neg ODir : he doesn't sleep
Pres Anter Pos ODir : he has slept
Pres Anter Neg ODir : he hasn't slept
Past Simul Pos ODir : he slept
Past Simul Neg ODir : he didn't sleep
Past Anter Pos ODir : he had slept
Past Anter Neg ODir : he hadn't slept
Fut Simul Pos ODir : he will sleep
Fut Simul Neg ODir : he won't sleep
Fut Anter Pos ODir : he will have slept
Fut Anter Neg ODir : he won't have slept
Cond Simul Pos ODir : he would sleep
Cond Simul Neg ODir : he wouldn't sleep
Cond Anter Pos ODir : he would have slept
Cond Anter Neg ODir : he wouldn't have slept
-}
}

379
src/rukiga/StructuralCgg.gf Executable file
View File

@@ -0,0 +1,379 @@
--# -path=.:../prelude:../abstract:../common
concrete StructuralCgg of Structural = CatCgg **
open ResCgg, ParadigmsCgg, (C = ConstructX), Prelude in {
{-variants
NOTE: Please add them to the abstract syntax, ask aarne
or creat you own abstract Lexicon which inherits from the
standard one. See how english does it. i.e. use DictCggAbs.gf for the funs.
and DictCgg.gf for the lins.
Actually use and extend module for Structural
-}
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 = Pre; doesAgree = False}; --: Det ; indefinite singular ---s
aPl_Det = {s =[]; s2= \\_ => []; ntype = Complete; num = Pl; pos = Pre; doesAgree = False}; -- : Det ;indefinite plural ---s
the_Det = {s =[]; s2= \\_ => []; ntype = Complete; num = Sg; pos = Pre; doesAgree = False}; --: Det ; -- definite singular ---s thePl_Det = {s =[]; ntype = Complete; num = Pl; pos = PreDeterminer}; --: Det ;definite plural ---s
every_Det = {s ="buri"; s2 = \\_ => []; ntype=Incomplete; num=Sg; pos=Pre; doesAgree = False} ;
few_Det = {s="kye"; s2 = \\_ => []; ntype =Complete; num=Pl; pos=Post; doesAgree = False} ;
many_Det ={s="ingi"; s2 = \\_ => []; ntype =Complete; num=Pl; pos=Post; doesAgree = False} ;
i_Pron = {s = table{Gen => glueGen (AgMUBAP1 Sg); _=> mkSStand (AgMUBAP1 Sg)}; third = \\_,_=>[]; agr = AgrYes (AgMUBAP1 Sg)};--mkPron "nyowe" "nyowe" (AgMUBAP1 Sg);
youSg_Pron = {s = table{Gen => glueGen (AgMUBAP2 Sg); _=>mkSStand (AgMUBAP2 Sg)}; third = \\_,_=>[]; agr = AgrYes(AgMUBAP2 Sg)};--mkPron "iwe" "we" (AgMUBAP2 Sg);
he_Pron, she_Pron = {s = table{Gen => glueGen (AgP3 Sg MU_BA); _=>mkSStand (AgP3 Sg MU_BA)}; third = \\_,_=>[]; agr = AgrYes(AgP3 Sg MU_BA)};--mkPron "uwe" "uwe" (AgP3 Sg MU_BA);
we_Pron = {s = table{Gen => glueGen (AgMUBAP1 Pl); _=>mkSStand (AgMUBAP1 Pl)}; third = \\_,_=>[]; agr = AgrYes (AgMUBAP1 Pl)}; --mkPron "itwe" "itwe" (AgMUBAP1 Pl);
youPl_Pron = {s = table{Gen => glueGen (AgMUBAP2 Pl); _=>mkSStand (AgMUBAP2 Pl)}; third = \\_,_=>[]; agr =AgrYes (AgMUBAP2 Pl)};--mkPron "imwe" "imwe" (AgMUBAP2 Pl); they_Pron = {s = table{Gen => glueGen AgP3 Pl MU_BA; _=>mkSStand (AgP3 Pl MU_BA)}; third = \\_,_=>[]; itP3Required=False};--mkPron "bo" "bo" (AgP3 Pl MU_BA);
-- default implementation Using KI_BI. Use mkmkGenPrepNoIVClitic and
it_Pron = {
s = \\_=>[];
third = \\agr => table{Gen =>glueGen agr; _ => mkSStand agr};
agr = AgrNo
}; --mkPron "kyo" "kyo" (AgP3 Sg KI_BI); -- should form an it_Pron_NClass in extra module
behind_Prep = mkPrep "enyuma ya" [] False;
between_Prep =mkPrep "hagati ya" [] False;
to_Prep = mkPrep "aha" [] False;
-- several words depending on use omuri??
in_Prep = mkPrep "omu" "omuri" False;
--aha-ri Kamukuzi??? works for places
on_Prep = mkPrep "aha" "ahari" False;
in8front_Prep = mkPrep "enyuma ya" [] False; --: Prep ; -- in front of
--na --please this string varies with vowels use combine_morphemes or
--combine_words when using it.
with_Prep = mkPrep "na" [] False;
from_Prep =mkPrep "kurunga" "" False;
under_Prep = mkPrep "hansi ya" "" False;
after_Prep = mkPrep "omu maisho" "" False; --: Prep ;
---Structural
{-
--there are several and i.e.
-- na (two nouns, 2 Noun Phrases, 2 Pronouns, 2 relative subject clauses, )
--kandi (clauses having a commonality of subjects, object or tense)
--the best structure is a table
--mkConjunction "na" "kandi" and_Conj ;
-}
and_Conj = {
s = table {
AConj Other => "kandi";
_ => "na" -- used to link nouns, pronouns, relative subject clauses, relative object clauses and adjectival nouns or infinitives (okuzana na okwikruka
};
s2 =[];
n = Pl
};
{-
TODO: Look at the grammar books by Mpairwe & Kahangi Pg 155
and investigate or to find out its arguments but for now
I will assume nari works on all types of
ConjArg (Conjunction Arguments)
nari is the general or
These are candidates for Extra module if they are not specific
to the type of argument.
nînga for Runynakore and
nainga for rukiga
-}
or_Conj = {
s = \\ _ => "nari";
s2 =[];
n = Sg
};
have_V2 ={s= "ine"; pres=[]; perf =[]; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
{-
All Predeterminers are given here.
Initial analysis shows that
a) They appear after the noun phrase but some may be multi-word expressions for a single word in eblish.
b) They appear to agree with the noun class particle. But nothing in the literature states about
their morphological structure. The stems can be guessed by removing the two letter
suffix at the begining of the word. However, there are exceptions such as "not" which is not
inflected according to noun class
c) A table of concords must be built to accomodate every instance and this can only be done
using an analysis of some of the words in the dictionary(Mapirwe and Kahagi).
I am incluned to say use of the table of self-standing pronouns is sufficient.
d) An investigation of the tone systems would also be worthwhile.
Example sentences:
1. All these chickens
2. once a day
3. only the man
-}
all_Predet = {s = "òna"; s2 = []; isMWE = False; isInflected =True};
only_Predet = {s = "nka"; s2 = []; isMWE = False; isInflected =True};
{-
-- how do we deal with superlatives. There seems to be no distinction between countable
-- and uncountable when it comes to superlatioves
-}
most_Predet = {s = "rikukíra"; s2 = "îngi"; isMWE = True; isInflected =True};
not_Predet = {s = "ti"; s2 = []; isMWE = False; isInflected =False};
{-Section for Adverbs-}
always_AdV = {s = "obutóòsha"; agr = AgrNo};
everywhere_Adv = {s = "hóòna"; agr = AgrNo}; -- adverb of place.
here_Adv = {s = "hanu"; agr = AgrNo};
{-End of Adverbs Adverbs-}
{-Begining of Quantifiers-}
--For DetQuant function to work, we need sample quatitifiers in Runynakore. Proximal, Medial, Distant
--We need a table to provide all of these.
that_Quant = {s={s = \\_=>[]; third =\\_,_=>[]; agr = AgrNo}; s2 = mkThat; doesAgree = True; isPron = False}; --: Quant ;
this_Quant = {s={s = \\_=>[]; third =\\_,_=>[]; agr = AgrNo}; s2 = mkThis; doesAgree = True; isPron = False}; --: Quant ;
no_Quant = {s ={s=\\_=>"tihariho";third =\\_,_=>[]; agr=AgrNo}; s2 =\\_=> []; doesAgree = False; isPron = False};--: Quant ;
{-End of Quantifiers-}
{-Begining of verb-phrase-complement verb VV-} -- A verb whose complement is a verb phrase
--can8know_VV : VV ; -- can (capacity)
{-End of verb-phrase-complement verb -}
{-Beggining of Interrogative Pronoun-}
whatPl_IP = { s= "ki"; n = IPl; isVerbSuffix = True; requiresIPPrefix = False; aux=[]; endOfSentence = True} ; -- what (plural)
whatSg_IP = { s= "ki"; n = ISg; isVerbSuffix = True; requiresIPPrefix = False; aux=[]; endOfSentence = True}; --: IP ; -- what (singular)
whoPl_IP = { s= "ha"; n = IPl; isVerbSuffix = True; requiresIPPrefix = False; aux="ni"; endOfSentence = True} ;--: IP ; -- who (plural)
whoSg_IP = { s= "ha"; n = ISg; isVerbSuffix = True; requiresIPPrefix = False; aux=[]; endOfSentence = True}; --: IP ; -- who (singular)
--You may need to use booleans to indicate that you need these tables rather than carrying them.
how_IAdv = {s ="ta"; requiresSubjPrefix = True; endOfSentence =True}; --: IAdv ;
--how8much_IAdv = {s ="kwiga"; s2requireSubjPrefix = True};--: IAdv ;
when_IAdv = {s ="ryari"; requiresSubjPrefix = False; endOfSentence =True}; --: IAdv ;
where_IAdv = {s ="nkahe"; requiresSubjPrefix = False; endOfSentence =True}; --: IAdv ;
why_IAdv = {s ="ahabweki"; requiresSubjPrefix = False; endOfSentence =False};--: IAdv ;
how8many_IDet ={s ="ngahe"; n =Pl; requiresSubjPrefix = False; endOfSentence = True};--: IDet ;
which_IQuant ={s =\\_ =>"ha"; requiresSubjPrefix = False};--: IQuant ;
almost_AdN = {s="hihi"}; --: AdN ; -- what about nika
at_least_AdN ={s= " hakiri"}; --: AdN ; --need advice from linguist. What about akakye?
{-
The following require some reflection from a linguist.
-}
someSg_Det =
{
s =[];
s2 =\\agr => mkSubjCliticTableSg ! agr ++ BIND++ "mwe";
ntype = Complete;
num = Sg;
pos = Pre;
doesAgree = True
};
somePl_Det =
{
s =[];
s2 =\\agr => mkSubjCliticTablePl ! agr ++ BIND++ "mwe";
ntype = Complete;
num = Pl;
pos = Pre;
doesAgree = True
};--: Det ;
want_VV = {s = "yend"; pres="da"; perf = "zire"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};
can8know_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (capacity)
can_VV = {s = "baas"; pres="a"; perf = "ize"; morphs=mkVerbMorphs; isRegular=True; inf=[]; whenUsed = VVBoth};--: VV ; -- can (possibility)
-- must_VV used especially in the perfective mood: see dictionary entry shemerera on Pg 501 of Mpairwe
-- must has no passive form
must_VV = {s = "shemere"; pres="ra"; perf = "ire"; morphs=mkVerbMorphs; isRegular=False; inf=[]; whenUsed = VVPerf}; --VV
--somebody_NP = {}; --: NP ;
--something_NP : NP ;
--somewhere_Adv : Adv ;
that_Subj = ss "ngu" ;
--Adjective modifying Adverbs
almost_AdA = {s="haihi"; position=Pre}; --: AdA ;
--quite_Adv ss "kimwe"; --: AdA ; used in the pr
so_AdA = {s="munônga"; position=Post};--: AdA ;
too_AdA = {s="munônga"; position=Post}; --: AdA ;
very_AdA = {s="munônga"; position=Post}; --: AdA ;
please_Voc = ss ", nyabura we"; --: Voc ;
but_PConj = ss "báìtu"; --: PConj ; -- variants béìtu
otherwise_PConj = ss "okûndi"; --: PConj ;
therefore_PConj = ss "n'ahabwe'êkyo"; --: PConj ;
{-
and_Conj : Conj ;
both7and_DConj : Conj ; -- both...and
both7and_DConj : DConj ;
but_PConj : PConj ;
either7or_DConj : Conj ; -- either...or
either7or_DConj : DConj ;
or_Conj : Conj ;
otherwise_PConj : PConj ;
therefore_PConj : PConj ;
if_then_Conj : Conj ;
-}
{-
--1 Structural: Structural Words
--
-- Here we have some words belonging to closed classes and appearing
-- in all languages we have considered.
-- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish
-- should be replaced by masculine and feminine variants, found in
-- [``ExtendSpa`` ../spanish/ExtendSpa.gf].
abstract Structural = Cat ** {
fun
-- This is an alphabetical list of structural words
above_Prep : Prep ;
after_Prep : Prep ;
all_Predet : Predet ;
almost_AdA : AdA ;
almost_AdN : AdN ;
although_Subj : Subj ;
always_AdV : AdV ;
and_Conj : Conj ;
because_Subj : Subj ;
before_Prep : Prep ;
behind_Prep : Prep ;
between_Prep : Prep ;
both7and_DConj : Conj ; -- both...and
---b both7and_DConj : DConj ;
but_PConj : PConj ;
by8agent_Prep : Prep ; -- by (agent)
by8means_Prep : Prep ; -- by (means of)
can8know_VV : VV ; -- can (capacity)
can_VV : VV ; -- can (possibility)
during_Prep : Prep ;
either7or_DConj : Conj ; -- either...or
---b either7or_DConj : DConj ;
every_Det : Det ;
everybody_NP : NP ; -- everybody
everything_NP : NP ;
everywhere_Adv : Adv ; --ha-ona =hoona
--- first_Ord : Ord ; DEPRECATED
few_Det : Det ;
for_Prep : Prep ;
from_Prep : Prep ;
he_Pron : Pron ;
here_Adv : Adv ; --hanu
here7to_Adv : Adv ; -- to here
here7from_Adv : Adv ; -- from here
how_IAdv : IAdv ;
how8many_IDet : IDet ;
how8much_IAdv : IAdv ;
i_Pron : Pron ;
if_Subj : Subj ;
in8front_Prep : Prep ; -- in front of
in_Prep : Prep ;
it_Pron : Pron ;
less_CAdv : CAdv ;
many_Det : Det ;
more_CAdv : CAdv ;
most_Predet : Predet ;
much_Det : Det ;
must_VV : VV ;
---b no_Phr : Phr ;
no_Utt : Utt ;
on_Prep : Prep ;
--- one_Quant : QuantSg ; DEPRECATED
only_Predet : Predet ;
or_Conj : Conj ;
otherwise_PConj : PConj ;
part_Prep : Prep ;
please_Voc : Voc ;
possess_Prep : Prep ; -- of (possessive)
quite_Adv : AdA ;
she_Pron : Pron ;
so_AdA : AdA ;
someSg_Det : Det ;
somePl_Det : Det ;
somebody_NP : NP ;
something_NP : NP ;
somewhere_Adv : Adv ;
that_Quant : Quant ;
that_Subj : Subj ;
there_Adv : Adv ; --hari
there7to_Adv : Adv ; -- to there
there7from_Adv : Adv ; -- from there
therefore_PConj : PConj ;
they_Pron : Pron ;
this_Quant : Quant ;
through_Prep : Prep ;
to_Prep : Prep ;
too_AdA : AdA ;
under_Prep : Prep ;
very_AdA : AdA ;
want_VV : VV ;
we_Pron : Pron ;
whatPl_IP : IP ; -- what (plural)
whatSg_IP : IP ; -- what (singular)
when_IAdv : IAdv ;
when_Subj : Subj ;
where_IAdv : IAdv ;
which_IQuant : IQuant ;
whoPl_IP : IP ; -- who (plural)
whoSg_IP : IP ; -- who (singular)
why_IAdv : IAdv ;
with_Prep : Prep ;
without_Prep : Prep ;
---b yes_Phr : Phr ;
yes_Utt : Utt ;
youSg_Pron : Pron ; -- you (singular)
youPl_Pron : Pron ; -- you (plural)
youPol_Pron : Pron ; -- you (polite)
no_Quant : Quant ;
not_Predet : Predet ;
if_then_Conj : Conj ;
at_least_AdN : AdN ;
at_most_AdN : AdN ;
nobody_NP : NP ;
nothing_NP : NP ;
except_Prep : Prep ;
as_CAdv : CAdv ;
have_V2 : V2 ;
fun language_title_Utt : Utt ;
-}
}

View File

@@ -0,0 +1,130 @@
--# -path=.:../prelude:../abstract:../common
concrete StructuralCgg of Structural = CatCgg **
open ResCgg, ParadigmsCgg, (C = ConstructX), Prelude in {
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
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} ;
behind_Prep ={s="enyuma ya"};
between_Prep = {s="hagati ya"};
to_Prep ={s="aha"};
-- several words depending on use omuri??
in_Prep = mkPrep "omu" "omuri";
--aha-ri Kamukuzi??? works for places
on_Prep = mkPrep "aha" "ahari";
with_Prep = mkPrep "na" [];
from_Prep ={s="kuruga"};
under_Prep = {s="hansi ya"};
{-
--there are several and i.e.
-- na (two nouns, 2 Noun Phrases, 2 Pronouns, 2 relative subject clauses, )
--kandi (clauses having a commonality of subjects, object or tense)
--the best structure is a table
--mkConjunction "na" "kandi" and_Conj ;
-}
and_Conj = {
s = table { AConj Other => "kandi"; _ => "na"};
s2 =[];
n = Pl
};
{-
--TODO: Look at the grammar books by Mpairwe & Kahangi Pg 155
--and investigate or to find out its arguments but for now
--I will assume nari works on all types of
--ConjArg (Conjunction Arguments)
--nari is the general or
--These are candidates for Extra module if they are not specific
--to the type of argument.
--nînga for Runynakore and
--nainga for rukiga
-}
or_Conj = {
s = \\ _ => "nari";
s2 =[];
n = Sg
};
have_V2 ={s= "ine"; pres=[]; perf =[]; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
i_Pron = {s = table{Gen => glueGen (AgMUBAP1 Sg); _=> mkSStand (AgMUBAP1 Sg)}; third = \\_,_=>[]; itP3Required=False};--mkPron "nyowe" "nyowe" (AgMUBAP1 Sg);
youSg_Pron = {s = table{Gen => glueGen (AgMUBAP2 Sg); _=>mkSStand (AgMUBAP2 Sg)}; third = \\_,_=>[]; itP3Required=False};--mkPron "iwe" "we" (AgMUBAP2 Sg);
he_Pron, she_Pron = {s = table{Gen => glueGen (AgP3 Sg MU_BA); _=>mkSStand (AgP3 Sg MU_BA)}; third = \\_,_=>[]; itP3Required=False};--mkPron "uwe" "uwe" (AgP3 Sg MU_BA);
we_Pron = {s = table{Gen => glueGen (AgMUBAP1 Pl); _=>mkSStand (AgMUBAP1 Pl)}; third = \\_,_=>[]; itP3Required=False}; --mkPron "itwe" "itwe" (AgMUBAP1 Pl);
youPl_Pron = {s = table{Gen => glueGen (AgMUBAP2 Pl); _=>mkSStand (AgMUBAP2 Pl)}; third = \\_,_=>[]; itP3Required=False};--mkPron "imwe" "imwe" (AgMUBAP2 Pl); they_Pron = {s = table{Gen => glueGen AgP3 Pl MU_BA; _=>mkSStand (AgP3 Pl MU_BA)}; third = \\_,_=>[]; itP3Required=False};--mkPron "bo" "bo" (AgP3 Pl MU_BA);
-- default implementation Using KI_BI. Use mkmkGenPrepNoIVClitic and
it_Pron = {s = \\_=>[]; third = table{Gen => \\agr => glueGen agr; _=> \\agr => mkSStand agr}; itP3Required=True}; --mkPron "kyo" "kyo" (AgP3 Sg KI_BI); -- should form an it_Pron_NClass in extra module
{-
All Predeterminers are given here.
Initial analysis shows that
a) They appear after the noun phrase but some may be multi-word expressions for a single word in eblish.
b) They appear to agree with the noun class particle. But nothing in the literature states about
their morphological structure. The stems can be guessed by removing the two letter
suffix at the begining of the word. However, there are exceptions such as "not" which is not
inflected according to noun class
c) A table of concords must be built to accomodate every instance and this can only be done
using an analysis of some of the words in the dictionary(Mapirwe and Kahagi).
I am incluned to say use of the table of self-standing pronouns is sufficient.
d) An investigation of the tone systems would also be worthwhile.
Example sentences:
1. All these chickens
2. once a day
3. only the man
-}
all_Predet = {s = "òna"; s2 = []; isMWE = False; isInflected =True};
only_Predet = {s = "nka"; s2 = []; isMWE = False; isInflected =True};
{-
-- how do we deal with superlatives. There seems to be no distinction between countable
-- and uncountable when it comes to superlatioves
-}
most_Predet = {s = "rikukíra"; s2 = "îngi"; isMWE = True; isInflected =True};
not_Predet = {s = "ti"; s2 = []; isMWE = False; isInflected =False};
-- Adverbs
always_AdV = {s = "obutóòsha"; agr = AgrNo};
everywhere_Adv = {s = "hóòna"; agr = AgrNo}; -- adverb of place.
here_Adv = {s = "hanu"; agr = AgrNo};
--Quantifiers
that_Quant = {s={s=\\_ =>[]; agr=AgrNo}; s2 = mkThat; doesAgree = True; isPron = False}; --: Quant ;
this_Quant = {s={s=\\_ =>[]; agr=AgrNo}; s2 = mkThis; doesAgree = True; isPron = False}; --: Quant ;
no_Quant = {s ={s=\\_=>"tihariho";agr=AgrNo}; s2 =\\_=> []; doesAgree = False; isPron = False};--: Quant ;
}

View File

@@ -0,0 +1,298 @@
--# -path=.:../prelude:../abstract:../common
concrete StructuralCggOld of Structural = CatCgg **
open ResCgg, ParadigmsCgg, (C = ConstructX), Prelude in {
{-variants
NOTE: Please add them to the abstract syntax, ask aarne
or creat you own abstract Lexicon which inherits from the
standard one. See how english does it. i.e. use DictCggAbs.gf for the funs.
and DictCgg.gf for the lins.
Actually use and extend module for Structural
-}
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
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 = {s = table{Gen => glueGen (AgMUBAP1 Sg); _=> mkSStand (AgMUBAP1 Sg)}; third = \\_,_=>[]; itP3Required=False};--mkPron "nyowe" "nyowe" (AgMUBAP1 Sg);
youSg_Pron = {s = table{Gen => glueGen (AgMUBAP2 Sg); _=>mkSStand (AgMUBAP2 Sg)}; third = \\_,_=>[]; itP3Required=False};--mkPron "iwe" "we" (AgMUBAP2 Sg);
--he_Pron, she_Pron = {s = table{Gen => glueGen (AgP3 Sg MU_BA); _=>mkSStand (AgP3 Sg MU_BA)}; third = \\_,_=>[]; itP3Required=False};--mkPron "uwe" "uwe" (AgP3 Sg MU_BA);
--we_Pron = {s = table{Gen => glueGen AgMUBAP1 Pl); _=>mkSStand (AgMUBAP1 Pl)}; third = \\_,_=>[]; itP3Required=False}; --mkPron "itwe" "itwe" (AgMUBAP1 Pl);
--youPl_Pron = {s = table{Gen => glueGen (AgMUBAP2 Pl); _=>mkSStand (AgMUBAP2 Pl)}; third = \\_,_=>[]; itP3Required=False};--mkPron "imwe" "imwe" (AgMUBAP2 Pl);
--they_Pron = {s = table{Gen => glueGen (AgP3 Pl MU_BA); _=>mkSStand (AgP3 Pl MU_BA)}; third = \\_,_=>[]; itP3Required=False};--mkPron "bo" "bo" (AgP3 Pl MU_BA);
--default implementation Using KI_BI. Use mkmkGenPrepNoIVClitic and
--it_Pron = {s = \\_=>[]; third = table{Gen => \\agr => glueGen agr; _=>\\agr => mkSStand agr}; itP3Required=True}; --mkPron "kyo" "kyo" (AgP3 Sg KI_BI); -- should form an it_Pron_NClass in extra module
behind_Prep ={s="enyuma ya"};
between_Prep = {s="hagati ya"};
to_Prep ={s="aha"};
-- several words depending on use omuri??
in_Prep = mkPrep "omu" "omuri";
--aha-ri Kamukuzi??? works for places
on_Prep = mkPrep "aha" "ahari";
--na --please this string varies with vowels use combine_morphemes or
--combine_words when using it.
with_Prep = mkPrep "na" [];
from_Prep ={s="kuruga"};
under_Prep = {s="hansi ya"};
---Structural
{-
--there are several and i.e.
-- na (two nouns, 2 Noun Phrases, 2 Pronouns, 2 relative subject clauses, )
--kandi (clauses having a commonality of subjects, object or tense)
--the best structure is a table
--mkConjunction "na" "kandi" and_Conj ;
-}
and_Conj = {
s = table {
AConj Other => "kandi";
_ => "na"
};
s2 =[];
n = Pl
};
{-
TODO: Look at the grammar books by Mpairwe & Kahangi Pg 155
and investigate or to find out its arguments but for now
I will assume nari works on all types of
ConjArg (Conjunction Arguments)
nari is the general or
These are candidates for Extra module if they are not specific
to the type of argument.
nînga for Runynakore and
nainga for rukiga
-}
or_Conj = {
s = \\ _ => "nari";
s2 =[];
n = Sg
};
have_V2 ={s= "ine"; pres=[]; perf =[]; morphs = mkVerbMorphs; comp = []; isRegular=False}; --: V2 ;
{-
All Predeterminers are given here.
Initial analysis shows that
a) They appear after the noun phrase but some may be multi-word expressions for a single word in eblish.
b) They appear to agree with the noun class particle. But nothing in the literature states about
their morphological structure. The stems can be guessed by removing the two letter
suffix at the begining of the word. However, there are exceptions such as "not" which is not
inflected according to noun class
c) A table of concords must be built to accomodate every instance and this can only be done
using an analysis of some of the words in the dictionary(Mapirwe and Kahagi).
I am incluned to say use of the table of self-standing pronouns is sufficient.
d) An investigation of the tone systems would also be worthwhile.
Example sentences:
1. All these chickens
2. once a day
3. only the man
-}
all_Predet = {s = "òna"; s2 = []; isMWE = False; isInflected =True};
only_Predet = {s = "nka"; s2 = []; isMWE = False; isInflected =True};
{-
-- how do we deal with superlatives. There seems to be no distinction between countable
-- and uncountable when it comes to superlatioves
-}
most_Predet = {s = "rikukíra"; s2 = "îngi"; isMWE = True; isInflected =True};
not_Predet = {s = "ti"; s2 = []; isMWE = False; isInflected =False};
{-Section for Adverbs-}
always_AdV = {s = "obutóòsha"; agr = AgrNo};
everywhere_Adv = {s = "hóòna"; agr = AgrNo}; -- adverb of place.
here_Adv = {s = "hanu"; agr = AgrNo};
{-End of Adverbs Adverbs-}
{-Begining of Quantifiers-}
--For DetQuant function to work, we need sample quatitifiers in Runynakore. Proximal, Medial, Distant
--We need a table to provide all of these.
that_Quant = {s={s=\\_ =>[]; agr=AgrNo}; s2 = mkThat; doesAgree = True; isPron = False}; --: Quant ;
this_Quant = {s={s=\\_ =>[]; agr=AgrNo}; s2 = mkThis; doesAgree = True; isPron = False}; --: Quant ;
--these_Quant = {s =[]; s2 = mkThese; doesAgree = True};
--those_Quant = {s =[]; s2 = mkThose; doesAgree = True};
no_Quant = {s ={s=\\_=>"tihariho";agr=AgrNo}; s2 =\\_=> []; doesAgree = False; isPron = False};--: Quant ;
{-End of Quantifiers-}
{-Begining of verb-phrase-complement verb VV-} -- A verb whose complement is a verb phrase
--can8know_VV : VV ; -- can (capacity)
{-End of verb-phrase-complement verb -}
{-
--1 Structural: Structural Words
--
-- Here we have some words belonging to closed classes and appearing
-- in all languages we have considered.
-- Sometimes more distinctions are needed, e.g. $we_Pron$ in Spanish
-- should be replaced by masculine and feminine variants, found in
-- [``ExtendSpa`` ../spanish/ExtendSpa.gf].
abstract Structural = Cat ** {
fun
-- This is an alphabetical list of structural words
above_Prep : Prep ;
after_Prep : Prep ;
all_Predet : Predet ;
almost_AdA : AdA ;
almost_AdN : AdN ;
although_Subj : Subj ;
always_AdV : AdV ;
and_Conj : Conj ;
because_Subj : Subj ;
before_Prep : Prep ;
behind_Prep : Prep ;
between_Prep : Prep ;
both7and_DConj : Conj ; -- both...and
---b both7and_DConj : DConj ;
but_PConj : PConj ;
by8agent_Prep : Prep ; -- by (agent)
by8means_Prep : Prep ; -- by (means of)
can8know_VV : VV ; -- can (capacity)
can_VV : VV ; -- can (possibility)
during_Prep : Prep ;
either7or_DConj : Conj ; -- either...or
---b either7or_DConj : DConj ;
every_Det : Det ;
everybody_NP : NP ; -- everybody
everything_NP : NP ;
everywhere_Adv : Adv ; --ha-ona =hoona
--- first_Ord : Ord ; DEPRECATED
few_Det : Det ;
for_Prep : Prep ;
from_Prep : Prep ;
he_Pron : Pron ;
here_Adv : Adv ; --hanu
here7to_Adv : Adv ; -- to here
here7from_Adv : Adv ; -- from here
how_IAdv : IAdv ;
how8many_IDet : IDet ;
how8much_IAdv : IAdv ;
i_Pron : Pron ;
if_Subj : Subj ;
in8front_Prep : Prep ; -- in front of
in_Prep : Prep ;
it_Pron : Pron ;
less_CAdv : CAdv ;
many_Det : Det ;
more_CAdv : CAdv ;
most_Predet : Predet ;
much_Det : Det ;
must_VV : VV ;
---b no_Phr : Phr ;
no_Utt : Utt ;
on_Prep : Prep ;
--- one_Quant : QuantSg ; DEPRECATED
only_Predet : Predet ;
or_Conj : Conj ;
otherwise_PConj : PConj ;
part_Prep : Prep ;
please_Voc : Voc ;
possess_Prep : Prep ; -- of (possessive)
quite_Adv : AdA ;
she_Pron : Pron ;
so_AdA : AdA ;
someSg_Det : Det ;
somePl_Det : Det ;
somebody_NP : NP ;
something_NP : NP ;
somewhere_Adv : Adv ;
that_Quant : Quant ;
that_Subj : Subj ;
there_Adv : Adv ; --hari
there7to_Adv : Adv ; -- to there
there7from_Adv : Adv ; -- from there
therefore_PConj : PConj ;
they_Pron : Pron ;
this_Quant : Quant ;
through_Prep : Prep ;
to_Prep : Prep ;
too_AdA : AdA ;
under_Prep : Prep ;
very_AdA : AdA ;
want_VV : VV ;
we_Pron : Pron ;
whatPl_IP : IP ; -- what (plural)
whatSg_IP : IP ; -- what (singular)
when_IAdv : IAdv ;
when_Subj : Subj ;
where_IAdv : IAdv ;
which_IQuant : IQuant ;
whoPl_IP : IP ; -- who (plural)
whoSg_IP : IP ; -- who (singular)
why_IAdv : IAdv ;
with_Prep : Prep ;
without_Prep : Prep ;
---b yes_Phr : Phr ;
yes_Utt : Utt ;
youSg_Pron : Pron ; -- you (singular)
youPl_Pron : Pron ; -- you (plural)
youPol_Pron : Pron ; -- you (polite)
no_Quant : Quant ;
not_Predet : Predet ;
if_then_Conj : Conj ;
at_least_AdN : AdN ;
at_most_AdN : AdN ;
nobody_NP : NP ;
nothing_NP : NP ;
except_Prep : Prep ;
as_CAdv : CAdv ;
have_V2 : V2 ;
fun language_title_Utt : Utt ;
-}
}

55
src/rukiga/SymbolCgg.gf Executable file
View File

@@ -0,0 +1,55 @@
--# -path=.:../prelude:../abstract:../common
concrete SymbolCgg of Symbol = CatCgg **
open Prelude, ResCgg in {
{-
--1 Symbolic expressions
-- *Note*. This module is not automatically included in the main
-- grammar [Lang Lang.html].
abstract Symbol = Cat, PredefAbs ** {
--2 Noun phrases with symbols and numbers
fun
SymbPN : Symb -> PN ; -- x
IntPN : Int -> PN ; -- 27
FloatPN : Float -> PN ; -- 3.14159
NumPN : Card -> PN ; -- twelve [as proper name]
CNNumNP : CN -> Card -> NP ; -- level five ; level 5
CNSymbNP : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y
--2 Sentence consisting of a formula
SymbS : Symb -> S ; -- A
--2 Symbols as numerals
SymbNum : Symb -> Card ; -- n
SymbOrd : Symb -> Ord ; -- n'th
--2 Symbol lists
-- A symbol list has at least two elements. The last two are separated
-- by a conjunction ("and" in English), the others by commas.
-- This produces "x, y and z", in English.
cat
Symb ;
[Symb]{2} ;
fun
MkSymb : String -> Symb ; -- foo [making a symbol from a string]
--2 Obsolescent
CNIntNP : CN -> Int -> NP ; -- level 53 (covered by CNNumNP)
-}
}

425
src/rukiga/VerbCgg.gf Executable file
View File

@@ -0,0 +1,425 @@
--# -path=.:../prelude:../abstract:../common
concrete VerbCgg of Verb = CatCgg ** open ResCgg, Prelude in {
lin
UseV v = {
s = v.s ;
pres =v.pres;
perf = v.perf;
--morphs = v.morphs;
comp =[];
comp2 = [];
ap =[];
isCompApStem = False;
agr = AgrNo;
isRegular = v.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
}; --: V -> VP; -- sleep --ignoring object agreement
-- UseComp : Comp -> VP ; -- be warm means complement of a copula especially adjectival Phrase
--AdjectivalPhrase : Type = {s : Str ; post : Str; isPre : Bool; isProper : Bool; isPrep: Bool};
UseComp comp = let auxBe = mkBecome
in
{
s = auxBe.s ++ BIND ++auxBe.pres++ comp.s; --Assuming there is no AP which is prepositional
pres =[];
perf = [];
--morphs=\\form,morphs=>[];
comp = [];
comp2 = [];
ap = [];
isCompApStem = False;
agr = AgrNo;
isRegular = False;
adv = [];
containsAdv =False;
adV =[];
containsAdV = False
}; --its not generating any sentence
-- CompAP : AP -> Comp; -- (be) small
CompAP ap = {s=ap.s! AgP3 Sg KI_BI}; -- used a hack.
-- CompNP : NP -> Comp ; -- (be) the man
CompNP np = {s= np.s ! Acc}; --{s =[] ; post =np.s; isPre = False; isProper = Bool; isPrep: Bool};
-- CompAdv : Adv -> Comp ; -- (be) here
CompAdv adv =adv;
{-
This has been a hack to simply pick the sigular and complete noun.
-}
--CompCN : CN -> Comp ; -- (be) a man/men
CompCN cn = {s =cn.s ! Sg ! Complete} ; -- (be) a man/men
-- SlashV2a : V2 -> VPSlash ; -- love (it)
SlashV2a v2 ={
s =v2.s;
pres =v2.pres;
perf = v2.perf;
--morphs = v2.morphs;
comp = [];
comp2 =[];
ap =[];
isRegular =v2.isRegular;
adv=[];
containsAdv =False;
adV =[];
containsAdV = False
};
--Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her)
Slash2V3 v3 np ={
s =v3.s;
pres =v3.pres;
perf = v3.perf;
--morphs = v3.morphs;
comp = np.s ! Acc;
comp2 =[];
ap =[];
isRegular = v3.isRegular;
adv = [];
containsAdv =False;
adV =[];
containsAdV = False
};
--Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her
Slash3V3 v3 np ={
s =v3.s;
pres =v3.pres;
perf = v3.perf;
--morphs = v3.morphs;
comp = np.s ! Acc;
comp2 = np.s ! Acc; -- what is the meaning of this function?
ap = [];
isRegular = v3.isRegular;
adv = [];
containsAdv =False;
adV =[];
containsAdV = False
};
--SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy
SlashVV vv vpslash ={
s =vv.s;
pres =vv.pres;
perf = vv.perf;
--morphs = vv.morphs;
comp = vpslash.s ++ BIND ++ vpslash.pres;
comp2 = [];
ap = [];
isRegular = vv.isRegular;
adv = [];
containsAdv = False;
adV =[];
containsAdV = False
};
--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;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
comp = vpslash.comp ++ np.s ! Acc;
comp2 =vpslash.comp2; --should be empty
ap = [];
isCompApStem = False;
agr = AgrYes np.agr;
isRegular = vpslash.isRegular;
adv = [];
containsAdv =False;
adV =[];
containsAdV = False
};
-- AdvVP : VP -> Adv -> VP ; -- sleep here
-- VerbPhrase: Type = {s:Str; morphs: VMorphs ; comp:Str ; isCompApStem : Bool; agr : AgrExist};
AdvVP vp adv =
{
s=vp.s;
pres =vp.pres;
perf = vp.perf;
--morphs = vp.morphs;
comp = adv.s;
comp2 = [];
ap =[];
isCompApStem = False;
agr = AgrNo;
isRegular = vp.isRegular;
adv = [];
containsAdv =True;
adV =[];
containsAdV = False
};
-- AdVVP : AdV -> VP -> VP ; -- always sleep
AdVVP adV vp = {
s=vp.s;
pres =vp.pres;
perf = vp.perf;
--morphs = vp.morphs;
comp = vp.comp;
comp2 =vp.comp;
ap = [];
isCompApStem = False;
agr = AgrNo;
isRegular = vp.isRegular;
adv = [];
containsAdv =False;
adV =adV.s;
containsAdV = True
};
--AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here
{-
FUTURE:
The problem here could rise from the agreement if the adverb agrees.
We could change the type of adv to be Agreement => Str such that we have NONE.
-}
AdvVPSlash vpslash adv ={
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
comp = vpslash.comp;
comp2 = vpslash.comp2;
ap = [];
isRegular = vpslash.isRegular;
adv = adv.s;
containsAdv =True;
adV =[];
containsAdV = False
};
-- Adverb directly attached to verb
--AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it)
{- NOTE:
This is a hack mainly because we need a separate field for AdV type
-}
AdVVPSlash adV vpslash ={
s =vpslash.s;
pres =vpslash.pres;
perf = vpslash.perf;
--morphs = vpslash.morphs;
comp = vpslash.comp;
comp2 = vpslash.comp2;
ap = [];
isRegular = vpslash.isRegular;
adv = [];
containsAdv =False;
adV =adV.s;
containsAdV = True
};
-- Verb phrases are constructed from verbs by providing their
-- complements. There is one rule for each verb category.
{- NOTE: This is a hack
--ComplVV : VV -> VP -> VP ; -- want to run
--This function requires the remodelling of VP to accomodate two Verbs.
--
-}
ComplVV vv vp = let vpPres = "ku" ++ BIND ++ vp.s ++ BIND ++ vp.pres;
in case vv.whenUsed of {
VVPerf => {
s= vv.s ++ BIND ++ vv.perf ++ vpPres;
pres = [];--vv.pres;
perf= []; -- vv.perf;
--morphs = vv.morphs;
comp=vp.comp ;
comp2 = vp.comp2;
ap = [];
isCompApStem = False; agr = AgrNo;
isRegular = vv.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
};
_ => {
s= vv.s ++ BIND ++ vv.pres ++ vpPres;
pres = [];--vv.pres;
perf= [];--vv.perf;
--morphs = vv.morphs;
comp=vp.comp ;
comp2 = vp.comp2;
ap = [];
isCompApStem = False;
agr = AgrNo;
isRegular = vv.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
}
};
--ComplVS : VS -> S -> VP ; -- say that she runs
ComplVS vs s = {
s= vs.s;
pres =vs.pres;
perf=vs.perf;
--morphs = vs.morphs;
comp=s.s ;
comp2 = [];
ap = [];
isCompApStem = False;
agr = AgrNo;
isRegular = vs.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
};
{-
This function may need revision as I have not met such kinds of questions
-}
--ComplVQ : VQ -> QS -> VP ; -- wonder who runs
ComplVQ vq qs = {
s= vq.s;
pres =vq.pres;
perf=vq.perf;
--morphs = vq.morphs;
comp=qs.s ;
comp2 = [];
ap = [];
isCompApStem = False;
agr = AgrNo;
isRegular = vq.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
};
{-
The adgectival Phrase is comlicated here.
The VP has to accomodate the whole structure of the Adjectival Phrase
For the timebeing, we can use the isCompApStem field but we need a separate field
-}
--ComplVA : VA -> AP -> VP ; -- they become red
--AP = {s : Str ; position1 : Res.Position1; isProper : Bool; isPrep: Bool};--Res.AdjectivalPhrase;
ComplVA va ap = {
s= va.s;
pres =va.pres;
perf=va.perf;
--morphs = va.morphs;
comp=[] ;
comp2 = [];
ap = ap.s! AgP3 Sg KI_BI;
isCompApStem = True;
agr = AgrNo;
isRegular = va.isRegular;
adv =[];
containsAdv =False;
adV =[];
containsAdV = False
};
-- Copula alone
--UseCopula : VP ; -- be
UseCopula = mkBecome ** {
comp=[];
comp2 = [];
ap = [];
isCompApStem = False;
agr = AgrNo;
adv = [];
containsAdv = False;
adV =[];
containsAdV = False
};
{-
--1 The construction of verb phrases
abstract Verb = Cat ** {
flags coding = utf8 ;
--2 Complementization rules
-- Verb phrases are constructed from verbs by providing their
-- complements. There is one rule for each verb category.
ComplVV : VV -> VP -> VP ; -- want to run
ComplVS : VS -> S -> VP ; -- say that she runs
ComplVQ : VQ -> QS -> VP ; -- wonder who runs
ComplVA : VA -> AP -> VP ; -- they become red
SlashV2a : V2 -> VPSlash ; -- love (it)
Slash2V3 : V3 -> NP -> VPSlash ; -- give it (to her)
Slash3V3 : V3 -> NP -> VPSlash ; -- give (it) to her
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
SlashVV : VV -> VPSlash -> VPSlash ; -- want to buy
SlashV2VNP : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy
--2 Other ways of forming verb phrases
-- Verb phrases can also be constructed reflexively and from
-- copula-preceded complements.
ReflVP : VPSlash -> VP ; -- love himself
UseComp : Comp -> VP ; -- be warm
-- Passivization of two-place verbs is another way to use
-- them. In many languages, the result is a participle that
-- is used as complement to a copula ("is used"), but other
-- auxiliary verbs are possible (Ger. "wird angewendet", It.
-- "viene usato"), as well as special verb forms (Fin. "käytetään",
-- Swe. "används").
--
-- *Note*. the rule can be overgenerating, since the $V2$ need not
-- take a direct object.
PassV2 : V2 -> VP ; -- be loved
-- Adverbs can be added to verb phrases. Many languages make
-- a distinction between adverbs that are attached in the end
-- vs. next to (or before) the verb.
AdvVP : VP -> Adv -> VP ; -- sleep here
ExtAdvVP : VP -> Adv -> VP ; -- sleep , even though ...
AdVVP : AdV -> VP -> VP ; -- always sleep
AdvVPSlash : VPSlash -> Adv -> VPSlash ; -- use (it) here
AdVVPSlash : AdV -> VPSlash -> VPSlash ; -- always use (it)
VPSlashPrep : VP -> Prep -> VPSlash ; -- live in (it)
-- *Agents of passives* are constructed as adverbs with the
-- preposition [Structural Structural.html]$.8agent_Prep$.
--2 Complements to copula
-- Adjectival phrases, noun phrases, and adverbs can be used.
CompAP : AP -> Comp ; -- (be) small
CompNP : NP -> Comp ; -- (be) the man
CompAdv : Adv -> Comp ; -- (be) here
CompCN : CN -> Comp ; -- (be) a man/men
-- Copula alone
UseCopula : VP ; -- be
-}
}