mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-15 07:49:31 -06:00
changed Finnish VP so that the verb is stored as such. This makes compilation and parsing several times faster. TODO: treat passivization correctly; optimize further by only storing the stems.
This commit is contained in:
@@ -58,7 +58,9 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
|
||||
sc = ss.sc ; h = ss.h
|
||||
} ;
|
||||
|
||||
MkVPS t p vp = { -- Temp -> Pol -> VP -> VPS ;
|
||||
MkVPS t p vp0 = let vp = vp2old_vp vp0 in
|
||||
|
||||
{ -- Temp -> Pol -> VP -> VPS ;
|
||||
s = \\a => let vps = vp.s ! VIFin t.t ! t.a ! p.p ! a
|
||||
in
|
||||
t.s ++ p.s ++
|
||||
@@ -207,17 +209,17 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
|
||||
in
|
||||
{s = t.s ++ p.s ++ cl.compl ++ pa ++ cl.fin ++ cl.inf ++ cl.subj ++ cl.adv ++ cl.ext} ;
|
||||
|
||||
PredClPlus np vp = mkClausePlus (subjForm np vp.sc) np.a vp ;
|
||||
PredClPlusFocSubj np vp = insertKinClausePlus 0 (mkClausePlus (subjForm np vp.sc) np.a vp) ;
|
||||
PredClPlusFocVerb np vp = insertKinClausePlus 1 (mkClausePlus (subjForm np vp.sc) np.a vp) ;
|
||||
PredClPlus np vp = mkClausePlus (subjForm np vp.s.sc) np.a vp ;
|
||||
PredClPlusFocSubj np vp = insertKinClausePlus 0 (mkClausePlus (subjForm np vp.s.sc) np.a vp) ;
|
||||
PredClPlusFocVerb np vp = insertKinClausePlus 1 (mkClausePlus (subjForm np vp.s.sc) np.a vp) ;
|
||||
PredClPlusObj np vps obj =
|
||||
insertObjClausePlus 0 False (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ;
|
||||
insertObjClausePlus 0 False (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.s.sc) np.a vps) ;
|
||||
PredClPlusFocObj np vps obj =
|
||||
insertObjClausePlus 0 True (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.sc) np.a vps) ;
|
||||
insertObjClausePlus 0 True (\\b => appCompl True b vps.c2 obj) (mkClausePlus (subjForm np vps.s.sc) np.a vps) ;
|
||||
PredClPlusAdv np vp adv =
|
||||
insertObjClausePlus 1 False (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ;
|
||||
insertObjClausePlus 1 False (\\_ => adv.s) (mkClausePlus (subjForm np vp.s.sc) np.a vp) ;
|
||||
PredClPlusFocAdv np vp adv =
|
||||
insertObjClausePlus 1 True (\\_ => adv.s) (mkClausePlus (subjForm np vp.sc) np.a vp) ;
|
||||
insertObjClausePlus 1 True (\\_ => adv.s) (mkClausePlus (subjForm np vp.s.sc) np.a vp) ;
|
||||
|
||||
ClPlusWithObj c = c ;
|
||||
ClPlusWithAdv c = c ;
|
||||
@@ -232,10 +234,13 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
|
||||
pahan_Part = mkPart "pahan" "pähän" ;
|
||||
|
||||
PassVPSlash vp = {
|
||||
s = vp.s ; ---- TODO
|
||||
{- -----
|
||||
s = \\vif,ant,pol,agr => case vif of {
|
||||
VIFin t => vp.s ! VIPass t ! ant ! pol ! agr ;
|
||||
_ => vp.s ! vif ! ant ! pol ! agr
|
||||
} ;
|
||||
-}
|
||||
s2 = vp.s2 ;
|
||||
adv = vp.adv ;
|
||||
ext = vp.ext ;
|
||||
@@ -249,7 +254,8 @@ concrete ExtraFin of ExtraFinAbs = CatFin **
|
||||
---- sinua olen rakastanut minä -> sinua olen minä rakastanus
|
||||
|
||||
PassAgentVPSlash vp np = {
|
||||
s = \\vif,ant,pol,agr => vp.s ! vif ! ant ! pol ! np.a ; -- only agr changes
|
||||
s = vp.s ; ---- TODO
|
||||
---- s = \\vif,ant,pol,agr => vp.s ! vif ! ant ! pol ! np.a ; -- only agr changes
|
||||
s2 = \\b,p,a => np.s ! NPCase Nom ++ vp.s2 ! b ! p ! a ;
|
||||
adv = vp.adv ;
|
||||
ext = vp.ext ;
|
||||
|
||||
@@ -37,11 +37,16 @@ concrete IdiomFin of Idiom = CatFin **
|
||||
|
||||
ImpersCl vp = mkClause noSubj (agrP3 Sg) vp ;
|
||||
|
||||
---- TODO properlu
|
||||
GenericCl vp = mkClause noSubj (agrP3 Sg) {
|
||||
{- ----
|
||||
s = \\vif,ant,pol,agr => case vif of {
|
||||
VIFin t => vp.s ! VIPass t ! ant ! pol ! agr ;
|
||||
_ => vp.s ! vif ! ant ! pol ! agr
|
||||
} ;
|
||||
-}
|
||||
s = vp.s ; ----
|
||||
|
||||
s2 = vp.s2 ;
|
||||
adv = vp.adv ;
|
||||
ext = vp.ext ;
|
||||
@@ -52,7 +57,7 @@ concrete IdiomFin of Idiom = CatFin **
|
||||
|
||||
ProgrVP vp =
|
||||
let
|
||||
inf = (vp.s ! VIInf Inf3Iness ! Simul ! Pos ! agrP3 Sg).fin ;
|
||||
inf = vp.s.s ! Inf Inf3Iness ;
|
||||
on = predV olla
|
||||
in {
|
||||
s = on.s ;
|
||||
@@ -63,13 +68,10 @@ concrete IdiomFin of Idiom = CatFin **
|
||||
h = vp.h ; isNeg = vp.isNeg
|
||||
} ;
|
||||
|
||||
-- This gives "otetaan oluet" instead of "ottakaamme oluet".
|
||||
-- The imperative is not available in a $VP$.
|
||||
|
||||
ImpPl1 vp =
|
||||
let vps = vp.s ! VIPass Pres ! Simul ! Pos ! Ag Pl P1
|
||||
let vps = vp.s.s ! ImperP1Pl
|
||||
in
|
||||
{s = vps.fin ++ vps.inf ++
|
||||
{s = vps ++
|
||||
vp.s2 ! True ! Pos ! Ag Pl P1 ++ vp.ext
|
||||
} ;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ concrete QuestionFin of Question = CatFin ** open ResFin, Prelude in {
|
||||
|
||||
QuestVP ip vp =
|
||||
let
|
||||
cl = mkClause (subjForm (ip ** {isPron = False ; a = agrP3 ip.n}) vp.sc) (agrP3 ip.n) vp
|
||||
cl = mkClause (subjForm (ip ** {isPron = False ; a = agrP3 ip.n}) vp.s.sc) (agrP3 ip.n) vp
|
||||
in {
|
||||
s = \\t,a,p => cl.s ! t ! a ! p ! SDecl
|
||||
} ;
|
||||
@@ -33,7 +33,7 @@ concrete QuestionFin of Question = CatFin ** open ResFin, Prelude in {
|
||||
s = \\t,a,p =>
|
||||
let
|
||||
vp = predV (verbOlla ** {sc = NPCase Nom ; h = Back ; p = []}) ;
|
||||
cl = mkClause (subjForm np vp.sc) np.a vp ;
|
||||
cl = mkClause (subjForm np vp.s.sc) np.a vp ;
|
||||
in
|
||||
icomp.s ! np.a ++ cl.s ! t ! a ! p ! SDecl
|
||||
} ;
|
||||
|
||||
@@ -20,7 +20,7 @@ concrete RelativeFin of Relative = CatFin ** open Prelude, ResFin, MorphoFin in
|
||||
} ;
|
||||
cl = mkClause
|
||||
(subjForm {s = rp.s ! (complNumAgr agr) ;
|
||||
a = agr ; isPron = False} vp.sc) agr vp
|
||||
a = agr ; isPron = False} vp.s.sc) agr vp
|
||||
in
|
||||
cl.s ! t ! ant ! b ! SDecl ;
|
||||
c = NPCase Nom
|
||||
|
||||
@@ -210,7 +210,27 @@ param
|
||||
;
|
||||
|
||||
oper
|
||||
|
||||
|
||||
VP = {
|
||||
s : HVerb ;
|
||||
s2 : Bool => Polarity => Agr => Str ; -- talo/talon/taloa
|
||||
adv : Polarity => Str ; -- ainakin/ainakaan
|
||||
ext : Str ;
|
||||
isNeg : Bool ; -- True if some complement is negative
|
||||
} ;
|
||||
|
||||
HVerb : Type = Verb ** {sc : NPForm ; h : Harmony ; p : Str} ;
|
||||
|
||||
predV : HVerb -> VP = \verb -> {
|
||||
s = verb ;
|
||||
s2 = \\_,_,_ => [] ;
|
||||
adv = \\_ => verb.p ; -- the particle of the verb
|
||||
ext = [] ;
|
||||
isNeg = False
|
||||
} ;
|
||||
|
||||
old_VP = {
|
||||
s : VIForm => Anteriority => Polarity => Agr => {fin, inf : Str} ;
|
||||
s2 : Bool => Polarity => Agr => Str ; -- talo/talon/taloa
|
||||
adv : Polarity => Str ; -- ainakin/ainakaan
|
||||
@@ -219,8 +239,8 @@ oper
|
||||
isNeg : Bool ; -- True if some complement is negative
|
||||
h : Harmony
|
||||
} ;
|
||||
|
||||
predV : (Verb ** {sc : NPForm ; h : Harmony ; p : Str}) -> VP = \verb -> {
|
||||
|
||||
vp2old_vp : VP -> old_VP = \vp -> let verb = vp.s in {
|
||||
s = \\vi,ant,b,agr0 =>
|
||||
let
|
||||
|
||||
@@ -289,12 +309,12 @@ oper
|
||||
VIInf i => mkvf (Inf i)
|
||||
} ;
|
||||
|
||||
s2 = \\_,_,_ => [] ;
|
||||
adv = \\_ => verb.p ; -- the particle of the verb
|
||||
ext = [] ;
|
||||
s2 = vp.s2 ;
|
||||
adv = vp.adv ; -- the particle of the verb
|
||||
ext = vp.ext ;
|
||||
sc = verb.sc ;
|
||||
h = verb.h ;
|
||||
isNeg = False
|
||||
isNeg = vp.isNeg
|
||||
} ;
|
||||
|
||||
insertObj : (Bool => Polarity => Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
@@ -372,7 +392,7 @@ oper
|
||||
} ;
|
||||
|
||||
mkClausePlus : (Polarity -> Str) -> Agr -> VP -> ClausePlus =
|
||||
\sub,agr,vp -> {
|
||||
\sub,agr,vp0 -> let vp = vp2old_vp vp0 in {
|
||||
s = \\t,a,b =>
|
||||
let
|
||||
agrfin = case vp.sc of {
|
||||
@@ -386,7 +406,7 @@ oper
|
||||
compl = vp.s2 ! agrfin.p2 ! b ! agr ;
|
||||
adv = vp.adv ! b ;
|
||||
ext = vp.ext ;
|
||||
h = selectPart vp a b
|
||||
h = selectPart vp0 a b
|
||||
}
|
||||
} ;
|
||||
|
||||
@@ -438,22 +458,23 @@ oper
|
||||
Neg => Front ; -- eikö tule
|
||||
_ => case a of {
|
||||
Anter => Back ; -- onko mennyt --# notpresent
|
||||
_ => vp.h -- tuleeko, meneekö
|
||||
_ => vp.s.h -- tuleeko, meneekö
|
||||
}
|
||||
} ;
|
||||
|
||||
-- the first Polarity is VP-internal, the second comes form the main verb:
|
||||
-- ([main] tahdon | en tahdo) ([internal] nukkua | olla nukkumatta)
|
||||
infVPGen : Polarity -> NPForm -> Polarity -> Agr -> VP -> InfForm -> Str =
|
||||
\ipol,sc,pol,agr,vp,vi ->
|
||||
\ipol,sc,pol,agr,vp0,vi ->
|
||||
let
|
||||
vp = vp2old_vp vp0 ;
|
||||
fin = case sc of { -- subject case
|
||||
NPCase Nom => True ; -- minä tahdon nähdä auton
|
||||
_ => False -- minun täytyy nähdä auto
|
||||
} ;
|
||||
verb = case ipol of {
|
||||
Pos => <vp.s ! VIInf vi ! Simul ! Pos ! agr, []> ; -- nähdä/näkemään
|
||||
Neg => <(predV (verbOlla ** {sc = NPCase Nom ; h = Back ; p = []})).s ! VIInf vi ! Simul ! Pos ! agr,
|
||||
Neg => <(vp2old_vp (predV (verbOlla ** {sc = NPCase Nom ; h = Back ; p = []}))).s ! VIInf vi ! Simul ! Pos ! agr,
|
||||
(vp.s ! VIInf Inf3Abess ! Simul ! Pos ! agr).fin> -- olla/olemaan näkemättä
|
||||
} ;
|
||||
vph = vp.h ;
|
||||
|
||||
@@ -5,11 +5,11 @@ concrete SentenceFin of Sentence = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
|
||||
lin
|
||||
|
||||
PredVP np vp = mkClausePol (orB np.isNeg vp.isNeg) (subjForm np vp.sc) np.a vp ;
|
||||
PredVP np vp = mkClausePol (orB np.isNeg vp.isNeg) (subjForm np vp.s.sc) np.a vp ;
|
||||
|
||||
PredSCVP sc vp = mkClause (\_ -> sc.s) (agrP3 Sg) vp ;
|
||||
|
||||
ImpVP vp = {
|
||||
ImpVP vp0 = let vp = vp2old_vp vp0 in {
|
||||
s = \\pol,agr =>
|
||||
let
|
||||
verb = vp.s ! VIImper ! Simul ! pol ! agr ;
|
||||
@@ -21,7 +21,7 @@ concrete SentenceFin of Sentence = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
-- The object case is formed at the use site of $c2$, in $Relative$ and $Question$.
|
||||
|
||||
SlashVP np vp = {
|
||||
s = \\t,a,p => (mkClause (subjForm np vp.sc) np.a vp).s ! t ! a ! p ! SDecl ;
|
||||
s = \\t,a,p => (mkClause (subjForm np vp.s.sc) np.a vp).s ! t ! a ! p ! SDecl ;
|
||||
c2 = vp.c2
|
||||
} ;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
insertObj
|
||||
(\\_,b,a => infVP v.sc b a vp v.vi)
|
||||
(predSV {s = v.s ;
|
||||
sc = case vp.sc of {
|
||||
sc = case vp.s.sc of {
|
||||
NPCase Nom => v.sc ; -- minun täytyy pestä auto
|
||||
c => c -- minulla täytyy olla auto
|
||||
} ;
|
||||
@@ -61,7 +61,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
insertObj
|
||||
(\\_,b,a => infVP v.sc b a vp v.vi)
|
||||
(predSV {s = v.s ;
|
||||
sc = case vp.sc of {
|
||||
sc = case vp.s.sc of {
|
||||
NPCase Nom => v.sc ; -- minun täytyy pestä auto
|
||||
c => c -- minulla täytyy olla auto
|
||||
} ;
|
||||
@@ -82,10 +82,14 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
ReflVP v = insertObjPre False (\fin,b,agr -> appCompl fin b v.c2 (reflPron agr)) v ;
|
||||
|
||||
PassV2 v = let vp = predSV v in {
|
||||
---- TODO
|
||||
{- ----
|
||||
s = \\vif,ant,pol,agr => case vif of {
|
||||
VIFin t => vp.s ! VIPass t ! ant ! pol ! agr ;
|
||||
_ => vp.s ! vif ! ant ! pol ! agr
|
||||
} ;
|
||||
-}
|
||||
s = vp.s ;
|
||||
s2 = \\_,_,_ => [] ;
|
||||
adv = \\_ => [] ;
|
||||
ext = [] ;
|
||||
@@ -94,8 +98,6 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin, StemFin in {
|
||||
sc = v.c2.c ; -- minut valitaan ; minua rakastetaan ; minulle kuiskataan
|
||||
} ; ---- talon valitaan: should be marked like inf.
|
||||
|
||||
----b UseVS, UseVQ = \v -> v ** {c2 = {s = [] ; c = NPAcc ; isPre = True}} ;
|
||||
|
||||
CompAP ap = {
|
||||
s = \\agr =>
|
||||
let
|
||||
|
||||
@@ -30,7 +30,7 @@ lin
|
||||
insertObj
|
||||
(\\_,b,a => infVPGen pol.p v.sc b a vp v.vi)
|
||||
(predSV {s = v.s ;
|
||||
sc = case vp.sc of {
|
||||
sc = case vp.s.sc of {
|
||||
NPCase Nom => v.sc ; -- minun täytyy pestä auto
|
||||
c => c -- minulla täytyy olla auto
|
||||
} ;
|
||||
@@ -96,7 +96,7 @@ lin
|
||||
insertObj (\\_,b,a => infVPGen p.p v.sc b a vp v.vi) (predSV v) ** {c2 = v.c2} ;
|
||||
|
||||
CompS s = {s = \\_ => "että" ++ s.s} ; -- S -> Comp ---- what are these expected to do ? 29/3/2013
|
||||
CompVP ant pol vp = {s = \\a => infVPGen pol.p vp.sc Pos a vp Inf1} ; -- VP -> Comp
|
||||
CompVP ant pol vp = {s = \\a => infVPGen pol.p vp.s.sc Pos a vp Inf1} ; -- VP -> Comp
|
||||
|
||||
|
||||
that_RP = which_RP ;
|
||||
|
||||
@@ -503,7 +503,7 @@ oper
|
||||
|
||||
slashV2VNP : (SVerb1 ** {c2 : Compl ; vi : InfForm}) -> (NP ** {isNeg : Bool}) ->
|
||||
(VP ** {c2 : Compl}) -> (VP ** {c2 : Compl})
|
||||
= \v, np, vp ->
|
||||
= \v, np, vp0 -> let vp = vp2old_vp vp0 ** {c2 = vp0.c2} in
|
||||
insertObjPre False ---- ignoring np.isNeg
|
||||
(\fin,b,a -> np.s ! v.c2.c ++ vp.c2.s ++
|
||||
---- appCompl fin b v.c2 np ++ -- ignoring Acc variation and pre/postposition
|
||||
|
||||
Reference in New Issue
Block a user