fixed prepositional verbs in Chinese, and swapped mkPrep to the natural pre-post order

This commit is contained in:
aarne
2013-09-27 02:40:34 +00:00
parent a6e0ef76f1
commit 6c28e9743d
9 changed files with 84 additions and 67 deletions

View File

@@ -65,8 +65,8 @@ concrete CatChi of Cat = CommonX - [Tense, Temp, Adv] ** open ResChi, Prelude in
-- Open lexical classes, e.g. Lexicon
V, VS, VQ, VA = Verb ;
V2, V2Q, V2S = Verb ** {c2 : Preposition} ;
V3, V2A, V2V = Verb ** {c2, c3 : Preposition} ;
V2, V2Q, V2S = Verb ** {c2 : Preposition ; hasPrep : Bool ; part : Str} ;
V3, V2A, V2V = Verb ** {c2, c3 : Preposition ; hasPrep : Bool ; part : Str} ;
VV = Verb ;
A = ResChi.Adj ;

View File

@@ -466,7 +466,7 @@ lin
--- TODO
of_Prep = mkPrep "的" ;
of_Prep = mkPrep [] "的" ;
by_Prep = mkPrep "由" ;
at_Prep = mkPrep "在" ;
as_Prep = mkPrep "如" ;
@@ -1213,7 +1213,7 @@ evidence_N = mkN "证据" ;
appear_VV = mkVV "出现" ;
sure_A = mkA "肯定" ;
size_N = mkN "大小" ;
out_Prep = mkPrep "到。。。外面" ;
out_Prep = mkPrep "到" "外面" ;
face_N = mkN "面对" ;
anything_NP = mkNPword "无论何事" ;
version_N = mkN "版本" ;
@@ -1630,7 +1630,7 @@ delay_N = mkN "延迟" ;
decline_V2 = mkV2 "下降" ;
crisis_N = mkN "危机" ;
audience_N = mkN "听众" ;
amid_Prep = mkPrep "在。。。之中" ;
amid_Prep = mkPrep "在" "之中" ;
yield_V = mkV "产量" ;
street_N = mkN "街头" ;
soar_V = mkV "翱翔" ;

View File

