1
0
forked from GitHub/gf-rgl

working tests for verbal affixes and tenses, add kepada (to a person), initial groundwork for animacy, numerals

This commit is contained in:
Meowyam
2022-03-21 17:28:45 +08:00
parent 88ae0d5093
commit 9fa07fb22d
13 changed files with 96 additions and 21 deletions

View File

@@ -39,6 +39,8 @@ concrete AdjectiveMay of Adjective = CatMay ** open ResMay, Prelude in {
-- AdjOrd ord = ord ** { -- AdjOrd ord = ord ** {
-- compar = [] -- compar = []
-- } ; -- } ;
-- AdjOrd : Ord -> AP =
AdjOrd ord = ord ;
-- Sentence and question complements defined for all adjectival -- Sentence and question complements defined for all adjectival
-- phrases, although the semantics is only clear for some adjectives. -- phrases, although the semantics is only clear for some adjectives.

View File

@@ -13,6 +13,8 @@ lin
-- : Prep -> NP -> Adv ; -- : Prep -> NP -> Adv ;
PrepNP prep np = {s = applyPrep prep np} ; PrepNP prep np = {s = applyPrep prep np} ;
-- PrepNP to_Prep (UsePron youSg_Pron)
-- Adverbs can be modified by 'adadjectives', just like adjectives. -- Adverbs can be modified by 'adadjectives', just like adjectives.
--AdAdv : AdA -> Adv -> Adv ; -- very quickly --AdAdv : AdA -> Adv -> Adv ; -- very quickly

View File

@@ -126,4 +126,10 @@ concrete CatMay of Cat = CommonX - [IAdv] ** open ResMay, Prelude in {
ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s; ClSlash = \cl -> cl.subj ++ cl.pred ! Root ! Pos ++ cl.c2.s;
RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos; RCl = \cl -> cl.subj ++ cl.pred ! P1 ! Pos;
Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos; Cl = \cl -> cl.subj ++ cl.pred ! Active ! Pos;
Det = linDet ;
} }
-- Determiner : Type = Quant ** {
-- pr : Str ; -- prefix for numbers
-- n : NumType ; -- number as in 5 (noun in singular), Sg or Pl
-- } ;

View File

@@ -19,7 +19,7 @@ lin ask_V2Q = mkV2 "tanya" ;
---- ----
-- B -- B
lin baby_N = mkN "bayi" ; lin baby_N = mkN "bayi" Animate ;
lin back_N = mkN "belakang" ; lin back_N = mkN "belakang" ;
-- lin bad_A = mkA "" ; -- lin bad_A = mkA "" ;
lin bank_N = mkN "bank" ; lin bank_N = mkN "bank" ;
@@ -29,7 +29,7 @@ lin beautiful_A = mkA "cantik" ;
lin beer_N = mkN "bir" ; lin beer_N = mkN "bir" ;
-- lin beg_V2V = mkV2 "" ; -- lin beg_V2V = mkV2 "" ;
-- lin belly_N = mkN "" ; -- lin belly_N = mkN "" ;
-- lin big_A = mkA "" ; lin big_A = mkA "besar" ;
-- lin bike_N = mkN "" ; -- lin bike_N = mkN "" ;
-- lin bird_N = mkN "" ; -- lin bird_N = mkN "" ;
-- lin bite_V2 = mkV2 "" ; -- lin bite_V2 = mkV2 "" ;
@@ -208,7 +208,7 @@ lin king_N = mkN "raja" ;
-- lin language_N = mkN "" ; -- lin language_N = mkN "" ;
-- lin laugh_V = mkV "" ; -- lin laugh_V = mkV "" ;
-- lin leaf_N = mkN "" ; -- lin leaf_N = mkN "" ;
-- lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ; lin learn_V2 = mkV2 (prefixV (mkV "ajar" Ber)) emptyPrep ;
-- lin leather_N = mkN "" ; -- lin leather_N = mkN "" ;
-- lin leave_V2 = mkV2 "" ; -- lin leave_V2 = mkV2 "" ;
-- lin leg_N = mkN "" ; -- lin leg_N = mkN "" ;

View File

