1
0
forked from GitHub/gf-core

took tense linearizations apart from Common/Cat to Tense, for bettter structure of lib

This commit is contained in:
aarne
2009-12-03 10:53:14 +00:00
parent 5c678ab686
commit a7809c3e1c
35 changed files with 127 additions and 96 deletions

View File

@@ -3,14 +3,6 @@
-- This module defines the categories that uniformly have the linearization
-- ${s : Str}$ in all languages.
-- Moreover, this module defines the abstract parameters of tense, polarity, and
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
-- These tenses are defined for all languages in the library. More tenses
-- can be defined in the language extensions, e.g. the "passé simple" of
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
abstract Common = {
cat
@@ -51,14 +43,4 @@ abstract Common = {
Pol ; -- polarity e.g. positive, negative
Ant ; -- anteriority e.g. simultaneous, anterior
fun
TTAnt : Tense -> Ant -> Temp ;
PPos, PNeg : Pol ; -- I sleep/don't sleep
TPres : Tense ;
ASimul : Ant ;
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
AAnter : Ant ; -- I have slept --# notpresent
}

View File

@@ -18,6 +18,6 @@ abstract Grammar =
Phrase,
Text,
Structural,
Idiom ;
Idiom,
Tense ;

22
lib/src/abstract/Tense.gf Normal file
View File

@@ -0,0 +1,22 @@
--1 Common: Structures with Common Implementations.
-- This module defines the abstract parameters of tense, polarity, and
-- anteriority, which are used in [``Phrase`` Phrase.html] to generate different
-- forms of sentences. Together they give 4 x 2 x 2 = 16 sentence forms.
-- These tenses are defined for all languages in the library. More tenses
-- can be defined in the language extensions, e.g. the "passé simple" of
-- Romance languages in [``ExtraRomance`` ../romance/ExtraRomance.gf].
abstract Tense = Common ** {
fun
TTAnt : Tense -> Ant -> Temp ;
PPos, PNeg : Pol ; -- I sleep/don't sleep
TPres : Tense ;
ASimul : Ant ;
TPast, TFut, TCond : Tense ; -- I slept/will sleep/would sleep --# notpresent
AAnter : Ant ; -- I have slept --# notpresent
}

View File

@@ -13,7 +13,8 @@ concrete GrammarAra of Grammar =
PhraseAra,
TextX - [Utt],
StructuralAra,
IdiomAra
IdiomAra,
TenseX - [Utt]
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,7 +13,8 @@ concrete GrammarBul of Grammar =
PhraseBul,
TextBul,
StructuralBul,
IdiomBul
IdiomBul,
TenseX - [CAdv,IAdv]
** {
flags coding=cp1251 ;

View File

@@ -11,9 +11,10 @@ concrete GrammarCat of Grammar =
RelativeCat,
ConjunctionCat,
PhraseCat,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond],
TextX - [Temp,Tense],
IdiomCat,
StructuralCat
StructuralCat,
TenseCat
** {

View File

@@ -0,0 +1,3 @@
concrete TenseCat of Tense = CatCat, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResCat) ;

View File

@@ -19,16 +19,4 @@ concrete CommonX of Common = open (R = ParamX) in {
Ant = {s : Str ; a : R.Anteriority} ;
Pol = {s : Str ; p : R.Polarity} ;
lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a} ;
PPos = {s = []} ** {p = R.Pos} ;
PNeg = {s = []} ** {p = R.Neg} ;
TPres = {s = []} ** {t = R.Pres} ;
TPast = {s = []} ** {t = R.Past} ; --# notpresent
TFut = {s = []} ** {t = R.Fut} ; --# notpresent
TCond = {s = []} ** {t = R.Cond} ; --# notpresent
ASimul = {s = []} ** {a = R.Simul} ;
AAnter = {s = []} ** {a = R.Anter} ; --# notpresent
}

View File