@@ -14,7 +14,7 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in {
PredetNP pred np = mkNP (pred.s ++ possessive_s ++ np.s) ;
PPartNP np v2 = mkNP ((predV v2).verb.s ++ possessive_s ++ np.s) ; ---- ??
PPartNP np v2 = mkNP ((predV v2 v2.part).verb.s ++ possessive_s ++ np.s) ; ---- ??
AdvNP np adv = mkNP (adv.s ++ possessive_s ++ np.s) ;

View File

@@ -18,7 +18,7 @@ oper
---- = \n,p -> lin N2 (n ** {c2 = mkPrep p}) ;
} ;
mkN3 : N -> Preposition -> Preposition -> N3
mkN3 : N -> Prep -> Prep -> N3
= \n,p,q -> lin N3 (n ** {c2 = p ; c3 = q}) ;
@@ -43,17 +43,26 @@ oper
= \arrive,pp,ds,dp,ep,neg -> lin V (mkVerb arrive pp ds dp ep neg) ;
} ;
mkV2 : Str -> V2
= \s -> lin V2 (regVerb s ** {c2 = emptyPrep}) ;
mkV2 = overload {
mkV2 : Str -> V2
= \s -> case s of {
v + "+" + p => lin V2 (regVerb v ** {c2 = emptyPrep ; hasPrep = False ; part = p}) ;
v + "*" + p => lin V2 (regVerb v ** {c2 = ResChi.mkPreposition p [] ; hasPrep = True ; part = []}) ;
_ => lin V2 (regVerb s ** {c2 = emptyPrep ; hasPrep = False ; part = []})
} ;
mkV2 : V -> V2
= \v -> lin V2 (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV2 : V -> Prep -> V2
= \v,p -> lin V2 (v ** {c2 = p ; hasPrep = True ; part = []}) ;
} ;
mkV3 = overload {
mkV3 : Str -> V3
= \s -> lin V3 (regVerb s ** {c2,c3 = emptyPrep}) ;
= \s -> lin V3 (regVerb s ** {c2,c3 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV3 : V -> V3
= \s -> lin V3 (s ** {c2,c3 = emptyPrep}) ;
---- mkV3 : V -> Str -> Str -> V3
---- = \v,p,q -> lin V3 (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ;
= \s -> lin V3 (s ** {c2,c3 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV3 : V -> Prep -> Prep -> V3
= \v,p,q -> lin V3 (v ** {c2 = p ; c3 = q ; hasPrep = True ; part = []}) ;
} ;
mkVV : Str -> VV = ----
@@ -77,34 +86,34 @@ oper
} ;
mkV2Q : V -> V2Q =
\v -> lin V2Q (v ** {c2 = emptyPrep}) ;
\v -> lin V2Q (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ;
---- mkV2Q : V -> Str -> V2Q =
---- \v,p -> lin V2Q (v ** {c2 = mkPrep p}) ;
mkV2V= overload {
mkV2V : Str -> V2V =
\s -> lin V2V (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep}) ;
\s -> lin V2V (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV2V : V -> V2V =
\v -> lin V2V (v ** {c2 = emptyPrep ; c3 = emptyPrep}) ;
\v -> lin V2V (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ;
---- mkV2V : V -> Str -> Str -> V2V =
---- \v,p,q -> lin V2V (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ;
} ;
mkV2S = overload {
mkV2S : Str -> V2S =
\s -> lin V2S (regVerb s ** {c2 = emptyPrep}) ;
\s -> lin V2S (regVerb s ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV2S : V -> V2S =
\v -> lin V2S (v ** {c2 = emptyPrep}) ;
\v -> lin V2S (v ** {c2 = emptyPrep ; hasPrep = False ; part = []}) ;
---- mkV2S : V -> Str -> V2S =
---- \v,p -> lin V2S (v ** {c2 = mkPrep p}) ;
} ;
mkV2A = overload {
mkV2A : Str -> V2A
= \s -> lin V2A (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep}) ;
= \s -> lin V2A (regVerb s ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ;
mkV2A : V -> V2A
= \v -> lin V2A (v ** {c2 = emptyPrep ; c3 = emptyPrep}) ;
= \v -> lin V2A (v ** {c2 = emptyPrep ; c3 = emptyPrep ; hasPrep = False ; part = []}) ;
} ;
---- mkV2A : V -> Str -> Str -> V2A
---- = \v,p,q -> lin V2A (v ** {c2 = mkPrep p ; c3 = mkPrep q}) ;
@@ -125,9 +134,9 @@ oper
mannerAdvType : AdvType
= ATManner ;
mkPrep = overload { ---- is this the right order of the fields?
mkPrep = overload { -- first pre part, then optional post part
mkPrep : Str -> Prep
= \s -> lin Prep (ResChi.mkPreposition [] s) ;
= \s -> lin Prep (ResChi.mkPreposition s []) ;
mkPrep : Str -> Str -> Prep
= \s,t -> lin Prep (ResChi.mkPreposition s t) ;
} ;

View File

@@ -100,7 +100,7 @@ DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ----
SlashV2V v a p vp =
insertObj (ResChi.mkNP (a.s ++ p.s ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl))
(predV v) ** {c2 = v.c2 ; isPre = True} ; ---- aspect
(predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ; ---- aspect
{-
SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++
@@ -114,15 +114,15 @@ DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ----
PredVPovs np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ----
CompS s = insertObj s (predV copula) ; ----
CompS s = insertObj s (predV copula []) ; ----
CompQS qs = insertObj qs (predV copula) ; ----
CompVP ant p vp = insertObj (ss (infVP vp)) (predV copula) ; ----
CompQS qs = insertObj qs (predV copula []) ; ----
CompVP ant p vp = insertObj (ss (infVP vp)) (predV copula []) ; ----
{-
VPSlashVS vs vp =
insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) **
insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs []) **
{c2 = ""; gapInMiddle = False} ;
-}

View File

@@ -12,7 +12,7 @@ concrete QuestionChi of Question = CatChi **
} ;
QuestSlash ip cls = {
s =\\p,a => cls.c2.prepPre ++ cls.np ++ cls.c2.prepMain ++ cls.vp ! p ! a ++
s =\\p,a => appPrep cls.c2 cls.np ++ cls.vp ! p ! a ++
possessive_s ++ di_s ++ ip.s
} ;

View File

@@ -137,9 +137,9 @@ oper
infVP : VP -> Str = \vp -> vp.prePart ++ vp.verb.s ++ vp.compl ;
predV : Verb -> VP = \v -> {
predV : Verb -> Str -> VP = \v,part -> {
verb = v ;
compl = [] ;
compl = part ;
prePart = [] ;
} ;
@@ -158,7 +158,13 @@ oper
insertAdv : SS -> VP -> VP = \adv,vp -> {
verb = vp.verb ;
compl = vp.compl ;
prePart = adv.s
prePart = adv.s ++ vp.prePart
} ;
insertPP : SS -> VP -> VP = \pp,vp -> {
verb = vp.verb ;
compl = vp.compl ;
prePart = vp.prePart ++ pp.s
} ;
insertExtra : SS -> VP -> VP = \ext,vp ->
@@ -215,9 +221,9 @@ oper
s = word s
} ;
mkPreposition : Str -> Str -> Preposition = \s,b -> {
prepMain = word s ;
prepPre = word b
mkPreposition : Str -> Str -> Preposition = \s1,s2 -> {
prepPre = word s1 ;
prepPost = word s2
} ;
mkSubj : Str -> Str -> {prePart : Str ; sufPart : Str} = \p,s -> {
@@ -225,13 +231,13 @@ oper
sufPart = word s
} ;
Preposition = {prepMain : Str ; prepPre : Str} ;
Preposition = {prepPre : Str ; prepPost : Str} ;
-- added by AR
mkNP : Str -> NP = ss ; -- not to be used in lexicon building
appPrep : Preposition -> Str -> Str = \prep,s ->
prep.prepPre ++ s ++ prep.prepMain ;
prep.prepPre ++ s ++ prep.prepPost ;
}

View File

@@ -19,10 +19,11 @@ lin
very_AdA = ssword "非常" ;
by8means_Prep = mkPrep "旁边" [] ;
in_Prep = mkPrep "里" [];
possess_Prep = mkPrep "的" [];
with_Prep = mkPrep "一起" "和";
by8means_Prep = mkPrep [] "旁边" ;
-- in_Prep = mkPrep "里" []; --- in Paris
in_Prep = mkPrep "在" "中" ; --- in the house, the car, etc
possess_Prep = mkPrep [] "的" ;
with_Prep = mkPrep "和" "一起" ;
---- with_Prep = mkPrep [] "和"; -- an alternative for some uses
and_Conj = {s = table {
@@ -82,10 +83,10 @@ but_PConj = mkPConjL "但是" ;
can8know_VV = mkV "会" [] [] [] [] "不" ; ----
except_Prep = mkPrep "除了" "以外" ;
except_Prep = mkPrep "以外" "除了" ;
for_Prep = mkPrep "为了" ;
from_Prep = mkPrep "从" ;
in8front_Prep = mkPrep "前边" zai_s ;
in8front_Prep = mkPrep zai_s "前边" ;
it_Pron = pronNP "它" ;
much_Det = mkDet "多" Sg ;
no_Quant = mkQuant "不" ;
@@ -114,7 +115,7 @@ almost_AdN = ssword "几乎" ;
as_CAdv = {s = word "和" ; p = word "一样" } ; -- modified by chenpeng 11.24
at_least_AdN = ssword "最少" ; -- at least five
at_most_AdN = ssword "最多" ;
behind_Prep = mkPrep "后面" "在";
behind_Prep = mkPrep "在" "后面" ;
both7and_DConj = {s = table { -- modified by chenpeng 11.19
CPhr CNPhrase => mkConjForm2 "包括" "和" ;
@@ -126,7 +127,7 @@ both7and_DConj = {s = table { -- modified by chenpeng 11.19
by8agent_Prep = mkPrep "被" ; -- by for agent in passive
-- [mark] 被
during_Prep = mkPrep "期间" "在" ; -- [mark] often equivalent to nothing
during_Prep = mkPrep "在" "期间" ; -- [mark] often equivalent to nothing
-- translation for "he swam during this summer. " and "he swam this summer." are often the same
either7or_DConj = {s = table { -- modified by chenpeng 11.19
@@ -159,7 +160,7 @@ if_then_Conj = {s = table { -- added by chenpeng 11.19
} ;
nobody_NP = ssword "没人" ;
nothing_NP = ssword "没有什么" ;
on_Prep = mkPrep "" "在" ;
on_Prep = mkPrep "" "上" ;
only_Predet = ssword "只有" ; -- only John
so_AdA = ssword "如此" ;
somebody_NP = ssword "某人" ;
@@ -172,7 +173,7 @@ therefore_PConj = ssword "因此" ;
through_Prep = mkPrep "通过" ;
which_IQuant = mkIQuant "哪" ;
--which_IQuant = ssword [] ; -- [mark] in sent, it depends on the context
without_Prep = mkPrep "没有" [];
without_Prep = mkPrep [] "没有" ;
youPol_Pron = ssword "您" ; -- polite you
}

View File

@@ -3,18 +3,18 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
flags optimize=all_subs ;
lin
UseV = predV ;
UseV v = predV v [] ;
SlashV2a v = predV v ** {c2 = v.c2 ; isPre = False} ;
SlashV2a v = predV v v.part ** {c2 = v.c2 ; isPre = v.hasPrep} ;
Slash2V3 v np = insertAdv (mkNP (ba_s ++ np.s)) (predV v) ** {c2 = v.c3 ; isPre = False} ; -- slot for third argument
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 np.s)) (predV v) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
Slash2V3 v np = insertAdv (mkNP (ba_s ++ np.s)) (predV v v.part) ** {c2 = v.c3 ; isPre = v.hasPrep} ; -- slot for third argument
Slash3V3 v np = insertObj (mkNP (appPrep v.c3 np.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = True} ; -- slot for ba object
SlashV2A v ap = insertObj ap (predV v) ** {c2 = v.c2 ; isPre = True} ;
SlashV2A v ap = insertObj ap (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2V v vp = insertObj (mkNP (infVP vp)) (predV v) ** {c2 = v.c2 ; isPre = True} ;
SlashV2S v s = insertObj (ss (say_s ++ s.s)) (predV v) ** {c2 = v.c2 ; isPre = True} ;
SlashV2Q v q = insertObj (ss (say_s ++ q.s)) (predV v) ** {c2 = v.c2 ; isPre = True} ;
SlashV2V v vp = insertObj (mkNP (infVP vp)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2S v s = insertObj (ss (say_s ++ s.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
SlashV2Q v q = insertObj (ss (say_s ++ q.s)) (predV v v.part) ** {c2 = v.c2 ; isPre = v.hasPrep} ;
ComplVV v vp = {
verb = v ;
@@ -22,24 +22,25 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
prePart = vp.prePart
} ;
ComplVS v s = insertObj s (predV v) ;
ComplVQ v q = insertObj q (predV v) ;
ComplVA v ap = insertObj ap (predV v) ;
ComplVS v s = insertObj s (predV v []) ;
ComplVQ v q = insertObj q (predV v []) ;
ComplVA v ap = insertObj ap (predV v []) ;
ComplSlash vp np = case vp.isPre of {
True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ?
--- True => insertAdv (mkNP (ba_s ++ np.s)) vp ; --- ba or vp.c2 ?
True => insertPP (mkNP (appPrep vp.c2 np.s)) vp ; --- ba or vp.c2 ?
False => insertObj (mkNP (appPrep vp.c2 np.s)) vp
} ;
UseComp comp = comp ;
UseCopula = predV copula ;
UseCopula = predV copula [] ;
SlashVV v vp = ---- too simple?
insertObj (mkNP (infVP vp)) (predV v) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
insertObj (mkNP (infVP vp)) (predV v []) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
SlashV2VNP v np vp =
insertObj np
(insertObj (mkNP (infVP vp)) (predV v)) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
(insertObj (mkNP (infVP vp)) (predV v v.part)) ** {c2 = vp.c2 ; isPre = vp.isPre} ;
AdvVP vp adv = case adv.advType of {
ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps well
@@ -50,15 +51,15 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in {
ReflVP vp = insertObj (mkNP reflPron) vp ;
PassV2 v = insertAdv (mkNP passive_s) (predV v) ; ----
PassV2 v = insertAdv (mkNP passive_s) (predV v v.part) ; ----
CompAP ap = insertObj (mkNP (ap.s ++ possessive_s)) (predV copula) ; ---- hen / bu
CompAP ap = insertObj (mkNP (ap.s ++ possessive_s)) (predV copula []) ; ---- hen / bu
CompNP np = insertObj np (predV copula) ; ----
CompNP np = insertObj np (predV copula []) ; ----
CompCN cn = insertObj cn (predV copula) ; ----
CompCN cn = insertObj cn (predV copula []) ; ----
CompAdv adv = insertObj adv (predV zai_V) ;
CompAdv adv = insertObj adv (predV zai_V []) ;
VPSlashPrep vp prep = vp ** {c2 = prep ; isPre = True} ;