mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-23 18:02:54 -06:00
Tense to Common ; Idiom ; Text
This commit is contained in:
@@ -1,18 +1,15 @@
|
|||||||
--1 The category system
|
--1 The category system
|
||||||
|
|
||||||
abstract Cat = Tense ** {
|
abstract Cat = Common ** {
|
||||||
|
|
||||||
cat
|
cat
|
||||||
|
|
||||||
--2 Top-level units
|
--2 Top-level units
|
||||||
|
|
||||||
-- Constructed in [Text Text.html].
|
-- Constructed in [Text Text.html]: $Text$.
|
||||||
|
|
||||||
Text ; -- text consisting of several phrases
|
-- Constructed in [Phrase Phrase.html]: $Phr$ and
|
||||||
|
|
||||||
-- Constructed in [Phrase Phrase.html].
|
|
||||||
|
|
||||||
Phr ; -- phrase in a text e.g. "But be quiet my darling."
|
|
||||||
Utt ; -- sentence, question, word... e.g. "be quiet"
|
Utt ; -- sentence, question, word... e.g. "be quiet"
|
||||||
Voc ; -- vocative or "please" e.g. "my darling"
|
Voc ; -- vocative or "please" e.g. "my darling"
|
||||||
|
|
||||||
|
|||||||
26
lib/resource-1.0/abstract/Common.gf
Normal file
26
lib/resource-1.0/abstract/Common.gf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
--1 Infrastructure 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 2 x 4 x 4 = 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.
|
||||||
|
|
||||||
|
abstract Common = {
|
||||||
|
|
||||||
|
cat
|
||||||
|
Text ; -- text consisting of several phrases
|
||||||
|
Phr ; -- phrase in a text e.g. "But be quiet my darling."
|
||||||
|
|
||||||
|
Pol ;
|
||||||
|
Tense ;
|
||||||
|
Ant ;
|
||||||
|
|
||||||
|
fun
|
||||||
|
PPos, PNeg : Pol ; -- I sleep/don't sleep
|
||||||
|
TPres, TPast, TFut, TCond : Tense ; -- I sleep/slept/will sleep/would sleep
|
||||||
|
ASimul, AAnter : Ant ; -- I sleep/have slept
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,9 @@ abstract Idiom = Cat ** {
|
|||||||
|
|
||||||
fun
|
fun
|
||||||
ExistNP : NP -> Cl ; -- there is a house
|
ExistNP : NP -> Cl ; -- there is a house
|
||||||
ImpersVP : VP -> Cl ; -- it rains
|
ImpersCl : VP -> Cl ; -- it rains
|
||||||
|
GenericCl : VP -> Cl ; -- one sleeps
|
||||||
|
|
||||||
ProgrVP : VP -> VP ; -- sleeping
|
ProgrVP : VP -> VP ; -- sleeping
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
20
lib/resource-1.0/common/CommonX.gf
Normal file
20
lib/resource-1.0/common/CommonX.gf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
concrete CommonX of Common = open (R = ParamX) in {
|
||||||
|
|
||||||
|
lincat
|
||||||
|
Text, Phr = {s : Str} ;
|
||||||
|
|
||||||
|
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} ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
concrete CatEng of Cat = CommonX ** open ResEng, Prelude in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
|||||||
|
|
||||||
-- Phrase
|
-- Phrase
|
||||||
|
|
||||||
Text, Phr, Utt, Voc = {s : Str} ;
|
Utt, Voc = {s : Str} ;
|
||||||
|
|
||||||
-- Tensed/Untensed
|
-- Tensed/Untensed
|
||||||
|
|
||||||
@@ -36,6 +36,7 @@ concrete CatEng of Cat = TenseX ** open ResEng, Prelude in {
|
|||||||
|
|
||||||
VP = {
|
VP = {
|
||||||
s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
|
s : Tense => Anteriority => Polarity => Order => Agr => {fin, inf : Str} ;
|
||||||
|
prp : Str ; -- present participle
|
||||||
ad : Str ;
|
ad : Str ;
|
||||||
s2 : Agr => Str
|
s2 : Agr => Str
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ concrete IdiomEng of Idiom = CatEng ** open Prelude, ResEng in {
|
|||||||
|
|
||||||
lin
|
lin
|
||||||
ExistNP np =
|
ExistNP np =
|
||||||
mkClause "there" (agrP3 Sg) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
mkClause "there" (agrP3 np.a.n) (insertObj (\\_ => np.s ! Acc) (predAux auxBe)) ;
|
||||||
ImpersVP vp = mkClause "it" (agrP3 Sg) vp ;
|
ImpersCl vp = mkClause "it" (agrP3 Sg) vp ;
|
||||||
-- ProgrVP : VP -> VP ; -- sleeping
|
GenericCl vp = mkClause "one" (agrP3 Sg) vp ;
|
||||||
|
|
||||||
|
ProgrVP vp = insertObj (\\a => vp.ad ++ vp.prp ++ vp.s2 ! a) (predAux auxBe) ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ concrete LangEng of Lang =
|
|||||||
LexiconEng
|
LexiconEng
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
|
|
||||||
VP : Type = {
|
VP : Type = {
|
||||||
s : VerbForms ;
|
s : VerbForms ;
|
||||||
|
prp : Str ; -- present participle
|
||||||
ad : Str ;
|
ad : Str ;
|
||||||
s2 : Agr => Str
|
s2 : Agr => Str
|
||||||
} ;
|
} ;
|
||||||
@@ -200,6 +201,7 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||||
} ;
|
} ;
|
||||||
|
prp = verb.s ! VPresPart ;
|
||||||
ad = [] ;
|
ad = [] ;
|
||||||
s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) []
|
s2 = \\a => if_then_Str verb.isRefl (reflPron ! a) []
|
||||||
} ;
|
} ;
|
||||||
@@ -230,12 +232,14 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
<Cond,Anter,Pos,_> => vf "would" ("have" ++ part) ;
|
||||||
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
<Cond,Anter,Neg,_> => vf "wouldn't" ("have" ++ part)
|
||||||
} ;
|
} ;
|
||||||
|
prp = verb.prpart ;
|
||||||
ad = [] ;
|
ad = [] ;
|
||||||
s2 = \\_ => []
|
s2 = \\_ => []
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
insertObj : (Agr => Str) -> VP -> VP = \obj,vp -> {
|
||||||
s = vp.s ;
|
s = vp.s ;
|
||||||
|
prp = vp.prp ;
|
||||||
ad = vp.ad ;
|
ad = vp.ad ;
|
||||||
s2 = \\a => vp.s2 ! a ++ obj ! a
|
s2 = \\a => vp.s2 ! a ++ obj ! a
|
||||||
} ;
|
} ;
|
||||||
@@ -244,6 +248,7 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
|
|
||||||
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
insertAdV : Str -> VP -> VP = \adv,vp -> {
|
||||||
s = vp.s ;
|
s = vp.s ;
|
||||||
|
prp = vp.prp ;
|
||||||
ad = vp.ad ++ adv ;
|
ad = vp.ad ++ adv ;
|
||||||
s2 = \\a => vp.s2 ! a
|
s2 = \\a => vp.s2 ! a
|
||||||
} ;
|
} ;
|
||||||
@@ -264,7 +269,8 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
Neg => \\_ => verbs ! VVPastNeg
|
Neg => \\_ => verbs ! VVPastNeg
|
||||||
} ;
|
} ;
|
||||||
inf = verbs ! VVF VInf ;
|
inf = verbs ! VVF VInf ;
|
||||||
ppart = verbs ! VVF VPPart
|
ppart = verbs ! VVF VPPart ;
|
||||||
|
prpart = verbs ! VVF VPresPart ;
|
||||||
} ;
|
} ;
|
||||||
_ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False}
|
_ => predV {s = \\vf => verbs ! VVF vf ; isRefl = False}
|
||||||
} ;
|
} ;
|
||||||
@@ -287,7 +293,7 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
does = agrVerb "does" "do" ;
|
does = agrVerb "does" "do" ;
|
||||||
doesnt = agrVerb "doesn't" "don't" ;
|
doesnt = agrVerb "doesn't" "don't" ;
|
||||||
|
|
||||||
Aux = {pres,past : Polarity => Agr => Str ; inf,ppart : Str} ;
|
Aux = {pres,past : Polarity => Agr => Str ; inf,ppart,prpart : Str} ;
|
||||||
|
|
||||||
auxBe : Aux = {
|
auxBe : Aux = {
|
||||||
pres = \\b,a => case <b,a> of {
|
pres = \\b,a => case <b,a> of {
|
||||||
@@ -300,7 +306,8 @@ resource ResEng = ParamX ** open Prelude in {
|
|||||||
_ => (posneg b "were")
|
_ => (posneg b "were")
|
||||||
} ;
|
} ;
|
||||||
inf = "be" ;
|
inf = "be" ;
|
||||||
ppart = "been"
|
ppart = "been" ;
|
||||||
|
prpart = "being"
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
posneg : Polarity -> Str -> Str = \p,s -> case p of {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
|
concrete CatFin of Cat = CommonX ** open ResFin, Prelude in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ concrete CatFin of Cat = TenseX ** open ResFin, Prelude in {
|
|||||||
|
|
||||||
-- Phrase
|
-- Phrase
|
||||||
|
|
||||||
Text, Phr, Utt, Voc = {s : Str} ;
|
Utt, Voc = {s : Str} ;
|
||||||
|
|
||||||
-- Tensed/Untensed
|
-- Tensed/Untensed
|
||||||
|
|
||||||
|
|||||||
7
lib/resource-1.0/finnish/IdiomFin.gf
Normal file
7
lib/resource-1.0/finnish/IdiomFin.gf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
concrete IdiomFin of Idiom = CatFin **
|
||||||
|
open MorphoFin, ParadigmsFin, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangFin of Lang =
|
|||||||
RelativeFin,
|
RelativeFin,
|
||||||
ConjunctionFin,
|
ConjunctionFin,
|
||||||
PhraseFin,
|
PhraseFin,
|
||||||
|
TextX,
|
||||||
|
IdiomFin,
|
||||||
StructuralFin,
|
StructuralFin,
|
||||||
LexiconFin
|
LexiconFin
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = finnish ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ concrete VerbFin of Verb = CatFin ** open Prelude, ResFin in {
|
|||||||
ComplV2A v np ap =
|
ComplV2A v np ap =
|
||||||
insertObj
|
insertObj
|
||||||
(\\fin,b,_ => appCompl fin b v.c2 np ++
|
(\\fin,b,_ => appCompl fin b v.c2 np ++
|
||||||
ap.s ! False ! AN (NCase np.a.n (npform2case v.c2.c))) --agr to obj
|
ap.s ! False ! AN (NCase np.a.n (npform2case v.c3.c))) --agr to obj
|
||||||
(predV v) ;
|
(predV v) ;
|
||||||
|
|
||||||
UseComp comp =
|
UseComp comp =
|
||||||
|
|||||||
@@ -82,6 +82,22 @@ instance DiffFre of DiffRomance = open CommonRomance, PhonoFre, Prelude in {
|
|||||||
_ => <pdat ++ pacc, []>
|
_ => <pdat ++ pacc, []>
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
mkImperative vp = {
|
||||||
|
s = \\pol,aag =>
|
||||||
|
let
|
||||||
|
agr = aag ** {p = P2} ;
|
||||||
|
verb = (vp.s ! VPImperat).fin ! agr ;
|
||||||
|
neg = vp.neg ! pol ;
|
||||||
|
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||||
|
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||||
|
in
|
||||||
|
case pol of {
|
||||||
|
Pos => verb ++ clpr.p1 ++ compl ; ---- clitics can be different
|
||||||
|
Neg => neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ compl
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
|
|
||||||
negation : Polarity => (Str * Str) = table {
|
negation : Polarity => (Str * Str) = table {
|
||||||
Pos => <[],[]> ;
|
Pos => <[],[]> ;
|
||||||
Neg => <elisNe,"pas">
|
Neg => <elisNe,"pas">
|
||||||
|
|||||||
20
lib/resource-1.0/french/IdiomFre.gf
Normal file
20
lib/resource-1.0/french/IdiomFre.gf
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
concrete IdiomFre of Idiom = CatFre **
|
||||||
|
open PhonoFre, MorphoFre, ParadigmsFre, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
lin
|
||||||
|
ExistNP np =
|
||||||
|
mkClause "il" (agrP3 Masc Sg)
|
||||||
|
(insertClit2 "y" (insertComplement (\\_ => np.s ! Ton Acc) (predV avoir_V))) ;
|
||||||
|
ImpersCl vp = mkClause "il" (agrP3 Masc Sg) vp ;
|
||||||
|
GenericCl vp = mkClause "on" (agrP3 Masc Sg) vp ;
|
||||||
|
|
||||||
|
ProgrVP vp =
|
||||||
|
insertComplement
|
||||||
|
(\\a => "en" ++ "train" ++ elisDe ++ infVP vp a)
|
||||||
|
(predV copula) ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangFre of Lang =
|
|||||||
RelativeFre,
|
RelativeFre,
|
||||||
ConjunctionFre,
|
ConjunctionFre,
|
||||||
PhraseFre,
|
PhraseFre,
|
||||||
|
TextX,
|
||||||
|
IdiomFre,
|
||||||
StructuralFre,
|
StructuralFre,
|
||||||
LexiconFre
|
LexiconFre
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
concrete CatGer of Cat = TenseX ** open ResGer, Prelude in {
|
concrete CatGer of Cat = CommonX ** open ResGer, Prelude in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
@@ -6,7 +6,7 @@ concrete CatGer of Cat = TenseX ** open ResGer, Prelude in {
|
|||||||
|
|
||||||
-- Phrase
|
-- Phrase
|
||||||
|
|
||||||
Text, Phr, Utt, Voc = {s : Str} ;
|
Utt, Voc = {s : Str} ;
|
||||||
|
|
||||||
-- Tensed/Untensed
|
-- Tensed/Untensed
|
||||||
|
|
||||||
|
|||||||
7
lib/resource-1.0/german/IdiomGer.gf
Normal file
7
lib/resource-1.0/german/IdiomGer.gf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
concrete IdiomGer of Idiom = CatGer **
|
||||||
|
open MorphoGer, ParadigmsGer, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangGer of Lang =
|
|||||||
RelativeGer,
|
RelativeGer,
|
||||||
ConjunctionGer,
|
ConjunctionGer,
|
||||||
PhraseGer,
|
PhraseGer,
|
||||||
|
TextX,
|
||||||
|
IdiomGer,
|
||||||
StructuralGer,
|
StructuralGer,
|
||||||
LexiconGer
|
LexiconGer
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ concrete StructuralGer of Structural = CatGer **
|
|||||||
a = Strong
|
a = Strong
|
||||||
} ;
|
} ;
|
||||||
only_Predet = {s = \\_,_,_ => "nur"} ;
|
only_Predet = {s = \\_,_,_ => "nur"} ;
|
||||||
no_Phr = ss ["Nein ."] ;
|
no_Phr = ss "nein" ;
|
||||||
on_Prep = mkPrep "auf" Dat ;
|
on_Prep = mkPrep "auf" Dat ;
|
||||||
or_Conj = ss "oder" ** {n = Sg} ;
|
or_Conj = ss "oder" ** {n = Sg} ;
|
||||||
otherwise_PConj = ss "sonst" ;
|
otherwise_PConj = ss "sonst" ;
|
||||||
@@ -123,6 +123,6 @@ concrete StructuralGer of Structural = CatGer **
|
|||||||
youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
youSg_Pron = mkPronPers "du" "dich" "dir" "deiner" "dein" Sg P2 ;
|
||||||
youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss
|
youPl_Pron = mkPronPers "ihr" "euch" "euch" "eurer" "euer" Pl P2 ; ---- poss
|
||||||
youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ;
|
youPol_Pron = mkPronPers "Sie" "Sie" "Ihnen" "Ihrer" "Ihr" Pl P3 ;
|
||||||
yes_Phr = ss ["Ja ."] ;
|
yes_Phr = ss "ja" ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -100,6 +100,20 @@ instance DiffIta of DiffRomance = open CommonRomance, PhonoIta, BeschIta, Prelud
|
|||||||
in
|
in
|
||||||
<pdat ++ pacc, []> ;
|
<pdat ++ pacc, []> ;
|
||||||
|
|
||||||
|
mkImperative vp = {
|
||||||
|
s = \\pol,aag =>
|
||||||
|
let
|
||||||
|
agr = aag ** {p = P2} ;
|
||||||
|
verb = case <aag.n, pol> of {
|
||||||
|
<Sg,Neg> => (vp.s ! VPInfinit Simul).inf ! aag ;
|
||||||
|
_ => (vp.s ! VPImperat).fin ! agr
|
||||||
|
} ;
|
||||||
|
neg = vp.neg ! pol ;
|
||||||
|
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||||
|
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||||
|
in
|
||||||
|
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||||
|
} ;
|
||||||
|
|
||||||
negation : Polarity => (Str * Str) = table {
|
negation : Polarity => (Str * Str) = table {
|
||||||
Pos => <[],[]> ;
|
Pos => <[],[]> ;
|
||||||
|
|||||||
7
lib/resource-1.0/italian/IdiomIta.gf
Normal file
7
lib/resource-1.0/italian/IdiomIta.gf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
concrete IdiomIta of Idiom = CatIta **
|
||||||
|
open MorphoIta, ParadigmsIta, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangIta of Lang =
|
|||||||
RelativeIta,
|
RelativeIta,
|
||||||
ConjunctionIta,
|
ConjunctionIta,
|
||||||
PhraseIta,
|
PhraseIta,
|
||||||
|
TextX,
|
||||||
|
IdiomIta,
|
||||||
StructuralIta,
|
StructuralIta,
|
||||||
LexiconIta
|
LexiconIta
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ lin
|
|||||||
bike_N = regN "bicicletta" ;
|
bike_N = regN "bicicletta" ;
|
||||||
bird_N = regN "uccello" ;
|
bird_N = regN "uccello" ;
|
||||||
black_A = regADeg "nero" ;
|
black_A = regADeg "nero" ;
|
||||||
blue_A = regADeg "blù" ;
|
blue_A = mkA "blù" "blù" "blù" "blù" "blumente" ;
|
||||||
boat_N = regN "batello" ;
|
boat_N = regN "batello" ;
|
||||||
book_N = regN "libro" ;
|
book_N = regN "libro" ;
|
||||||
boot_N = regN "stivale" ;
|
boot_N = regN "stivale" ;
|
||||||
|
|||||||
@@ -12,3 +12,6 @@
|
|||||||
--# prob ComplV2A 0.01
|
--# prob ComplV2A 0.01
|
||||||
--# prob ComplA2 0.1
|
--# prob ComplA2 0.1
|
||||||
--# prob UsePN 0.01
|
--# prob UsePN 0.01
|
||||||
|
--# prob yes_Phr 0.02
|
||||||
|
--# prob no_Phr 0.02
|
||||||
|
--# prob TEmpty 0.1
|
||||||
|
|||||||
7
lib/resource-1.0/norwegian/IdiomNor.gf
Normal file
7
lib/resource-1.0/norwegian/IdiomNor.gf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
concrete IdiomNor of Idiom = CatNor **
|
||||||
|
open MorphoNor, ParadigmsNor, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangNor of Lang =
|
|||||||
RelativeNor,
|
RelativeNor,
|
||||||
ConjunctionNor,
|
ConjunctionNor,
|
||||||
PhraseNor,
|
PhraseNor,
|
||||||
|
TextX,
|
||||||
|
IdiomNor,
|
||||||
StructuralNor,
|
StructuralNor,
|
||||||
LexiconNor
|
LexiconNor
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
incomplete concrete CatRomance of Cat =
|
incomplete concrete CatRomance of Cat =
|
||||||
TenseX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
|
CommonX ** open Prelude, CommonRomance, ResRomance, (R = ParamX) in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ incomplete concrete CatRomance of Cat =
|
|||||||
|
|
||||||
-- Phrase
|
-- Phrase
|
||||||
|
|
||||||
Text, Phr, Utt, Voc = {s : Str} ;
|
Utt, Voc = {s : Str} ;
|
||||||
|
|
||||||
-- Tensed/Untensed
|
-- Tensed/Untensed
|
||||||
|
|
||||||
|
|||||||
@@ -47,12 +47,14 @@ interface DiffRomance = open CommonRomance, Prelude in {
|
|||||||
|
|
||||||
-- To render pronominal arguments as clitics and/or ordinary complements.
|
-- To render pronominal arguments as clitics and/or ordinary complements.
|
||||||
|
|
||||||
pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ;
|
oper pronArg : Number -> Person -> CAgr -> CAgr -> Str * Str ;
|
||||||
|
|
||||||
|
-- To render imperatives (with their clitics etc).
|
||||||
|
|
||||||
|
oper mkImperative : CommonRomance.VP -> {s : Polarity => AAgr => Str} ;
|
||||||
|
|
||||||
--2 Constants that must derivatively depend on language
|
--2 Constants that must derivatively depend on language
|
||||||
|
|
||||||
---- nominative : Case ;
|
|
||||||
---- accusative : Case ;
|
|
||||||
dative : Case ;
|
dative : Case ;
|
||||||
genitive : Case ;
|
genitive : Case ;
|
||||||
|
|
||||||
|
|||||||
@@ -61,6 +61,11 @@ oper
|
|||||||
habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ;
|
habet : TMood -> Agr -> Str = \tm,a -> aux ! VFin tm a.n a.p ;
|
||||||
habere : Str = aux ! VInfin ;
|
habere : Str = aux ! VInfin ;
|
||||||
|
|
||||||
|
vimp : Agr -> Str = \a -> verb.s ! VImper (case a.n of {
|
||||||
|
Sg => SgP2 ;
|
||||||
|
Pl => PlP2
|
||||||
|
}) ;
|
||||||
|
|
||||||
vf : (Agr -> Str) -> (AAgr -> Str) -> {
|
vf : (Agr -> Str) -> (AAgr -> Str) -> {
|
||||||
fin : Agr => Str ;
|
fin : Agr => Str ;
|
||||||
inf : AAgr => Str
|
inf : AAgr => Str
|
||||||
@@ -74,7 +79,7 @@ oper
|
|||||||
s = table {
|
s = table {
|
||||||
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
|
VPFinite t Simul => vf (vfin t) (\_ -> []) ;
|
||||||
VPFinite t Anter => vf (habet t) vpart ;
|
VPFinite t Anter => vf (habet t) vpart ;
|
||||||
VPImperat => vf (\_ -> verb.s ! VImper SgP2) (\_ -> []) ; ----
|
VPImperat => vf vimp (\_ -> []) ;
|
||||||
VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ;
|
VPInfinit Simul => vf (\_ -> []) (\_ -> vinf) ;
|
||||||
VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a)
|
VPInfinit Anter => vf (\_ -> []) (\a -> habere ++ vpart a)
|
||||||
} ;
|
} ;
|
||||||
@@ -139,6 +144,17 @@ oper
|
|||||||
ext = vp.ext ;
|
ext = vp.ext ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
insertClit2 : Str -> VP -> VP = \co,vp -> {
|
||||||
|
s = vp.s ;
|
||||||
|
agr = vp.agr ;
|
||||||
|
clAcc = vp.clAcc ;
|
||||||
|
clDat = vp.clDat ;
|
||||||
|
clit2 = vp.clit2 ++ co ; ---- y en
|
||||||
|
neg = vp.neg ;
|
||||||
|
comp = vp.comp ;
|
||||||
|
ext = vp.ext ;
|
||||||
|
} ;
|
||||||
|
|
||||||
insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> {
|
insertExtrapos : (Polarity => Str) -> VP -> VP = \co,vp -> {
|
||||||
s = vp.s ;
|
s = vp.s ;
|
||||||
agr = vp.agr ;
|
agr = vp.agr ;
|
||||||
@@ -168,7 +184,7 @@ oper
|
|||||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||||
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b
|
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! b
|
||||||
in
|
in
|
||||||
subj ++ neg.p1 ++ clpr.p1 ++ verb ++ neg.p2 ++ inf ++ compl
|
subj ++ neg.p1 ++ clpr.p1 ++ vp.clit2 ++ verb ++ neg.p2 ++ inf ++ compl
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
infVP : VP -> Agr -> Str = \vp,agr ->
|
infVP : VP -> Agr -> Str = \vp,agr ->
|
||||||
@@ -178,7 +194,7 @@ oper
|
|||||||
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||||
obj = clpr.p2 ++ vp.comp ! agr
|
obj = clpr.p2 ++ vp.comp ! agr
|
||||||
in
|
in
|
||||||
clitInf clpr.p1 inf ++ obj ;
|
clitInf (clpr.p1 ++ vp.clit2) inf ++ obj ;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,7 @@ incomplete concrete SentenceRomance of Sentence =
|
|||||||
|
|
||||||
PredSCVP sc vp = mkClause sc.s (agrP3 Masc Sg) vp ;
|
PredSCVP sc vp = mkClause sc.s (agrP3 Masc Sg) vp ;
|
||||||
|
|
||||||
ImpVP vp = {
|
ImpVP = mkImperative ;
|
||||||
s = \\pol,aag =>
|
|
||||||
let
|
|
||||||
agr = aag ** {p = P2} ;
|
|
||||||
verb = (vp.s ! VPImperat).fin ! agr
|
|
||||||
in
|
|
||||||
verb ++ vp.comp ! agr ++ vp.ext ! pol ---- neg,clit
|
|
||||||
} ;
|
|
||||||
|
|
||||||
SlashV2 np v2 =
|
SlashV2 np v2 =
|
||||||
mkClause
|
mkClause
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
incomplete concrete CatScand of Cat =
|
incomplete concrete CatScand of Cat =
|
||||||
TenseX ** open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
CommonX ** open ResScand, Prelude, CommonScand, (R = ParamX) in {
|
||||||
|
|
||||||
flags optimize=all_subs ;
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ incomplete concrete CatScand of Cat =
|
|||||||
|
|
||||||
-- Phrase
|
-- Phrase
|
||||||
|
|
||||||
Text, Phr, Utt, Voc = {s : Str} ;
|
Utt, Voc = {s : Str} ;
|
||||||
|
|
||||||
-- Tensed/Untensed
|
-- Tensed/Untensed
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,21 @@ instance DiffSpa of DiffRomance = open CommonRomance, PhonoSpa, BeschSpa, Prelud
|
|||||||
-- <Sg,P2,CRefl,CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
-- <Sg,P2,CRefl,CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||||
-- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
-- <_,_,CPron {n = Sg ; p = P2},CPron {n = Sg ; p = P1}> => <"te" ++ "me", []> ;
|
||||||
|
|
||||||
|
mkImperative vp = {
|
||||||
|
s = \\pol,aag =>
|
||||||
|
let
|
||||||
|
agr = aag ** {p = P2} ;
|
||||||
|
verb = case <aag.n, pol> of {
|
||||||
|
<Sg,Neg> => (vp.s ! VPFinite (VPres Conjunct) Simul).fin ! agr ;
|
||||||
|
_ => (vp.s ! VPImperat).fin ! agr
|
||||||
|
} ;
|
||||||
|
neg = vp.neg ! pol ;
|
||||||
|
clpr = pronArg agr.n agr.p vp.clAcc vp.clDat ;
|
||||||
|
compl = clpr.p2 ++ vp.comp ! agr ++ vp.ext ! pol
|
||||||
|
in
|
||||||
|
neg.p1 ++ verb ++ clpr.p1 ++ compl ;
|
||||||
|
} ;
|
||||||
|
|
||||||
negation : Polarity => (Str * Str) = table {
|
negation : Polarity => (Str * Str) = table {
|
||||||
Pos => <[],[]> ;
|
Pos => <[],[]> ;
|
||||||
Neg => <"no",[]>
|
Neg => <"no",[]>
|
||||||
|
|||||||
7
lib/resource-1.0/spanish/IdiomSpa.gf
Normal file
7
lib/resource-1.0/spanish/IdiomSpa.gf
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
concrete IdiomSpa of Idiom = CatSpa **
|
||||||
|
open MorphoSpa, ParadigmsSpa, Prelude in {
|
||||||
|
|
||||||
|
flags optimize=all_subs ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -11,10 +11,12 @@ concrete LangSpa of Lang =
|
|||||||
RelativeSpa,
|
RelativeSpa,
|
||||||
ConjunctionSpa,
|
ConjunctionSpa,
|
||||||
PhraseSpa,
|
PhraseSpa,
|
||||||
|
TextSpa, -- special punctuation
|
||||||
|
IdiomSpa,
|
||||||
StructuralSpa,
|
StructuralSpa,
|
||||||
LexiconSpa
|
LexiconSpa
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
11
lib/resource-1.0/spanish/TextSpa.gf
Normal file
11
lib/resource-1.0/spanish/TextSpa.gf
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
concrete TextSpa of Text = {
|
||||||
|
|
||||||
|
-- This works for the special punctuation marks of 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} ;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
concrete CatSwe of Cat = TenseX ** CatScand with
|
concrete CatSwe of Cat = CommonX ** CatScand with
|
||||||
(ResScand = ResSwe) ;
|
(ResScand = ResSwe) ;
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ concrete LangSwe of Lang =
|
|||||||
LexiconSwe
|
LexiconSwe
|
||||||
** {
|
** {
|
||||||
|
|
||||||
flags startcat = Phr ;
|
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||||
|
|
||||||
} ;
|
} ;
|
||||||
|
|||||||
@@ -71,6 +71,7 @@ formatAsTextGen tag para = unwords . format . cap . words where
|
|||||||
w : c : ww | major c -> format $ (w ++ c) :(cap ww)
|
w : c : ww | major c -> format $ (w ++ c) :(cap ww)
|
||||||
w : c : ww | minor c -> format $ (w ++ c) : ww
|
w : c : ww | minor c -> format $ (w ++ c) : ww
|
||||||
p : c : ww | openp p -> format $ (p ++ c) :ww
|
p : c : ww | openp p -> format $ (p ++ c) :ww
|
||||||
|
p : c : ww | spanish p -> format $ (p ++ concat (cap [c])) :ww
|
||||||
c : ww | para c -> "\n\n" : format ww
|
c : ww | para c -> "\n\n" : format ww
|
||||||
w : ww -> w : format ww
|
w : ww -> w : format ww
|
||||||
[] -> []
|
[] -> []
|
||||||
@@ -81,6 +82,7 @@ formatAsTextGen tag para = unwords . format . cap . words where
|
|||||||
major = flip elem (map singleton ".!?")
|
major = flip elem (map singleton ".!?")
|
||||||
minor = flip elem (map singleton ",:;)")
|
minor = flip elem (map singleton ",:;)")
|
||||||
openp = all (flip elem "(")
|
openp = all (flip elem "(")
|
||||||
|
spanish = all (flip elem "¡¿")
|
||||||
|
|
||||||
formatAsCode :: String -> String
|
formatAsCode :: String -> String
|
||||||
formatAsCode = rend 0 . words where
|
formatAsCode = rend 0 . words where
|
||||||
|
|||||||
@@ -110,6 +110,6 @@ linearize mgr lang =
|
|||||||
linTree2string noMark (canModules mgr) (zIdent lang)
|
linTree2string noMark (canModules mgr) (zIdent lang)
|
||||||
where
|
where
|
||||||
sgr = stateGrammarOfLangOpt False mgr (zIdent lang)
|
sgr = stateGrammarOfLangOpt False mgr (zIdent lang)
|
||||||
untok = customOrDefault noOptions useUntokenizer customUntokenizer sgr
|
untok = customOrDefault (stateOptions sgr) useUntokenizer customUntokenizer sgr
|
||||||
|
|
||||||
showTree t = prt_ $ tree2exp t
|
showTree t = prt_ $ tree2exp t
|
||||||
|
|||||||
Reference in New Issue
Block a user