(May) Define three different preposition types

This commit is contained in:
Inari Listenmaa
2020-08-22 20:20:25 +02:00
parent ec9dcb92bf
commit 2205d5c91c
4 changed files with 20 additions and 14 deletions

View File

@@ -132,9 +132,9 @@ concrete NounMay of Noun = CatMay ** open ResMay, Prelude in {
-- : N2 -> NP -> CN ; -- : N2 -> NP -> CN ;
ComplN2 n2 np = useN n2 ** { ComplN2 n2 np = useN n2 ** {
s = \\nf => s = \\nf =>
case <n2.c2.isPoss, np.a, nf> of { case <n2.c2.prepType, np.a, nf> of {
<True, IsPron p, NF num _> <DirObj, IsPron p, NF num _>
=> n2.s ! NF num (Poss p) ++ np.empty ; => n2.s ! NF num (Poss p) ++ np.empty ; -- DirObj is reused here to mean possession
_ => n2.s ! nf ++ applyPrep n2.c2 np _ => n2.s ! nf ++ applyPrep n2.c2 np
} }
} ; } ;

View File

@@ -1,3 +1,4 @@
resource ParamMay = ParamX ** open Prelude in { resource ParamMay = ParamX ** open Prelude in {
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
@@ -119,6 +120,8 @@ param
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Prepositions -- Prepositions
param
PrepType = DirObj | EmptyPrep | OtherPrep ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
-- Verbs -- Verbs

View File

@@ -17,10 +17,13 @@ lin
subj = rp.s -- yang subj = rp.s -- yang
++ cls.subj ; -- saya ++ cls.subj ; -- saya
pred = \\per,pol => pred = \\per,pol =>
cls.pred ! Root ! pol -- ikut sama let object : Str = case cls.c2.prepType of {
++ case cls.c2.isPoss of { OtherPrep
True => [] ; => cls.c2.obj ! per ; -- depends on the head, not known yet
False => cls.c2.obj ! per} -- dengan+nya (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 ; -- : RP ;

View File

@@ -105,13 +105,13 @@ oper
Preposition : Type = { Preposition : Type = {
s : Str ; -- dengan s : Str ; -- dengan
obj : Person => Str ; -- dengan+nya -- needed in relative clauses to refer to the object 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 -> { mkPrep : Str -> Preposition = \dengan -> {
s = dengan ; s = dengan ;
obj = \\p => dengan + poss2str (Poss p) ; obj = \\p => dengan + poss2str (Poss p) ;
isPoss = False ; prepType = OtherPrep ;
} ; } ;
-- direct object: "hits him" -> "memukul+nya" -- direct object: "hits him" -> "memukul+nya"
@@ -121,22 +121,22 @@ oper
P1 => BIND ++ "ku" ; P1 => BIND ++ "ku" ;
P2 => BIND ++ "mu" ; P2 => BIND ++ "mu" ;
P3 => BIND ++ "nya" } ; P3 => BIND ++ "nya" } ;
isPoss = True ; prepType = DirObj ;
} ; } ;
-- truly empty -- truly empty
emptyPrep : Preposition = { emptyPrep : Preposition = {
s = [] ; s = [] ;
obj = \\_ => [] ; obj = \\_ => [] ;
isPoss = True ; prepType = EmptyPrep ;
} ; } ;
datPrep : Preposition = mkPrep "kepada" ; datPrep : Preposition = mkPrep "kepada" ;
applyPrep : Preposition -> NounPhrase -> Str = \prep,np -> applyPrep : Preposition -> NounPhrase -> Str = \prep,np ->
case np.a of { case <np.a, prep.prepType> of {
IsPron p => prep.obj ! p ++ np.empty ; <IsPron p,OtherPrep> => prep.obj ! p ++ np.empty ;
NotPron => prep.s ++ np.s ! Bare _ => prep.s ++ np.s ! Bare
} ; } ;
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------