mirror of
https://github.com/GrammaticalFramework/gf-rgl.git
synced 2026-05-27 17:08:54 -06:00
(Som) IAdv + related functions
This commit is contained in:
@@ -11,14 +11,7 @@ lin
|
||||
-- ComparAdvAdjS : CAdv -> A -> S -> Adv ; -- more warmly than he runs
|
||||
|
||||
-- : Prep -> NP -> Adv ;
|
||||
PrepNP prep np = prep ** {
|
||||
np = case prep.isPoss of {
|
||||
True => nplite emptyNP ;
|
||||
False => nplite np } ;
|
||||
miscAdv = case prep.isPoss of {
|
||||
True => np.s ! Abs ++ prep.miscAdv ! np.a ;
|
||||
False => prep.miscAdv ! Sg3 Masc }
|
||||
} ;
|
||||
PrepNP = prepNP ;
|
||||
|
||||
-- Adverbs can be modified by 'adadjectives', just like adjectives.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
concrete CatSom of Cat = CommonX - [Adv,IAdv] ** open ResSom, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
@@ -84,11 +84,7 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
-- Constructed in StructuralSom.
|
||||
Conj = {s2 : State => Str ; s1 : Str ; n : Number } ;
|
||||
Subj = SS ;
|
||||
Prep = ResSom.Prep ** {
|
||||
isPoss : Bool ;
|
||||
c2 : Preposition ;
|
||||
berri, sii, dhex : Str ;
|
||||
miscAdv : Agreement => Str } ;
|
||||
Prep = ResSom.Prep ;
|
||||
|
||||
|
||||
|
||||
@@ -120,7 +116,8 @@ concrete CatSom of Cat = CommonX - [Adv] ** open ResSom, Prelude in {
|
||||
N3 = ResSom.Noun3 ;
|
||||
PN = ResSom.PNoun ;
|
||||
|
||||
Adv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb.
|
||||
Adv,
|
||||
IAdv = ResSom.Adverb ; -- Preposition of an adverbial can merge with obligatory complements of the verb.
|
||||
|
||||
linref
|
||||
-- Cl = linCl ;
|
||||
|
||||
@@ -9,10 +9,10 @@ concrete GrammarSom of Grammar =
|
||||
RelativeSom,
|
||||
ConjunctionSom,
|
||||
PhraseSom,
|
||||
TextX - [Adv],
|
||||
TextX - [Adv,IAdv],
|
||||
StructuralSom,
|
||||
IdiomSom,
|
||||
TenseX - [Adv]
|
||||
TenseX - [Adv,IAdv]
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
@@ -13,10 +13,10 @@ concrete PhraseSom of Phrase = CatSom ** open Prelude, ResSom in {
|
||||
UttImpPol = UttImpSg ;
|
||||
|
||||
UttIP ip = {s = ip.s ! Abs} ;
|
||||
UttIAdv iadv = iadv ;
|
||||
UttNP np = {s = np.s ! Abs} ;
|
||||
UttVP vp = {s = infVP vp} ;
|
||||
UttAdv adv = {s = linAdv adv} ;
|
||||
UttAdv,
|
||||
UttIAdv = \adv -> {s = linAdv adv} ;
|
||||
UttCN n = {s = linCN n} ;
|
||||
UttCard n = {s = n.s ! Mid} ;
|
||||
UttAP ap = { s = ap.s ! AF Sg Abs } ;
|
||||
|
||||
@@ -22,7 +22,16 @@ concrete QuestionSom of Question = CatSom ** open
|
||||
--QuestSlash ip cls = ;
|
||||
|
||||
-- : IAdv -> Cl -> QCl ; -- why does John walk
|
||||
-- QuestIAdv iadv cl = { } ;
|
||||
QuestIAdv iadv cls =
|
||||
let clRaw : ClSlash = insertIAdv iadv cls ;
|
||||
sbj = clRaw.subj ;
|
||||
cl : ClSlash = clRaw ** {
|
||||
stm = \\clt,p => case <clt,p> of {
|
||||
-- IAdv is focused
|
||||
<_,Pos> => "baa" ++ sbj.pron ++ sbj.noun;
|
||||
_ => clRaw.stm ! clt ! p } ;
|
||||
subj = {noun, pron = [] ; isP3 = True}}
|
||||
in cl2qcl cl ;
|
||||
|
||||
-- : IComp -> NP -> QCl ; -- where is John?
|
||||
-- QuestIComp icomp np = ;
|
||||
@@ -47,21 +56,21 @@ concrete QuestionSom of Question = CatSom ** open
|
||||
|
||||
-- Interrogative adverbs can be formed prepositionally.
|
||||
-- : Prep -> IP -> IAdv ; -- with whom
|
||||
PrepIP prep ip = let a = AS.PrepNP prep ip in a ** {s = a.berri} ;
|
||||
PrepIP = AS.PrepNP ;
|
||||
|
||||
-- They can be modified with other adverbs.
|
||||
|
||||
-- : IAdv -> Adv -> IAdv ; -- where in Paris
|
||||
AdvIAdv iadv adv = iadv ** {s = iadv.s ++ adv.berri} ;
|
||||
-- AdvIAdv iadv adv = iadv ** {s = iadv.s ++ adv.berri} ; -- TODO do we need PrepCombination in IAdv?
|
||||
|
||||
-- Interrogative complements to copulas can be both adverbs and
|
||||
-- pronouns.
|
||||
|
||||
-- : IAdv -> IComp ;
|
||||
CompIAdv iadv = iadv ; -- where (is it)
|
||||
--CompIAdv iadv = iadv ; -- where (is it)
|
||||
|
||||
-- : IP -> IComp ;
|
||||
CompIP ip = { s = ip.s ! Abs } ; -- who (is it)
|
||||
--CompIP ip = { s = ip.s ! Abs } ; -- who (is it)
|
||||
|
||||
{-
|
||||
-- More $IP$, $IDet$, and $IAdv$ are defined in $Structural$.
|
||||
|
||||
@@ -170,6 +170,8 @@ oper
|
||||
|
||||
impersNP : NounPhrase = pronTable ! Impers ;
|
||||
|
||||
indeclNP : Str -> NounPhrase = \s -> emptyNP ** {s = \\c => s} ;
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Pronouns
|
||||
|
||||
@@ -344,9 +346,14 @@ oper
|
||||
--------------------------------------------------------------------------------
|
||||
-- Prepositions
|
||||
|
||||
Prep : Type = {s : PrepAgr => Str} ;
|
||||
Prep : Type = {
|
||||
s : PrepAgr => Str ;
|
||||
c2 : Preposition ;
|
||||
isPoss : Bool ;
|
||||
berri, sii, dhex : Str ;
|
||||
miscAdv : Agreement => Str } ;
|
||||
|
||||
mkPrep : (x1,_,_,_,_,x6 : Str) -> Prep = \ku,ii,kuu,noo,idiin,isku -> {
|
||||
mkPrep : (x1,_,_,_,_,x6 : Str) -> {s : PrepAgr => Str} = \ku,ii,kuu,noo,idiin,isku -> {
|
||||
s = table {
|
||||
P3_Prep => ku ;
|
||||
Sg1_Prep => ii ;
|
||||
@@ -357,9 +364,10 @@ oper
|
||||
Reflexive_Prep => isku
|
||||
}
|
||||
} ;
|
||||
prep : Preposition -> (Prep ** {c2 : Preposition}) = \p -> prepTable ! p ** {c2 = p} ;
|
||||
prep : Preposition -> {s : PrepAgr => Str ; c2 : Preposition} = \p ->
|
||||
prepTable ! p ** {c2 = p} ;
|
||||
|
||||
prepTable : Preposition => Prep = table {
|
||||
prepTable : Preposition => {s : PrepAgr => Str} = table {
|
||||
Ku => mkPrep "ku" "igu" "kugu" "nagu" "idinku" "isku" ;
|
||||
Ka => mkPrep "ka" "iga" "kaa" "naga" "idinka" "iska" ;
|
||||
La => mkPrep "la" "ila" "kula" "nala" "idinla" "isla" ;
|
||||
@@ -675,7 +683,7 @@ oper
|
||||
} ;
|
||||
|
||||
------------------
|
||||
-- VP
|
||||
-- Adv
|
||||
|
||||
BaseAdv : Type = {
|
||||
sii, -- sii, soo, wala, kada go inside VP.
|
||||
@@ -689,6 +697,18 @@ oper
|
||||
np : NPLite ; -- NP from PrepNP can be promoted into a core argument.
|
||||
} ;
|
||||
|
||||
prepNP : Prep -> NounPhrase -> Adverb = \prep,np -> prep ** {
|
||||
np = case prep.isPoss of {
|
||||
True => nplite emptyNP ;
|
||||
False => nplite np } ;
|
||||
miscAdv = case prep.isPoss of {
|
||||
True => np.s ! Abs ++ prep.miscAdv ! np.a ;
|
||||
False => prep.miscAdv ! Sg3 Masc }
|
||||
} ;
|
||||
|
||||
------------------
|
||||
-- VP
|
||||
|
||||
Complement : Type = {
|
||||
comp : Agreement => {p1,p2 : Str} ; -- Agreement for AP complements
|
||||
stm : STM ; -- to choose right sentence type marker
|
||||
@@ -754,9 +774,21 @@ oper
|
||||
} ;
|
||||
|
||||
insertComp : VPSlash -> NounPhrase -> VerbPhrase = \vp,np ->
|
||||
insertCompLite vp (nplite np) ;
|
||||
vp ** insertCompLite vp (nplite np) ;
|
||||
|
||||
insertCompLite : VPSlash -> NPLite -> VerbPhrase = \vp,nplite ->
|
||||
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
|
||||
vp ** insertAdvLite vp adv ;
|
||||
|
||||
insertIAdv : Adverb -> ClSlash -> ClSlash = \adv,cls ->
|
||||
cls ** insertAdvLite cls adv ;
|
||||
|
||||
-- To generalise insertAdv and insertComp
|
||||
VPLite : Type = {
|
||||
c2 : PrepCombination ;
|
||||
obj2 : NPLite ;
|
||||
sii,dhex,berri,miscAdv,secObj : Str} ;
|
||||
|
||||
insertCompLite : VPLite -> NPLite -> VPLite = \vp,nplite ->
|
||||
case vp.obj2.a of {
|
||||
-- If the old object is 3rd person (or nonexistent), we replace its agreement.
|
||||
-- We keep both old and new string (=noun, if there was one) in obj2.s.
|
||||
@@ -772,10 +804,9 @@ oper
|
||||
s = vp.obj2.s ++ nplite.s
|
||||
} ;
|
||||
secObj = vp.secObj ++ secondObject ! nplite.a}
|
||||
|
||||
} ;
|
||||
|
||||
insertAdv : VerbPhrase -> Adverb -> VerbPhrase = \vp,adv ->
|
||||
insertAdvLite : VPLite -> Adverb -> VPLite = \vp,adv ->
|
||||
case adv.c2 of {
|
||||
NoPrep => vp ** adv'' ; -- the adverb is not formed with PrepNP, e.g. "tomorrow"
|
||||
_ => case vp.c2 of {
|
||||
|
||||
@@ -15,8 +15,9 @@ lin very_AdA = mkAdA "" ;
|
||||
lin as_CAdv = { s = "" ; p = [] } ;
|
||||
lin less_CAdv = { s = "" ; p = [] } ;
|
||||
lin more_CAdv = { s = "" ; p = [] } ;
|
||||
|
||||
lin how_IAdv = ss "" ;
|
||||
-}
|
||||
lin how_IAdv = prepNP (mkPrep (mkPrep u) "sidee" [] []) emptyNP ;
|
||||
{-
|
||||
lin how8much_IAdv = ss "" ;
|
||||
lin when_IAdv = ss "" ;
|
||||
lin where_IAdv = ss "" ;
|
||||
|
||||
Reference in New Issue
Block a user