mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
resource = resource-1.0
This commit is contained in:
31
lib/resource/common/CommonX.gf
Normal file
31
lib/resource/common/CommonX.gf
Normal file
@@ -0,0 +1,31 @@
|
||||
concrete CommonX of Common = open (R = ParamX) in {
|
||||
|
||||
lincat
|
||||
Text = {s : Str} ; --lock_Text : {}} ;
|
||||
Phr = {s : Str} ; --lock_Phr : {}} ;
|
||||
Utt = {s : Str} ; --lock_Utt : {}} ;
|
||||
Voc = {s : Str} ; --lock_Voc : {}} ;
|
||||
SC = {s : Str} ; --lock_SC : {}} ;
|
||||
Adv = {s : Str} ; --lock_Adv : {}} ;
|
||||
AdV = {s : Str} ; --lock_AdV : {}} ;
|
||||
AdA = {s : Str} ; --lock_AdA : {}} ;
|
||||
AdN = {s : Str} ; --lock_AdN : {}} ;
|
||||
IAdv = {s : Str} ; --lock_IAdv : {}} ;
|
||||
CAdv = {s : Str} ; --lock_CAdv : {}} ;
|
||||
PConj = {s : Str} ; --lock_PConj : {}} ;
|
||||
|
||||
Tense = {s : Str ; t : R.Tense} ;
|
||||
Ant = {s : Str ; a : R.Anteriority} ;
|
||||
Pol = {s : Str ; p : R.Polarity} ;
|
||||
|
||||
lin
|
||||
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
|
||||
|
||||
}
|
||||
17
lib/resource/common/ConstructX.gf
Normal file
17
lib/resource/common/ConstructX.gf
Normal file
@@ -0,0 +1,17 @@
|
||||
resource ConstructX = open CommonX in {
|
||||
|
||||
oper
|
||||
mkText : Str -> Text = \s -> {s = s ; lock_Text = <>} ;
|
||||
mkPhr : Str -> Phr = \s -> {s = s ; lock_Phr = <>} ;
|
||||
mkUtt : Str -> Utt = \s -> {s = s ; lock_Utt = <>} ;
|
||||
mkVoc : Str -> Voc = \s -> {s = s ; lock_Voc = <>} ;
|
||||
mkSC : Str -> SC = \s -> {s = s ; lock_SC = <>} ;
|
||||
mkAdv : Str -> Adv = \s -> {s = s ; lock_Adv = <>} ;
|
||||
mkAdV : Str -> AdV = \s -> {s = s ; lock_AdV = <>} ;
|
||||
mkAdA : Str -> AdA = \s -> {s = s ; lock_AdA = <>} ;
|
||||
mkAdN : Str -> AdN = \s -> {s = s ; lock_AdN = <>} ;
|
||||
mkIAdv : Str -> IAdv = \s -> {s = s ; lock_IAdv = <>} ;
|
||||
mkCAdv : Str -> CAdv = \s -> {s = s ; lock_CAdv = <>} ;
|
||||
mkPConj : Str -> PConj = \s -> {s = s ; lock_PConj = <>} ;
|
||||
|
||||
}
|
||||
47
lib/resource/common/ParamX.gf
Normal file
47
lib/resource/common/ParamX.gf
Normal file
@@ -0,0 +1,47 @@
|
||||
resource ParamX = open Prelude in {
|
||||
|
||||
param
|
||||
Number = Sg | Pl ;
|
||||
Person = P1 | P2 | P3 ;
|
||||
Degree = Posit | Compar | Superl ;
|
||||
|
||||
Anteriority =
|
||||
Simul
|
||||
| Anter --# notpresent
|
||||
;
|
||||
Tense =
|
||||
Pres
|
||||
| Past --# notpresent
|
||||
| Fut --# notpresent
|
||||
| Cond --# notpresent
|
||||
;
|
||||
|
||||
param
|
||||
|
||||
Polarity = Pos | Neg ;
|
||||
|
||||
QForm = QDir | QIndir ;
|
||||
|
||||
oper
|
||||
conjNumber : Number -> Number -> Number = \m,n ->
|
||||
case <m,n> of {
|
||||
<Sg,Sg> => Sg ;
|
||||
_ => Pl
|
||||
} ;
|
||||
|
||||
-- For persons, we let the latter argument win ("either you or I am absent"
|
||||
-- but "either I or you are absent"). This is not quite clear.
|
||||
|
||||
conjPerson : Person -> Person -> Person = \_,p ->
|
||||
p ;
|
||||
|
||||
-- To construct a record with a polarity-dependent table.
|
||||
|
||||
polCases : SS -> SS -> {s : Polarity => Str} = \true,false -> {
|
||||
s = table {
|
||||
Pos => true.s ;
|
||||
Neg => false.s
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
18
lib/resource/common/TenseX.gf
Normal file
18
lib/resource/common/TenseX.gf
Normal file
@@ -0,0 +1,18 @@
|
||||
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} ;
|
||||
|
||||
lin
|
||||
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} ;
|
||||
ASimul = {s = []} ** {a = R.Simul} ;
|
||||
AAnter = {s = []} ** {a = R.Anter} ;
|
||||
|
||||
}
|
||||
11
lib/resource/common/TextX.gf
Normal file
11
lib/resource/common/TextX.gf
Normal file
@@ -0,0 +1,11 @@
|
||||
concrete TextX of Text = CommonX ** {
|
||||
|
||||
-- This will work for almost all languages except Spanish.
|
||||
|
||||
lin
|
||||
TEmpty = {s = []} ;
|
||||
TFullStop x xs = {s = x.s ++ "." ++ xs.s} ;
|
||||
TQuestMark x xs = {s = x.s ++ "?" ++ xs.s} ;
|
||||
TExclMark x xs = {s = x.s ++ "!" ++ xs.s} ;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user