From 3377aaabdd27cb7f63ffdd158f1d19d3fe1eceb4 Mon Sep 17 00:00:00 2001 From: aarne Date: Thu, 30 Jun 2005 22:09:36 +0000 Subject: [PATCH] gfcm in Java ; Finnish close to finished --- examples/stoneage/StoneageFin.gf | 24 ++--- examples/stoneage/StoneageResFin.gf | 3 + lib/resource/danish/SyntaxDan.gf | 2 +- lib/resource/doc/gf-resource.html | 12 ++- lib/resource/finnish/BasicFin.gf | 20 ++-- lib/resource/finnish/CategoriesFin.gf | 20 ++-- lib/resource/finnish/ClauseFin.gf | 2 +- lib/resource/finnish/ParadigmsFin.gf | 93 ++++++++++++------- lib/resource/finnish/RulesFin.gf | 7 +- lib/resource/finnish/StructuralFin.gf | 8 +- lib/resource/finnish/SyntaxFin.gf | 76 ++++++++------- lib/resource/norwegian/SyntaxNor.gf | 1 + lib/resource/scandinavian/SyntaxScand.gf | 12 +-- lib/resource/swedish/SyntaxSwe.gf | 2 +- .../de/uka/ilkd/key/ocl/gf/GrammarFilter.java | 6 +- .../de/uka/ilkd/key/ocl/gf/Utils.java | 2 +- 16 files changed, 168 insertions(+), 122 deletions(-) diff --git a/examples/stoneage/StoneageFin.gf b/examples/stoneage/StoneageFin.gf index 22a5c3180..2afe3a188 100644 --- a/examples/stoneage/StoneageFin.gf +++ b/examples/stoneage/StoneageFin.gf @@ -25,24 +25,24 @@ lin Drink = PresV2 (dirV2 drink_V) ; Eat = PresV2 (dirV2 eat_V) ; - Bite = PresV2 (dirV2 bite_V) ; + Bite = PresV2 (partV2 bite_V) ; Suck = PresV2 (dirV2 suck_V) ; See = PresV2 (dirV2 see_V) ; Hear = PresV2 (dirV2 hear_V) ; Know = PresV2 (dirV2 know_V) ; Smell = PresV2 (dirV2 smell_V) ; - Fear = PresV2 (dirV2 fear_V) ; + Fear = PresV2 (partV2 fear_V) ; Kill = PresV2 (dirV2 kill_V) ; - Fight = PresV2 (dirV2 fight_V) ; - Hunt = PresV2 (dirV2 hunt_V) ; - Hit = PresV2 (dirV2 hit_V) ; + Fight = PresV2 (mkV2 fight_V (postpP partitive "vastaan")) ; + Hunt = PresV2 (partV2 hunt_V) ; + Hit = PresV2 (partV2 hit_V) ; Cut = PresV2 (dirV2 cut_V) ; Split = PresV2 (dirV2 split_V) ; - Stab = PresV2 (dirV2 stab_V) ; - Scratch = PresV2 (dirV2 scratch_V) ; - Hold = PresV2 (dirV2 hold_V) ; + Stab = PresV2 (partV2 stab_V) ; + Scratch = PresV2 (partV2 scratch_V) ; + Hold = PresV2 (partV2 hold_V) ; Squeeze = PresV2 (dirV2 squeeze_V) ; - Rub = PresV2 (dirV2 rub_V) ; + Rub = PresV2 (partV2 rub_V) ; Wash = PresV2 (dirV2 wash_V) ; Wipe = PresV2 (dirV2 wipe_V) ; Pull = PresV2 (dirV2 pull_V) ; @@ -79,7 +79,7 @@ lin Swell = PresV swell_V ; Burn = PresV burn_V ; ----- Give = PresV3 (dirV3 give_V "to") ; + Give = PresV3 (dirV3 give_V allative) ; -- Say = ; @@ -198,8 +198,8 @@ lin Name = UseN name_N ; -- NameOf = AppN2 name_N2 ; ------ MotherOf = AppN2 (mkN2 mother_N "of") ; ------ FatherOf = AppN2 (mkN2 father_N "of") ; + MotherOf = AppN2 (genN2 mother_N) ; + FatherOf = AppN2 (genN2 father_N) ; Big = ModPosA big_ADeg ; Long = ModPosA long_ADeg ; diff --git a/examples/stoneage/StoneageResFin.gf b/examples/stoneage/StoneageResFin.gf index 3542f5f07..f7b47ffe2 100644 --- a/examples/stoneage/StoneageResFin.gf +++ b/examples/stoneage/StoneageResFin.gf @@ -5,6 +5,7 @@ oper PresV2 : V2 -> NP -> NP -> Phr = \v,s,o -> PresCl (SPredV2 s v o) ; PresV3 : V3 -> NP -> NP -> NP -> Phr = \v,s,o,r -> PresCl (SPredV3 s v o r) ; PresVasV2 : V -> NP -> NP -> Phr = \ v -> PresV2 (dirV2 v) ; + PresPartV2 : V -> NP -> NP -> Phr = \ v -> PresV2 (caseV2 v partitive) ; PresCl : Cl -> Phr = \c -> { s = (UseCl (PosTP TPresent ASimul) c).s } ** {lock_Phr = <>} ; @@ -12,4 +13,6 @@ oper ModPosA : ADeg -> CN -> CN = \a -> ModAP (PositADeg a) ; ModA : A -> CN -> CN = \a -> ModAP (UseA a) ; + partV2 : V -> V2 = \v -> caseV2 v partitive ; + } diff --git a/lib/resource/danish/SyntaxDan.gf b/lib/resource/danish/SyntaxDan.gf index 1cfca0c9b..f8b9df029 100644 --- a/lib/resource/danish/SyntaxDan.gf +++ b/lib/resource/danish/SyntaxDan.gf @@ -71,7 +71,7 @@ instance SyntaxDan of SyntaxScand = TypesDan ** auxSka = "vil" ; auxSkulle = "ville" ; - infinAtt = "at" ; + infinAtt, subordAtt = "at" ; varjeDet : Determiner = mkDeterminerSg (detSgInvar "hver") IndefP ; allaDet : Determiner = mkDeterminerPl "alle" IndefP ; diff --git a/lib/resource/doc/gf-resource.html b/lib/resource/doc/gf-resource.html index f761d7972..920d692bb 100644 --- a/lib/resource/doc/gf-resource.html +++ b/lib/resource/doc/gf-resource.html @@ -815,7 +815,7 @@ In two language families: Language v0.6 v0.9 API Paradigms Basic lex Verbs Danish - X - - - English X X X X X -Finnish X - - - - +Finnish X + X X 0 French X X X X X German X - * - - Italian X X X X X @@ -826,10 +826,13 @@ In two language families: X = implemented (few exceptions may occur)
++ = implemented for a large part +
* = linguistic material ready for implementation
- = not implemented - +
+0 = not applicable @@ -842,7 +845,10 @@ Danish

