summaryrefslogtreecommitdiff
path: root/grammars/resource/swedish/SyntaxSwe.gf
diff options
context:
space:
mode:
authoraarne <unknown>2003-11-05 14:41:34 +0000
committeraarne <unknown>2003-11-05 14:41:34 +0000
commited1d2a2954a3c955625cf210905a67e0683c8411 (patch)
treef835c7f062fb748bb9f25a0ea187184043d5f741 /grammars/resource/swedish/SyntaxSwe.gf
parentc75a0ee9209e82ce3ffcea80ed1fae0eb30aa807 (diff)
Swedish resource almost ready.
Diffstat (limited to 'grammars/resource/swedish/SyntaxSwe.gf')
-rw-r--r--grammars/resource/swedish/SyntaxSwe.gf82
1 files changed, 81 insertions, 1 deletions
diff --git a/grammars/resource/swedish/SyntaxSwe.gf b/grammars/resource/swedish/SyntaxSwe.gf
index 2deb412bc..25dcd3e18 100644
--- a/grammars/resource/swedish/SyntaxSwe.gf
+++ b/grammars/resource/swedish/SyntaxSwe.gf
@@ -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,