@@ -51,7 +51,7 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
-- : Det -> NP ; -- : Det -> NP ;
DetNP det = emptyNP ** { DetNP det = emptyNP ** {
s = \\_ => det.s ; s = \\_ => linDet det ;
} ; } ;
-- MassNP : CN -> NP ; -- MassNP : CN -> NP ;
@@ -71,10 +71,12 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
n = num.n n = num.n
} ; } ;
-- : Quant -> Num -> Ord -> Det ; -- these five best -- : Quant -> Num -> Ord -> Det ;
-- DetQuantOrd quant num ord = DetQuantOrd quant num ord = quant ** {
-- let theseFive = DetQuant quant num in theseFive ** { pr = num.s ;
-- } ; n = num.n ;
s = ord.s ++ quant.s ;
} ;
-- Whether the resulting determiner is singular or plural depends on the -- Whether the resulting determiner is singular or plural depends on the
-- cardinal. -- cardinal.
@@ -107,18 +109,21 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
OrdDigits digs = digs ** { s = digs.s ! NOrd } ; OrdDigits digs = digs ** { s = digs.s ! NOrd } ;
-} -}
-- : Numeral -> Ord ; -- : Numeral -> Ord ;
-- OrdNumeral num = num ** { OrdNumeral num = {
-- s = \\_ => num.ord s = num.ord
-- } ; } ;
-- : A -> Ord ; -- : A -> Ord ;
-- OrdSuperl a = { OrdSuperl a = {
-- } ; s = "ter" ++ BIND ++ a.s
} ;
-- One can combine a numeral and a superlative. -- One can combine a numeral and a superlative.
-- : Numeral -> A -> Ord ; -- third largest -- : Numeral -> A -> Ord ; -- third largest
-- OrdNumeralSuperl num a = num ** { } ; OrdNumeralSuperl num a = {
s = num.ord ++ "ter" ++ BIND ++ a.s
} ;
-- : Quant -- : Quant
DefArt = mkQuant [] ; DefArt = mkQuant [] ;
@@ -199,6 +204,14 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
} }
} ; } ;
-- : Det -> NP -> NP ;
CountNP det np = np **
{
s = \\pos => "ke" ++ BIND ++ linDet det ++ BIND ++ "-" ++ BIND ++ linDet det ++ np.s ! pos;
} ; -- Nonsense for DefArt or IndefArt
-- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples
-- PartNP cn np = cn ** { -- PartNP cn np = cn ** {
-- } ; -- } ;

View File

@@ -96,6 +96,7 @@ oper
} ; } ;
-- To make Sub* funs directly from a string. -- To make Sub* funs directly from a string.
-- ordnumeral from here
mkNum : Str -> LinNumber = \s -> { mkNum : Str -> LinNumber = \s -> {
n = Pl ; n = Pl ;
s = \\_ => s ; -- Indep vs. Attrib only matters for number 1 s = \\_ => s ; -- Indep vs. Attrib only matters for number 1

View File

@@ -93,6 +93,7 @@ oper
mkN = overload { mkN = overload {
mkN : Str -> N = \s -> lin N (mkNoun s) ; mkN : Str -> N = \s -> lin N (mkNoun s) ;
mkN : Str -> Animacy -> N = \s,a -> lin N (mkNoun s) ;
} ; } ;

View File

@@ -85,6 +85,8 @@ param
NPAgr = NotPron | IsPron Person ; NPAgr = NotPron | IsPron Person ;
Animacy = Animate | Inanimate ;
oper oper
poss2str : Possession -> Str = \p -> case p of { poss2str : Possession -> Str = \p -> case p of {
Bare => [] ; Bare => [] ;
@@ -130,6 +132,10 @@ param
param param
PrepType = DirObj | EmptyPrep | OtherPrep ; PrepType = DirObj | EmptyPrep | OtherPrep ;
--------------------------------------------------------------------------------
-- Adverbs
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Verbs -- Verbs
param param

View File

@@ -81,6 +81,9 @@ oper
isPre : Bool ; isPre : Bool ;
} ; } ;
linDet : Determiner -> Str = \det -> det.pr ++ det.s ;
-- add field in determiner for kedua-dua numbers
Determiner : Type = Quant ** { Determiner : Type = Quant ** {
pr : Str ; -- prefix for numbers pr : Str ; -- prefix for numbers
n : NumType ; -- number as in 5 (noun in singular), Sg or Pl n : NumType ; -- number as in 5 (noun in singular), Sg or Pl

View File

@@ -110,7 +110,18 @@ lin in_Prep = mkPrep "di" ;
-- lin part_Prep = mkPrep ; -- lin part_Prep = mkPrep ;
lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2 lin possess_Prep = mkPrep [] ; -- TODO check Mintz p. 39-40, 2.2.1.2
-- lin through_Prep = mkPrep ; -- lin through_Prep = mkPrep ;
lin to_Prep = mkPrep "ke" ; -- lin to_Prep = mkPrep "ke" ;
lin to_Prep =
let ke : Preposition = mkPrep "ke";
kepada : Preposition = mkPrep "kepada" ;
in ke ** {
obj = kepada.obj
} ;
-- lin have_V2 = let have' : V2 = mkV2 "ada" in have' ** {
-- s = \\_ => "ada" ;
-- passive = "diadakan" ;
-- } ;
-- lin under_Prep = mkPrep "" ; -- lin under_Prep = mkPrep "" ;
lin with_Prep = mkPrep "dengan" ; lin with_Prep = mkPrep "dengan" ;
-- lin without_Prep = mkPrep "" ; -- lin without_Prep = mkPrep "" ;

View File

@@ -9,3 +9,31 @@ LangMay: lima kucing ini
Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N) Lang: DetCN (DetQuant (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot2 (pot0 n7))))))) (UseN cat_N)
LangEng: my seven hundred cats LangEng: my seven hundred cats
LangMay: tujuh ratus kucing aku LangMay: tujuh ratus kucing aku
Lang: AdjCN (AdjOrd (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N)
LangEng: second cat
LangMay: kucing kedua
Lang: DetQuantOrd IndefArt NumPl (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))
LangEng: second
LangMay: kedua
Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) NumSg (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N))
LangEng: my second cat
LangMay: kucing kedua aku
Lang: UttNP (DetCN (DetQuantOrd (PossPron i_Pron) (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (OrdNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2))))))) (UseN cat_N))
LangEng: my two second cats
LangMay: dua kucing kedua aku
Lang: CountNP (DetQuant IndefArt (NumCard (NumNumeral (num (pot2as3 (pot1as2 (pot0as1 (pot0 n2)))))))) (DetCN (DetQuant (PossPron i_Pron) NumPl) (UseN cat_N))
LangEng: two of my cats
LangMay: kedua-dua kucing aku
Lang: MassNP (AdjCN (AdjOrd (OrdNumeralSuperl (num (pot2as3 (pot1as2 (pot0as1 (pot0 n3))))) big_A)) (UseN cat_N))
LangEng: third biggest cat
LangMay: kucing ketiga terbesar
Lang: MassNP (AdjCN (AdjOrd (OrdSuperl big_A)) (UseN cat_N))
LangEng: biggest cat
LangMay: kucing terbesar