English:

-Finnish +Finnish: +missing many nominal forms of verbs; +the basic lexicon has some erroneous inflectional patterns; +possessive and interrogative suffixes have no proper lexer.

French: no inverted questions; diff --git a/lib/resource/finnish/BasicFin.gf b/lib/resource/finnish/BasicFin.gf index 69f01a0d6..b3bd56db1 100644 --- a/lib/resource/finnish/BasicFin.gf +++ b/lib/resource/finnish/BasicFin.gf @@ -10,18 +10,18 @@ flags lin airplane_N = regN "lentokone" ; - answer_V2S = mkV2S (regV "vastata") allative [] [] ; + answer_V2S = mkV2S (caseV2 (regV "vastata") allative) ; apartment_N = regN "asunto" ; apple_N = regN "omena" ; --- omenia, not omenoita art_N = regN "taide" ; - ask_V2Q = mkV2Q (regV "kysyä") ablative [] [] ; + ask_V2Q = mkV2Q (caseV2 (regV "kysyä") ablative) ; baby_N = regN "vauva" ; bad_ADeg = mkADeg (regN "paha") "pahempi" "pahin" ; bank_N = regN "pankki" ; beautiful_ADeg = mkADeg (regN "kaunis") "kauniimpi" "kaunein" ; become_VA = mkVA (regV "tulla") translative ; beer_N = regN "olut" ; - beg_V2V = mkV2V (reg2V "pyytää" "pyysi") partitive inf_illative ; + beg_V2V = mkV2V (caseV2 (reg2V "pyytää" "pyysi") partitive) ; big_ADeg = mkADeg (reg2N "suuri" "suuria") "suurempi" "suurin" ; bike_N = nLukko "polkupyörä" ; --- for correct vowel harmony bird_N = regN "lintu" ; @@ -68,7 +68,7 @@ lin dog_N = regN "koira" ; door_N = reg2N "ovi" "ovia" ; drink_V2 = dirV2 (regV "juoda") ; - easy_A2V = mkA2V (regN (mkA "helppo")) allative ; + easy_A2V = mkA2V (mkA2 (mkA (regN "helppo")) allative) ; eat_V2 = dirV2 (regV "syödä") ; empty_ADeg = mkADeg (regN "tyhjä") "tyhjempi" "tyhjin" ; enemy_N = regN "vihollinen" ; @@ -93,7 +93,7 @@ lin harbour_N = reg3N "satama" "sataman" "satamia" ; hate_V2 = dirV2 (regV "vihata") ; hat_N = regN "hattu" ; - have_V2 = dirV2 (regV "omistaa") ; ---- olla + have_V2 = dirV2 (caseV adessive vOlla) ; hear_V2 = dirV2 (regV "kuulla") ; hill_N = regN "kukkula" ; hope_VS = mkVS (regV "toivoa") ; @@ -134,7 +134,7 @@ lin oil_N = regN "öljy" ; old_ADeg = mkADeg (regN "vanha") "vanhempi" "vanhin" ; open_V2 = dirV2 (regV "avata") ; - paint_V2A = mkV2A (regV "maalata") translative ; + paint_V2A = mkV2A (dirV2 (regV "maalata")) translative ; paper_N = reg2N "paperi" "papereita" ; peace_N = regN "rauha" ; pen_N = regN "kynä" ; @@ -145,14 +145,14 @@ lin priest_N = regN "pappi" ; probable_AS = mkAS (mkA (nNainen "todennäköistä")) ; --- for vowel harmony queen_N = regN "kuningatar" ; - radio_N = reg3N "radio" "radioita" ; - rain_V0 = mkV0 (vHuoltaa "sataa" "sadan" "satoi" "sadoin") ; + radio_N = reg2N "radio" "radioita" ; + rain_V0 = mkV0 (reg2V "sataa" "satoi") ; read_V2 = dirV2 (regV "lukea") ; red_ADeg = regADeg "punainen" ; religion_N = regN "uskonto" ; restaurant_N = regN "ravintola" ; river_N = nArpi "joki" ; - rock_N = regN "kallio" "kallioita" ; + rock_N = reg2N "kallio" "kallioita" ; roof_N = regN "katto" ; rubber_N = regN "kumi" ; run_V = reg2V "juosta" "juoksi" ; @@ -189,7 +189,7 @@ lin switch8off_V2 = dirV2 (regV "sammuttaa") ; --- switch8on_V2 = dirV2 (regV "sytyttää") ; --- table_N = regN "pöytä" ; - talk_V3 = mkV3 (regV "puhua") allative elative ; + talk_V3 = mkV3 (regV "puhua") (caseP allative) (caseP elative) ; teacher_N = regN "opettaja" ; teach_V2 = dirV2 (regV "opettaa") ; television_N = reg2N "televisio" "telievisioita" ; diff --git a/lib/resource/finnish/CategoriesFin.gf b/lib/resource/finnish/CategoriesFin.gf index ee6771bc8..6694e6395 100644 --- a/lib/resource/finnish/CategoriesFin.gf +++ b/lib/resource/finnish/CategoriesFin.gf @@ -37,27 +37,27 @@ lincat A = Adjective ; -- = CommonNoun ; - A2 = Adjective ** {c : NPForm} ; + A2 = Adjective ** {c : ComplCase} ; ADeg = {s : Degree => AForm => Str} ; AP = {s : AdjPos => AForm => Str} ; AS = Adjective ; --- "more difficult for him to come than..." - A2S = Adjective ** {c : NPForm} ; + A2S = Adjective ** {c : ComplCase} ; AV = Adjective ; - A2V = Adjective ** {c : NPForm} ; + A2V = Adjective ** {c : ComplCase} ; - V = Verb ; + V = Verb1 ; -- = {s : VForm => Str} ---- VP = {s,s2 : Bool => SForm => Agr => Str ; isAux : Bool} ; VPI = {s : VIForm => Str} ; ----- VP = Verb ** {s2 : VForm => Str ; c : ComplCase} ; ---- VG = {s,s2 : Bool => VForm => Str ; c : ComplCase} ; V2 = TransVerb ; - -- = Verb ** {s3, s4 : Str ; c : ComplCase} ; - V3 = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ; - VS = Verb ; - VV = Verb ** {c : ComplCase} ; - VQ = Verb ; - VA = Verb ** {c : Case} ; + -- = Verb ** {s3 : Str ; p : Bool ; c : ComplCase} ; + V3 = TransVerb ** {s5 : Str ; p2 : Bool ; c2 : ComplCase} ; + VS = Verb1 ; + VV = Verb1 ** {i : VIForm} ; + VQ = Verb1 ; + VA = Verb1 ** {c : Case} ; V2S = TransVerb ; V2Q = TransVerb ; diff --git a/lib/resource/finnish/ClauseFin.gf b/lib/resource/finnish/ClauseFin.gf index ca156d2c8..a80a8c0b3 100644 --- a/lib/resource/finnish/ClauseFin.gf +++ b/lib/resource/finnish/ClauseFin.gf @@ -14,7 +14,7 @@ concrete ClauseFin of Clause = CategoriesFin ** sats2clause (mkSatsObject np v y) ; SPredV3 subj verb obj1 obj2 = sats2clause ( - insertObject (mkSatsObject subj verb obj1) verb.c2 verb.s5 verb.s6 obj2) ; + insertObject (mkSatsObject subj verb obj1) verb.c2 verb.s5 verb.p obj2) ; ---- SPredReflV2 subj verb = ---- sats2clause ( ---- mkSatsObject subj diff --git a/lib/resource/finnish/ParadigmsFin.gf b/lib/resource/finnish/ParadigmsFin.gf index d2bc21667..203db7ed2 100644 --- a/lib/resource/finnish/ParadigmsFin.gf +++ b/lib/resource/finnish/ParadigmsFin.gf @@ -43,6 +43,7 @@ oper nominative : Case ; genitive : Case ; partitive : Case ; + translative : Case ; inessive : Case ; elative : Case ; illative : Case ; @@ -51,8 +52,10 @@ oper allative : Case ; PPosition : Type ; - PPrep : Case -> Str -> PPosition ; - PPostp : Case -> Str -> PPosition ; + prepP : Case -> Str -> PPosition ; + postpP : Case -> Str -> PPosition ; + caseP : Case -> PPosition ; + accusative : PPosition ; --2 Nouns @@ -171,6 +174,8 @@ oper mkN2 : N -> Case -> N2 ; genN2 : N -> N2 ; + mkN3 : N -> Case -> Case -> N3 ; + -- Proper names can be formed by using declensions for nouns. -- The plural forms are filtered away by the compiler. @@ -185,7 +190,7 @@ oper -- Two-place adjectives need a case for the second argument. - mkA2 : N -> Case -> A2 ; + mkA2 : A -> Case -> A2 ; -- Comparison adjectives have three forms. The comparative and the superlative -- are always inflected in the same way, so the nominative of them is actually @@ -232,6 +237,11 @@ oper vTuoda : (tuoda : Str) -> V ; +-- All the patterns above have $nominative$ as subject case. +-- If another case is wanted, use the following. + + caseV : Case -> V -> V ; + -- The verbs "be" and the negative auxiliary are special. vOlla : V ; @@ -240,7 +250,7 @@ oper -- Two-place verbs need a case, and can have a pre- or postposition. -- At least one of the latter is empty, $[]$. - mkV2 : V -> PPostp -> V2 ; + mkV2 : V -> PPosition -> V2 ; -- If both are empty, the following special function can be used. @@ -257,7 +267,7 @@ oper -- the first one or both can be absent. mkV3 : V -> PPosition -> PPosition -> V3 ; -- speak, with, about - dirV3 : V -> PPosition -> V3 ; -- give,_,to + dirV3 : V -> Case -> V3 ; -- give,_,to dirdirV3 : V -> V3 ; -- acc, allat --3 Other complement patterns @@ -275,10 +285,10 @@ oper mkVQ : V -> VQ ; mkV2Q : V2 -> V2Q ; - mkAS : A -> AS ; - mkA2S : A -> Str -> A2S ; - mkAV : A -> AV ; - mkA2V : A -> Str -> A2V ; + mkAS : A -> AS ; + mkA2S : A2 -> A2S ; + mkAV : A -> AV ; + mkA2V : A2 -> A2V ; -- The definitions should not bother the user of the API. So they are @@ -297,6 +307,7 @@ oper nominative = Nom ; genitive = Gen ; partitive = Part ; + translative = Transl ; inessive = Iness ; elative = Elat ; illative = Illat ; @@ -304,11 +315,14 @@ oper ablative = Ablat ; allative = Allat ; - PPosition : Type = {c : Case ; s1,s2 : Str} ; - PPrep : Case -> Str -> PPosition = - \c,p -> {c = c ; s1 = p ; s2 = []} ; - PPostp : Case -> Str -> PPosition = - \c,p -> {c = c ; s1 = [] ; s2 = p} ; + PPosition : Type = {c : ComplCase ; s3 : Str ; p : Bool} ; + prepP : Case -> Str -> PPosition = + \c,p -> {c = CCase c ; s3 = p ; p = True} ; + postpP : Case -> Str -> PPosition = + \c,p -> {c = CCase c ; s3 = p ; p = False} ; + caseP : Case -> PPosition = + \c -> {c = CCase c ; s3 = [] ; p = True} ; + accusative = {c = CAcc ; s3 = [] ; p = True} ; mkN = \a,b,c,d,e,f,g,h,i,j,k -> mkNoun a b c d e f g h i j ** {g = k ; lock_N = <>} ; @@ -414,11 +428,12 @@ reg3N = \vesi,veden,vesi nComp = \s,n -> {s = \\c => s ++ n.s ! c ; g = n.g ; lock_N = <>} ; mkN2 = \n,c -> n2n n ** {c = NPCase c ; lock_N2 = <>} ; + mkN3 = \n,c,e -> n2n n ** {c = NPCase c ; c2 = NPCase e ; lock_N3 = <>} ; genN2 = \n -> mkN2 n genitive ; mkPN n = mkProperName n ** {lock_PN = <>} ; mkA = \x -> noun2adj x ** {lock_A = <>} ; - mkA2 = \x,c -> mkA x ** {c = NPCase c ; lock_A2 = <>} ; + mkA2 = \x,c -> x ** {c = CCase c ; lock_A2 = <>} ; mkADeg x kivempi kivin = let a = last (x.s ! ((NCase Sg Part))) ; ---- gives "kivinta" @@ -434,7 +449,8 @@ reg3N = \vesi,veden,vesi (init (suur.s ! NCase Sg Gen) + "mpi") (init (suur.s ! NCase Pl Ess)) ; - mkV a b c d e f g h i j k l = mkVerb a b c d e f g h i j k l ** {lock_V = <>} ; + mkV a b c d e f g h i j k l = mkVerb a b c d e f g h i j k l ** + {sc = Nom ; lock_V = <>} ; regV soutaa = let @@ -455,7 +471,7 @@ regV soutaa = "da" | "dä" => vJuoda soutaa joi ; "ta" | "tä" => vOsata soutaa ; _ => vHukkua soutaa souda - }} ** {lock_V = <>} ; + }} ** {sc = Nom ; lock_V = <>} ; reg2V : (soutaa,souti : Str) -> V = \soutaa,souti -> let @@ -476,7 +492,7 @@ reg2V : (soutaa,souti : Str) -> V = \soutaa,souti -> "at" | "ät" => vPalkata soutaa souti ; "st" => vJuosta soutaa souden (juo + o+u+"t") (juo + "t"+u) ; _ => soudat - }} ** {lock_V = <>} ; + }} ** {sc = Nom ; lock_V = <>} ; reg3V soutaa soudan souti = let @@ -496,43 +512,48 @@ reg3V soutaa soudan souti = "aa" | "ää" => vHuoltaa soutaa soudan souti soudin ; "da" | "dä" => vJuoda soutaa souti ; _ => soudat - }} ** {lock_V = <>} ; + }} ** {sc = Nom ; lock_V = <>} ; + + vValua v = vSanoa v ** {sc = Nom ; lock_V = <>} ; + vKattaa v u = vOttaa v u ** {sc = Nom ; lock_V = <>} ; + vOstaa v = vPoistaa v ** {sc = Nom ; lock_V = <>} ; + vNousta v u = vJuosta v u [] [] ** {sc = Nom ; lock_V = <>} ; ----- + vTuoda v = vJuoda v [] ** {sc = Nom ; lock_V = <>} ; ----- + caseV c v = {s = v.s ; sc = c ; lock_V = <>} ; + + vOlla = verbOlla ** {sc = Nom ; lock_V = <>} ; + vEi = verbEi ** {sc = Nom ; lock_V = <>} ; - vValua v = vSanoa v ** {lock_V = <>} ; - vKattaa v u = vOttaa v u ** {lock_V = <>} ; - vOstaa v = vPoistaa v ** {lock_V = <>} ; - vNousta v u = vJuosta v u [] [] ** {lock_V = <>} ; ----- - vTuoda v = vJuoda v [] ** {lock_V = <>} ; ----- - vOlla = verbOlla ** {lock_V = <>} ; - vEi = verbEi ** {lock_V = <>} ; vHuoltaa : (_,_,_,_ : Str) -> Verb = \ottaa,otan,otti,otin -> - SyntaxFin.vHuoltaa ottaa otan otti otin ** {lock_V = <>} ; --- mkV2 = \v,c,p,o -> v ** {s3 = p ; s4 = o ; c = CCase c ; lock_V2 = <>} ; --- caseV2 = \v,c -> mkV2 v c [] [] ; + SyntaxFin.vHuoltaa ottaa otan otti otin ** {sc = Nom ; lock_V = <>} ; + mkV2 = \v,c -> v ** {s3 = c.s3 ; p = c.p ; c = c.c ; lock_V2 = <>} ; + caseV2 = \v,c -> mkV2 v (caseP c) ; dirV2 v = mkTransVerbDir v ** {lock_V2 = <>} ; mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ; --- mkV3 : V -> PPosition -> PPosition -> V3 ; -- speak, with, about --- dirV3 : V -> PPosition -> V3 ; -- give,_,to --- dirdirV3 : V -> -> V3 ; -- acc, allat + mkV3 v p q = v ** + {s3 = p.s3 ; p = p.p ; c = p.c ; s5 = q.s3 ; p2 = q.p ; c2 = q.c ; + lock_V3 = <>} ; + dirV3 v p = mkV3 v accusative (caseP p) ; + dirdirV3 v = dirV3 v allative ; mkV0 v = v ** {lock_V0 = <>} ; mkVS v = v ** {lock_VS = <>} ; mkV2S v = v ** {lock_V2S = <>} ; -- mkVV v = v ** {lock_VV = <>} ; mkV2V v = v ** {lock_V2V = <>} ; --- mkVA v c = v ** {c = c ; lock_V0 = <>} ; --- mkV2A v c = v ** {c2 = c ; lock_V0 = <>} ; + mkVA v c = v ** {c = c ; lock_VA = <>} ; + mkV2A v c = v ** {c2 = c ; lock_V2A = <>} ; mkVQ v = v ** {lock_VQ = <>} ; mkV2Q v = v ** {lock_V2Q = <>} ; mkAS v = v ** {lock_AS = <>} ; --- mkA2S v c = v ** {c = c ; lock_AS = <>} ; + mkA2S v = v ** {lock_A2S = <>} ; mkAV v = v ** {lock_AV = <>} ; --- mkA2V v c = v ** {c = c ; lock_AS = <>} ; + mkA2V v = v ** {lock_A2V = <>} ; -- inf_illative -- infinitive diff --git a/lib/resource/finnish/RulesFin.gf b/lib/resource/finnish/RulesFin.gf index 4051aa972..b742da31f 100644 --- a/lib/resource/finnish/RulesFin.gf +++ b/lib/resource/finnish/RulesFin.gf @@ -63,7 +63,8 @@ lin ComplA2 = complAdj ; ComplAV av vpi = {s = \\_,a => av.s ! a ++ vpi.s ! VIInfinit} ; - ComplObjA2V av obj vpi = {s = \\_,a => av.s ! a ++ obj.s ! av.c ++ vpi.s ! VIInfinit} ; + ComplObjA2V av obj vpi = {s = \\_,a => av.s ! a ++ obj.s ! complCase + True av.c VImperat ++ vpi.s ! VIInfinit} ; PositADeg = positAdjPhrase ; ComparADeg = comparAdjPhrase ; @@ -73,10 +74,10 @@ lin PredAS adj sent = sats2clause ( insertComplement - (mkSats impersNounPhrase verbOlla) + (mkSats impersNounPhrase (vNom verbOlla)) (complAdjPhrase Sg (adj2adjPhrase adj) ++ sent.s) ) ; - PredV0 rain = sats2clause (mkSats impersNounPhrase rain) ; + PredV0 rain = sats2clause (mkSats impersNounPhrase (vNom rain)) ; -- Partial saturation. diff --git a/lib/resource/finnish/StructuralFin.gf b/lib/resource/finnish/StructuralFin.gf index 6fbabdfbd..ced177ceb 100644 --- a/lib/resource/finnish/StructuralFin.gf +++ b/lib/resource/finnish/StructuralFin.gf @@ -27,8 +27,8 @@ concrete StructuralFin of Structural = both_AndConjD = sd2 "sekä" "että" ** {n = Pl} ; by8agent_Prep = prepPostpGen "toimesta" ; by8means_Prep = prepPostpGen "avulla" ; - can8know_VV = nomVerbVerb (vOsata "osata") ; - can_VV = nomVerbVerb (vJuoda "voida" "voi") ; +---- can8know_VV = nomVerbVerb (vOsata "osata") ; +---- can_VV = nomVerbVerb (vJuoda "voida" "voi") ; during_Prep = prepPostpGen "aikana" ; either8or_ConjD = sd2 "joko" "tai" ** {n = Sg} ; everybody_NP = { @@ -55,7 +55,7 @@ concrete StructuralFin of Structural = most8many_Det = useimmatDet ; most_Det = mkDeterminer singular (caseTable singular (sSuurin "enintä")) ; much_Det = mkDeterminer singular (caseTable singular (sNauris "runsasta")) ; - must_VV = vHukkua "täytyä" "täydy" ** {c = CCase Gen} ; +---- must_VV = vHukkua "täytyä" "täydy" ** {c = CCase Gen} ; no_Phr = ss ("Ei" ++ stopPunct) ; on_Prep = prepCase Adess ; or_Conj = ss "tai" ** {n = Sg} ; @@ -92,7 +92,7 @@ concrete StructuralFin of Structural = to_Prep = prepCase Illat ; --- allat under_Prep = prepPostpGen "alla" ; very_Adv = ss "hyvin" ; - want_VV = nomVerbVerb (vOsata "haluta") ; +---- want_VV = nomVerbVerb (vOsata "haluta") ; we_NP = pronNounPhrase pronMe ; what8many_IP = intPronWhat Pl ; what8one_IP = intPronWhat Sg ; diff --git a/lib/resource/finnish/SyntaxFin.gf b/lib/resource/finnish/SyntaxFin.gf index 9a2138051..9685b7a70 100644 --- a/lib/resource/finnish/SyntaxFin.gf +++ b/lib/resource/finnish/SyntaxFin.gf @@ -367,23 +367,22 @@ oper -- "tyytyväinen vaalitulokseen", "jaollinen kolmella"), which is not a possible -- order for the accusative case. - AdjCompl = Adjective ** {c : NPForm} ; + AdjCompl = Adjective ** {c : ComplCase} ; + +--- Only the middle argument of $complCase$ matters, since +--- no accusatives come into question. complAdj : AdjCompl -> NounPhrase -> AdjPhrase = \hyva,paini -> - let { + let hyvat : AForm => Str = \\a => hyva.s ! a ; - painissa : Str = paini.s ! hyva.c - } + c : NPForm = complCase True hyva.c VImperat ; + painissa : Str = paini.s ! c in {s = table { AAttr => \\a => painissa ++ hyvat ! a ; APred => \\a => if_then_else Str - (isLocalNPForm hyva.c) - (variants { - hyvat ! a ++ painissa ; - painissa ++ hyvat ! a - } - ) + (isLocalNPForm c) + (hyvat ! a ++ painissa) (painissa ++ hyvat ! a) } } ; @@ -479,6 +478,14 @@ oper -- --3 Verb phrases -- +-- In Finnish, verbs can have nominative subjects, but there are +-- also verbs with a special subject case ("täytyy"). + + Verb1 : Type = Verb ** {sc : Case} ; + + vCase : Verb -> Case -> Verb1 = \v,c -> v ** {sc = c} ; + vNom : Verb -> Verb1 = \v -> vCase v Nom ; + -- These are parameters for clauses and sentences. param @@ -528,27 +535,33 @@ oper questPart : Str -> Str = \s -> glueParticle s "ko" ; --- "kö" - mkSats : NounPhrase -> Verb -> Sats = \subj,verb -> - {subj = subj.s ! NPCase Nom ; --- "minusta tulee poliisi" + mkSats : NounPhrase -> Verb1 -> Sats = \subj,verb -> + let + np = case verb.sc of { + Nom => ; + _ => + } + in + {subj = subj.s ! NPCase verb.sc ; -- "minusta tulee poliisi" pred = \\b,sf => - inflectVerb verb subj.n (np2Person subj.p) b sf ** {obj = []} ; + inflectVerb verb np.p1 np.p2 b sf ** {obj = []} ; comp = [] } ; mkSatsObject : NounPhrase -> TransVerb -> NounPhrase -> Sats = \subj,verb,obj -> - insertObject (mkSats subj verb) verb.c verb.s3 verb.s4 obj ; + insertObject (mkSats subj verb) verb.c verb.s3 verb.p obj ; mkSatsCopula : NounPhrase -> Str -> Sats = \subj,comp -> - insertComplement (mkSats subj verbOlla) comp ; + insertComplement (mkSats subj (vNom verbOlla)) comp ; - insertObject : Sats -> ComplCase -> Str -> Str -> NounPhrase -> Sats = - \sats, c, prep, postp, obj -> + insertObject : Sats -> ComplCase -> Str -> Bool -> NounPhrase -> Sats = + \sats, c, prep, pos, obj -> {subj = sats.subj ; pred = \\b,sf => let spred = sats.pred ! b ! sf in {fin = spred.fin ; inf = spred.inf ; - obj = spred.obj ++ prep ++ obj.s ! complCase b c sf ++ postp + obj = spred.obj ++ pPosit prep pos (obj.s ! complCase b c sf) } ; comp = sats.comp } ; @@ -664,7 +677,7 @@ oper --3 Transitive verbs -- -- Transitive verbs are verbs with a case and, possibly, a preposition --- or a postposition for the complement, +-- or a postposition for the complement ($True$ = preposition), -- in analogy with two-place adjectives and functions. -- One might prefer to use the term "2-place verb", since -- "transitive" traditionally means that the inherent preposition is empty. @@ -674,7 +687,10 @@ param ComplCase = CCase Case | CAcc ; oper - TransVerb : Type = Verb ** {s3, s4 : Str ; c : ComplCase} ; + TransVerb : Type = Verb1 ** {s3 : Str ; p : Bool ; c : ComplCase} ; + + pPosit : Str -> Bool -> Str -> Str = \p,b,s -> + if_then_Str b (p ++ s) (s ++ p) ; -- The rule for using transitive verbs is the complementization rule. -- @@ -700,13 +716,13 @@ oper -- Verbs that take their object with a case other than the accusative, -- without pre- or postposition: - mkTransVerbCase : Verb -> Case -> TransVerb = \nauraa,c -> - nauraa ** {s3 = [] ; s4 = [] ; c = CCase c} ; + mkTransVerbCase : Verb1 -> Case -> TransVerb = \nauraa,c -> + nauraa ** {s3 = [] ; p = True ; c = CCase c} ; -- Verbs that take direct object with the accusative: - mkTransVerbDir : Verb -> TransVerb = \ostaa -> - ostaa ** {s3 = [] ; s4 = [] ; c = CAcc} ; + mkTransVerbDir : Verb1 -> TransVerb = \ostaa -> + ostaa ** {s3 = [] ; p = True ; c = CAcc} ; {- -- Most two-place verbs can be used passively; the object case need not be -- the accusative, and it becomes the subject case in the passive sentence. @@ -727,7 +743,7 @@ oper -- is left to applications. The definition is trivial, due to record -- subtyping. - transAsVerb : TransVerb -> Verb = \juoda -> + transAsVerb : TransVerb -> Verb1 = \juoda -> juoda ; -- The 'real' Finnish passive is unpersonal, equivalent to the @@ -740,7 +756,7 @@ oper -- We treat so far only the rule in which the ditransitive -- verb takes both complements to form a verb phrase. - DitransVerb = TransVerb ** {s5, s6 : Str ; c2 : ComplCase} ; + DitransVerb = TransVerb ** {s5 : Str ; p2 : Bool ; c2 : ComplCase} ; --2 Adverbials @@ -807,7 +823,7 @@ oper -- -- Sentence-complement verbs take sentences as complements. - SentenceVerb : Type = Verb ; + SentenceVerb : Type = Verb1 ; -- To generate "sanoo että Jussi ui" / "ei sano että Jussi ui" @@ -815,10 +831,8 @@ oper --3 Verb-complement verbs -- -- Verb-complement verbs take verb phrases as complements. --- In Finnish, they can be ordinary verbs ("haluta", "yrittää"), but --- also verbs with a special subject case ("täytyy", "on pakko"). - VerbVerb : Type = Verb ** {c : ComplCase} ; + VerbVerb : Type = Verb1 ** {i : VIForm} ; {- complVerbVerb : VerbVerb -> VerbGroup -> VerbGroup = \haluta, uida -> let @@ -839,7 +853,7 @@ oper c = hc } ; -} -nomVerbVerb : Verb -> VerbVerb = \v -> v ** {c = CCase Nom} ; + --2 Sentences missing noun phrases -- diff --git a/lib/resource/norwegian/SyntaxNor.gf b/lib/resource/norwegian/SyntaxNor.gf index f81f0c47a..1e45f47e0 100644 --- a/lib/resource/norwegian/SyntaxNor.gf +++ b/lib/resource/norwegian/SyntaxNor.gf @@ -74,6 +74,7 @@ instance SyntaxNor of SyntaxScand = TypesNor ** auxSkulle = "ville" ; infinAtt = "å" ; + subordAtt = "at" ; varjeDet : Determiner = mkDeterminerSg (detSgInvar "hver") IndefP ; allaDet : Determiner = mkDeterminerPl "alle" IndefP ; diff --git a/lib/resource/scandinavian/SyntaxScand.gf b/lib/resource/scandinavian/SyntaxScand.gf index 128db5356..5619fa396 100644 --- a/lib/resource/scandinavian/SyntaxScand.gf +++ b/lib/resource/scandinavian/SyntaxScand.gf @@ -286,7 +286,7 @@ oper -- first place as common nouns, so that one can also have "ett förslag att...". nounThatSentence : CommNounPhrase -> Sentence -> CommNounPhrase = \tanke,x -> - {s = \\n,d,c => tanke.s ! n ! d ! c ++ infinAtt ++ x.s ! Sub ; + {s = \\n,d,c => tanke.s ! n ! d ! c ++ subordAtt ++ x.s ! Sub ; g = tanke.g ; p = tanke.p } ; @@ -709,7 +709,7 @@ oper predVerbGroupClause npDet (vara ( - \\g,n,_ => bra.s ! predFormAdj g n ! Nom ++ infinAtt ++ hansover.s ! Sub)) ; + \\g,n,_ => bra.s ! predFormAdj g n ! Nom ++ subordAtt ++ hansover.s ! Sub)) ; predAdjSent2 : AdjCompl -> NounPhrase -> Adjective = \bra,han -> {s = \\af,c => bra.s ! af ! c ++ {-strPrep-} bra.s2 ++ han.s ! PAcc} ; @@ -1026,7 +1026,7 @@ oper SentenceVerb : Type = Verb ; complSentVerb : SentenceVerb -> Sentence -> VerbGroup = \se,duler -> - useVerb se (\\_,_,_ => optStr infinAtt ++ duler.s ! Sub) ; + useVerb se (\\_,_,_ => optStr subordAtt ++ duler.s ! Sub) ; complQuestVerb : SentenceVerb -> QuestionSent -> VerbGroup = \se,omduler -> useVerb se (\\_,_,_ => omduler.s ! IndirQ) ; @@ -1034,7 +1034,7 @@ oper complDitransSentVerb : TransVerb -> NounPhrase -> Sentence -> VerbGroup = \sa,honom,duler -> useVerb sa - (\\_,_,_ => {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ optStr infinAtt ++ duler.s ! Main) ; + (\\_,_,_ => {-strPrep-} sa.s2 ++ honom.s ! PAcc ++ optStr subordAtt ++ duler.s ! Main) ; complDitransQuestVerb : TransVerb -> NounPhrase -> QuestionSent -> VerbGroup = \sa,honom,omduler -> @@ -1212,7 +1212,7 @@ oper -- "tal x sådant att x är primt". relSuch : Clause -> RelClause = \A -> - {s = \\b,sf,g,p => pronSådan ! g ++ infinAtt ++ A.s ! b ! s2cl sf Sub} ; + {s = \\b,sf,g,p => pronSådan ! g ++ subordAtt ++ A.s ! b ! s2cl sf Sub} ; -- The main use of relative clauses is to modify common nouns. -- The result is a common noun, out of which noun phrases can be formed @@ -1687,7 +1687,7 @@ oper auxHar, auxHade, auxHa, auxSka, auxSkulle : Str ; - infinAtt : Str ; + infinAtt, subordAtt : Str ; prepÄn : Str ; negInte : Str ; conjOm : Str ; diff --git a/lib/resource/swedish/SyntaxSwe.gf b/lib/resource/swedish/SyntaxSwe.gf index 9876bae07..4d0aaf8a7 100644 --- a/lib/resource/swedish/SyntaxSwe.gf +++ b/lib/resource/swedish/SyntaxSwe.gf @@ -73,7 +73,7 @@ instance SyntaxSwe of SyntaxScand = TypesSwe ** auxSka = "ska" ; auxSkulle = "skulle" ; - infinAtt = "att" ; + infinAtt,subordAtt = "att" ; varjeDet : Determiner = mkDeterminerSg (detSgInvar "varje") IndefP ; allaDet : Determiner = mkDeterminerPl "alla" IndefP ; diff --git a/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/GrammarFilter.java b/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/GrammarFilter.java index 13d8f5184..e8bd59c66 100644 --- a/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/GrammarFilter.java +++ b/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/GrammarFilter.java @@ -20,7 +20,7 @@ import javax.swing.filechooser.*; public class GrammarFilter extends FileFilter { - // Accept all directories and all gf, gfm files. + // Accept all directories and all gf, gfcm files. public boolean accept(File f) { if (f.isDirectory()) { return true; @@ -29,7 +29,7 @@ public class GrammarFilter extends FileFilter { String extension = Utils.getExtension(f); if (extension != null) { if (extension.equals(Utils.gf) || - extension.equals(Utils.gfm)) { + extension.equals(Utils.gfcm)) { return true; } else { return false; @@ -41,6 +41,6 @@ public class GrammarFilter extends FileFilter { // The description of this filter public String getDescription() { - return "Just Grammars (*.gf, *.gfm)"; + return "Just Grammars (*.gf, *.gfcm)"; } } diff --git a/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/Utils.java b/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/Utils.java index e8b67e72b..fc93852a2 100644 --- a/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/Utils.java +++ b/src/JavaGUI2/de/uka/ilkd/key/ocl/gf/Utils.java @@ -30,7 +30,7 @@ public class Utils { } public static final String gf = "gf"; - public static final String gfm = "gfm"; + public static final String gfcm = "gfcm"; /* * Get the extension of a file.