forked from GitHub/gf-rgl
Merge pull request #428 from GrammaticalFramework/korean-imperative
Korean imperative
This commit is contained in:
@@ -16,7 +16,7 @@ concrete CatKor of Cat = CommonX ** open ResKor, Prelude in {
|
||||
Cl = ResKor.ClSlash ;
|
||||
ClSlash = ResKor.ClSlash ;
|
||||
SSlash = ResKor.Sentence ; -- sentence missing NP; e.g. "she has looked at"
|
||||
Imp = {s : Number => Polarity => Str} ; -- imperative e.g. "look at this"
|
||||
Imp = {s : Polarity => Str} ; -- imperative e.g. "look at this"
|
||||
|
||||
--2 Questions and interrogatives
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@ oper IdetIP : IDet -> IP = notYet "IdetIP" ;
|
||||
oper IdetQuant : IQuant -> Num -> IDet = notYet "IdetQuant" ;
|
||||
oper ImpP3 : NP -> VP -> Utt = notYet "ImpP3" ;
|
||||
oper ImpPl1 : VP -> Utt = notYet "ImpPl1" ;
|
||||
oper ImpVP : VP -> Imp = notYet "ImpVP" ;
|
||||
oper ImpersCl : VP -> Cl = notYet "ImpersCl" ;
|
||||
oper OrdDigits : Digits -> Ord = notYet "OrdDigits" ;
|
||||
oper OrdNumeral : Numeral -> Ord = notYet "OrdNumeral" ;
|
||||
@@ -101,9 +100,6 @@ oper UseQCl : Temp -> Pol -> QCl -> QS = notYet "UseQCl" ;
|
||||
oper UseSlash : Temp -> Pol -> ClSlash -> SSlash = notYet "UseSlash" ;
|
||||
oper UttIAdv : IAdv -> Utt = notYet "UttIAdv" ;
|
||||
oper UttIP : IP -> Utt = notYet "UttIP" ;
|
||||
oper UttImpPl : Pol -> Imp -> Utt = notYet "UttImpPl" ;
|
||||
oper UttImpPol : Pol -> Imp -> Utt = notYet "UttImpPol" ;
|
||||
oper UttImpSg : Pol -> Imp -> Utt = notYet "UttImpSg" ;
|
||||
oper UttInterj : Interj -> Utt = notYet "UttInterj" ;
|
||||
oper UttQS : QS -> Utt = notYet "UttQS" ;
|
||||
oper VPSlashPrep : VP -> Prep -> VPSlash = notYet "VPSlashPrep" ;
|
||||
|
||||
@@ -108,6 +108,9 @@ param
|
||||
| Imperative
|
||||
| Propositive ;
|
||||
|
||||
ObjectForm = -- sometimes need to override V2's object case for Imp
|
||||
DeclObj
|
||||
| ImpObj ;
|
||||
|
||||
-- TODO: include Aspect and SentenceType.
|
||||
-- These are all Generic and Declarative.
|
||||
@@ -115,7 +118,8 @@ param
|
||||
VForm =
|
||||
VStem Polarity -- for adding conjunctions
|
||||
| VAttr Polarity -- for subordinate clauses
|
||||
| VF Style Polarity ;
|
||||
| VF Style Polarity
|
||||
| VImpNeg ;
|
||||
|
||||
oper
|
||||
-- Default style used in the whole grammar. Change here for another style.
|
||||
@@ -141,7 +145,8 @@ oper
|
||||
VF Polite Pos => "s (VF Polite Pos)" ;
|
||||
VF Polite Neg => "s (VF Polite Neg)" ;
|
||||
VF Plain Pos => "s (VF Plain Pos)" ;
|
||||
VF Plain Neg => "s (VF Plain Neg)" } ;
|
||||
VF Plain Neg => "s (VF Plain Neg)" ;
|
||||
VImpNeg => "s VImpNeg" } ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Clauses
|
||||
|
||||
@@ -8,11 +8,11 @@ concrete PhraseKor of Phrase = CatKor ** open Prelude, ResKor in {
|
||||
UttIAdv iadv = iadv ;
|
||||
UttAdv adv = adv ;
|
||||
UttInterj i = i ;
|
||||
{-
|
||||
UttImpSg pol imp =
|
||||
UttImpPl pol imp =
|
||||
|
||||
UttImpSg pol imp = {s = imp.s ! pol.p} ;
|
||||
UttImpPl,
|
||||
UttImpPol = UttImpSg ;
|
||||
-}
|
||||
|
||||
UttIP ip = {s = ip.s ! Bare} ;
|
||||
|
||||
UttNP np = {s = np.s ! Bare} ;
|
||||
|
||||
@@ -8,7 +8,7 @@ lin
|
||||
-- : RP -> VP -> RCl ;
|
||||
RelVP rp vp = vp ** { -- TODO no tenses yet in the grammar
|
||||
s = \\t,a,p,cltyp =>
|
||||
rp.s ++ vp.adv ++ vp.nObj ++
|
||||
rp.s ++ vp.adv ++ vp.nObj ! DeclObj ++
|
||||
case cltyp of {
|
||||
WithConj => vp.s ! VStem p ;
|
||||
_ => vp.s ! VAttr p } ;
|
||||
|
||||
@@ -206,10 +206,11 @@ oper
|
||||
planeg = neg ++ negForms ! Plain ;
|
||||
polneg = neg ++ negForms ! Polite ;
|
||||
formneg = neg ++ negForms ! Formal ;
|
||||
in mkVerbFull stem attrpos attrneg plain polite formal planeg polneg formneg ;
|
||||
impneg = neg ++ "마새요" ;
|
||||
in mkVerbFull stem attrpos attrneg plain polite formal planeg polneg formneg impneg ;
|
||||
|
||||
mkVerbFull : (x1,_,_,_,_,_,_,_,x9 : Str) -> Verb =
|
||||
\stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg -> {
|
||||
mkVerbFull : (x1,_,_,_,_,_,_,_,_,x10 : Str) -> Verb =
|
||||
\stem,attrpos,attrneg,plain,polite,formal,planeg,polneg,formneg,impneg -> {
|
||||
s = table {
|
||||
VStem Pos => stem ;
|
||||
VStem Neg => init planeg ;
|
||||
@@ -220,7 +221,8 @@ oper
|
||||
VF Polite Pos => polite ;
|
||||
VF Polite Neg => polneg ;
|
||||
VF Formal Pos => formal ;
|
||||
VF Formal Neg => formneg
|
||||
VF Formal Neg => formneg ;
|
||||
VImpNeg => impneg
|
||||
} ;
|
||||
sc = Subject ;
|
||||
p = if_then_else Phono (vowFinal stem) Vowel Consonant ;
|
||||
@@ -236,7 +238,8 @@ oper
|
||||
"입니다"
|
||||
"아니다"
|
||||
"아니에요"
|
||||
"아닙니다" ;
|
||||
"아닙니다"
|
||||
"있지마세요" ;
|
||||
|
||||
copulaAfterVowel : Verb = copula ** {
|
||||
s = \\vf => case vf of {
|
||||
@@ -255,7 +258,8 @@ oper
|
||||
"있습니다"
|
||||
"없다"
|
||||
"없어요"
|
||||
"없습니다" ;
|
||||
"없습니다"
|
||||
"없지 마새요" ;
|
||||
|
||||
-- For building an adjective. Different attr from do_V.
|
||||
do_A : Verb = mkVerbReg
|
||||
@@ -316,17 +320,14 @@ oper
|
||||
|
||||
BaseVP : Type = {
|
||||
adv,
|
||||
nObj,
|
||||
vComp : Str
|
||||
-- {subjunc : Str ; -- inflected verb complement
|
||||
-- inf : Str ; -- infinitive verb complement
|
||||
-- subcl : Str} -- clause complement
|
||||
vComp : Str ;
|
||||
nObj : ObjectForm => Str ; -- may need diff form for imperative vs. declarative sentences
|
||||
} ;
|
||||
|
||||
baseVP : BaseVP = {
|
||||
adv,
|
||||
nObj,
|
||||
vComp = [] ;
|
||||
nObj = \\_ => []
|
||||
} ;
|
||||
|
||||
VerbPhrase : Type = BaseVerb ** Complement ** BaseVP ;
|
||||
@@ -338,7 +339,9 @@ oper
|
||||
useVc : Verb2 -> VPSlash = \v2 -> baseVP ** v2 ;
|
||||
|
||||
insertComp : VPSlash -> NounPhrase -> VerbPhrase = \v2,np -> useV v2 ** {
|
||||
nObj = np.s ! v2.c2 ++ v2.p2.s ! np.p
|
||||
nObj = table {
|
||||
DeclObj => np.s ! v2.c2 ++ v2.p2.s ! np.p ;
|
||||
ImpObj => np.s ! Object ++ v2.p2.s ! np.p } -- use 을/를 always for imperative
|
||||
} ;
|
||||
|
||||
insertAdv : VerbPhrase -> SS -> VerbPhrase = \vp,adv -> vp ** {adv = adv.s ++ vp.adv} ;
|
||||
@@ -374,7 +377,7 @@ oper
|
||||
WithConj => VStem p ;
|
||||
Statement st => VF st p } -- TODO: more tenses
|
||||
in np
|
||||
++ vp.nObj -- an object, not copula complement
|
||||
++ vp.nObj ! DeclObj -- an object, not copula complement
|
||||
++ vp.adv
|
||||
++ vp.s ! vf
|
||||
} ;
|
||||
@@ -382,7 +385,12 @@ oper
|
||||
--------------------------------------------------------------------------------
|
||||
-- linrefs
|
||||
|
||||
linVerb : Verb -> Str = \v -> v.s ! linVF ;
|
||||
linVP : VForm -> VerbPhrase -> Str = \vf,vp -> vp.nObj ++ vp.adv ++ vp.s ! vf ;
|
||||
linVerb : Verb -> Str = \v -> v.s ! VF Polite Pos ;
|
||||
linVP : VForm -> VerbPhrase -> Str = \vf,vp -> vp.nObj ! DeclObj ++ vp.adv ++ vp.s ! vf ;
|
||||
linImp : Polarity -> VerbPhrase -> Str = \pol,vp ->
|
||||
let vf : VForm = case pol of {
|
||||
Pos => VF Polite Pos ;
|
||||
Neg => VImpNeg }
|
||||
in vp.nObj ! ImpObj ++ vp.adv ++ vp.s ! vf ;
|
||||
linAP : AdjPhrase -> Str = \ap -> ap.compar ++ ap.s ! linVF ;
|
||||
}
|
||||
|
||||
@@ -29,13 +29,13 @@ lin
|
||||
-- : Temp -> Pol -> ClSlash -> SSlash ; -- (that) she had not seen
|
||||
UseSlash t p cls = {
|
||||
} ;
|
||||
|
||||
-}
|
||||
--2 Imperatives
|
||||
-- : VP -> Imp ;
|
||||
ImpVP vp = {s = \\num,pol => linVP (VImp num pol) Statement vp} ;
|
||||
ImpVP vp = {s = \\pol => linImp pol vp} ;
|
||||
|
||||
--2 Embedded sentences
|
||||
-}
|
||||
|
||||
-- : S -> SC ;
|
||||
EmbedS s = {s = s.s ! Subord ++ "것이"} ; -- TODO check subject case
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
-- LangEng: I am smaller than a cat
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseComp (CompAP (ComparA small_A (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))))) NoVoc
|
||||
LangKor: 제가 고양이 &+ 보다 더 작아요
|
||||
LangKor: 제가 고양이 &+ 보다 더 작습니다
|
||||
|
||||
-- LangEng: I am a woman smaller than a cat
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (UseComp (CompCN (AdjCN (ComparA small_A (DetCN (DetQuant IndefArt NumSg) (UseN cat_N))) (UseN woman_N))))))) NoVoc
|
||||
LangKor: 제가 고양이 &+ 보다 더 작은 여자 &+ 예요
|
||||
LangKor: 제가 고양이 &+ 보다 더 작은 여자 &+ 입니다
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAdv (PrepNP in_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))))) NoVoc
|
||||
LangEng: the cat is in the house
|
||||
LangKor: 고양이가 집 &+ 에서 있어요
|
||||
LangKor: 고양이가 집 &+ 에서 있습니다
|
||||
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAdv (PrepNP behind_Prep (DetCN (DetQuant DefArt NumSg) (UseN house_N)))))))) NoVoc
|
||||
LangEng: the cat is behind the house
|
||||
LangKor: 고양이가 집 뒤에 있어요
|
||||
LangKor: 고양이가 집 뒤에 있습니다
|
||||
|
||||
86
src/korean/unittest/imperative.gftest
Normal file
86
src/korean/unittest/imperative.gftest
Normal file
@@ -0,0 +1,86 @@
|
||||
-- Imperative forms, positive and negative
|
||||
|
||||
-- Intransitive verbs, positive
|
||||
Lang: UttImpSg PPos (ImpVP (UseV come_V))
|
||||
LangEng: come
|
||||
LangKor: 와요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (UseV go_V))
|
||||
LangEng: go
|
||||
LangKor: 가요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (UseV laugh_V))
|
||||
LangEng: laugh
|
||||
LangKor: 웃어요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (UseV sing_V))
|
||||
LangEng: sing
|
||||
LangKor: 노래해요
|
||||
|
||||
-- Intransitive verbs, negative
|
||||
Lang: UttImpSg PNeg (ImpVP (UseV come_V))
|
||||
LangEng: don't come
|
||||
LangKor: 오지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (UseV go_V))
|
||||
LangEng: don't go
|
||||
LangKor: 가지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (UseV laugh_V))
|
||||
LangEng: don't laugh
|
||||
LangKor: 웃지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (UseV sing_V))
|
||||
LangEng: don't sing
|
||||
LangKor: 노래하지 마새요
|
||||
|
||||
|
||||
-- Transitive verbs, positive
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a do_V2) something_NP))
|
||||
LangEng: do something
|
||||
LangKor: 무엇을 해요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a drink_V2) something_NP))
|
||||
LangEng: drink something
|
||||
LangKor: 무엇을 마셔요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a eat_V2) something_NP))
|
||||
LangEng: eat something
|
||||
LangKor: 무엇을 먹어요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a have_V2) something_NP))
|
||||
LangEng: have something
|
||||
LangKor: 무엇을 있어요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a like_V2) something_NP))
|
||||
LangEng: like something
|
||||
LangKor: 무엇을 좋아해요
|
||||
|
||||
Lang: UttImpSg PPos (ImpVP (ComplSlash (SlashV2a see_V2) something_NP))
|
||||
LangEng: see something
|
||||
LangKor: 무엇을 봐요
|
||||
|
||||
-- Transitive verbs, negative
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a do_V2) something_NP))
|
||||
LangEng: don't do something
|
||||
LangKor: 무엇을 하지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a drink_V2) something_NP))
|
||||
LangEng: don't drink something
|
||||
LangKor: 무엇을 마시지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a eat_V2) something_NP))
|
||||
LangEng: don't eat something
|
||||
LangKor: 무엇을 먹지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a have_V2) something_NP))
|
||||
LangEng: don't have something
|
||||
LangKor: 무엇을 없지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a like_V2) something_NP))
|
||||
LangEng: don't like something
|
||||
LangKor: 무엇을 좋아하지 마새요
|
||||
|
||||
Lang: UttImpSg PNeg (ImpVP (ComplSlash (SlashV2a see_V2) something_NP))
|
||||
LangEng: don't see something
|
||||
LangKor: 무엇을 보지 마새요
|
||||
@@ -8,7 +8,7 @@
|
||||
Lang: eat_V2
|
||||
LangKor: 먹어요
|
||||
|
||||
Lang: UseComp (CompAP (PositA good_A))
|
||||
Lang: ImpVP (UseComp (CompAP (PositA good_A)))
|
||||
LangKor: 좋아요
|
||||
|
||||
-- Final ㅏ or ㅓ does not repeat itself
|
||||
@@ -16,7 +16,7 @@ Lang: go_V
|
||||
LangKor: 가요
|
||||
|
||||
-- Monosyllabic 으-final is dropped
|
||||
Lang: UseComp (CompAP (PositA big_A))
|
||||
Lang: ImpVP (UseComp (CompAP (PositA big_A)))
|
||||
LangKor: 커요
|
||||
|
||||
-- Final ㅗ + -아요 becomes ㅘ요
|
||||
|
||||
@@ -9,8 +9,8 @@ LangKor: 지금 우유를 마시는 고양이
|
||||
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (RelCN (UseN cat_N) (ConjRS and_Conj (BaseRS (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (UseV laugh_V))) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a drink_V2) (MassNP (UseN milk_N))))))))))))) NoVoc
|
||||
LangEng: I like cats that laugh and that drink milk
|
||||
LangKor: 저는 웃 &+ 고 우유를 마시는 고양이를 좋아해요
|
||||
LangKor: 저는 웃 &+ 고 우유를 마시는 고양이 &+ 들을 좋아합니다
|
||||
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (RelCN (UseN cat_N) (UseRCl (TTAnt TPres ASimul) PPos (RelVP IdRP (ComplSlash (SlashV2a like_V2) (UsePron i_Pron)))))))))) NoVoc
|
||||
LangEng: I like cats that like me
|
||||
LangKor: 저는 저를 좋아하는 고양이가 좋아요
|
||||
LangKor: 저는 저를 좋아하는 고양이 &+ 들을 좋아합니다
|
||||
|
||||
@@ -2,21 +2,21 @@
|
||||
|
||||
-- LangEng: I see a cat
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a see_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc
|
||||
LangKor: 제가 고양이를 봐요
|
||||
LangKor: 제가 고양이를 봅니다
|
||||
|
||||
-- Double subject case
|
||||
-- LangEng: the cat is short
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (DetCN (DetQuant DefArt NumSg) (UseN cat_N)) (UseComp (CompAP (PositA short_A)))))) NoVoc
|
||||
LangKor: 고양이가 키가 작아요
|
||||
LangKor: 고양이가 키가 작습니다
|
||||
|
||||
-- Topic as subject case
|
||||
|
||||
-- LangEng: I have a cat
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a have_V2) (DetCN (DetQuant IndefArt NumSg) (UseN cat_N)))))) NoVoc
|
||||
LangKor: 저는 고양이가 있어요
|
||||
LangKor: 저는 고양이가 있습니다
|
||||
|
||||
-- Topic + object
|
||||
|
||||
-- LangEng: I like cats
|
||||
Lang: PhrUtt NoPConj (UttS (UseCl (TTAnt TPres ASimul) PPos (PredVP (UsePron i_Pron) (ComplSlash (SlashV2a like_V2) (DetCN (DetQuant IndefArt NumPl) (UseN cat_N)))))) NoVoc
|
||||
LangKor: 저는 고양이를 좋아해요
|
||||
LangKor: 저는 고양이 &+ 들을 좋아합니다
|
||||
|
||||
Reference in New Issue
Block a user