@@ -1,18 +1,14 @@
concrete TenseX of Tense = open (R = ParamX) in {
lincat
Tense = {s : Str ; t : R.Tense} ;
Ant = {s : Str ; a : R.Anteriority} ;
Pol = {s : Str ; p : R.Polarity} ;
concrete TenseX of Tense = CommonX ** open (R = ParamX) in {
lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a} ;
PPos = {s = []} ** {p = R.Pos} ;
PNeg = {s = []} ** {p = R.Neg} ;
TPres = {s = []} ** {t = R.Pres} ;
TPast = {s = []} ** {t = R.Past} ;
TFut = {s = []} ** {t = R.Fut} ;
TCond = {s = []} ** {t = R.Cond} ;
TPast = {s = []} ** {t = R.Past} ; --# notpresent
TFut = {s = []} ** {t = R.Fut} ; --# notpresent
TCond = {s = []} ** {t = R.Cond} ; --# notpresent
ASimul = {s = []} ** {a = R.Simul} ;
AAnter = {s = []} ** {a = R.Anter} ;
AAnter = {s = []} ** {a = R.Anter} ; --# notpresent
}

View File

@@ -13,7 +13,8 @@ concrete GrammarDan of Grammar =
PhraseDan,
TextX,
IdiomDan,
StructuralDan
StructuralDan,
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,4 +13,5 @@ concrete GrammarDut of Grammar =
PhraseDut,
TextX,
IdiomDut,
StructuralDut ;
StructuralDut,
TenseX ;

View File

@@ -13,7 +13,8 @@ concrete GrammarEng of Grammar =
PhraseEng,
TextX,
StructuralEng,
IdiomEng
IdiomEng,
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -13,7 +13,8 @@ concrete GrammarFin of Grammar =
PhraseFin,
TextX,
IdiomFin,
StructuralFin
StructuralFin,
TenseX
** {
flags startcat = Phr ; unlexer = finnish ; lexer = text ;

View File

@@ -11,9 +11,10 @@ concrete GrammarFre of Grammar =
RelativeFre,
ConjunctionFre,
PhraseFre,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond],
TextX - [Temp,Tense],
IdiomFre,
StructuralFre
StructuralFre,
TenseFre
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -0,0 +1,3 @@
concrete TenseFre of Tense = CatFre, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResFre) ;

View File

@@ -1,5 +1,5 @@
concrete CatGer of Cat =
CommonX - [Tense,TPres,TPast,TFut,TCond,TTAnt,Temp] **
CommonX - [Tense,Temp] **
open ResGer, Prelude in {
flags optimize=all_subs ;
@@ -93,11 +93,4 @@ concrete CatGer of Cat =
Temp = {s : Str ; t : ResGer.Tense ; a : Anteriority ; m : Mood} ;
Tense = {s : Str ; t : ResGer.Tense ; m : Mood} ;
lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a ; m = t.m} ;
TPres = {s = [] ; t = Pres ; m = MIndic} ;
TPast = {s = [] ; t = Past ; m = MIndic} ; --# notpresent
TFut = {s = [] ; t = Fut ; m = MIndic} ; --# notpresent
TCond = {s = [] ; t = Cond ; m = MIndic} ; --# notpresent
}

View File

@@ -11,9 +11,10 @@ concrete GrammarGer of Grammar =
RelativeGer,
ConjunctionGer,
PhraseGer,
TextX - [Tense,TPres,TPast,TFut,TCond,TTAnt,Temp],
TextX - [Tense,Temp],
IdiomGer,
StructuralGer
StructuralGer,
TenseGer
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -152,7 +152,7 @@ resource ResGer = ParamX ** open Prelude in {
} ;
conjAgr : Agr -> Agr -> Agr = \a,b -> {
g = Utr ; ----
g = Neutr ; ----
n = conjNumber a.n b.n ;
p = conjPerson a.p b.p
} ;

View File

@@ -0,0 +1,12 @@
concrete TenseGer of Tense =
CatGer [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] ** open ResGer in {
lin
TTAnt t a = {s = t.s ++ a.s ; t = t.t ; a = a.a ; m = t.m} ;
TPres = {s = [] ; t = Pres ; m = MIndic} ;
TPast = {s = [] ; t = Past ; m = MIndic} ; --# notpresent
TFut = {s = [] ; t = Fut ; m = MIndic} ; --# notpresent
TCond = {s = [] ; t = Cond ; m = MIndic} ; --# notpresent
}

View File

@@ -13,7 +13,8 @@ concrete GrammarHin of Grammar =
PhraseHin,
TextX,
StructuralHin,
IdiomHin
IdiomHin,
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -11,9 +11,10 @@ concrete GrammarIta of Grammar =
RelativeIta,
ConjunctionIta,
PhraseIta,
TextX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond],
TextX - [Temp,Tense],
IdiomIta,
StructuralIta
StructuralIta,
TenseIta
** {

View File

@@ -0,0 +1,3 @@
concrete TenseIta of Tense = CatIta, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResIta) ;

