diff --git a/src/korean/AdjectiveKor.gf b/src/korean/AdjectiveKor.gf new file mode 100644 index 000000000..a59e74ea5 --- /dev/null +++ b/src/korean/AdjectiveKor.gf @@ -0,0 +1,62 @@ +concrete AdjectiveKor of Adjective = CatKor ** open ResKor, Prelude in { + + flags optimize=all_subs ; + + lin + + -- : A -> AP ; + PositA a = a ** { + compar = [] ; + } ; + + -- : A -> NP -> AP ; + ComparA a np = a ** { + compar = np.s + } ; + + -- : A2 -> NP -> AP ; -- married to her + -- ComplA2 a2 np = a2 ** { } ; + + -- : A2 -> AP ; -- married to itself + -- ReflA2 a2 = a2 ** { } ; + + -- : A2 -> AP ; -- married + UseA2 = PositA ; + + -- : A -> AP ; -- warmer + -- UseComparA a = a ** { + -- s = \\af => "???" ++ a.s ! af ; + -- compar = [] + -- } ; + + + -- : CAdv -> AP -> NP -> AP ; -- as cool as John + -- CAdvAP adv ap np = ap ** { } ; + +-- The superlative use is covered in $Ord$. + + -- : Ord -> AP ; -- warmest + AdjOrd ord = ord ** { + compar = [] + } ; + +-- Sentence and question complements defined for all adjectival +-- phrases, although the semantics is only clear for some adjectives. + + -- : AP -> SC -> AP ; -- good that she is here + -- SentAP ap sc = ap ** { + -- s = \\af => ap.s ! af ++ sc.s + -- } ; + +-- An adjectival phrase can be modified by an *adadjective*, such as "very". + + -- : AdA -> AP -> AP ; + -- AdAP ada ap = ap ** { } ; + + +-- It can also be postmodified by an adverb, typically a prepositional phrase. + + -- : AP -> Adv -> AP ; -- warm by nature + -- AdvAP ap adv = ap ** {} ; + +} diff --git a/src/korean/AdverbKor.gf b/src/korean/AdverbKor.gf new file mode 100644 index 000000000..24da40d26 --- /dev/null +++ b/src/korean/AdverbKor.gf @@ -0,0 +1,33 @@ +concrete AdverbKor of Adverb = CatKor ** open ResKor, ParamKor, ParadigmsKor, Prelude in { + +--lin + + -- : A -> Adv ; + --PositAdvAdj adj = { } ; + + -- : CAdv -> A -> NP -> Adv ; -- more warmly than John + -- ComparAdvAdj cadv a np = { } ; + +-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs + + -- : Prep -> NP -> Adv ; + -- PrepNP = + +-- Adverbs can be modified by 'adadjectives', just like adjectives. + + --AdAdv : AdA -> Adv -> Adv ; -- very quickly + -- AdAdv ada adv = adv ** +-- Like adverbs, adadjectives can be produced by adjectives. + + -- : A -> AdA ; -- extremely +-- PositAdAAdj a = { } ; +-- Subordinate clauses can function as adverbs. + + -- : Subj -> S -> Adv ; + -- SubjS subj s = + +-- Comparison adverbs also work as numeral adverbs. + + --AdnCAdv : CAdv -> AdN ; -- less (than five) + --AdnCAdv cadv = {s = } ; +} ; diff --git a/src/korean/AllKor.gf b/src/korean/AllKor.gf new file mode 100644 index 000000000..83e04fabb --- /dev/null +++ b/src/korean/AllKor.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:../prelude + +concrete AllKor of AllKorAbs = + LangKor, + ExtendKor + ** {} ; diff --git a/src/korean/AllKorAbs.gf b/src/korean/AllKorAbs.gf new file mode 100644 index 000000000..a6eb14173 --- /dev/null +++ b/src/korean/AllKorAbs.gf @@ -0,0 +1,6 @@ +--# -path=.:../abstract:../common:prelude + +abstract AllKorAbs = + Lang, + Extend + ** {} ; diff --git a/src/korean/CatKor.gf b/src/korean/CatKor.gf new file mode 100644 index 000000000..55c38df22 --- /dev/null +++ b/src/korean/CatKor.gf @@ -0,0 +1,120 @@ +concrete CatKor of Cat = CommonX ** open ResKor, Prelude in { + + flags optimize=all_subs ; + + lincat + +--2 Sentences and clauses +-- Constructed in SentenceKor, and also in IdiomKor + + S = ResKor.Sentence ; + QS = SS ; + RS = SS ; + -- relative sentence. Tense and polarity fixed, + -- but agreement may depend on the CN/NP it modifies. + + 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" + +--2 Questions and interrogatives + +-- Constructed in QuestionKor. + + QCl = ResKor.QClause ; + IComp = SS ; -- interrogative complement of copula e.g. "where" + IDet = ResKor.Determiner ; -- interrogative determiner e.g. "how many" + IQuant = ResKor.Quant ; -- interrogative quantifier e.g. "which" + IP = ResKor.NounPhrase ; -- interrogative pronoun e.g. "who" + +--2 Subord clauses and pronouns + + RCl = ResKor.RClause ; + RP = SS ; + +--2 Verb phrases + +-- Constructed in VerbKor. + + VP = ResKor.VerbPhrase ; + VPSlash = ResKor.VPSlash ; + Comp = ResKor.Complement ; + + +--2 Adjectival phrases + +-- Constructed in AdjectiveKor. + + AP = ResKor.AdjPhrase ; + + +--2 Nouns and noun phrases + +-- Constructed in NounKor. +-- Many atomic noun phrases e.g. "everybody" +-- are constructed in StructuralKor. +-- The determiner structure is +-- ``` Predet (QuantSg | QuantPl Num) Ord +-- as defined in NounKor. + + CN = ResKor.CNoun ; + NP = ResKor.NounPhrase ; + Pron = ResKor.Pronoun ; --Pronouns need enough info to turn it into NP or Quant. + Det = ResKor.Determiner ; + Predet = SS ; + Quant = ResKor.Quant ; + Num = ResKor.Num ; + Ord = { + s : Str ; -- AForm => Str ; -- Ord can came from AP and become AP again + n : Number -- Ord can come from Num, which has inherent number + } ; + DAP = ResKor.Determiner ; + + +--2 Numerals + +-- Constructed in NumeralKor. + + Card = ResKor.Num ; + Numeral = ResKor.Numeral ; + Digits = {s : CardOrd => Str ; n : Number} ; + + + +--2 Structural words + +-- Constructed in StructuralKor. + Conj = {s2 : Bool => Str ; s1 : Str ; n : Number } ; + Subj = SS ; + Prep = ResKor.Postposition ; + + + +--2 Words of open classes + +-- These are constructed in LexiconKor and in +-- additional lexicon modules. + + VS, -- sentence-complement verb e.g. "claim" + -- TODO: eventually different lincats + VQ, -- question-complement verb e.g. "wonder" + VA, -- adjective-complement verb e.g. "look" + V = ResKor.Verb ; + + VV, -- verb-phrase-complement verb e.g. "want" + V2A, -- verb with NP and AP complement e.g. "paint" + V2V, -- verb with NP and V complement e.g. "cause" + V2S, -- verb with NP and S complement e.g. "tell" + V2Q, -- verb with NP and Q complement e.g. "ask" + V2 = ResKor.Verb2 ; + V3 = ResKor.Verb3 ; + + A = ResKor.Adjective ; + A2 = ResKor.Adjective2 ; + + N = ResKor.Noun ; + N2 = ResKor.Noun2 ; + N3 = ResKor.Noun3 ; + PN = ResKor.PNoun ; +} diff --git a/src/korean/ConjunctionKor.gf b/src/korean/ConjunctionKor.gf new file mode 100644 index 000000000..ea33c7155 --- /dev/null +++ b/src/korean/ConjunctionKor.gf @@ -0,0 +1,97 @@ +concrete ConjunctionKor of Conjunction = + CatKor ** open ResKor, Coordination, Prelude in { + + flags optimize=all_subs ; + + {- Conjunction for category X needs four things: + lincat [X] + lin BaseX + lin ConsX + lin ConjX + + For example, if X is defined as + + lincat X = {s : Number => Str ; g : Gender} ; + + then [X] will split its s field into two, and retain its other fields as is: + + lincat [X] = {s1,s2 : Number => Str ; g : Gender} ; + + Let us look at a simple case: Adv is of type {s : Str} + Then [Adv] is {s1,s2 : Str}. + BaseAdv, ConsAdv and ConjAdv can all use functions defined in prelude/Coordination: + + BaseAdv = twoSS ; + ConsAdv = consrSS comma ; + ConjAdv = conjunctSS ; + + --} + + +-- Adverb and other simple {s : Str} types. +lincat + [Adv],[AdV],[IAdv] = {s1,s2 : Str} ; + +lin + BaseAdv, BaseAdV, BaseIAdv = twoSS ; + ConsAdv, ConsAdV, ConsIAdv = consrSS comma ; + ConjAdv, ConjAdV, ConjIAdv = conjunctDistrSS ; + + +{- +-- RS depends on X, Y and Z, otherwise exactly like previous. +-- RS can modify CNs, which are open for …, and have inherent … +lincat + [RS] = {s1,s2 : … => Str} ; + +lin + BaseRS = twoTable3 … ; + ConsRS = consrTable3 … comma ; + ConjRS = conjunctRSTable ; + + +lincat + [S] = {} ; + +lin + BaseS x y = y ** { } ; + ConsS x xs = + xs ** { } ; + ConjS co xs = {} ; + +lincat + [AP] = {} ; + +lin + BaseAP x y = twoTable … x y ** y ; --choose all the other fields from second argument + ConsAP as a = consrTable … comma as a ** as ; + ConjAP co as = conjunctDistrTable … co as ** as ; + +lincat + [CN] = { } ; + +lin + BaseCN = {} ; + ConsCN = {} ; + ConjCN co cs = conjunctDistrTable Agr co cs ** cs ; + +lincat + [DAP] = + +lin + BaseDAP x y = x ** + ConsDAP xs x = xs ** + ConjDet conj xs = xs ** + + +-- Noun phrases +lincat + [NP] = + +lin + BaseNP x y = + ConsNP x xs = + ConjNP conj xs = + +-} +} diff --git a/src/korean/ConstructionKor.gf b/src/korean/ConstructionKor.gf new file mode 100644 index 000000000..48660f46c --- /dev/null +++ b/src/korean/ConstructionKor.gf @@ -0,0 +1,119 @@ +concrete ConstructionKor of Construction = CatKor ** open ParadigmsKor in { + +lincat + Timeunit = N ; + Weekday = N ; + Monthday = NP ; + Month = N ; + Year = NP ; +{- +lin + + timeunitAdv n time = + let n_card : Card = n ; + n_hours_NP : NP = mkNP n_card time ; + in SyntaxKor.mkAdv for_Prep n_hours_NP | mkAdv (n_hours_NP.s ! R.npNom) ; + + weekdayPunctualAdv w = ; -- on Sunday + weekdayHabitualAdv w = ; -- on Sundays + weekdayNextAdv w = -- next Sunday + weekdayLastAdv w = -- last Sunday + + monthAdv m = mkAdv in_Prep (mkNP m) ; + yearAdv y = mkAdv in_Prep y ; + dayMonthAdv d m = ; -- on 17 May + monthYearAdv m y = ; -- in May 2012 + dayMonthYearAdv d m y = ; -- on 17 May 2013 + + intYear = symb ; + intMonthday = symb ; + +lincat Language = N ; + +lin InLanguage l = mkAdv ???_Prep (mkNP l) ; + +lin + weekdayN w = w ; + monthN m = m ; + + weekdayPN w = mkPN w ; + monthPN m = mkPN m ; + + languageCN l = mkCN l ; + languageNP l = mkNP l ; + + +oper mkLanguage : Str -> N = \s -> mkN s ; + +---------------------------------------------- +---- lexicon of special names + +lin second_Timeunit = mkN "second" ; +lin minute_Timeunit = mkN "minute" ; +lin hour_Timeunit = mkN "hour" ; +lin day_Timeunit = mkN "day" ; +lin week_Timeunit = mkN "week" ; +lin month_Timeunit = mkN "month" ; +lin year_Timeunit = mkN "year" ; + +lin monday_Weekday = mkN "Monday" ; +lin tuesday_Weekday = mkN "Tuesday" ; +lin wednesday_Weekday = mkN "Wednesday" ; +lin thursday_Weekday = mkN "Thursday" ; +lin friday_Weekday = mkN "Friday" ; +lin saturday_Weekday = mkN "Saturday" ; +lin sunday_Weekday = mkN "Sunday" ; + +lin january_Month = mkN "January" ; +lin february_Month = mkN "February" ; +lin march_Month = mkN "March" ; +lin april_Month = mkN "April" ; +lin may_Month = mkN "May" ; +lin june_Month = mkN "June" ; +lin july_Month = mkN "July" ; +lin august_Month = mkN "August" ; +lin september_Month = mkN "September" ; +lin october_Month = mkN "October" ; +lin november_Month = mkN "November" ; +lin december_Month = mkN "December" ; + +lin afrikaans_Language = mkLanguage "Afrikaans" ; +lin amharic_Language = mkLanguage "Amharic" ; +lin arabic_Language = mkLanguage "Arabic" ; +lin bulgarian_Language = mkLanguage "Bulgarian" ; +lin catalan_Language = mkLanguage "Catalan" ; +lin chinese_Language = mkLanguage "Chinese" ; +lin danish_Language = mkLanguage "Danish" ; +lin dutch_Language = mkLanguage "Dutch" ; +lin english_Language = mkLanguage "Euslish" ; +lin estonian_Language = mkLanguage "Estonian" ; +lin finnish_Language = mkLanguage "Finnish" ; +lin french_Language = mkLanguage "French" ; +lin german_Language = mkLanguage "German" ; +lin greek_Language = mkLanguage "Greek" ; +lin hebrew_Language = mkLanguage "Hebrew" ; +lin hindi_Language = mkLanguage "Hindi" ; +lin japanese_Language = mkLanguage "Japanese" ; +lin italian_Language = mkLanguage "Italian" ; +lin latin_Language = mkLanguage "Latin" ; +lin latvian_Language = mkLanguage "Latvian" ; +lin maltese_Language = mkLanguage "Maltese" ; +lin nepali_Language = mkLanguage "Nepali" ; +lin norwegian_Language = mkLanguage "Norwegian" ; +lin persian_Language = mkLanguage "Persian" ; +lin polish_Language = mkLanguage "Polish" ; +lin punjabi_Language = mkLanguage "Punjabi" ; +lin romanian_Language = mkLanguage "Romanian" ; +lin russian_Language = mkLanguage "Russian" ; +lin sindhi_Language = mkLanguage "Sindhi" ; +lin spanish_Language = mkLanguage "Spanish" ; +lin swahili_Language = mkLanguage "Swahili" ; +lin swedish_Language = mkLanguage "Swedish" ; +lin thai_Language = mkLanguage "Thai" ; +lin turkish_Language = mkLanguage "Turkish" ; +lin urdu_Language = mkLanguage "Urdu" ; + +—} +} +-} +} diff --git a/src/korean/ExtendKor.gf b/src/korean/ExtendKor.gf new file mode 100644 index 000000000..345728b05 --- /dev/null +++ b/src/korean/ExtendKor.gf @@ -0,0 +1,8 @@ +--# -path=.:../common:../abstract + +concrete ExtendKor of Extend = CatKor + -- ** ExtendFunctor - [] + -- with (Grammar=GrammarKor) + ** open Prelude, ResKor, NounKor in { + +} ; diff --git a/src/korean/GrammarKor.gf b/src/korean/GrammarKor.gf new file mode 100644 index 000000000..55550ada2 --- /dev/null +++ b/src/korean/GrammarKor.gf @@ -0,0 +1,20 @@ +concrete GrammarKor of Grammar = + NounKor, + VerbKor, + AdjectiveKor, + AdverbKor, + NumeralKor, + SentenceKor, + QuestionKor, + RelativeKor, + ConjunctionKor, + PhraseKor, + TextX, + StructuralKor, + IdiomKor, + TenseX + ** { + +flags startcat = Phr ; unlexer = text ; lexer = text ; + +} ; diff --git a/src/korean/IdiomKor.gf b/src/korean/IdiomKor.gf new file mode 100644 index 000000000..3eec44d49 --- /dev/null +++ b/src/korean/IdiomKor.gf @@ -0,0 +1,47 @@ + +--1 Idiom: Idiomatic Expressions + +concrete IdiomKor of Idiom = CatKor ** open Prelude, ResKor, VerbKor, NounKor, StructuralKor in { + +-- This module defines constructions that are formed in fixed ways, +-- often different even in closely related languages. + +{- lin + + + -- ImpersCl : VP -> Cl ; -- it is hot + -- GenericCl : VP -> Cl ; -- one sleeps + ImpersCl, + GenericCl = \vp -> predVP impersNP (passVP vp) ; + + CleftNP : NP -> RS -> Cl ; -- it is I who did it + CleftAdv : Adv -> S -> Cl ; -- it is here she slept + + -- : NP -> Cl ; -- there is a house + ExistNP np = + + ExistIP : IP -> QCl ; -- which houses are there + +-- 7/12/2012 generalizations of these + + ExistNPAdv : NP -> Adv -> Cl ; -- there is a house in Paris + ExistIPAdv : IP -> Adv -> QCl ; -- which houses are there in Paris + + -- : VP -> VP ; + ProgrVP vp = vp ** { + } ; + + + -- : VP -> Utt ; -- let's go + ImpPl1 vp = { } ; + + ImpP3 : NP -> VP -> Utt ; -- let John walk + +-- 3/12/2013 non-reflexive uses of "self" + + SelfAdvVP : VP -> VP ; -- is at home himself + SelfAdVVP : VP -> VP ; -- is himself at home + SelfNP : NP -> NP ; -- the president himself (is at home) +-} + +} diff --git a/src/korean/LangKor.gf b/src/korean/LangKor.gf new file mode 100644 index 000000000..3f35a43c9 --- /dev/null +++ b/src/korean/LangKor.gf @@ -0,0 +1,4 @@ +concrete LangKor of Lang = + GrammarKor, + LexiconKor, + ConstructionKor ; diff --git a/src/korean/LexiconKor.gf b/src/korean/LexiconKor.gf new file mode 100644 index 000000000..15f6036a8 --- /dev/null +++ b/src/korean/LexiconKor.gf @@ -0,0 +1,418 @@ +concrete LexiconKor of Lexicon = CatKor ** + open ParadigmsKor, ResKor in { + +---- +-- A + +-- lin add_V3 = mkV3 "" ; +-- lin airplane_N = mkN "" ; +-- lin alas_Interj = mkInterj "" ; +-- lin already_Adv = mkA "" ; +-- lin animal_N = mkN "동물" ; +-- lin answer_V2S = mkV2S "" ; +-- lin apartment_N = mkN "" ; +-- lin apple_N = mkN "" ; +-- lin art_N = mkN "" ; +-- lin ashes_N = mkN "" ; +-- lin ask_V2Q = mkV2 "" ; + +---- +-- B + +-- lin baby_N = mkN "" ; +-- lin back_N = mkN "" ; +-- lin bad_A = mkA "" ; +-- lin bank_N = mkN "" ; +-- lin bark_N = mkN "" ; +-- lin beautiful_A = mkA "" ; +-- lin become_VA = mkVA "" ; +-- lin beer_N = mkN "" ; +-- lin beg_V2V = mkV2 "" ; +-- lin belly_N = mkN "" ; +-- lin big_A = mkA "" ; +-- lin bike_N = mkN "" ; +-- lin bird_N = mkN "" ; +-- lin bite_V2 = mkV2 "" ; +-- lin black_A = mkA "" ; +-- lin blood_N = mkN "" ; +-- lin blow_V = mkV "" ; +-- lin blue_A = mkA "" ; +-- lin boat_N = mkN "" ; +-- lin bone_N = mkN "" ; +-- lin boot_N = mkN "" ; +-- lin boss_N = mkN "" ; +lin book_N = mkN "책" ; +lin boy_N = mkN "남자아이" ; +lin bread_N = mkN "빵" ; +-- lin break_V2 = mkV2 "" ; +-- lin breast_N = mkN "" ; +-- lin breathe_V = mkV "" ; +-- lin broad_A = mkA "" ; +-- lin brother_N2 = mkN "" ; +-- lin brown_A = mkA "" ; +-- lin burn_V = mkV "" ; +-- lin butter_N = mkN "" ; +-- lin buy_V2 = mkV2 "" ; + +---- +-- C + +-- lin camera_N = mkN "" ; +-- lin cap_N = mkN "" ; +-- lin car_N = mkN "" ; +-- lin carpet_N = mkN "" ; +lin cat_N = mkN "고양이" ; +-- lin ceiling_N = mkN "" ; +-- lin chair_N = mkN "" ; +-- lin cheese_N = mkN "" ; +-- lin child_N = mkN "" ; +-- lin church_N = mkN "" ; +-- lin city_N = mkN "" ; +-- lin clean_A = mkA "" ; +-- lin clever_A = mkA "" ; +-- lin close_V2 = mkV2 "" ; +-- lin cloud_N = mkN "" ; +-- lin coat_N = mkN "" ; +-- lin cold_A = mkA "" ; +-- lin come_V = mkV "" ; +-- lin computer_N = mkN "" ; +-- lin correct_A = mkA "" ; +-- lin count_V2 = mkV2 "" ; +-- lin country_N = mkN "" ; +-- lin cousin_N = mkN "" ; +-- lin cow_N = mkN "" ; +-- lin cut_V2 = mkV2 "" ; +-- +-- ---- +-- -- D +-- +-- lin day_N = mkN "" ; +-- lin die_V = mkV "" ; +-- lin dig_V = mkV "" ; +-- lin dirty_A = mkA "" ; +-- lin distance_N3 = mkN "" ; +-- lin do_V2 = lin V2 egin_V ; +-- lin doctor_N = mkN "" ; +-- lin dog_N = mkN "" ; +-- lin door_N = mkN "" ; +-- lin drink_V2 = mkV2 "" ; +-- lin dry_A = mkA "" ; +-- lin dull_A = mkA "" ; +-- lin dust_N = mkN "" ; + +---- +-- E + +-- lin ear_N = mkN "" ; +-- lin earth_N = mkN "" ; +-- lin eat_V2 = mkV2 "" ; +-- lin egg_N = mkN "" ; +-- lin empty_A = mkA "" ; +-- lin enemy_N = mkN "" ; +-- lin eye_N = mkN "" ; + +---- +-- F + +-- lin factory_N = mkN "" ; +-- lin fall_V = mkV "" ; +-- lin far_Adv = mkA "" ; +-- lin fat_N = mkN "" ; +-- lin father_N2 = mkN2 "" ; +-- lin fear_V2 = mkV2 "" ; +-- lin fear_VS = mkVS "" ; +-- lin feather_N = mkN "" ; +-- lin fight_V2 = mkV2 "" ; +-- lin find_V2 = mkV2 "" ; +-- lin fingernail_N = mkN "" ; +-- lin fire_N = mkN "" ; +-- lin fish_N = mkN "" ; +-- lin float_V = mkV "" ; +-- lin floor_N = mkN "" ; +-- lin flow_V = mkV "" ; +-- lin flower_N = mkN "" ; +-- lin fly_V = mkV "" ; +-- lin fog_N = mkN "" ; +-- lin foot_N = mkN "" ; +-- lin forest_N = mkN "" ; +-- lin forget_V2 = mkV2 "" ; +-- lin freeze_V = mkV "" ; +-- lin fridge_N = mkN "" ; +-- lin friend_N = mkN "" ; +-- lin fruit_N = mkN "" ; +-- lin full_A = mkA "" ; +-- --lin fun_AV + +---- +-- G + +-- lin garden_N = mkN "" ; +lin girl_N = mkN "여자아이" ; +-- lin give_V3 = mkV3 "" ; +-- lin glove_N = mkN "" ; +-- lin go_V = mkV "" ; +-- lin gold_N = mkN "" ; +-- lin good_A = mkA "" ; +-- lin grammar_N = mkN "" ; +-- lin grass_N = mkN "" ; +-- lin green_A = mkA "" ; + +---- +-- H + +-- lin hair_N = mkN "" ; +-- lin hand_N = mkN "" ; +-- lin harbour_N = mkN "" ; +-- lin hat_N = mkN "" ; +-- lin hate_V2 = mkV2 "" ; +-- lin head_N = mkN "" ; +-- lin hear_V2 = mkV2 "" ; +-- lin heart_N = mkN "" ; +-- lin heavy_A = mkA "" ; +-- lin hill_N = mkN "" ; +-- lin hit_V2 = mkV2 "" ; +-- lin hold_V2 = mkV2 "" ; +-- lin hope_VS = mkV "" ; +-- lin horn_N = mkN "" ; +-- lin horse_N = mkN "" ; +-- lin hot_A = mkA "" ; +lin house_N = mkN "guri" ; +-- lin hunt_V2 = mkV2 "" ; +-- lin husband_N = mkN "" ; + +-------- +-- I - K + +-- lin ice_N = mkN "" ; +-- lin industry_N = mkN "" ; +-- lin iron_N = mkN "" ; +-- lin john_PN = mkPN "" ; +-- lin jump_V = mkV "" ; +-- lin kill_V2 = mkV2 "" ; +-- lin king_N = mkN "" ; +-- lin knee_N = mkN "" ; +-- lin know_V2 = mkV2 "" ; +-- lin know_VQ = mkVQ "" ; +-- lin know_VS = mkV "" ; + + +---- +-- L + +-- lin lake_N = mkN "" ; +-- lin lamp_N = mkN "" ; +-- lin language_N = mkN "" ; +-- lin laugh_V = mkV "" ; +-- lin leaf_N = mkN "" ; +-- lin learn_V2 = mkV2 "" ; +-- lin leather_N = mkN "" ; +-- lin leave_V2 = mkV2 "" ; +-- lin leg_N = mkN "" ; +-- lin lie_V = mkV "" ; +-- lin like_V2 = mkV2 "" ; +-- lin listen_V2 = mkV2 "" ; +-- lin live_V = mkV ""; +-- lin liver_N = mkN "" ; +-- lin long_A = mkA "" ; +-- lin lose_V2 = mkV2 "" ; +-- lin louse_N = mkN "" ; +-- lin love_N = mkN "" ; +-- lin love_V2 = mkV2 "" ; + +---- +-- M + +lin man_N = mkN "남자" ; +-- lin married_A2 = mkA "" ; +-- lin meat_N = mkN "" ; +lin milk_N = mkN "우유" ; +-- lin moon_N = mkN "" ; +--lin mother_N2 = mkN2 "" ; +-- lin mountain_N = mkN "" ; +-- lin mouth_N = mkN "" ; +-- lin music_N = mkN "" ; + +---- +-- N + +lin name_N = mkN "성함" ; +-- lin narrow_A = mkA "" ; +-- lin near_A = mkA "" ; +-- lin neck_N = mkN "" ; +-- lin new_A = mkA "" ; +-- lin newspaper_N = mkN "" ; +-- lin night_N = mkN "" ; +-- lin nose_N = mkN "" ; +-- lin now_Adv = mkA "" ; +-- lin number_N = mkN "" ; +-- +-- -------- +-- -- O - P +-- +-- +-- lin oil_N = mkN "" ; +-- lin old_A = mkA "" ; +-- lin open_V2 = mkV2 "" ; +-- lin paint_V2A = mkV2A "" ; +-- lin paper_N = mkN "" ; +-- lin paris_PN = mkPN "Paris" ; +-- lin peace_N = mkN "" ; +-- lin pen_N = mkN "" ; +lin person_N = mkN "사람" ; +-- lin planet_N = mkN "" ; +-- lin plastic_N = mkN "" ; +-- lin play_V = mkV "" ; +-- lin policeman_N = mkN "" ; +-- lin priest_N = mkN "" ; +-- lin pull_V2 = mkV2 "" ; +-- lin push_V2 = mkV2 "" ; +-- lin put_V2 = mkV2 "" ; +-- +-- -------- +-- -- Q - R +-- +-- lin queen_N = mkN "" ; +-- lin question_N = mkN "" ; +-- lin radio_N = mkN "" ; +-- lin rain_N = mkN "" ; +-- lin rain_V0 = mkV "" ; +-- lin read_V2 = mkV2 "" ; +-- lin ready_A = mkA "" ; +-- lin reason_N = mkN "" ; +-- lin red_A = mkA "" ; +-- lin religion_N = mkN "" ; +-- lin restaurant_N = mkN "" ; +-- lin river_N = mkN "" ; +-- lin road_N = mkN "" ; +-- lin rock_N = mkN "" ; +-- lin roof_N = mkN "" ; +-- lin root_N = mkN "" ; +-- lin rope_N = mkN "" ; +-- lin rotten_A = mkA "" ; +-- lin round_A = mkA "" ; +-- lin rub_V2 = mkV2 "" ; +-- lin rubber_N = mkN "" ; +-- lin rule_N = mkN "" ; +-- lin run_V = mkV "" ; + +---- +-- S + +-- lin salt_N = mkN "" ; +-- lin sand_N = mkN "" ; +-- lin say_VS = mkVS "" ; +-- lin school_N = mkN "" ; +-- lin science_N = mkN "" ; +-- lin scratch_V2 = mkV2 "" ; +-- lin sea_N = mkN "" ; +-- lin see_V2 = mkV2 "" ; +-- lin seed_N = mkN "" ; +-- lin seek_V2 = mkV2 "" ; +-- lin sell_V3 = mkV3 "" ; +-- lin send_V3 = mkV3 "" ; +-- lin sew_V = mkV "" ; +-- lin sharp_A = mkA "" ; +-- lin sheep_N = mkN "" fem ; +-- lin ship_N = mkN "" ; +-- lin shirt_N = mkN "" ; +-- lin shoe_N = mkN "" ; +-- lin shop_N = mkN "" ; +-- lin short_A = mkA "" ; +-- lin silver_N = mkN "" ; +-- lin sing_V = mkV "" ; +-- lin sister_N = mkN "" ; +-- lin sit_V = mkV "" ; +-- lin skin_N = mkN "" ; +-- lin sky_N = mkN "" ; +-- lin sleep_V = mkV "" ; +lin small_A = mkA "작아" ; +-- lin smell_V = mkV "" ; +-- lin smoke_N = mkN "" ; +-- lin smooth_A = mkA "" ; +-- lin snake_N = mkN "" ; +-- lin snow_N = mkN "" ; +-- lin sock_N = mkN "" ; +-- lin song_N = mkN "" ; +-- lin speak_V2 = mkV2 "" ; +-- lin spit_V = mkV "" ; +-- lin split_V2 = mkV2 "" ; +-- lin squeeze_V2 = mkV2 "" ; +-- lin stab_V2 = mkV2 "" ; +-- lin stand_V = mkV "" ; +-- lin star_N = mkN "" ; +-- lin steel_N = mkN "" ; +-- lin stick_N = mkN "" ; +-- lin stone_N = mkN "" ; +-- lin stop_V = mkV "" ; +-- lin stove_N = mkN "" ; +-- lin straight_A = mkA "" ; +-- lin student_N = mkN "" ; +-- lin stupid_A = mkA "" ; +-- lin suck_V2 = mkV2 "" ; +-- lin sun_N = mkN "" ; +-- lin swell_V = mkV "" ; +-- lin swim_V = mkV "" ; + +---- +-- T + + +-- lin table_N = mkN "" ; +-- lin tail_N = mkN "" ; +-- lin talk_V3 = mkV3 "" ; +-- lin teach_V2 = mkV2 "" ; +-- lin teacher_N = mkN "" ; +-- lin television_N = mkN "" ; +-- lin thick_A = mkA "" ; +-- lin thin_A = mkA "" ; +-- lin think_V = mkV "" ; +-- lin throw_V2 = mkV2 "" ; +-- lin tie_V2 = mkV2 "" ; +-- lin today_Adv = mkA "" ; +-- lin tongue_N = mkN "" ; +-- lin tooth_N = mkN "" ; +-- lin train_N = mkN "" ; +-- lin travel_V = mkV "" ; +-- lin tree_N = mkN "" ; +-- lin turn_V = mkV "" ; + +-------- +-- U - V + +-- lin ugly_A = mkA "" ; +-- lin uncertain_A = mkA "" ; +-- lin understand_V2 = mkV2 "" ; +-- lin university_N = mkN "" ; +-- lin village_N = mkN "" ; +-- lin vomit_V = mkV2 "" ; + +-------- +-- W - Y + +-- lin wait_V2 = mkV2 "" ; +-- lin walk_V = mkV "" ; +-- lin war_N = mkN "" ; +-- lin warm_A = mkA "" ; +-- lin wash_V2 = mkV2 "" ; +-- lin watch_V2 = mkV2 "" ; +-- lin water_N = mkNoun "" ; +-- lin wet_A = mkA "" ; +-- lin white_A = mkA "" ; +-- lin wide_A = mkA "" ; +-- lin wife_N = mkN "" ; +-- lin win_V2 = mkV2 "" ; +-- lin wind_N = mkN "" ; +-- lin window_N = mkN "" ; +-- lin wine_N = mkN "" ; +-- lin wing_N = mkN "" ; +-- lin wipe_V2 = mkV2 "" ; +lin woman_N = mkN "여자" ; +-- lin wonder_VQ = mkVQ "" ; +-- lin wood_N = mkN "" ; +-- lin worm_N = mkN "" ; +-- lin write_V2 = mkV2 "" ; +-- lin year_N = mkN "" ; +-- lin yellow_A = mkA "" ; +-- lin young_A = mkA "" ; + +} diff --git a/src/korean/MissingKor.gf b/src/korean/MissingKor.gf new file mode 100644 index 000000000..628df5577 --- /dev/null +++ b/src/korean/MissingKor.gf @@ -0,0 +1,2 @@ +resource MissingKor = open GrammarKor, SymbolKor, Prelude in { +} diff --git a/src/korean/NounKor.gf b/src/korean/NounKor.gf new file mode 100644 index 000000000..81af0cbfe --- /dev/null +++ b/src/korean/NounKor.gf @@ -0,0 +1,190 @@ +concrete NounKor of Noun = CatKor ** open ResKor, Prelude in { + + flags optimize=all_subs ; + + lin + +--2 Noun phrases + +-- : Det -> CN -> NP + DetCN det cn = {s = det.s ++ cn.s} ; + + -- : PN -> NP ; +-- UsePN pn = pn ** { +-- } ; + + -- : Pron -> NP ; + -- UsePron pron = pron ; + + -- : Predet -> NP -> NP ; -- only the man + -- PredetNP predet np = + +-- A noun phrase can also be postmodified by the past participle of a +-- verb, by an adverb, or by a relative clause + + + -- : NP -> V2 -> NP ; -- the man seen + -- PPartNP np v2 = np ** { + -- s = \\c => v2.s ! ??? ++ np.s ! c } ; ---- + + -- : NP -> Adv -> NP ; -- Paris today ; boys, such as .. + --AdvNP,ExtAdvNP = \np,adv -> np ** {} ; + + -- : NP -> RS -> NP ; -- Paris, which is here + -- RelNP np rs = np ** { + -- } ; + +-- Determiners can form noun phrases directly. + + -- : Det -> NP ; + -- DetNP det = emptyNP ** { + -- } ; + + -- MassNP : CN -> NP ; + -- MassNP cn = useN cn ** { + -- } ; + + +--2 Determiners + +-- The determiner has a fine-grained structure, in which a 'nucleus' +-- quantifier and an optional numeral can be discerned. + + -- : Quant -> Num -> Det ; + DetQuant quant num = quant ** { + n = num.n + } ; + + -- : Quant -> Num -> Ord -> Det ; -- these five best + -- DetQuantOrd quant num ord = + -- let theseFive = DetQuant quant num in theseFive ** { + -- } ; + +-- Whether the resulting determiner is singular or plural depends on the +-- cardinal. + +-- All parts of the determiner can be empty, except $Quant$, which is +-- the "kernel" of a determiner. It is, however, the $Num$ that determines +-- the inherent number. + + NumSg = baseNum ; + NumPl = baseNum ** {n = Pl} ; + + -- : Card -> Num ; + -- NumCard card = + + -- : Digits -> Card ; + -- NumDigits dig = + + -- : Numeral -> Card ; + -- NumNumeral num + +{- + -- : AdN -> Card -> Card ; + AdNum adn card = card ** { s = adn.s ++ card.s } ; + + -- : Digits -> Ord ; + OrdDigits digs = digs ** { s = digs.s ! NOrd } ; +-} + -- : Numeral -> Ord ; + -- OrdNumeral num = num ** { + -- s = \\_ => num.ord + -- } ; + + -- : A -> Ord ; + -- OrdSuperl a = { + -- s = \\af => "제일" ++ a.s ! af ; + -- n = Sg -- ?? is this meaningful? + -- } ; + +-- One can combine a numeral and a superlative. + + -- : Numeral -> A -> Ord ; -- third largest + -- OrdNumeralSuperl num a = num ** { } ; + + -- : Quant + DefArt = baseQuant ** {sp = \\_ => []} ; + + -- : Quant + IndefArt = baseQuant ** {sp = \\_ => []} ; + + -- : Pron -> Quant + -- PossPron pron = + -- let p = pron.poss ; + -- in DefArt ** { + -- } ; + +--2 Common nouns + + -- : N -> CN + -- : N2 -> CN ; + UseN,UseN2 = ResKor.useN ; + + -- : N2 -> NP -> CN ; + -- ComplN2 n2 np = + + -- : N3 -> NP -> N2 ; -- distance from this city (to Paris) + -- ComplN3 n3 np = + + + -- : N3 -> N2 ; -- distance (from this city) + -- Use2N3 n3 = lin N2 n3 ** { c2 = n3.c3 } ; + + -- : N3 -> N2 ; -- distance (to Paris) + -- Use3N3 n3 = lin N2 n3 ; + -- : AP -> CN -> CN + -- AdjCN ap cn = cn ** { + -- } ; + + -- : CN -> RS -> CN ; + -- RelCN cn rs = cn ** { + -- } ; + +{- + -- : CN -> Adv -> CN ; + AdvCN cn adv = cn ** { } ; + +-- Nouns can also be modified by embedded sentences and questions. +-- For some nouns this makes little sense, but we leave this for applications +-- to decide. Sentential complements are defined in VerbKor. + + -- : CN -> SC -> CN ; -- question where she sleeps + SentCN cn sc = cn ** { } ; + + +--2 Apposition + +-- This is certainly overgenerating. + + -- : CN -> NP -> CN ; -- city Paris (, numbers x and y) + ApposCN cn np = cn ** { s = } ; +-} + +--2 Possessive and partitive constructs + + -- : PossNP : CN -> NP -> CN ; + -- PossNP cn np = cn ** { + -- } ; + + -- : CN -> NP -> CN ; -- glass of wine / two kilos of red apples + -- PartNP cn np = cn ** { + -- } ; + +{- + +-- This is different from the partitive, as shown by many languages. + + -- : Det -> NP -> NP ; + CountNP det np = np ** + { } ; -- Nonsense for DefArt or IndefArt + +--3 Conjoinable determiners and ones with adjectives + + -- : DAP -> AP -> DAP ; -- the large (one) + AdjDAP dap ap = dap ** { } ; + + -- : Det -> DAP ; -- this (or that) + DetDAP det = det ; +-} + +} diff --git a/src/korean/NumeralKor.gf b/src/korean/NumeralKor.gf new file mode 100644 index 000000000..83179b773 --- /dev/null +++ b/src/korean/NumeralKor.gf @@ -0,0 +1,4 @@ +concrete NumeralKor of Numeral = CatKor [Numeral,Digits] ** + open Prelude, ResKor, ParamKor in { + +} diff --git a/src/korean/ParadigmsKor.gf b/src/korean/ParadigmsKor.gf new file mode 100644 index 000000000..1825b1e24 --- /dev/null +++ b/src/korean/ParadigmsKor.gf @@ -0,0 +1,125 @@ +resource ParadigmsKor = open CatKor, ResKor, ParamKor, NounKor, Prelude in { + +oper + +--2 Parameters +-- +-- To abstract over number, valency and (some) case names, +-- we define the following identifiers. The application programmer +-- should always use these constants instead of the constructors +-- defined in $ResSom$. + + +--2 Nouns + + mkN : overload { + mkN : (noun : Str) -> N ; -- Predictable nouns + } ; + +--2 Adjectives + + mkA : overload { + mkA : (adj : Str) -> A ; + } ; + + -- mkA2 : Str -> Prep -> A2 ; + +--2 Verbs + + -- Verbs + mkV : overload { + mkV : (inf : Str) -> V ; -- Predictable verb: infinitive form as argument +-- mkV : Str -> V -> V -- Add a prefix to an existing verb, e.g. u baahan+ahay + } ; + + copula : V ; -- The copula verb '' + + mkV2 : overload { + mkV2 : (inf : Str) -> V2 ; + } ; + + -- mkV3 : overload { + -- } ; + + -- mkVV : overload { + -- } ; + + -- + -- mkVA : Str -> VA + -- = \s -> lin VA (regV s) ; + -- mkVQ : Str -> VQ + -- = \s -> lin VQ (regV s) ; + -- mkVS : Str -> VS + -- = \s -> lin VS (regV s) ; + -- + -- mkV2A : Str -> V2A + -- = \s -> lin V2A (regV s ** {c2 = noPrep}) ; + -- mkV2V : Str -> V2V + -- = \s -> lin V2V (regV s ** {c2 = noPrep}) ; + -- mkV2Q : Str -> V2Q + -- = \s -> lin V2Q (regV s ** {c2 = noPrep}) ; + + ----- + +--2 Structural categories + + -- mkPrep = overload { + -- } ; + + -- mkConj : (_,_ : Str) -> Number -> Conj = \s1,s2,num -> + -- lin Conj { s = s1 ; s2 = s2 } ; + + -- mkSubj : Str -> Bool -> Subj = \s,b -> + -- lin Subj { } ; + + mkAdv : Str -> Adv = \s -> lin Adv {s = s} ; + + mkAdV : Str -> AdV = \s -> lin AdV {s = s} ; + + mkAdA : Str -> AdA = \s -> lin AdA {s = s} ; + + +--. +------------------------------------------------------------------------------- +-- The definitions should not bother the user of the API. So they are +-- hidden from the document. + + mkN = overload { + mkN : Str -> N = \s -> lin N (mkNoun s) ; + } ; + + + mkN2 = overload { + mkN2 : Str -> N2 = \s -> lin N2 (mkNoun s) ; + mkN2 : N -> N2 = \n -> lin N2 n ; + } ; + + -- mkPN = overload { + -- } ; + + mkA = overload { + mkA : (adj : Str) -> A = \s -> lin A (mkAdj s) ; + } ; + + mkV = overload { + mkV : (inf : Str) -> V = \v -> lin V (mkVerb v) ; + } ; + + copula = ResKor.copula ; + + -- regV : Str -> Verb = \s -> case s of { + -- } ; + + mkV2 = overload { + mkV2 : (inf : Str) -> V2 = \v2 -> lin V2 (mkVerb v2) ; + } ; + -- + -- mkV3 = overload { + -- } ; + -- + -- mkVV = overload { + -- } ; + +-------------------------------------------------------------------------------- + +} diff --git a/src/korean/ParamKor.gf b/src/korean/ParamKor.gf new file mode 100644 index 000000000..084d72391 --- /dev/null +++ b/src/korean/ParamKor.gf @@ -0,0 +1,80 @@ +resource ParamKor = ParamX ** open Prelude in { + +-------------------------------------------------------------------------------- +-- Phonology + +oper + v : pattern Str = #("아" | "이" | "어" | + "가" | "개" | "갸" | "걔" | "거" | "게" | "겨" | "계" | "고" | "과" | "괘" | "괴" | "교" | "구" | "궈" | "궤" | "귀" | "규" | "그" | "긔" | "기") ; -- TODO: figure out if this is a smart way to do it; if no better way, then complete the table. +-- maybe subpatterns for diphthongs? + + -- c : pattern Str = #("m"|"n"|"p"|"b"|"t"|"d"|"k"|"g"|"f"|"v" + -- |"s"|"h"|"l"|"j"|"r"|"z"|"c"|"q"); + -- + -- voiced : Str -> Str = \s -> case s of { + -- "k" => "g" ; + -- "t" => "d" ; + -- "p" => "b" ; + -- _ => s } ; + +-------------------------------------------------------------------------------- +-- Morphophonology + + + +-------------------------------------------------------------------------------- +-- Nouns + +param + NForm = + Topic + | Subject + | Object ; + + +-------------------------------------------------------------------------------- +-- Numerals + +param + DForm = Indep | Attrib ; + + CardOrd = NOrd | NCard ; + + -- TODO see if this is needed + NumType = NoNum | IsDigit | IsNumber ; + +oper + isNum : NumType -> Bool = \nt -> case nt of { + NoNum => False ; + _ => True + } ; +-------------------------------------------------------------------------------- +-- Adjectives + +param + AForm = AdjPres | AdjPast ; -- TODO: proper thing + +-------------------------------------------------------------------------------- +-- Prepositions + +-------------------------------------------------------------------------------- +-- Verbs +param + VerbType = Active | Stative | Existential | Copula ; -- from Wikipedia https://en.wikipedia.org/wiki/Korean_verbs#Classification + + Aspect = Gnomic | Prospective | Perfect ; + + -- TODO: proper list of forms + VForm = + VInf + | VFin Aspect Polarity ; + + +-------------------------------------------------------------------------------- +-- Clauses + +param + + ClType = Statement | PolarQuestion | WhQuestion | Subord ; + +} diff --git a/src/korean/PhraseKor.gf b/src/korean/PhraseKor.gf new file mode 100644 index 000000000..dc9ba43bf --- /dev/null +++ b/src/korean/PhraseKor.gf @@ -0,0 +1,29 @@ +concrete PhraseKor of Phrase = CatKor ** open Prelude, ResKor in { + + lin + PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ; + + UttS s = s ; + UttQS qs = qs ; + UttIAdv iadv = iadv ; +{- + UttImpSg pol imp = + UttImpPl pol imp = + UttImpPol = UttImpSg ; + + UttIP ip = {s = ip.s ! } ; + UttNP np = {s = np.s ! } ; + UttVP vp = {s = } ; + UttAdv adv = {s = } ; + UttCN n = {s = } ; + UttCard n = {s = } ; + UttAP ap = { s = ap.s ! } ; + UttInterj i = i ; +-} + NoPConj = {s = []} ; +-- PConjConj conj = {s = conj.s1 ++ conj.s2 ! …} ; + + NoVoc = {s = []} ; +-- VocNP np = { s = "," ++ np.s ! … } ; -} + +} diff --git a/src/korean/QuestionKor.gf b/src/korean/QuestionKor.gf new file mode 100644 index 000000000..fd1f4f130 --- /dev/null +++ b/src/korean/QuestionKor.gf @@ -0,0 +1,78 @@ +concrete QuestionKor of Question = CatKor ** open + Prelude, ResKor, ParadigmsKor, (VS=VerbKor), (NS=NounKor), (SS=StructuralKor) in { + +-- A question can be formed from a clause ('yes-no question') or +-- with an interrogative. + +{- + lin + -- : Cl -> QCl ; + QuestCl = + + -- : IP -> VP -> QCl ; + QuestVP ip vp = + + -- : IP -> ClSlash -> QCl ; -- whom does John love + QuestSlash ip cls = + + -- : IAdv -> Cl -> QCl ; -- why does John walk + QuestIAdv iadv cls = + + + -- : IComp -> NP -> QCl ; -- where is John? + QuestIComp icomp np = + + +-- Interrogative pronouns can be formed with interrogative +-- determiners, with or without a noun. + + -- : IDet -> CN -> IP ; -- which five songs + IdetCN idet cn = {contractSTM = False} ** NS.DetCN idet cn ; + + -- : IDet -> IP ; -- which five + IdetIP idet = {contractSTM = False} ** NS.DetNP idet ; + +-- They can be modified with adverbs. + -- : IP -> Adv -> IP ; -- who in Paris + --AdvIP = NS.AdvNP ; + +-- Interrogative quantifiers have number forms and can take number modifiers. + + -- : IQuant -> Num -> IDet ; -- which (five) + IdetQuant = NS.DetQuant ; + +-- Interrogative adverbs can be formed prepositionally. + -- : Prep -> IP -> IAdv ; -- with whom + PrepIP prep ip = SS.prepIP prep (ip.s ! Abs) False ; + +-- They can be modified with other adverbs. + + -- : IAdv -> Adv -> IAdv ; -- where in Paris + -- AdvIAdv iadv adv = + +-- Interrogative complements to copulas can be both adverbs and +-- pronouns. + + -- : IAdv -> IComp ; + CompIAdv iadv = iadv ; -- where (is it) + + -- : IP -> IComp ; + CompIP ip = {s = ip.s ! Abs} ; -- who (is it) + + +-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$. + +-- Wh questions with two or more question words require a new, special category. + + cat + QVP ; -- buy what where + fun + ComplSlashIP : VPSlash -> IP -> QVP ; -- buys what + AdvQVP : VP -> IAdv -> QVP ; -- lives where + AddAdvQVP : QVP -> IAdv -> QVP ; -- buys what where + + QuestQVP : IP -> QVP -> QCl ; -- who buys what where +-} + + +} diff --git a/src/korean/RelativeKor.gf b/src/korean/RelativeKor.gf new file mode 100644 index 000000000..a6c9e3056 --- /dev/null +++ b/src/korean/RelativeKor.gf @@ -0,0 +1,22 @@ +concrete RelativeKor of Relative = CatKor ** open + ResKor, Prelude, (NS=NounKor), (SS=StructuralKor) in { + +{- +lin + -- : Cl -> RCl ; -- such that John loves her + -- RelCl cl = ; + + -- : RP -> VP -> RCl ; + RelVP rp vp = + + -- : RP -> ClSlash -> RCl ; -- whom John loves + RelSlash rp cls = + + -- : RP ; + IdRP = {s = ""} ; + + -- : Prep -> NP -> RP -> RP ; -- the mother of whom + --FunRP prep np rp = {} ; +-} + +} diff --git a/src/korean/ResKor.gf b/src/korean/ResKor.gf new file mode 100644 index 000000000..3303301b2 --- /dev/null +++ b/src/korean/ResKor.gf @@ -0,0 +1,196 @@ +resource ResKor = ParamKor ** open Prelude, Predef, ParamKor in { + +-------------------------------------------------------------------------------- +-- Nouns +oper + + Noun : Type = { + s : Str + } ; + Noun2 : Type = Noun ; -- TODO eventually more parameters? + Noun3 : Type = Noun ; + + CNoun : Type = Noun ** { + } ; + + PNoun : Type = Noun ; + + mkNoun : Str -> Noun = \str -> ss str ; + + useN : Noun -> CNoun = \n -> n ; + +--------------------------------------------- +-- NP + + -- BaseNP : Type = { + -- a : Agreement ; + -- isPron : Bool ; + -- empty : Str ; -- standard trick for pro-drop + -- } ; + -- + -- emptyNP : NounPhrase = { + -- s = \\_ => [] ; + -- a = Sg3 Masc ; + -- isPron = False ; + -- empty = [] ; + -- } ; + -- + -- indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ; + + --NounPhrase : Type = BaseNP ** {s : NForm => Str} ; + NounPhrase = Noun ; + +-------------------------------------------------------------------------------- +-- Pronouns + + Pronoun : Type = NounPhrase ** { + -- poss : { -- for PossPron : Pron -> Quant + -- } ; + sp : NForm => Str ; + } ; + + +-------------------------------------------------------------------------------- +-- Det, Quant, Card, Ord + + BaseQuant : Type = { + s : Str ; + isPoss : Bool + } ; + + Determiner : Type = BaseQuant ** { + sp : NForm => Str ; + n : Number ; +-- numtype : NumType ; -- number as in "5" or "Sg/Pl", often makes a difference in lots of things + } ; + + Quant : Type = BaseQuant ** { + sp : NForm => Str ; + } ; + + Num : Type = { + s : DForm => Str ; -- independent or attribute + n : Number + } ; + + baseNum : Num = { + s = \\_ => [] ; + n = Sg ; + numtype = NoNum + } ; + + Numeral : Type = Num ** { + ord : Str + } ; + + baseQuant : BaseQuant = { + s = [] ; + isPoss = False ; + } ; + +-------------------------------------------------------------------------------- +-- Postpositions + + Postposition : Type = SS ; + + mkPrep : Str -> Postposition = \str -> ss str ; + +-------------------------------------------------------------------------------- +-- Adjectives + + Adjective : Type = SS ; -- {s : AForm => Str} ; + Adjective2 : Type = Adjective ; + + mkAdj : Str -> Adjective = \str -> {s = str} ; + + AdjPhrase : Type = Adjective ** {compar : Str} ; +-------------------------------------------------------------------------------- +-- Verbs + + BaseVerb : Type = { + s : VForm => Str ; + type : VerbType ; + } ; + Verb : Type = BaseVerb ** { + } ; + Verb2 : Type = Verb ; -- ** {c2 : Postposition} ; + Verb3 : Type = Verb ; -- ** {c3 : Postposition} ; + +-- VV : Type = Verb ** {vvtype : VVForm} ; + + copula : Verb = { + s = table { + VInf => "이다" ; + VFin Gnomic Pos => "입니다" ; + VFin Gnomic Neg => "아닙니다" ; + _ => "TODO:copula" } ; + type = Copula ; + } ; + + mkVerb : Str -> Verb = \str -> { + s = \\_ => str ; + type = Active + } ; + +------------------ +-- Adv + + Adverb : Type = SS ; + +------------------ +-- VP + + Complement : Type = { + aComp : Str ; -- AForm => Str ; + nComp : Str ; + -- compar : Str ; -- comparative is discontinuous + } ; + + emptyComp : Complement = { + aComp = [] ; + nComp = [] ; + -- compar : Str ; + } ; + + VerbPhrase : Type = BaseVerb ** Complement ** { + vComp : Str + -- {subjunc : Str ; -- inflected verb complement + -- inf : Str ; -- infinitive verb complement + -- subcl : Str} -- clause complement + } ; + + VPSlash : Type = VerbPhrase ; + + useV : Verb -> VerbPhrase = \v -> v ** { + aComp = [] ; -- \\_ => [] ; + nComp = [] ; + vComp = [] ; + } ; +-------------------------------------------------------------------------------- +-- Cl, S + + Clause : Type = {s : Tense => Anteriority => Polarity => Str} ; + + {- After PredVP, we might still want to add more adverbs (QuestIAdv), + but we're done with verb inflection. + -} + ClSlash : Type = Clause ; + + QClause : Type = Clause ; + + RClause : Type = {s : NForm => Tense => Anteriority => Polarity => Str} ; + + Sentence : Type = {s : Str} ; + + predVPslash = predVP ; -- VP==VPSlash, Cl==ClSlash + + predVP : NounPhrase -> VerbPhrase -> ClSlash = \np,vp -> vp ** { + s = \\t,a,p => np.s + ++ vp.aComp ++ vp.nComp -- TODO: embed copula into complement + ++ vp.s ! VFin Gnomic Pos -- TODO: actual forms + } ; + +-------------------------------------------------------------------------------- +-- linrefs + +} diff --git a/src/korean/SentenceKor.gf b/src/korean/SentenceKor.gf new file mode 100644 index 000000000..2f394ca2b --- /dev/null +++ b/src/korean/SentenceKor.gf @@ -0,0 +1,79 @@ +concrete SentenceKor of Sentence = CatKor ** open + TenseX, ResKor, (AK=AdverbKor), Prelude in { + +flags optimize=all_subs ; + +lin + +--2 Clauses + + -- : NP -> VP -> Cl + PredVP = predVP ; + + -- : SC -> VP -> Cl ; -- that she goes is good (Saeed p. 94) + --PredSCVP sc vp = ; + +--2 Clauses missing object noun phrases + -- : NP -> VPSlash -> ClSlash ; + SlashVP = predVP ; +{- + -- : ClSlash -> Adv -> ClSlash ; -- (whom) he sees today + AdvSlash cls adv = cls ** insertAdv adv cls ; + +-- SlashPrep : Cl -> Prep -> ClSlash ; -- (with whom) he walks + + -- : NP -> VS -> SSlash -> ClSlash ; -- (whom) she says that he loves +-- SlashVS np vs ss = {} ; + + + -- : 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} ; + +--2 Embedded sentences + + -- : S -> SC ; + EmbedS s = {s = s.s ! True} ; -- choose subordinate + + -- : QS -> SC ; + -- EmbedQS qs = { } ; + + -- : VP -> SC ; + EmbedVP vp = {s = infVP vp} ; +-} +--2 Sentences + + -- : Temp -> Pol -> Cl -> S ; + UseCl t p cl = { + s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p + } ; + + -- : Temp -> Pol -> QCl -> QS ; + UseQCl t p cl = {s = t.s ++ p.s ++ cl.s ! t.t ! t.a ! p.p} ; + + -- : Temp -> Pol -> RCl -> RS ; + -- UseRCl t p cl = {s = } ; + + -- AdvS : Adv -> S -> S ; -- then I will go home + AdvS = advS "" ; + + -- ExtAdvS : Adv -> S -> S ; -- next week, I will go home + ExtAdvS = advS (SOFT_BIND ++ ","); + + -- : S -> Subj -> S -> S ; + -- SSubjS s1 subj s2 = AdvS (AK.SubjS subj s2) s1 ; + + -- : S -> RS -> S ; -- she sleeps, which is good + -- RelS sent rs = advS {s = rs.s ! Sg3 Masc ++ SOFT_BIND ++ ","} sent ; + +oper + + advS : (comma : Str) -> Adverb -> S -> S = \comma,a,sent -> sent ** { + s = a.s ++ comma ++ sent.s + } ; + +} diff --git a/src/korean/StructuralKor.gf b/src/korean/StructuralKor.gf new file mode 100644 index 000000000..2f4593c86 --- /dev/null +++ b/src/korean/StructuralKor.gf @@ -0,0 +1,171 @@ +concrete StructuralKor of Structural = CatKor ** + open Prelude, ResKor, (N=NounKor), ParadigmsKor in { + +------- +-- Ad* +{- +lin almost_AdA = mkAdA "" ; +lin almost_AdN = ss "" ; +lin at_least_AdN = ss "" ; +lin at_most_AdN = ss "" ; +lin so_AdA = ss "" ; +lin too_AdA = ss "" ; +lin very_AdA = mkAdA "" ; + +lin as_CAdv = { s = "" ; p = [] } ; +lin less_CAdv = { s = "" ; p = [] } ; +lin more_CAdv = { s = "" ; p = [] } ; +lin how_IAdv = ss "" : + +lin how8much_IAdv = ss "" ; +lin when_IAdv = ss "" ; +lin where_IAdv = ss "" : +lin why_IAdv = ss "" : + +lin always_AdV = ss "" ; + +lin everywhere_Adv = ss "" ; +lin here7from_Adv = ss "" ; +lin here7to_Adv = ss "" ; +lin here_Adv = ss "" ; +lin quite_Adv = ss "" ; +lin somewhere_Adv = ss "" ; +lin there7from_Adv = ss "" ; +lin there7to_Adv = ss "" ; +lin there_Adv = ss "" ; + +-} +------- +-- Conj + +-- lin and_Conj = {s2 = table {x => "" ; y => ""} ; s1 = [] ; n = Pl} ; +-- lin or_Conj = {s2 = \\_ => "" ; s1 = [] ; n = Sg} ; +-- lin if_then_Conj = mkConj +-- lin both7and_DConj = mkConj "" "" pl ; +-- lin either7or_DConj = {s2 = \\_ => "" ; s1 = "" ; n = Sg} ; +-- +-- lin but_PConj = ss "" ; +-- lin otherwise_PConj = ss "" ; +-- lin therefore_PConj = ss "" ; + + +----------------- +-- *Det and Quant + +{- +lin how8many_IDet = ; + +lin all_Predet = {s = ""} ; +lin not_Predet = { s = "" } ; +lin only_Predet = { s = "" } ; +lin most_Predet = {s = ""} ; + +lin every_Det = R.defDet [] pl ** + { s = mkVow } ; +lin few_Det = R.indefDet "" pl ; +lin many_Det = R.indefDet "" pl ; +lin much_Det = R.indefDet "" sg ; + +lin somePl_Det = +lin someSg_Det = + +lin no_Quant = +lin that_Quant = +lin this_Quant = +lin which_IQuant = + + +----- +-- NP + +lin everybody_NP = defNP "" N.NumPl ; +lin everything_NP = defNP "" N.NumSg ; +lin nobody_NP = mkVerb; "" +lin nothing_NP = defNP "" N.NumSg ; +lin somebody_NP = defNP "" N.NumSg ; +lin something_NP = defNP "" N.NumSg ; + +oper + defNP : Str -> Num -> NP = {} ; +-} + +------- +-- Prep + +-- lin above_Prep = mkPrep "" +-- lin after_Prep = mkPrep "" +-- lin before_Prep = mkPrep "" ; +-- lin behind_Prep = mkPrep "" ; +-- lin between_Prep = = mkPrep "" ; +-- lin by8agent_Prep = mkPrep ; +-- lin by8means_Prep = mkPrep ; +-- lin during_Prep = mkPrep ; +-- lin except_Prep = mkPrep ; +-- lin for_Prep = mkPrep ; +-- lin from_Prep = mkPrep "" ; +-- lin in8front_Prep = mkPrep "" ; +-- lin in_Prep = mkPrep "" ; +-- lin on_Prep = mkPrep "" ; +-- lin part_Prep = mkPrep ; +-- lin possess_Prep = mkPrep ; +-- lin through_Prep = mkPrep ; +-- lin to_Prep = mkPrep ; +-- lin under_Prep = mkPrep "" ; +-- lin with_Prep = mkPrep "" ; +-- lin without_Prep = mkPrep "" ; + + +------- +-- Pron + +-- Pronouns are closed class, no constructor in ParadigmsKor. + -- it_Pron = + -- i_Pron = + -- youPol_Pron, + -- youSg_Pron = + -- he_Pron = + -- she_Pron = + -- we_Pron = + -- youPl_Pron = + -- they_Pron = + +--lin whatPl_IP = ; +--lin whatSg_IP = : +--lin whoPl_IP = ; +--lin whoSg_IP = ; + +------- +-- Subj + +-- lin although_Subj = +-- lin because_Subj = +-- lin if_Subj = +-- lin that_Subj = +-- lin when_Subj = + + +------ +-- Utt + +lin language_title_Utt = ss "한국어" ; +lin no_Utt = ss "예" ; +lin yes_Utt = ss "아니요" ; + + +------- +-- Verb + +--lin have_V2 = mkV2 have_V ; +-- lin can8know_VV = can_VV ; -- can (capacity) +-- lin can_VV = mkVV "" ; -- can (possibility) +-- lin must_VV = mkVV "" ; +-- lin want_VV = mkVV "" subjunctive ; + + +------ +-- Voc +{- +lin please_Voc = ss "" ; +-} + +} diff --git a/src/korean/SymbolKor.gf b/src/korean/SymbolKor.gf new file mode 100644 index 000000000..2d04509aa --- /dev/null +++ b/src/korean/SymbolKor.gf @@ -0,0 +1,50 @@ +--# -path=.:../abstract:../common:../prelude + +concrete SymbolKor of Symbol = CatKor ** + open Prelude, ParadigmsKor, ResKor, (NS=NounKor) in { + +lin + + -- : Symb -> PN ; -- x + SymbPN i = mkPN i.s ; + + -- : Int -> PN ; -- 27 + IntPN i = mkPN i.s ; + + -- : Float -> PN ; -- 3.14159 + FloatPN i = mkPN i.s ; + + -- : Card -> PN ; -- twelve [as proper name] + NumPN i = mkPN i.s ; + +{- +lin +-- CNIntNP cn i = {} ; + + -- : Det -> CN -> [Symb] -> NP ; -- (the) (2) numbers x and y + CNSymbNP det cn xs = + let cnSymb = cn ** { comp = cn.comp ++ xs.s } + in NS.DetCN det cnSymb ; + + -- : CN -> Card -> NP ; -- level five ; level 5 + CNNumNP cn i = NS.MassNP (cn ** { comp = cn.comp ++ i.s }) ; + + -- : Symb -> S ; + SymbS sy = {s = } ; + -- : Symb -> Card ; + SymbNum sy = { s = sy.s ; n = Pl } ; + + -- : Symb -> Ord ; + SymbOrd sy = { s =} ; +-} +lincat + Symb, [Symb] = SS ; + +lin + MkSymb s = s ; + + BaseSymb = infixSS "과" ; -- 와 after vowel. TODO make it a table. + ConsSymb = infixSS "," ; + + +} diff --git a/src/korean/VerbKor.gf b/src/korean/VerbKor.gf new file mode 100644 index 000000000..126a58294 --- /dev/null +++ b/src/korean/VerbKor.gf @@ -0,0 +1,138 @@ +concrete VerbKor of Verb = CatKor ** open ResKor, AdverbKor, Prelude in { + + +lin + +----- +-- VP + -- : V -> VP + UseV = ResKor.useV ; + + -- : V2 -> VP ; -- be loved + -- PassV2 = ResKor.passV2 ; + + -- : VPSlash -> VP ; + -- ReflVP = ResKor.insertRefl ; + + -- : VV -> VP -> VP ; + -- ComplVV vv vp = let vc = vp.vComp in case vv.vvtype of { + -- + -- } ; + + -- : VS -> S -> VP ; + -- ComplVS vs s = + -- let vps = useV vs ; + -- subord = SubjS {s=""} s ; + -- in vps ** {} ; + +{- + -- : VQ -> QS -> VP ; + ComplVQ vq qs = ; + + -- : VA -> AP -> VP ; -- they become red + ComplVA va ap = ResKor.insertComp (CompAP ap).s (useV va) ; + +-} +-------- +-- Slash +{- + -- : V2 -> VPSlash + SlashV2a = useVc ; + + -- : V3 -> NP -> VPSlash ; -- give it (to her) + -- : V3 -> NP -> VPSlash ; -- give (it) to her + Slash2V3, + Slash3V3 = \v3 -> insertComp (useVc3 v3) ; + + -- : V2S -> S -> VPSlash ; -- answer (to him) that it is good + SlashV2S v2s s = + let vps = useVc v2s ; + subord = SubjS {s=""} s ; + in vps ** {obj = } ; + + + -- : V2V -> VP -> VPSlash ; -- beg (her) to go + SlashV2V v2v vp = ; + + -- : V2Q -> QS -> VPSlash ; -- ask (him) who came + SlashV2Q v2q qs = ; + + -- : V2A -> AP -> VPSlash ; -- paint (it) red + -- TODO: is "red" plural in "paint them red"? + SlashV2A v2a ap = useVc v2a ** { + aComp = \\_ => (CompAP ap).aComp ! Sg3 Masc + } ; + + -- : VPSlash -> NP -> VP + ComplSlash = insertComp ; +-} +{- + -- : VV -> VPSlash -> VPSlash ; + -- Just like ComplVV except missing subject! + SlashVV vv vps = ComplVV vv vps ** { missing = vps.missing ; + post = vps.post } ; + + -- : V2V -> NP -> VPSlash -> VPSlash ; -- beg me to buy + SlashV2VNP v2v np vps = + ComplVV v2v vps ** + { missing = vps.missing ; + post = vps.post ; + iobj = np ** { s = np.s ! Dat } } ; + +-} + + -- : Comp -> VP ; + UseComp comp = UseCopula ** comp ; +{- + -- : VP -> Adv -> VP ; -- sleep here + AdvVP = insertAdv ; + + -- : VPSlash -> Adv -> VPSlash ; -- use (it) here + AdvVPSlash = insertAdv ; + + -- : VP -> Adv -> VP ; -- sleep , even though ... + ExtAdvVP vp adv = ; + + -- : AdV -> VP -> VP ; -- always sleep + AdVVP adv vp = vp ** {adv = adv} ; + + + -- : AdV -> VPSlash -> VPSlash ; -- always use (it) + AdVVPSlash adv vps = vps ** { adv = adv.s ++ vps.adv } ; +-} + -- : VP -> Prep -> VPSlash ; -- live in (it) + -- VPSlashPrep vp prep = + -- let adv = prepNP prep emptyNP + -- in insertAdv vp adv ; + + + + +--2 Complements to copula + +-- Adjectival phrases, noun phrases, and adverbs can be used. + + -- : AP -> Comp ; + CompAP ap = emptyComp ** { + aComp = ap.s ; + } ; + + -- : CN -> Comp ; + CompCN cn = emptyComp ** { + aComp = cn.s ; -- TODO: num. I am [a house that sleeps here] vs. we are [houses that sleep here] + } ; + + -- NP -> Comp ; + CompNP np = emptyComp ** { + nComp = np.s ; -- ! Object ; + } ; + + -- : Adv -> Comp ; + CompAdv adv = emptyComp ** { + aComp = adv.s ; + } ; + + -- : VP -- Copula alone; + UseCopula = useV copula ; + +}