mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-06-03 07:08:54 -06:00
Swedish resource almost ready.
This commit is contained in:
@@ -195,6 +195,17 @@ oper
|
||||
Pl => man.s ! Pl ! IndefP ! Nom
|
||||
} ;
|
||||
|
||||
-- Constructions like "tanken att två är jämnt" are formed at the
|
||||
-- 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 ++ "att" ++ x.s ! Sub ;
|
||||
g = tanke.g ;
|
||||
x = tanke.x ;
|
||||
p = tanke.p
|
||||
} ;
|
||||
|
||||
|
||||
--2 Adjectives
|
||||
--3 Simple adjectives
|
||||
--
|
||||
@@ -371,6 +382,18 @@ oper
|
||||
npGenDet nf x (noun2CommNounPhrase värde)
|
||||
} ;
|
||||
|
||||
-- Two-place functions add one argument place.
|
||||
|
||||
Function2 = Function ** {s3 : Preposition} ;
|
||||
|
||||
-- There application starts by filling the first place.
|
||||
|
||||
appFun2 : Function2 -> NounPhrase -> Function = \flyg, paris ->
|
||||
{s = \\n,d,c => flyg.s ! n ! d ! c ++ flyg.s2 ++ paris.s ! PAcc ;
|
||||
g = flyg.g ;
|
||||
x = flyg.x ;
|
||||
s2 = flyg.s3
|
||||
} ;
|
||||
|
||||
|
||||
--2 Verbs
|
||||
@@ -453,7 +476,47 @@ oper
|
||||
-- The rule for using transitive verbs is the complementization rule:
|
||||
|
||||
complTransVerb : Bool -> TransVerb -> NounPhrase -> VerbPhrase = \b,se,dig ->
|
||||
{s = se.s ; s2 = negation b ; s3 = \\_,_ => se.s2 ++ dig.s ! PAcc} ;
|
||||
{s = se.s ;
|
||||
s2 = negation b ;
|
||||
s3 = \\_,_ => se.s2 ++ dig.s ! PAcc
|
||||
} ;
|
||||
|
||||
-- Transitive verbs with accusative objects can be used passively.
|
||||
-- The function does not check that the verb is transitive.
|
||||
-- Therefore, the function can also be used for "han löps", etc.
|
||||
-- The syntax is the same as for active verbs, with the choice of the
|
||||
-- "s" passive form.
|
||||
|
||||
passVerb : Bool -> Verb -> VerbPhrase = \b,se -> ---- passive not yet
|
||||
se ** {
|
||||
s2 = negation b ;
|
||||
s3 = \\_,_ => []
|
||||
} ;
|
||||
|
||||
-- Transitive verbs can be used elliptically as verbs. The semantics
|
||||
-- is left to applications. The definition is trivial, due to record
|
||||
-- subtyping.
|
||||
|
||||
transAsVerb : TransVerb -> Verb = \love ->
|
||||
love ;
|
||||
|
||||
-- *Ditransitive verbs* are verbs with three argument places.
|
||||
-- We treat so far only the rule in which the ditransitive
|
||||
-- verb takes both complements to form a verb phrase.
|
||||
|
||||
DitransVerb = TransVerb ** {s3 : Preposition} ;
|
||||
|
||||
mkDitransVerb : Verb -> Preposition -> Preposition -> DitransVerb = \v,p1,p2 ->
|
||||
v ** {s3 = p1 ; s3 = p2} ;
|
||||
|
||||
complDitransVerb :
|
||||
Bool -> DitransVerb -> NounPhrase -> NounPhrase -> VerbPhrase =
|
||||
\b,ge,dig,vin ->
|
||||
{s = ge.s ;
|
||||
s2 = negation b ;
|
||||
s3 = \\_,_ => ge.s2 ++ dig.s ! PAcc ++ ge.s3 ++ vin.s ! PAcc
|
||||
} ;
|
||||
|
||||
|
||||
--2 Adverbials
|
||||
--
|
||||
@@ -475,6 +538,11 @@ oper
|
||||
s3 = \\g,n => spelar.s3 ! g ! n ++ (if_then_else Str postp bra.s [])
|
||||
} ;
|
||||
|
||||
advAdjPhrase : Adverb -> AdjPhrase -> AdjPhrase = \mycket, dyr ->
|
||||
{s = \\a,c => mycket.s ++ dyr.s ! a ! c ;
|
||||
p = dyr.p
|
||||
} ;
|
||||
|
||||
-- Adverbials are typically generated by prefixing prepositions.
|
||||
-- The rule for creating locative noun phrases by the preposition "i"
|
||||
-- is a little shaky: "i Sverige" but "på Island".
|
||||
@@ -830,6 +898,14 @@ oper
|
||||
imperUtterance : Number -> Imperative -> Utterance = \n,I ->
|
||||
ss (I.s ! n ++ "!") ;
|
||||
|
||||
--2 Sentence adverbials
|
||||
--
|
||||
-- This class covers adverbials such as "annars", "därför", which are prefixed
|
||||
-- to a sentence to form a phrase.
|
||||
|
||||
advSentence : Adverb -> Sentence -> Utterance = \annars,soverhan ->
|
||||
ss (annars.s ++ soverhan.s ! Inv ++ ".") ;
|
||||
|
||||
|
||||
--2 Coordination
|
||||
--
|
||||
@@ -975,6 +1051,10 @@ oper
|
||||
let {As = A.s ! Sub} in
|
||||
variants {if.s ++ As ++ "," ++ B ; B ++ "," ++ if.s ++ As} ;
|
||||
|
||||
subjunctVerbPhrase : VerbPhrase -> Subjunction -> Sentence -> VerbPhrase =
|
||||
\V, if, A ->
|
||||
adVerbPhrase V (advPost (if.s ++ A.s ! Sub)) ;
|
||||
|
||||
--2 One-word utterances
|
||||
--
|
||||
-- An utterance can consist of one phrase of almost any category,
|
||||
|
||||
Reference in New Issue
Block a user