forked from GitHub/gf-rgl
(May) Define three different preposition types
This commit is contained in:
@@ -132,9 +132,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
|
||||
-- : N2 -> NP -> CN ;
|
||||
ComplN2 n2 np = useN n2 ** {
|
||||
s = \\nf =>
|
||||
case <n2.c2.isPoss, np.a, nf> of {
|
||||
<True, IsPron p, NF num _>
|
||||
=> n2.s ! NF num (Poss p) ++ np.empty ;
|
||||
case <n2.c2.prepType, np.a, nf> of {
|
||||
<DirObj, IsPron p, NF num _>
|
||||
=> n2.s ! NF num (Poss p) ++ np.empty ; -- DirObj is reused here to mean possession
|
||||
_ => n2.s ! nf ++ applyPrep n2.c2 np
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
resource ParamMay = ParamX ** open Prelude in {
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -119,6 +120,8 @@ param
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Prepositions
|
||||
param
|
||||
PrepType = DirObj | EmptyPrep | OtherPrep ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Verbs
|
||||
|
||||
@@ -17,10 +17,13 @@ lin
|
||||
subj = rp.s -- yang
|
||||
++ cls.subj ; -- saya
|
||||
pred = \\per,pol =>
|
||||
cls.pred ! Root ! pol -- ikut sama
|
||||
++ case cls.c2.isPoss of {
|
||||
True => [] ;
|
||||
False => cls.c2.obj ! per} -- dengan+nya (depends on the head, not known yet)
|
||||
let object : Str = case cls.c2.prepType of {
|
||||
OtherPrep
|
||||
=> cls.c2.obj ! per ; -- depends on the head, not known yet
|
||||
_ => [] -- if the preposition is dir.obj or empty, no obj. pronoun
|
||||
} ;
|
||||
in cls.pred ! Root ! pol -- ikut sama
|
||||
++ object -- dengan+nya
|
||||
} ;
|
||||
|
||||
-- : RP ;
|
||||
|
||||
@@ -105,13 +105,13 @@ oper
|
||||
Preposition : Type = {
|
||||
s : Str ; -- dengan
|
||||
obj : Person => Str ; -- dengan+nya -- needed in relative clauses to refer to the object
|
||||
isPoss : Bool ; -- TODO rename, the name is confusing
|
||||
prepType : PrepType ; -- TODO rename, the name is confusing
|
||||
} ;
|
||||
|
||||
mkPrep : Str -> Preposition = \dengan -> {
|
||||
s = dengan ;
|
||||
obj = \\p => dengan + poss2str (Poss p) ;
|
||||
isPoss = False ;
|
||||
prepType = OtherPrep ;
|
||||
} ;
|
||||
|
||||
-- direct object: "hits him" -> "memukul+nya"
|
||||
@@ -121,22 +121,22 @@ oper
|
||||
P1 => BIND ++ "ku" ;
|
||||
P2 => BIND ++ "mu" ;
|
||||
P3 => BIND ++ "nya" } ;
|
||||
isPoss = True ;
|
||||
prepType = DirObj ;
|
||||
} ;
|
||||
|
||||
-- truly empty
|
||||
emptyPrep : Preposition = {
|
||||
s = [] ;
|
||||
obj = \\_ => [] ;
|
||||
isPoss = True ;
|
||||
prepType = EmptyPrep ;
|
||||
} ;
|
||||
|
||||
datPrep : Preposition = mkPrep "kepada" ;
|
||||
|
||||
applyPrep : Preposition -> NounPhrase -> Str = \prep,np ->
|
||||
case np.a of {
|
||||
IsPron p => prep.obj ! p ++ np.empty ;
|
||||
NotPron => prep.s ++ np.s ! Bare
|
||||
case <np.a, prep.prepType> of {
|
||||
<IsPron p,OtherPrep> => prep.obj ! p ++ np.empty ;
|
||||
_ => prep.s ++ np.s ! Bare
|
||||
} ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user