mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-20 02:09:32 -06:00
Structural.you*; reorganized scand
This commit is contained in:
@@ -86,7 +86,6 @@ abstract Structural = Cat ** {
|
||||
this_NP : NP ;
|
||||
those_NP : NP ;
|
||||
those_Quant : QuantPl ;
|
||||
thou_Pron : Pron ;
|
||||
through_Prep : Prep ;
|
||||
to_Prep : Prep ;
|
||||
too_AdA : AdA ;
|
||||
@@ -106,8 +105,9 @@ abstract Structural = Cat ** {
|
||||
why_IAdv : IAdv ;
|
||||
with_Prep : Prep ;
|
||||
without_Prep : Prep ;
|
||||
ye_Pron : Pron ;
|
||||
yes_Phr : Phr ;
|
||||
you_Pron : Pron ;
|
||||
youSg_Pron : Pron ;
|
||||
youPl_Pron : Pron ;
|
||||
youPol_Pron : Pron ;
|
||||
|
||||
}
|
||||
|
||||
@@ -76,14 +76,13 @@ concrete StructuralEng of Structural = CatEng **
|
||||
this_NP = regNP "this" Sg ;
|
||||
those_NP = regNP "those" Pl ;
|
||||
those_Quant = mkDeterminer Pl "those" ;
|
||||
thou_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
through_Prep = ss "through" ;
|
||||
too_AdA = ss "too" ;
|
||||
to_Prep = ss "to" ;
|
||||
under_Prep = ss "under" ;
|
||||
very_AdA = ss "very" ;
|
||||
want_VV = verbGen "want" ** {c2 = "to"} ;
|
||||
we_Pron = mkNP "we" "us" "our" Pl P1 ;
|
||||
we_Pron = mkNP "we" "us" "our" Pl P1 ;
|
||||
whatPl_IP = mkIP "what" "what" "what's" Sg ;
|
||||
whatSg_IP = mkIP "what" "what" "what's" Sg ;
|
||||
when_IAdv = ss "when" ;
|
||||
@@ -96,9 +95,10 @@ concrete StructuralEng of Structural = CatEng **
|
||||
why_IAdv = ss "why" ;
|
||||
without_Prep = ss "without" ;
|
||||
with_Prep = ss "with" ;
|
||||
ye_Pron = mkNP "you" "you" "your" Pl P2 ;
|
||||
you_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
yes_Phr = ss "yes" ;
|
||||
youSg_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
youPl_Pron = mkNP "you" "you" "your" Pl P2 ;
|
||||
youPol_Pron = mkNP "you" "you" "your" Sg P2 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ lin
|
||||
most_Predet = {s = \\_,c => prepCase c ++ ["la plupart"] ; c = CPrep P_de} ;
|
||||
much_Det = {s = \\_,c => prepCase c ++ "beaucoup" ++ elisDe ; n = Pl} ;
|
||||
must_VV = mkVV (devoir_V2 ** {lock_V = <>}) ;
|
||||
no_Phr = ss "non" ; --- and also Si!
|
||||
no_Phr = ss "non" ;
|
||||
on_Prep = mkPreposition "sur" ;
|
||||
one_Quant = {s = \\g,c => prepCase c ++ genForms "un" "une" ! g} ;
|
||||
only_Predet = {s = \\_,c => prepCase c ++ "seulement" ; c = Nom} ; --- seul(e)(s)
|
||||
@@ -95,9 +95,6 @@ lin
|
||||
this_NP = pn2np (mkPN ["ceci"] Masc) ;
|
||||
those_NP = pn2np (mkPN ["celles-là"] Fem) ;
|
||||
those_Quant = {s = \\_,c => prepCase c ++ "ces"} ; ---- là
|
||||
thou_Pron = mkPronoun
|
||||
"tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes"
|
||||
Fem Sg P2 Clit1 ;
|
||||
through_Prep = mkPreposition "par" ;
|
||||
too_AdA = ss "trop" ;
|
||||
to_Prep = complDat ;
|
||||
@@ -119,11 +116,14 @@ lin
|
||||
why_IAdv = ss "pourquoi" ;
|
||||
without_Prep = mkPreposition "sans" ;
|
||||
with_Prep = mkPreposition "avec" ;
|
||||
ye_Pron, you_Pron =
|
||||
yes_Phr = ss "oui" ; --- si
|
||||
youSg_Pron = mkPronoun
|
||||
"tu" (elision "t") (elision "t") "toi" "ton" (elisPoss "t") "tes"
|
||||
Fem Sg P2 Clit1 ;
|
||||
youPl_Pron, youPol_Pron =
|
||||
mkPronoun
|
||||
"vous" "vous" "vous" "vous" "votre" "votre" "vos"
|
||||
Fem Pl P2 Clit3 ;
|
||||
yes_Phr = ss "oui" ; --- si
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -95,7 +95,6 @@ concrete StructuralGer of Structural = CatGer **
|
||||
this_NP = nameNounPhrase {s = caselist "dies" "dies" "diesem" "dieses"} ; ----
|
||||
those_NP = {s = caselist "jene" "jene" "jenen" "jener" ; a = agrP3 Pl} ;
|
||||
those_Quant = detLikeAdj Pl "jen" ;
|
||||
thou_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
||||
through_Prep = mkPrep "durch" Acc ;
|
||||
too_AdA = ss "zu" ;
|
||||
to_Prep = mkPrep "nach" Dat ;
|
||||
@@ -123,7 +122,9 @@ concrete StructuralGer of Structural = CatGer **
|
||||
why_IAdv = ss "warum" ;
|
||||
without_Prep = mkPrep "ohne" Acc ;
|
||||
with_Prep = mkPrep "mit" Dat ;
|
||||
ye_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss
|
||||
youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
||||
youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss
|
||||
youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ;
|
||||
yes_Phr = ss ["Ja ."] ;
|
||||
you_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete AdjectiveScand of Adjective =
|
||||
CatScand ** open DiffScand, ResScand, Prelude in {
|
||||
CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
incomplete concrete AdverbScand of Adverb = CatScand ** open DiffScand, ResScand, Prelude in {
|
||||
incomplete concrete AdverbScand of Adverb = CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PositAdvAdj a = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete CatScand of Cat =
|
||||
open ResScand, Prelude, DiffScand, (R = ParamX) in {
|
||||
open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete ConjunctionScand of Conjunction =
|
||||
CatScand ** open ResScand, Coordination, Prelude in {
|
||||
CatScand ** open CommonScand, ResScand, Coordination, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
interface DiffScand = open ResScand, Prelude in {
|
||||
interface DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
-- Parameters.
|
||||
|
||||
@@ -47,69 +47,7 @@ interface DiffScand = open ResScand, Prelude in {
|
||||
|
||||
pronSuch : GenNum => Str ;
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
--
|
||||
-- The functions and parameters below are here because they depend on
|
||||
-- the parametrized constants, but their definitions are fully given
|
||||
-- here relative to the above.
|
||||
|
||||
param
|
||||
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
|
||||
|
||||
oper
|
||||
agrP3 : Gender -> Number -> Agr = \g,n -> {
|
||||
gn = gennum g n ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
Noun = {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
|
||||
|
||||
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
|
||||
|
||||
predV : Verb -> VP = \verb ->
|
||||
let
|
||||
diath = case verb.vtype of {
|
||||
VPass => Pass ;
|
||||
_ => Act
|
||||
} ;
|
||||
vfin : Tense -> Str = \t -> verb.s ! vFin t diath ;
|
||||
vsup = verb.s ! VI (VSupin diath) ;
|
||||
vinf = verb.s ! VI (VInfin diath) ;
|
||||
|
||||
har : Tense -> Str = \t -> verbHave.s ! vFin t Act ;
|
||||
ha : Str = verbHave.s ! VI (VInfin Act) ;
|
||||
|
||||
vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> {
|
||||
fin = fin ; inf = inf
|
||||
} ;
|
||||
|
||||
in {
|
||||
s = table {
|
||||
VPFinite t Simul => case t of {
|
||||
Pres | Past => vf (vfin t) [] ;
|
||||
Fut => vf auxFut vinf ;
|
||||
Cond => vf auxCond vinf
|
||||
} ;
|
||||
VPFinite t Anter => case t of {
|
||||
Pres | Past => vf (har t) vsup ;
|
||||
Fut => vf auxFut (ha ++ vsup) ;
|
||||
Cond => vf auxCond (ha ++ vsup)
|
||||
} ;
|
||||
VPImperat => vf (verb.s ! VF (VImper diath)) [] ;
|
||||
VPInfinit Simul => vf [] vinf ;
|
||||
VPInfinit Anter => vf [] (ha ++ vsup)
|
||||
} ;
|
||||
a1 : Polarity => Str = negation ;
|
||||
n2 : Agr => Str = \\a => case verb.vtype of {
|
||||
VRefl => reflPron a ;
|
||||
_ => []
|
||||
} ;
|
||||
a2 : Str = [] ;
|
||||
ext : Str = [] ;
|
||||
en2,ea2,eext : Bool = False -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
reflPron : Agr -> Str ;
|
||||
reflPron : Agr -> Str ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete ExtScand of ExtScandAbs =
|
||||
CatScand ** open DiffScand, ResScand in {
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
lin
|
||||
DefSgN predet noun = let g = noun.g in {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete NounScand of Noun =
|
||||
CatScand ** open DiffScand, ResScand, Prelude in {
|
||||
CatScand ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete PhraseScand of Phrase =
|
||||
CatScand, TenseX ** open DiffScand, ResScand, Prelude in {
|
||||
CatScand, TenseX ** open CommonScand, ResScand, Prelude in {
|
||||
|
||||
lin
|
||||
PhrUtt pconj utt voc = {s = pconj.s ++ utt.s ++ voc.s} ;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete QuestionScand of Question =
|
||||
CatScand ** open DiffScand, ResScand in {
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete RelativeScand of Relative =
|
||||
CatScand ** open DiffScand, ResScand in {
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,193 +1,63 @@
|
||||
----1 Scandinavian auxiliary operations.
|
||||
--
|
||||
---- This module contains operations that are needed to make the
|
||||
---- resource syntax work. To define everything that is needed to
|
||||
---- implement $Test$, it moreover contains regular lexical
|
||||
---- patterns needed for $Lex$.
|
||||
--
|
||||
resource ResScand = ParamScand ** open Prelude in {
|
||||
--1 Scandinavian auxiliary operations
|
||||
|
||||
flags optimize=all ;
|
||||
interface ResScand = DiffScand ** open CommonScand, Prelude in {
|
||||
|
||||
oper
|
||||
--2 Constants uniformly defined in terms of language-dependent constants
|
||||
|
||||
-- For $Lex$.
|
||||
param
|
||||
CardOrd = NCard Gender | NOrd AFormSup ; -- sic! (AFormSup)
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
--
|
||||
-- But $mkNoun$ is fully defined only for each language, since
|
||||
-- $Gender$ varies.
|
||||
oper
|
||||
agrP3 : Gender -> Number -> Agr = \g,n -> {
|
||||
gn = gennum g n ;
|
||||
p = P3
|
||||
} ;
|
||||
|
||||
nounForms : (x1,_,_,x4 : Str) -> (Number => Species => Case => Str) =
|
||||
\man,mannen,men,mennen -> \\n,d,c => case <n,d> of {
|
||||
<Sg,Indef> => mkCase c man ;
|
||||
<Sg,Def> => mkCase c mannen ;
|
||||
<Pl,Indef> => mkCase c men ;
|
||||
<Pl,Def> => mkCase c mennen
|
||||
Noun = {s : Number => Species => Case => Str ; g : Gender} ;
|
||||
|
||||
-- This function is here because it depends on $verbHave, auxFut, auxCond$.
|
||||
|
||||
predV : Verb -> VP = \verb ->
|
||||
let
|
||||
diath = case verb.vtype of {
|
||||
VPass => Pass ;
|
||||
_ => Act
|
||||
} ;
|
||||
vfin : Tense -> Str = \t -> verb.s ! vFin t diath ;
|
||||
vsup = verb.s ! VI (VSupin diath) ;
|
||||
vinf = verb.s ! VI (VInfin diath) ;
|
||||
|
||||
har : Tense -> Str = \t -> verbHave.s ! vFin t Act ;
|
||||
ha : Str = verbHave.s ! VI (VInfin Act) ;
|
||||
|
||||
vf : Str -> Str -> {fin,inf : Str} = \fin,inf -> {
|
||||
fin = fin ; inf = inf
|
||||
} ;
|
||||
|
||||
Adjective : Type = {s : AForm => Str} ;
|
||||
|
||||
mkAdjective : (x1,_,_,_,_,_,x7 : Str) -> {s : AForm => Str} =
|
||||
\liten, litet, lilla, sma, mindre, minst, minsta -> {
|
||||
in {
|
||||
s = table {
|
||||
AF (APosit a) c => mkCase c (mkAdjPos a liten litet lilla sma) ;
|
||||
AF ACompar c => mkCase c mindre ;
|
||||
AF (ASuperl SupStrong) c => mkCase c minst ;
|
||||
AF (ASuperl SupWeak) c => mkCase c minsta
|
||||
}
|
||||
} ;
|
||||
|
||||
mkVerb : (x1,_,_,_,_,_,_,x8 : Str) -> {s : VForm => Str ; vtype : VType} =
|
||||
\finna,finner,finn,fann,funnit,funnen,funnet,funna -> {
|
||||
s = table {
|
||||
VF (VPres Act) => finner ;
|
||||
VF (VPres Pass) => mkVoice Pass finn ;
|
||||
VF (VPret v) => mkVoice v fann ;
|
||||
VF (VImper v) => mkVoice v finn ;
|
||||
VI (VInfin v) => mkVoice v finna ;
|
||||
VI (VSupin v) => mkVoice v funnit ;
|
||||
VI (VPtPret a c)=> mkCase c (mkAdjPos a funnen funnet funna funna)
|
||||
} ;
|
||||
vtype = VAct
|
||||
} ;
|
||||
|
||||
-- These are useful auxiliaries.
|
||||
|
||||
mkCase : Case -> Str -> Str = \c,f -> case c of {
|
||||
Nom => f ;
|
||||
Gen => f + case last f of {
|
||||
"s" | "x" => [] ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
mkAdjPos : AFormPos -> (s1,_,_,s4 : Str) -> Str =
|
||||
\a, liten, litet, lilla, sma ->
|
||||
case a of {
|
||||
Strong gn => case gn of {
|
||||
SgUtr => liten ;
|
||||
SgNeutr => litet ;
|
||||
Plg => sma
|
||||
} ;
|
||||
Weak Sg => lilla ;
|
||||
Weak Pl => sma
|
||||
} ;
|
||||
|
||||
mkVoice : Voice -> Str -> Str = \v,s -> case v of {
|
||||
Act => s ;
|
||||
Pass => s + case last s of {
|
||||
"s" => "es" ;
|
||||
_ => "s"
|
||||
}
|
||||
} ;
|
||||
|
||||
|
||||
-- For $Noun$.
|
||||
|
||||
artDef : GenNum -> Str = \gn -> gennumForms "den" "det" "de" ! gn ;
|
||||
|
||||
mkNP : (x1,_,_,_,x5 : Str) -> GenNum -> Person ->
|
||||
{s : NPForm => Str ; a : Agr} = \du,dig,din,ditt,dina,gn,p -> {
|
||||
s = table {
|
||||
NPNom => du ;
|
||||
NPAcc => dig ;
|
||||
NPPoss g => gennumForms din ditt dina ! g
|
||||
} ;
|
||||
a = {
|
||||
gn = gn ;
|
||||
p = p
|
||||
}
|
||||
} ;
|
||||
|
||||
gennumForms : (x1,x2,x3 : Str) -> GenNum => Str = \den,det,de ->
|
||||
table {
|
||||
SgUtr => den ;
|
||||
SgNeutr => det ;
|
||||
_ => de
|
||||
} ;
|
||||
|
||||
regNP : Str -> Str -> GenNum -> {s : NPForm => Str ; a : Agr} =
|
||||
\det,dess,gn ->
|
||||
mkNP det det dess dess dess gn P3 ;
|
||||
|
||||
|
||||
-- For $Verb$.
|
||||
|
||||
Verb : Type = {
|
||||
s : VForm => Str ;
|
||||
vtype : VType
|
||||
} ;
|
||||
|
||||
VP = {
|
||||
s : VPForm => {
|
||||
fin : Str ; -- V1 har ---s1
|
||||
inf : Str -- V2 sagt ---s4
|
||||
VPFinite t Simul => case t of {
|
||||
Pres | Past => vf (vfin t) [] ;
|
||||
Fut => vf auxFut vinf ;
|
||||
Cond => vf auxCond vinf
|
||||
} ;
|
||||
a1 : Polarity => Str ; -- A1 inte ---s3
|
||||
n2 : Agr => Str ; -- N2 dig ---s5
|
||||
a2 : Str ; -- A2 idag ---s6
|
||||
ext : Str ; -- S-Ext att hon går ---s7
|
||||
--- ea1,ev2, --- these depend on params of v and a1
|
||||
en2,ea2,eext : Bool -- indicate if the field exists
|
||||
VPFinite t Anter => case t of {
|
||||
Pres | Past => vf (har t) vsup ;
|
||||
Fut => vf auxFut (ha ++ vsup) ;
|
||||
Cond => vf auxCond (ha ++ vsup)
|
||||
} ;
|
||||
VPImperat => vf (verb.s ! VF (VImper diath)) [] ;
|
||||
VPInfinit Simul => vf [] vinf ;
|
||||
VPInfinit Anter => vf [] (ha ++ vsup)
|
||||
} ;
|
||||
|
||||
|
||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = \\a => vp.n2 ! a ++ obj ! a ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = True ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdv : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = vp.a1 ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ++ adv ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = True ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
s = vp.s ;
|
||||
a1 = \\b => vp.a1 ! b ++ adv ;
|
||||
n2 = vp.n2 ;
|
||||
a2 = vp.a2 ;
|
||||
ext = vp.ext ;
|
||||
en2 = vp.en2 ;
|
||||
ea2 = vp.ea2 ;
|
||||
eext = vp.eext
|
||||
} ;
|
||||
|
||||
infVP : VP -> Agr -> Str = \vp,a ->
|
||||
(vp.s ! VPInfinit Simul).inf ++ vp.n2 ! a ++ vp.a2 ++ vp.ext ; --- a1
|
||||
|
||||
|
||||
-- For $Sentence$.
|
||||
|
||||
Clause : Type = {
|
||||
s : Tense => Anteriority => Polarity => Order => Str
|
||||
} ;
|
||||
|
||||
mkClause : Str -> Agr -> VP -> Clause = \subj,agr,vp -> {
|
||||
s = \\t,a,b,o =>
|
||||
let
|
||||
verb = vp.s ! VPFinite t a ;
|
||||
neg = vp.a1 ! b ;
|
||||
compl = vp.n2 ! agr ++ vp.a2 ++ vp.ext
|
||||
in
|
||||
case o of {
|
||||
Main => subj ++ verb.fin ++ neg ++ verb.inf ++ compl ;
|
||||
Inv => verb.fin ++ subj ++ neg ++ verb.inf ++ compl ;
|
||||
Sub => subj ++ neg ++ verb.fin ++ verb.inf ++ compl
|
||||
}
|
||||
a1 : Polarity => Str = negation ;
|
||||
n2 : Agr => Str = \\a => case verb.vtype of {
|
||||
VRefl => reflPron a ;
|
||||
_ => []
|
||||
} ;
|
||||
a2 : Str = [] ;
|
||||
ext : Str = [] ;
|
||||
en2,ea2,eext : Bool = False -- indicate if the field exists
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
incomplete concrete SentenceScand of Sentence =
|
||||
CatScand ** open DiffScand, ResScand in {
|
||||
CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
incomplete concrete VerbScand of Verb = CatScand ** open DiffScand, ResScand in {
|
||||
incomplete concrete VerbScand of Verb = CatScand ** open CommonScand, ResScand in {
|
||||
|
||||
flags optimize=all_subs ;
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete AdjectiveSwe of Adjective = CatSwe ** AdjectiveScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete AdverbSwe of Adverb = CatSwe ** AdverbScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete CatSwe of Cat = CatScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete ConjunctionSwe of Conjunction = CatSwe ** ConjunctionScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
instance DiffSwe of DiffScand = open ResScand, Prelude in {
|
||||
instance DiffSwe of DiffScand = open CommonScand, Prelude in {
|
||||
|
||||
-- Parameters.
|
||||
|
||||
@@ -53,14 +53,6 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in {
|
||||
Neutr => allt
|
||||
} ;
|
||||
|
||||
reflPron : Agr -> Str = \a -> case a of {
|
||||
{gn = Plg ; p = P1} => "oss" ;
|
||||
{gn = Plg ; p = P2} => "er" ;
|
||||
{p = P1} => "mig" ;
|
||||
{p = P2} => "dig" ;
|
||||
{p = P3} => "sig"
|
||||
} ;
|
||||
|
||||
relPron : GenNum => RCase => Str = \\gn,c => case c of {
|
||||
RNom => "som" ;
|
||||
RGen => "vars" ;
|
||||
@@ -69,6 +61,12 @@ instance DiffSwe of DiffScand = open ResScand, Prelude in {
|
||||
|
||||
pronSuch = gennumForms "sådan" "sådant" "sådana" ;
|
||||
|
||||
|
||||
reflPron : Agr -> Str = \a -> case a of {
|
||||
{gn = Plg ; p = P1} => "oss" ;
|
||||
{gn = Plg ; p = P2} => "er" ;
|
||||
{p = P1} => "mig" ;
|
||||
{p = P2} => "dig" ;
|
||||
{p = P3} => "sig"
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
-- syntax. To build a lexicon, it is better to use $ParadigmsSwe$, which
|
||||
-- gives a higher-level access to this module.
|
||||
|
||||
resource MorphoSwe = ResScand, DiffSwe ** open Prelude, (Predef=Predef) in {
|
||||
resource MorphoSwe = CommonScand, ResSwe ** open Prelude, (Predef=Predef) in {
|
||||
|
||||
-- Nouns
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete NounSwe of Noun = CatSwe ** NounScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -28,8 +28,8 @@ resource ParadigmsSwe =
|
||||
open
|
||||
(Predef=Predef),
|
||||
Prelude,
|
||||
ResScand,
|
||||
DiffSwe,
|
||||
CommonScand,
|
||||
ResSwe,
|
||||
MorphoSwe,
|
||||
CatSwe in {
|
||||
|
||||
@@ -280,9 +280,9 @@ oper
|
||||
-- hidden from the document.
|
||||
--.
|
||||
|
||||
Gender = DiffSwe.Gender ;
|
||||
Number = ResScand.Number ;
|
||||
Case = ResScand.Case ;
|
||||
Gender = ResSwe.Gender ;
|
||||
Number = CommonScand.Number ;
|
||||
Case = CommonScand.Case ;
|
||||
utrum = Utr ;
|
||||
neutrum = Neutr ;
|
||||
singular = Sg ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete PhraseSwe of Phrase = CatSwe, TenseX ** PhraseScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete QuestionSwe of Question = CatSwe ** QuestionScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete RelativeSwe of Relative = CatSwe ** RelativeScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,268 +1,3 @@
|
||||
----1 Swedish auxiliary operations.
|
||||
--
|
||||
---- This module contains operations that are needed to make the
|
||||
---- resource syntax work. To define everything that is needed to
|
||||
---- implement $Test$, it moreover contains regular lexical
|
||||
---- patterns needed for $Lex$.
|
||||
--
|
||||
resource ResSwe = ParamScand, ResScand, DiffSwe ** open Prelude in {
|
||||
instance ResSwe of ResScand = DiffSwe ** open CommonScand, Prelude in {
|
||||
} ;
|
||||
|
||||
flags optimize=all ;
|
||||
|
||||
oper
|
||||
|
||||
-- For $Lex$.
|
||||
|
||||
-- For each lexical category, here are the worst-case constructors.
|
||||
|
||||
mkNoun : (_,_,_,_ : Str) -> Gender ->
|
||||
{s : Number => Species => Case => Str ; g : Gender} =
|
||||
\man,mannen,men,mennen,g -> {
|
||||
s = nounForms man mannen men mennen ;
|
||||
g = g
|
||||
} ;
|
||||
|
||||
-- mkAdjective : (_,_,_,_ : Str) -> {s : AForm => Str} =
|
||||
-- \good,better,best,well -> {
|
||||
-- s = table {
|
||||
-- AAdj Posit => good ;
|
||||
-- AAdj Compar => better ;
|
||||
-- AAdj Superl => best ;
|
||||
-- AAdv => well
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkVerb : (_,_,_,_,_ : Str) -> {s : VForm => Str} =
|
||||
-- \go,goes,went,gone,going -> {
|
||||
-- s = table {
|
||||
-- VInf => go ;
|
||||
-- VPres => goes ;
|
||||
-- VPast => went ;
|
||||
-- VPPart => gone ;
|
||||
-- VPresPart => going
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- mkIP : (i,me,my : Str) -> Number -> {s : Case => Str ; n : Number} =
|
||||
-- \i,me,my,n -> let who = mkNP i me my n P3 in {s = who.s ; n = n} ;
|
||||
--
|
||||
-- mkNP : (i,me,my : Str) -> Number -> Person -> {s : Case => Str ; a : Agr} =
|
||||
-- \i,me,my,n,p -> {
|
||||
-- s = table {
|
||||
-- Nom => i ;
|
||||
-- Acc => me ;
|
||||
-- Gen => my
|
||||
-- } ;
|
||||
-- a = {
|
||||
-- n = n ;
|
||||
-- p = p
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
---- These functions cover many cases; full coverage inflectional patterns are
|
||||
---- in $MorphoScand$.
|
||||
--
|
||||
-- regN : Str -> {s : Number => Case => Str} = \car ->
|
||||
-- mkNoun car (car + "'s") (car + "s") (car + "s'") ;
|
||||
--
|
||||
-- regA : Str -> {s : AForm => Str} = \warm ->
|
||||
-- mkAdjective warm (warm + "er") (warm + "est") (warm + "ly") ;
|
||||
--
|
||||
-- regV : Str -> {s : VForm => Str} = \walk ->
|
||||
-- mkVerb walk (walk + "s") (walk + "ed") (walk + "ed") (walk + "ing") ;
|
||||
--
|
||||
-- regNP : Str -> Number -> {s : Case => Str ; a : Agr} = \that,n ->
|
||||
-- mkNP that that (that + "'s") n P3 ;
|
||||
--
|
||||
---- We have just a heuristic definition of the indefinite article.
|
||||
---- There are lots of exceptions: consonantic "e" ("euphemism"), consonantic
|
||||
---- "o" ("one-sided"), vocalic "u" ("umbrella").
|
||||
--
|
||||
-- artIndef = pre {
|
||||
-- "a" ;
|
||||
-- "an" / strs {"a" ; "e" ; "i" ; "o" ; "A" ; "E" ; "I" ; "O" }
|
||||
-- } ;
|
||||
--
|
||||
-- artDef = "the" ;
|
||||
--
|
||||
---- For $Verb$.
|
||||
--
|
||||
-- Verb : Type = {
|
||||
-- s : VForm => Str
|
||||
-- } ;
|
||||
--
|
||||
-- VerbForms : Type =
|
||||
-- Tense => Anteriority => Polarity => Ord => Agr => {fin, inf : Str} ;
|
||||
--
|
||||
-- VP : Type = {
|
||||
-- s : VerbForms ;
|
||||
-- s2 : Agr => Str
|
||||
-- } ;
|
||||
--
|
||||
-- predV : Verb -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.s ! VInf ;
|
||||
-- fin = presVerb verb agr ;
|
||||
-- past = verb.s ! VPast ;
|
||||
-- part = verb.s ! VPPart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,Pos,ODir> => vf fin [] ;
|
||||
-- <Pres,Simul,Pos,OQuest> => vf (does agr) inf ;
|
||||
-- <Pres,Simul,Neg,_> => vf (doesnt agr) inf ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,Pos,ODir> => vf past [] ;
|
||||
-- <Past,Simul,Pos,OQuest> => vf "did" inf ;
|
||||
-- <Past,Simul,Neg,_> => vf "didn't" inf ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- predAux : Aux -> VP = \verb -> {
|
||||
-- s = \\t,ant,b,ord,agr =>
|
||||
-- let
|
||||
-- inf = verb.inf ;
|
||||
-- fin = verb.pres ! b ! agr ;
|
||||
-- past = verb.past ! b ! agr ;
|
||||
-- part = verb.ppart ;
|
||||
-- vf : Str -> Str -> {fin, inf : Str} = \x,y ->
|
||||
-- {fin = x ; inf = y} ;
|
||||
-- in
|
||||
-- case <t,ant,b,ord> of {
|
||||
-- <Pres,Simul,_, _> => vf fin [] ;
|
||||
-- <Pres,Anter,Pos,_> => vf (have agr) part ;
|
||||
-- <Pres,Anter,Neg,_> => vf (havent agr) part ;
|
||||
-- <Past,Simul,_, _> => vf past [] ;
|
||||
-- <Past,Anter,Pos,_> => vf "had" part ;
|
||||
-- <Past,Anter,Neg,_> => vf "hadn't" part ;
|
||||
-- <Fut, Simul,Pos,_> => vf "will" inf ;
|
||||
-- <Fut, Simul,Neg,_> => vf "won't" inf ;
|
||||
-- <Fut, Anter,Pos,_> => vf "will" ("have" ++ part) ;
|
||||
-- <Fut, Anter,Neg,_> => vf "won't" ("have" ++ part) ;
|
||||
-- <Cond,Simul,Pos,_> => vf "would" inf ;
|
||||
-- <Cond,Simul,Neg,_> => vf "wouldn't" inf ;
|
||||
-- <Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||
-- <Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||
-- } ;
|
||||
-- s2 = \\_ => []
|
||||
-- } ;
|
||||
--
|
||||
-- insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||
-- } ;
|
||||
--
|
||||
----- This is not functional.
|
||||
--
|
||||
-- insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||
-- s = vp.s ;
|
||||
-- s2 = vp.s2
|
||||
-- } ;
|
||||
--
|
||||
-- presVerb : {s : VForm => Str} -> Agr -> Str = \verb ->
|
||||
-- agrVerb (verb.s ! VPres) (verb.s ! VInf) ;
|
||||
--
|
||||
-- infVP : VP -> Agr -> Str = \vp,a ->
|
||||
-- (vp.s ! Fut ! Simul ! Neg ! ODir ! a).inf ++ vp.s2 ! a ;
|
||||
--
|
||||
-- agrVerb : Str -> Str -> Agr -> Str = \has,have,agr ->
|
||||
-- case agr of {
|
||||
-- {n = Sg ; p = P3} => has ;
|
||||
-- _ => have
|
||||
-- } ;
|
||||
--
|
||||
-- have = agrVerb "has" "have" ;
|
||||
-- havent = agrVerb "hasn't" "haven't" ;
|
||||
-- does = agrVerb "does" "do" ;
|
||||
-- doesnt = agrVerb "doesn't" "don't" ;
|
||||
--
|
||||
-- Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
|
||||
--
|
||||
-- auxBe : Aux = {
|
||||
-- pres = \\b,a => case <b,a> of {
|
||||
-- <Pos,{n = Sg ; p = P1}> => "am" ;
|
||||
-- <Neg,{n = Sg ; p = P1}> => ["am not"] ; --- am not I
|
||||
-- _ => agrVerb (posneg b "is") (posneg b "are") a
|
||||
-- } ;
|
||||
-- past = \\b,a => agrVerb (posneg b "was") (posneg b "were") a ;
|
||||
-- inf = "be" ;
|
||||
-- ppart = "been"
|
||||
-- } ;
|
||||
--
|
||||
-- posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||
-- Pos => s ;
|
||||
-- Neg => s + "n't"
|
||||
-- } ;
|
||||
--
|
||||
-- conjThat : Str = "that" ;
|
||||
--
|
||||
-- reflPron : Agr => Str = table {
|
||||
-- {n = Sg ; p = P1} => "myself" ;
|
||||
-- {n = Sg ; p = P2} => "yourself" ;
|
||||
-- {n = Sg ; p = P3} => "itself" ; ----
|
||||
-- {n = Pl ; p = P1} => "ourselves" ;
|
||||
-- {n = Pl ; p = P2} => "yourselves" ;
|
||||
-- {n = Pl ; p = P3} => "themselves"
|
||||
-- } ;
|
||||
--
|
||||
---- For $Sentence$.
|
||||
--
|
||||
-- Clause : Type = {
|
||||
-- s : Tense => Anteriority => Polarity => Ord => Str
|
||||
-- } ;
|
||||
--
|
||||
-- mkS : Str -> Agr -> VerbForms -> (Agr => Str) -> Clause =
|
||||
-- \subj,agr,verb,compl0 -> {
|
||||
-- s = \\t,a,b,o =>
|
||||
-- let
|
||||
-- verb = verb ! t ! a ! b ! o ! agr ;
|
||||
-- compl = compl0 ! agr
|
||||
-- in
|
||||
-- case o of {
|
||||
-- ODir => subj ++ verb.fin ++ verb.inf ++ compl ;
|
||||
-- OQuest => verb.fin ++ subj ++ verb.inf ++ compl
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
--
|
||||
---- For $Numeral$.
|
||||
--
|
||||
-- mkNum : Str -> Str -> Str -> Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \two, twelve, twenty, second ->
|
||||
-- {s = table {
|
||||
-- unit => table {NCard => two ; NOrd => second} ;
|
||||
-- teen => \\c => mkCard c twelve ;
|
||||
-- ten => \\c => mkCard c twenty
|
||||
-- }
|
||||
-- } ;
|
||||
--
|
||||
-- regNum : Str -> {s : DForm => CardOrd => Str} =
|
||||
-- \six -> mkNum six (six + "teen") (six + "ty") (regOrd six) ;
|
||||
--
|
||||
-- regCardOrd : Str -> {s : CardOrd => Str} = \ten ->
|
||||
-- {s = table {NCard => ten ; NOrd => regOrd ten}} ;
|
||||
--
|
||||
-- mkCard : CardOrd -> Str -> Str = \c,ten ->
|
||||
-- (regCardOrd ten).s ! c ;
|
||||
--
|
||||
-- regOrd : Str -> Str = \ten ->
|
||||
-- case last ten of {
|
||||
-- "y" => init ten + "ieth" ;
|
||||
-- _ => ten + "th"
|
||||
-- } ;
|
||||
--
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete SentenceSwe of Sentence = CatSwe ** SentenceScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -80,7 +80,6 @@ concrete StructuralSwe of Structural = CatSwe **
|
||||
this_NP = regNP ["det här"] ["det härs"] SgNeutr ;
|
||||
those_NP = regNP ["de där"] ["det därs"] Plg ;
|
||||
those_Quant = {s = \\_,_ => ["de där"] ; n = Pl ; det = DDef Def} ;
|
||||
thou_Pron = mkNP "du" "dig" "din" "ditt" "dina" SgUtr P2 ;
|
||||
through_Prep = ss "genom" ;
|
||||
too_AdA = ss "för" ;
|
||||
to_Prep = ss "till" ;
|
||||
@@ -102,9 +101,10 @@ concrete StructuralSwe of Structural = CatSwe **
|
||||
why_IAdv = ss "varför" ;
|
||||
without_Prep = ss "utan" ;
|
||||
with_Prep = ss "med" ;
|
||||
ye_Pron = mkNP "ni" "er" "er" "ert" "era" Plg P2 ;
|
||||
yes_Phr = ss ["ja"] ;
|
||||
you_Pron = mkNP "ni" "er" "er" "ert" "era" SgUtr P2 ; --- wrong in refl
|
||||
youSg_Pron = mkNP "du" "dig" "din" "ditt" "dina" SgUtr P2 ;
|
||||
youPl_Pron = mkNP "ni" "er" "er" "ert" "era" Plg P2 ;
|
||||
youPol_Pron = mkNP "ni" "er" "er" "ert" "era" SgUtr P2 ; --- wrong in refl
|
||||
|
||||
-- Auxiliaries that are used repeatedly.
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete TensedSwe of Tensed = CatSwe, TenseX ** TensedScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete UntensedSwe of Untensed = CatSwe ** UntensedScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
concrete VerbSwe of Verb = CatSwe ** VerbScand with
|
||||
(DiffScand = DiffSwe) ;
|
||||
(ResScand = ResSwe) ;
|
||||
|
||||
@@ -994,11 +994,11 @@ The structure looks like this.
|
||||
<tr><td>Danish</td> <td>-</td> <td>X</td> <td>-</td><td>-</td> <td>-</td> <td>-</tr>
|
||||
<tr><td>English</td> <td>X</td> <td>X</td> <td>X</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>Finnish</td> <td>X</td> <td>+</td> <td>-</td><td>X</td> <td>X</td> <td>0</tr>
|
||||
<tr><td>French</td> <td>X</td> <td>X</td> <td>-</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>French</td> <td>X</td> <td>X</td> <td>X</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>German</td> <td>X</td> <td>-</td> <td>X</td><td>X</td> <td>-</td> <td>-</tr>
|
||||
<tr><td>Italian</td> <td>X</td> <td>X</td> <td>-</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>Norwegian</td> <td>-</td> <td>X</td> <td>-</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>Russian</td> <td>X</td> <td>*</td> <td>-</td><td>*</td> <td>-</td> <td>-</tr>
|
||||
<tr><td>Russian</td> <td>X</td> <td>X</td> <td>-</td><td>*</td> <td>-</td> <td>-</tr>
|
||||
<tr><td>Spanish</td> <td>-</td> <td>X</td> <td>-</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
<tr><td>Swedish</td> <td>X</td> <td>X</td> <td>X</td><td>X</td> <td>X</td> <td>X</tr>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user