summaryrefslogtreecommitdiff
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
parentc75a0ee9209e82ce3ffcea80ed1fae0eb30aa807 (diff)
Swedish resource almost ready.
-rw-r--r--grammars/resource/swedish/MorphoSwe.gf14
-rw-r--r--grammars/resource/swedish/ResSwe.gf30
-rw-r--r--grammars/resource/swedish/SyntaxSwe.gf82
-rw-r--r--grammars/resource/swedish/TestSwe.gf6
4 files changed, 128 insertions, 4 deletions
diff --git a/grammars/resource/swedish/MorphoSwe.gf b/grammars/resource/swedish/MorphoSwe.gf
index bacf136d6..af2095227 100644
--- a/grammars/resource/swedish/MorphoSwe.gf
+++ b/grammars/resource/swedish/MorphoSwe.gf
@@ -147,6 +147,20 @@ oper sSak : Str -> Subst = \sak ->
h1 = Utr
} ;
+oper sVarelse : Str -> Subst = \varelse ->
+ {s = table {
+ SF Sg Indef Nom => varelse ;
+ SF Sg Indef Gen => varelse + "s" ;
+ SF Sg Def Nom => varelse + "n" ;
+ SF Sg Def Gen => varelse + "ns" ;
+ SF Pl Indef Nom => varelse + "r" ;
+ SF Pl Indef Gen => varelse + "rs" ;
+ SF Pl Def Nom => varelse + "rna" ;
+ SF Pl Def Gen => varelse + "rnas"
+ } ;
+ h1 = Utr
+ } ;
+
oper sNivå : Str -> Subst = \nivå ->
{s = table {
SF Sg Indef Nom => nivå ;
diff --git a/grammars/resource/swedish/ResSwe.gf b/grammars/resource/swedish/ResSwe.gf
index 725708a67..ba6be8c7f 100644
--- a/grammars/resource/swedish/ResSwe.gf
+++ b/grammars/resource/swedish/ResSwe.gf
@@ -32,7 +32,9 @@ lincat
-- = {s : NPForm => Str ; g : Gender ; n : Number} ;
PN = {s : Case => Str ; g : Gender ; x : Sex} ;
Det = {s : Gender => Sex => Str ; n : Number ; b : SpeciesP} ;
- Fun = CommNoun ** {s2 : Preposition} ;
+ Fun = Function ;
+ -- = CommNoun ** {s2 : Preposition} ;
+ Fun2 = Function ** {s3 : Preposition} ;
Adj1 = Adjective ;
-- = {s : AdjFormPos => Case => Str} ;
@@ -43,7 +45,9 @@ lincat
V = Verb ;
-- = {s : VForm => Str} ;
VP = Verb ** {s2 : Str ; s3 : Gender => Number => Str} ;
- TV = Verb ** {s2 : Preposition} ;
+ TV = TransVerb ;
+ -- = Verb ** {s2 : Preposition} ;
+ V3 = TransVerb ** {s3 : Preposition} ;
VS = Verb ;
AdV = {s : Str ; isPost : Bool} ;
@@ -76,6 +80,7 @@ lin
UsePN = nameNounPhrase ;
UseFun = funAsCommNounPhrase ;
AppFun = appFunComm ;
+ AppFun2 = appFun2 ;
AdjP1 = adj2adjPhrase ;
ComplAdj = complAdj ;
PositAdjP = positAdjPhrase ;
@@ -88,6 +93,8 @@ lin
DefOneNP = defNounPhrase singular ;
DefManyNP = defNounPhrase plural ;
+ CNthatS = nounThatSentence ;
+
PredVP = predVerbPhrase ;
PosV = predVerb True ;
NegV = predVerb False ;
@@ -97,18 +104,24 @@ lin
NegCN = predCommNoun False ;
PosTV = complTransVerb True ;
NegTV = complTransVerb False ;
+ PosV3 = complDitransVerb True ;
+ NegV3 = complDitransVerb False ;
PosNP = predNounPhrase True ;
NegNP = predNounPhrase False ;
+ PosPassV = passVerb True ;
+ NegPassV = passVerb False ;
PosVS = complSentVerb True ;
NegVS = complSentVerb False ;
-
+ VTrans = transAsVerb ;
AdvVP = adVerbPhrase ;
LocNP = locativeNounPhrase ;
AdvCN = advCommNounPhrase ;
+ AdvAP = advAdjPhrase ;
PosSlashTV = slashTransVerb True ;
NegSlashTV = slashTransVerb False ;
+ OneVP = predVerbPhrase (nameNounPhrase (mkProperName "man" Utr Masc)) ;
IdRP = identRelPron ;
FunRP = funRelPron ;
@@ -137,6 +150,8 @@ lin
ImperOne = imperUtterance singular ;
ImperMany = imperUtterance plural ;
+ AdvS = advSentence ;
+
lin
TwoS = twoSentence ;
ConsS = consSentence ;
@@ -156,6 +171,7 @@ lin
SubjS = subjunctSentence ;
SubjImper = subjunctImperative ;
SubjQu = subjunctQuestion ;
+ SubjVP = subjunctVerbPhrase ;
PhrNP = useNounPhrase ;
PhrOneCN = useCommonNounPhrase singular ;
@@ -163,6 +179,9 @@ lin
PhrIP ip = ip ;
PhrIAdv ia = ia ;
+ OnePhr p = p ;
+ ConsPhr = cc2 ;
+
INP = pronNounPhrase jag_32 ;
ThouNP = pronNounPhrase du_33 ;
HeNP = pronNounPhrase han_34 ;
@@ -193,4 +212,9 @@ lin
PhrYes = ss ["Ja ."] ;
PhrNo = ss ["Nej ."] ;
+
+ VeryAdv = ss "mycket" ;
+ TooAdv = ss "för" ;
+ OtherwiseAdv = ss "annars" ;
+ ThereforeAdv = ss "därför" ;
} ;
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,
diff --git a/grammars/resource/swedish/TestSwe.gf b/grammars/resource/swedish/TestSwe.gf
index 3b6d8388a..05d02c5ee 100644
--- a/grammars/resource/swedish/TestSwe.gf
+++ b/grammars/resource/swedish/TestSwe.gf
@@ -25,6 +25,10 @@ lin
Love = extTransVerb (vTala "älsk") [] ;
Send = extTransVerb (vTala "skick") [] ;
Wait = extTransVerb (vTala "vänt") "på" ;
+ Give = extTransVerb (vFinna "giv" "gav" "giv") [] ** {s3 = "till"} ; --- ge
+ Prefer = extTransVerb (vFinna "föredrag" "föredrog" "föredrag") [] **
+ {s3 = "framför"} ; --- föredra
+
Say = extVerb Act (vLeka "säg") ; --- works in present tense...
Prove = extVerb Act (vTala "bevis") ;
SwitchOn = extTransVerb (vVända "tän") [] ;
@@ -32,6 +36,8 @@ lin
Mother = mkFun (extCommNoun NoMasc mor_1) "till" ;
Uncle = mkFun (extCommNoun Masc farbror_8) "till" ;
+ Connection = mkFun (extCommNoun NoMasc (sVarelse "förbindelse")) "från" **
+ {s3 = "till"} ;
Always = advPre "alltid" ;
Well = advPost "bra" ;