Structural.you*; reorganized scand

This commit is contained in:
aarne
2006-01-24 14:30:36 +00:00
parent 06cb55df48
commit 10f2fd2457
35 changed files with 114 additions and 572 deletions

View File

@@ -1,2 +1,2 @@
concrete AdjectiveSwe of Adjective = CatSwe ** AdjectiveScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete AdverbSwe of Adverb = CatSwe ** AdverbScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete CatSwe of Cat = CatScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete ConjunctionSwe of Conjunction = CatSwe ** ConjunctionScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -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"
} ;
}

View File

@@ -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

View File

@@ -1,2 +1,2 @@
concrete NounSwe of Noun = CatSwe ** NounScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -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 ;

View File

@@ -1,2 +1,2 @@
concrete PhraseSwe of Phrase = CatSwe, TenseX ** PhraseScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete QuestionSwe of Question = CatSwe ** QuestionScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete RelativeSwe of Relative = CatSwe ** RelativeScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -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"
-- } ;
--
}

View File

@@ -1,2 +1,2 @@
concrete SentenceSwe of Sentence = CatSwe ** SentenceScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -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.

View File

@@ -1,2 +1,2 @@
concrete TensedSwe of Tensed = CatSwe, TenseX ** TensedScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete UntensedSwe of Untensed = CatSwe ** UntensedScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;

View File

@@ -1,2 +1,2 @@
concrete VerbSwe of Verb = CatSwe ** VerbScand with
(DiffScand = DiffSwe) ;
(ResScand = ResSwe) ;