From 7c396da3f77a86c6e266345332c72240ba886e94 Mon Sep 17 00:00:00 2001 From: aarne Date: Tue, 24 Sep 2013 15:43:43 +0000 Subject: [PATCH] implemented the top-17 missing functions in ParseChi; shaky definitions though --- lib/src/chinese/AdjectiveChi.gf | 2 + lib/src/chinese/AdverbChi.gf | 2 + lib/src/chinese/ExtraChi.gf | 3 ++ lib/src/chinese/ExtraChiAbs.gf | 2 +- lib/src/chinese/NounChi.gf | 2 + lib/src/chinese/ParseChi.gf | 76 ++++++++++++++++++-------------- lib/src/chinese/ResChi.gf | 2 +- lib/src/chinese/VerbChi.gf | 8 ++++ lib/src/chinese/pinyin/Pinyin.hs | 2 +- 9 files changed, 63 insertions(+), 36 deletions(-) diff --git a/lib/src/chinese/AdjectiveChi.gf b/lib/src/chinese/AdjectiveChi.gf index 7fb640286..040aa31d9 100644 --- a/lib/src/chinese/AdjectiveChi.gf +++ b/lib/src/chinese/AdjectiveChi.gf @@ -23,5 +23,7 @@ concrete AdjectiveChi of Adjective = CatChi ** open ResChi, Prelude in { AdAP ada ap = complexAP (ada.s ++ ap.s) ; UseA2 a = a ; + + AdvAP ap adv = complexAP (adv.s ++ ap.s) ; ---- } diff --git a/lib/src/chinese/AdverbChi.gf b/lib/src/chinese/AdverbChi.gf index 544a32d80..c349a96c0 100644 --- a/lib/src/chinese/AdverbChi.gf +++ b/lib/src/chinese/AdverbChi.gf @@ -16,4 +16,6 @@ concrete AdverbChi of Adverb = CatChi ** AdnCAdv cadv = ss (cadv.s ++ conjThat) ** {advType = ATManner} ; ----- + PositAdAAdj a = {s = a.s} ; ---- + } diff --git a/lib/src/chinese/ExtraChi.gf b/lib/src/chinese/ExtraChi.gf index 7a38dd3b8..ea960393f 100644 --- a/lib/src/chinese/ExtraChi.gf +++ b/lib/src/chinese/ExtraChi.gf @@ -4,4 +4,7 @@ concrete ExtraChi of ExtraChiAbs = CatChi ** lincat Aspect = {s : Str ; a : ResChi.Aspect} ; + lin + PassVPSlash vps = insertAdv (mkNP passive_s) vps ; + } diff --git a/lib/src/chinese/ExtraChiAbs.gf b/lib/src/chinese/ExtraChiAbs.gf index 91c9f672d..e76669589 100644 --- a/lib/src/chinese/ExtraChiAbs.gf +++ b/lib/src/chinese/ExtraChiAbs.gf @@ -1,4 +1,4 @@ -abstract ExtraChiAbs = Cat ** { +abstract ExtraChiAbs = Cat, Extra [VPSlash, PassVPSlash] ** { cat Aspect ; } ; diff --git a/lib/src/chinese/NounChi.gf b/lib/src/chinese/NounChi.gf index 91825d7ea..f06a80ae6 100644 --- a/lib/src/chinese/NounChi.gf +++ b/lib/src/chinese/NounChi.gf @@ -86,4 +86,6 @@ concrete NounChi of Noun = CatChi ** open ResChi, Prelude in { PossNP cn np = {s = np.s ++ possessive_s ++ cn.s ; c = cn.c} ; + CountNP det np = {s = det.s ++ possessive_s ++ np.s} ; ---- classifier? + } diff --git a/lib/src/chinese/ParseChi.gf b/lib/src/chinese/ParseChi.gf index d1c049aaf..60f38622d 100644 --- a/lib/src/chinese/ParseChi.gf +++ b/lib/src/chinese/ParseChi.gf @@ -1,4 +1,4 @@ ---# -path=.:../english:alltenses +--# -path=alltenses:.:../english concrete ParseChi of ParseEngAbs = TenseChi, --- CatChi, @@ -14,7 +14,7 @@ concrete ParseChi of ParseEngAbs = QuestionChi, RelativeChi, IdiomChi [NP, VP, Tense, Cl, ProgrVP, ExistNP], - ExtraChi [NP, Quant, VPSlash, VP, Tense, GenNP, PassVPSlash, + ExtraChi [NP, Quant, VPSlash, VP, Tense, Aspect, GenNP, PassVPSlash, Temp, Pol, Conj, VPS, ListVPS, S, Num, CN, RP, MkVPS, BaseVPS, ConsVPS, ConjVPS, PredVPS, GenRP, VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV, ClSlash, RCl, EmptyRelSlash], @@ -34,7 +34,7 @@ lin GenNP np = ParadigmsChi.mkQuant (np.s ++ possessive_s) ; - EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ; + EmptyRelSlash slash = mkRCl ; that_RP = which_RP ; @@ -69,17 +69,23 @@ DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ---- s = \\n,c => noun1.s ! Sg ! Nom ++ "-" ++ noun2.s ! n ! c ; g = noun2.g } ; +-} GerundN v = { - s = \\n,c => v.s ! VPresPart ; - g = Neutr + s = v.s ; + c = ge_s ---- ge } ; GerundAP v = { - s = \\agr => v.s ! VPresPart ; - isPre = True + s = v.s ++ de_s ; ---- + monoSyl = False } ; --} + + PastPartAP v = { + s = v.s ++ de_s ; + monoSyl = False + } ; + ---- PastPartAP v = v ; ---- @@ -89,49 +95,53 @@ DashCN noun cn = {s = noun.s ++ cn.s ; c = cn.c} ; ---- PositAdVAdj a = {s = a.s} ; + + UseQuantPN q pn = {s = q.s ++ ge_s ++ pn.s} ; ---- ge + + 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 + {- - UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ; - - SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++ - infVP v.typ vp ant.a p.p a) - (predVc v) ; - SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++ v.c3 ++ vpi.s ! VVAux ! a) (predVc v) ; - ComplVV v a p vp = insertObj (\\agr => a.s ++ p.s ++ - infVP v.typ vp a.a p.p agr) - (predVV v) ; -} ---- TODO: find proper expressions for OSV and OVS in Chi ----- PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ; ----- PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ; + PredVPosv np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- + PredVPovs np vp = PredVP np vp ; ---- (lin NP np) (lin VP vp) ; ---- ----- CompS s = s ; ----- + CompS s = insertObj s (predV copula) ; ---- + + + CompQS qs = insertObj qs (predV copula) ; ---- + CompVP ant p vp = insertObj (ss (infVP vp)) (predV copula) ; ---- {- - CompQS qs = {s = \\_ => qs.s ! QIndir} ; - CompVP ant p vp = {s = \\a => ant.s ++ p.s ++ - infVP VVInf vp ant.a p.p a} ; - VPSlashVS vs vp = insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) ** {c2 = ""; gapInMiddle = False} ; - PastPartRS ant pol vps = { - s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ; - c = npNom - } ; - - PresPartRS ant pol vp = { - s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ; - c = npNom - } ; -} + PastPartRS ant pol vp = { ---- copied from PresPartRS + s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect + } ; ---- ?? + + + PresPartRS ant pol vp = { ---- copied from RelVP + s = ant.s ++ pol.s ++ vp.prePart ++ useVerb vp.verb ! pol.p ! APlain ++ vp.compl ++ which_RP.s ---- aspect + } ; ---- ?? + + ComplVV v a p vp = { + verb = v ; + compl = a.s ++ p.s ++ useVerb vp.verb ! p.p ! APlain ++ vp.compl ; ---- aspect + prePart = vp.prePart + } ; + ApposNP np1 np2 = { s = np1.s ++ chcomma ++ np2.s } ; diff --git a/lib/src/chinese/ResChi.gf b/lib/src/chinese/ResChi.gf index 06b51f645..6dd4f19a1 100644 --- a/lib/src/chinese/ResChi.gf +++ b/lib/src/chinese/ResChi.gf @@ -19,7 +19,7 @@ resource ResChi = ParamX ** open Prelude in { than_s = "比" ; progressive_s = defaultStr ; - possessive_s = "的" ; -- also used for AP + NP + de_s, possessive_s = "的" ; -- also used for AP + NP deAdvV_s = "地" ; -- between Adv and V deVAdv_s = "得" ; -- between V and Adv imperneg_s = neg_s ; diff --git a/lib/src/chinese/VerbChi.gf b/lib/src/chinese/VerbChi.gf index b344ca8d7..551452fe2 100644 --- a/lib/src/chinese/VerbChi.gf +++ b/lib/src/chinese/VerbChi.gf @@ -62,5 +62,13 @@ concrete VerbChi of Verb = CatChi ** open ResChi, Prelude in { VPSlashPrep vp prep = vp ** {c2 = prep ; isPre = True} ; + AdvVPSlash vp adv = case adv.advType of { + ATManner => insertObj (ss (deVAdv_s ++ adv.s)) vp ; -- he sleeps well + _ => insertAdv (ss (zai_V.s ++ adv.s)) vp -- he sleeps in the house / today + } ** {c2 = vp.c2 ; isPre = vp.isPre} ; + + AdVVPSlash adv vp = insertAdv adv vp ** {c2 = vp.c2 ; isPre = vp.isPre} ; + + } diff --git a/lib/src/chinese/pinyin/Pinyin.hs b/lib/src/chinese/pinyin/Pinyin.hs index 999a06df0..7184e864f 100644 --- a/lib/src/chinese/pinyin/Pinyin.hs +++ b/lib/src/chinese/pinyin/Pinyin.hs @@ -2,7 +2,7 @@ module Main where import Numeric import qualified Data.Map as Map -import System +import System.Environment -- AR 3/10/2012 -- Chinese unicode - character - pinyin conversions