View File

@@ -23,3 +23,6 @@ LangMay: sekiranya aku berjalan , kucing akan berjalan
Lang: ExtAdvS (SubjS when_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V))) Lang: ExtAdvS (SubjS when_Subj (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseV walk_V)))) (UseCl (TTAnt TFut ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseV walk_V)))
LangEng: when I walk , the cat will walk LangEng: when I walk , the cat will walk
LangMay: kalau aku berjalan , kucing akan berjalan LangMay: kalau aku berjalan , kucing akan berjalan
---

View File

@@ -14,7 +14,7 @@ LangMay: kucing aku berjalan
-- As a verbal complement -- As a verbal complement
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V)))) Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant (PossPron i_Pron) NumSg) (UseN cat_N)) (ComplVV want_VV (UseV walk_V))))
LangEng: my cat wants to walk LangEng: my cat wants to walk
LangMay: kucing aku mahu jalan LangMay: kucing aku mahu berjalan
-- Transitive verbs -- Transitive verbs
@@ -25,7 +25,7 @@ LangMay: aku membaca buku ini
-- As a verbal complement -- As a verbal complement
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N)))))) Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplVV want_VV (ComplSlash (SlashV2a read_V2) (DetCN (DetQuant this_Quant NumSg) (UseN book_N))))))
LangEng: I want to read this book LangEng: I want to read this book
LangMay: aku mahu baca buku ini LangMay: aku mahu membaca buku ini
-- How about words like mengajar and belajar? Is the prefix more important here? -- How about words like mengajar and belajar? Is the prefix more important here?
@@ -37,10 +37,9 @@ Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (Com
LangEng: I teach science in the school LangEng: I teach science in the school
LangMay: aku mengajar sains di sekolah LangMay: aku mengajar sains di sekolah
-- The way the grammar is currently defined, we'd get the same output for both "I want to learn/study science". Is this correct, or should one or both of the verbs keep the ber/meng prefix in this context?
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a teach_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I want to teach science in the school LangEng: I want to teach science in the school
LangMay: aku mahu ajar sains di sekolah LangMay: aku mahu mengajar sains di sekolah
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N)))))) Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (AdvVP (ComplVV want_VV (ComplSlash (SlashV2a learn_V2) (MassNP (UseN science_N)))) (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN school_N))))))
LangEng: I want to learn science in the school LangEng: I want to learn science in the school
@@ -62,12 +61,12 @@ LangMay: buku ini diajar di sekolah
Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))) Lang: DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))
LangEng: a cat that walks LangEng: a cat that walks
LangMay: kucing yang jalan LangMay: kucing yang berjalan
-- In a context -- In a context
Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V)))))))) Lang: UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a buy_V2) (DetCN (DetQuant IndefArt NumSg) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV walk_V))))))))
LangEng: I buy a cat that walks LangEng: I buy a cat that walks
LangMay: aku membeli kucing yang jalan LangMay: aku membeli kucing yang berjalan
-- Transitive verbs -- Transitive verbs