View File

@@ -12,7 +12,8 @@ concrete GrammarLat of Grammar =
-- ConjunctionLat,
-- PhraseLat,
TextX,
StructuralLat
StructuralLat,
-- IdiomLat
TenseX
** {
} ;

View File

@@ -13,7 +13,8 @@ concrete GrammarNor of Grammar =
PhraseNor,
TextX,
IdiomNor,
StructuralNor
StructuralNor,
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -15,5 +15,6 @@ concrete GrammarPol of Grammar =
PhrasePol,
TextX - [CAdv],
StructuralPol,
IdiomPol
IdiomPol,
TenseX - [CAdv]
** { flags startcat = Phr ; unlexer = text ; lexer = text ;} ;

View File

@@ -1,5 +1,4 @@
incomplete concrete CatRomance of Cat =
CommonX - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond]
incomplete concrete CatRomance of Cat = CommonX
** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
flags optimize=all_subs ;
@@ -102,14 +101,8 @@ incomplete concrete CatRomance of Cat =
PN = {s : Str ; g : Gender} ;
-- tense augmented with passé simple
lincat
Temp = {s : Str ; t : RTense ; a : Anteriority} ;
Tense = {s : Str ; t : RTense} ;
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -0,0 +1,12 @@
incomplete concrete TenseRomance of Tense =
CatRomance [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
open ResRomance, CommonRomance in {
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -1,7 +1,7 @@
--# -path=.:../Romance:../common:../abstract:../common:prelude
concrete CatRon of Cat =
CommonX - [CAdv,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond]
CommonX - [CAdv,Temp,Tense]
** open Prelude, ResRon, MorphoRon,(R = ParamX) in {
flags optimize=all_subs ;
@@ -136,15 +136,6 @@ concrete CatRon of Cat =
Tense = {s : Str ; t : RTense} ;
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
oper
aagr : Gender -> Number -> AAgr = \g,n ->

View File

@@ -12,9 +12,10 @@ concrete GrammarRon of Grammar =
RelativeRon,
ConjunctionRon,
PhraseRon,
TextX - [CAdv,Temp,TTAnt,Tense,TPres,TPast,TFut,TCond],
TextX - [CAdv,Temp,Tense],
Prelude, MorphoRon, Coordination,
StructuralRon
StructuralRon,
TenseRon
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -0,0 +1,11 @@
concrete TenseRon of Tense =
CatRon [Tense,Temp], TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] ** open ResRon in {
lin
TTAnt t a = {s = a.s ++ t.s ; a = a.a ; t = t.t} ;
TPres = {s = []} ** {t = RPres} ;
TPast = {s = []} ** {t = RPast} ; --# notpresent
TFut = {s = []} ** {t = RFut} ; --# notpresent
TCond = {s = []} ** {t = RCond} ; --# notpresent
}

View File

@@ -13,5 +13,6 @@ concrete GrammarRus of Grammar =
PhraseRus,
TextX,
StructuralRus,
IdiomRus
IdiomRus,
TenseX
** { flags startcat = Phr ; unlexer = text ; lexer = text ; coding=utf8 ;} ;

View File

@@ -11,9 +11,10 @@ concrete GrammarSpa of Grammar =
RelativeSpa,
ConjunctionSpa,
PhraseSpa,
TextSpa - [Temp,TTAnt,Tense,TPres,TPast,TFut,TCond], -- special punctuation
TextSpa - [Temp,Tense], -- special punctuation
IdiomSpa,
StructuralSpa
StructuralSpa,
TenseSpa
** {

View File

@@ -0,0 +1,3 @@
concrete TenseSpa of Tense = CatSpa, TenseX [Ant,Pol,AAnter,ASimul,PNeg,PPos] **
TenseRomance with
(ResRomance = ResSpa) ;

View File

@@ -13,7 +13,8 @@ concrete GrammarSwe of Grammar =
PhraseSwe,
TextX,
IdiomSwe,
StructuralSwe
StructuralSwe,
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;

View File

@@ -12,8 +12,9 @@ concrete GrammarTha of Grammar =
-- ConjunctionTha,
PhraseTha,
-- TextX,
StructuralTha
StructuralTha,
-- IdiomTha
TenseX
** {
flags startcat = Phr ; unlexer = text ; lexer = text ;