mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
support for Italian translator and documentation
This commit is contained in:
6
lib/src/italian/DocumentationIta.gf
Normal file
6
lib/src/italian/DocumentationIta.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
-- documentation of Italian in Italian: the default introduced in LangIta
|
||||
|
||||
concrete DocumentationIta of Documentation = CatIta **
|
||||
DocumentationItaFunctor with (Terminology = TerminologyIta) ;
|
||||
218
lib/src/italian/DocumentationItaFunctor.gf
Normal file
218
lib/src/italian/DocumentationItaFunctor.gf
Normal file
@@ -0,0 +1,218 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
incomplete concrete DocumentationItaFunctor of Documentation = CatIta ** open
|
||||
Terminology, -- the interface to be instantiated
|
||||
ResIta,
|
||||
CommonRomance,
|
||||
ParadigmsIta,
|
||||
(G = GrammarIta),
|
||||
(S = SyntaxIta),
|
||||
(L = LexiconIta),
|
||||
Prelude,
|
||||
HTML
|
||||
in {
|
||||
|
||||
|
||||
lincat
|
||||
Inflection = {t : Str; s1,s2 : Str} ;
|
||||
Document = {s : Str} ;
|
||||
Tag = {s : Str} ;
|
||||
|
||||
{-
|
||||
-} --# notpresent
|
||||
|
||||
oper
|
||||
heading : N -> Str = \n -> (nounHeading n).s ;
|
||||
|
||||
lin
|
||||
InflectionN, InflectionN3, InflectionN3 = \noun -> {
|
||||
t = "n" ;
|
||||
s1 = heading1 (heading noun_Category ++
|
||||
case noun.g of {
|
||||
Masc => "("+heading masculine_Parameter+")" ;
|
||||
Fem => "("+heading feminine_Parameter+")"
|
||||
}) ;
|
||||
s2 = frameTable (
|
||||
tr (th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++
|
||||
tr (td (noun.s ! Sg) ++ td (noun.s ! Pl))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionA, InflectionA2 = \adj -> {
|
||||
t = "a" ;
|
||||
s1 = heading1 (nounHeading adjective_Category).s ;
|
||||
s2 = frameTable (
|
||||
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++
|
||||
tr (th (heading masculine_Parameter) ++ td (adj.s ! Posit ! (AF Masc Sg)) ++ td (adj.s ! Posit ! (AF Masc Pl))) ++
|
||||
tr (th (heading feminine_Parameter) ++ td (adj.s ! Posit ! (AF Fem Sg)) ++ td (adj.s ! Posit ! (AF Fem Pl)))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionAdv adv = {
|
||||
t = "adv" ;
|
||||
s1 = heading1 "Adverbe" ;
|
||||
s2 = paragraph adv.s
|
||||
} ;
|
||||
|
||||
InflectionPrep p = {
|
||||
t = "prep" ;
|
||||
s1 = heading1 "Préposition" ;
|
||||
s2 = paragraph p.s
|
||||
} ;
|
||||
|
||||
InflectionV v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2 v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV3 v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v S.something_NP S.something_NP)) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2V v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP (lin V2V v) S.we_NP (S.mkVP (L.sleep_V)))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2S v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2Q v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionV2A v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Verb" ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVV v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 (heading verb_Category) ++
|
||||
paragraph (verbExample (S.mkCl S.she_NP v (S.mkVP (L.sleep_V)))) ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVS v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Verb" ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVQ v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Verb" ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
InflectionVA v = {
|
||||
t = "v" ;
|
||||
s1 = heading1 "Verb" ;
|
||||
s2 = inflVerb v
|
||||
} ;
|
||||
|
||||
MkDocument b i e = ss (i.s1 ++ paragraph b.s ++ i.s2 ++ paragraph e.s) ; -- explanation appended in a new paragraph
|
||||
MkTag i = ss i.t ;
|
||||
|
||||
oper
|
||||
verbExample : CatIta.Cl -> Str = \cl ->
|
||||
(S.mkUtt cl).s
|
||||
++ ";" ++ (S.mkUtt (S.mkS S.anteriorAnt cl)).s --# notpresent
|
||||
;
|
||||
|
||||
inflVerb : Verb -> Str = \verb ->
|
||||
let
|
||||
vfin : CommonRomance.VF -> Str = \f ->
|
||||
verb.s ! f ;
|
||||
|
||||
ttable : TMood -> Str = \tense ->
|
||||
frameTable (
|
||||
tr (th "" ++
|
||||
th (heading singular_Parameter) ++
|
||||
th (heading plural_Parameter)) ++
|
||||
tr (th "1.p" ++
|
||||
td (vfin (VFin tense Sg P1)) ++
|
||||
td (vfin (VFin tense Pl P1))) ++
|
||||
tr (th "2.p" ++
|
||||
td (vfin (VFin tense Sg P2)) ++
|
||||
td (vfin (VFin tense Pl P2))) ++
|
||||
tr (th "3.p" ++
|
||||
td (vfin (VFin tense Sg P3)) ++
|
||||
td (vfin (VFin tense Pl P3)))
|
||||
) ;
|
||||
|
||||
ttable2 : (Mood -> TMood) -> Str = \f ->
|
||||
frameTable (
|
||||
tr (intagAttr "th" "colspan=2" "" ++
|
||||
th (heading indicative_Parameter) ++
|
||||
th (heading conjunctive_Parameter)) ++
|
||||
tr (intagAttr "th" "rowspan=3" (heading singular_Parameter) ++
|
||||
th "1.p" ++
|
||||
td (vfin (VFin (f Indic) Sg P1)) ++
|
||||
td (vfin (VFin (f Conjunct) Sg P1))) ++
|
||||
tr (th "2.p" ++
|
||||
td (vfin (VFin (f Indic) Sg P2)) ++
|
||||
td (vfin (VFin (f Conjunct) Sg P2))) ++
|
||||
tr (th "3.p" ++
|
||||
td (vfin (VFin (f Indic) Sg P3)) ++
|
||||
td (vfin (VFin (f Conjunct) Sg P3))) ++
|
||||
tr (intagAttr "th" "rowspan=3" (heading plural_Parameter) ++
|
||||
th "1.p" ++
|
||||
td (vfin (VFin (f Indic) Pl P1)) ++
|
||||
td (vfin (VFin (f Conjunct) Pl P1))) ++
|
||||
tr (th "2.p" ++
|
||||
td (vfin (VFin (f Indic) Pl P2)) ++
|
||||
td (vfin (VFin (f Conjunct) Pl P2))) ++
|
||||
tr (th "3.p" ++
|
||||
td (vfin (VFin (f Indic) Pl P3)) ++
|
||||
td (vfin (VFin (f Conjunct) Pl P3)))
|
||||
) ;
|
||||
|
||||
in heading2 (heading present_Parameter) ++
|
||||
ttable2 VPres ++
|
||||
heading2 (heading imperfect_Parameter) ++
|
||||
ttable2 VImperf
|
||||
++ heading2 (heading simple_past_Parameter) ++ --# notpresent
|
||||
ttable VPasse --# notpresent
|
||||
++ heading2 (heading future_Parameter) ++ --# notpresent
|
||||
ttable VFut --# notpresent
|
||||
++ heading2 (heading conditional_Parameter) ++ --# notpresent
|
||||
ttable VCondit --# notpresent
|
||||
++ heading2 (heading infinitive_Parameter) ++
|
||||
paragraph (vfin (VInfin False)) ++
|
||||
heading2 (heading imperative_Parameter) ++
|
||||
frameTable (
|
||||
tr (th "sg.2.p" ++ td (vfin (VImper SgP2))) ++
|
||||
tr (th "pl.1.p" ++ td (vfin (VImper PlP1))) ++
|
||||
tr (th "pl.2.p" ++ td (vfin (VImper PlP2)))
|
||||
) ++
|
||||
heading2 (heading participle_Parameter) ++
|
||||
frameTable (
|
||||
tr (th (heading past_Parameter) ++ td (vfin (VPart Masc Sg))) ++
|
||||
tr (th (heading present_Parameter) ++ td (vfin VGer))
|
||||
) ;
|
||||
|
||||
{- --# notpresent
|
||||
-}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
concrete LangIta of Lang =
|
||||
GrammarIta,
|
||||
LexiconIta
|
||||
,DocumentationIta
|
||||
** {
|
||||
|
||||
flags startcat = Phr ; unlexer = text ; lexer = text ;
|
||||
|
||||
67
lib/src/italian/TerminologyIta.gf
Normal file
67
lib/src/italian/TerminologyIta.gf
Normal file
@@ -0,0 +1,67 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
concrete TerminologyIta of Terminology = CatIta ** open
|
||||
ResIta,
|
||||
CommonRomance,
|
||||
ParadigmsIta,
|
||||
(G = GrammarIta),
|
||||
(S = SyntaxIta),
|
||||
(L = LexiconIta),
|
||||
Prelude
|
||||
|
||||
in {
|
||||
|
||||
|
||||
lincat
|
||||
Category = G.N ;
|
||||
ParameterType = G.N ;
|
||||
Parameter = G.N ;
|
||||
|
||||
Heading = {s : Str} ;
|
||||
|
||||
|
||||
lin
|
||||
noun_Category = mkN "nome" ;
|
||||
adjective_Category = mkN "addiettivo" ;
|
||||
verb_Category = mkN "verbe" masculine ;
|
||||
|
||||
gender_ParameterType = mkN "genere" masculine ;
|
||||
|
||||
singular_Parameter = mkN "singolare" ;
|
||||
plural_Parameter = mkN "plurale" ;
|
||||
|
||||
masculine_Parameter = mkN "maschio" ;
|
||||
feminine_Parameter = mkN "femminile" ;
|
||||
neuter_Parameter = mkN "neutro" ;
|
||||
|
||||
nominative_Parameter = mkN "nominativo" ;
|
||||
genitive_Parameter = mkN "genitivo" ;
|
||||
dative_Parameter = mkN "dativo" ;
|
||||
accusative_Parameter = mkN "accusativi" ;
|
||||
|
||||
imperative_Parameter = mkN "imperativo" ;
|
||||
indicative_Parameter = mkN "indicativo" ;
|
||||
conjunctive_Parameter = mkN "congiuntivo" ;
|
||||
infinitive_Parameter = mkN "infinitivo" ;
|
||||
|
||||
present_Parameter = mkN "presente" ;
|
||||
past_Parameter = mkN "passato" ;
|
||||
future_Parameter = mkN "futuro" ;
|
||||
conditional_Parameter = mkN "condizionale" ;
|
||||
perfect_Parameter = mkN "passato prossimo" ; ----
|
||||
imperfect_Parameter = mkN "imperfetto" ;
|
||||
simple_past_Parameter = mkN "passato remoto" ; ----
|
||||
|
||||
participle_Parameter = mkN "participio" ;
|
||||
aux_verb_Parameter = mkN "ausiliare" ;
|
||||
|
||||
positive_Parameter = mkN "positivo" ;
|
||||
comparative_Parameter = mkN "comparativo" ;
|
||||
superlative_Parameter = mkN "superlativo" ;
|
||||
predicative_Parameter = mkN "prédicativo" ;
|
||||
|
||||
nounHeading n = ss (n.s ! Sg) ;
|
||||
|
||||
exampleGr_N = mkN "esempio" masculine ;
|
||||
|
||||
}
|
||||
134
lib/src/translator/ExtensionsIta.gf
Normal file
134
lib/src/translator/ExtensionsIta.gf
Normal file
@@ -0,0 +1,134 @@
|
||||
concrete ExtensionsIta of Extensions =
|
||||
CatIta **
|
||||
open
|
||||
PhonoIta, MorphoIta, ResIta, CommonRomance, ParadigmsIta, SyntaxIta, Prelude, (G = GrammarIta) in {
|
||||
|
||||
----lincat
|
||||
---- VPI = E.VPI ;
|
||||
---- ListVPI = E.ListVPI ;
|
||||
---- VPS = E.VPS ;
|
||||
---- ListVPS = E.ListVPS ;
|
||||
|
||||
----lin
|
||||
---- MkVPI = E.MkVPI ;
|
||||
---- ConjVPI = E.ConjVPI ;
|
||||
---- ComplVPIVV = E.ComplVPIVV ;
|
||||
|
||||
---- MkVPS = E.MkVPS ;
|
||||
---- ConjVPS = E.ConjVPS ;
|
||||
---- PredVPS = E.PredVPS ;
|
||||
|
||||
---- BaseVPI = E.BaseVPI ;
|
||||
---- ConsVPI = E.ConsVPI ;
|
||||
---- BaseVPS = E.BaseVPS ;
|
||||
---- ConsVPS = E.ConsVPS ;
|
||||
|
||||
---- GenIP = E.GenIP ;
|
||||
---- GenRP = E.GenRP ;
|
||||
|
||||
---- PassVPSlash = E.PassVPSlash ;
|
||||
---- PassAgentVPSlash = E.PassAgentVPSlash ;
|
||||
|
||||
|
||||
lin
|
||||
GenNP np =
|
||||
let denp = (np.s ! ResIta.genitive).ton in {
|
||||
s = \\_,_,_,_ => [] ;
|
||||
sp = \\_,_,_ => denp ;
|
||||
s2 = denp ;
|
||||
isNeg = False ;
|
||||
} ;
|
||||
|
||||
EmptyRelSlash slash = mkRCl which_RP (lin ClSlash slash) ;
|
||||
|
||||
that_RP = which_RP ;
|
||||
|
||||
but_Subj = {s = "ma" ; m = Indic} ; ---- strange to have this as Subj
|
||||
|
||||
|
||||
|
||||
lin
|
||||
CompoundCN noun cn = {
|
||||
s = \\n => cn.s ! n ++ "di" ++ noun.s ! Sg ;
|
||||
g = cn.g
|
||||
} ;
|
||||
|
||||
{-
|
||||
GerundN v = {
|
||||
s = \\n,c => v.s ! VPresPart ;
|
||||
g = Neutr
|
||||
} ;
|
||||
|
||||
GerundAP v = {
|
||||
s = \\agr => v.s ! VPresPart ;
|
||||
isPre = True
|
||||
} ;
|
||||
-- }
|
||||
|
||||
PastPartAP v = {
|
||||
s = table {
|
||||
AF g n => v.s ! VPart g n ;
|
||||
_ => v.s ! VPart Masc Sg ---- the adverb form
|
||||
} ;
|
||||
isPre = True
|
||||
} ;
|
||||
|
||||
--{-
|
||||
OrdCompar a = {s = \\c => a.s ! AAdj Compar c } ;
|
||||
-}
|
||||
|
||||
PositAdVAdj a = {s = a.s ! Posit ! AA} ;
|
||||
|
||||
{-
|
||||
UseQuantPN q pn = {s = \\c => q.s ! False ! Sg ++ pn.s ! npcase2case c ; a = agrgP3 Sg pn.g} ;
|
||||
|
||||
SlashV2V v ant p vp = insertObjc (\\a => v.c3 ++ ant.s ++ p.s ++
|
||||
infVP v.typ vp ant.a p.p a)
|
||||
(predVc v) ;
|
||||
|
||||
SlashVPIV2V v p vpi = insertObjc (\\a => p.s ++
|
||||
v.c3 ++
|
||||
vpi.s ! VVAux ! a)
|
||||
(predVc v) ;
|
||||
-}
|
||||
ComplVV v a p vp =
|
||||
insertComplement (\\a => prepCase v.c2.c ++ infVP vp a) (predV v) ; ---- a,p
|
||||
|
||||
---- TODO: find proper expressions for OSV and OVS in Ita
|
||||
PredVPosv np vp = mkCl (lin NP np) (lin VP vp) ;
|
||||
PredVPovs np vp = mkCl (lin NP np) (lin VP vp) ;
|
||||
|
||||
|
||||
CompS s = {s = \\_ => "di" ++ "che" ++ s.s ! Indic} ; ---- de ?
|
||||
|
||||
{-
|
||||
CompQS qs = {s = \\_ => qs.s ! QIndir} ;
|
||||
CompVP ant p vp = {s = \\a => ant.s ++ p.s ++
|
||||
infVP VVInf vp ant.a p.p a} ;
|
||||
|
||||
VPSlashVS vs vp =
|
||||
insertObj (\\a => infVP VVInf vp Simul CPos a) (predV vs) **
|
||||
{c2 = ""; gapInMiddle = False} ;
|
||||
|
||||
PastPartRS ant pol vps = {
|
||||
s = \\agr => vps.ad ++ vps.ptp ++ vps.s2 ! agr ;
|
||||
c = npNom
|
||||
} ;
|
||||
|
||||
PresPartRS ant pol vp = {
|
||||
s = \\agr => vp.ad ++ vp.prp ++ vp.s2 ! agr ;
|
||||
c = npNom
|
||||
} ;
|
||||
|
||||
ApposNP np1 np2 = {
|
||||
s = \\c => np1.s ! c ++ "," ++ np2.s ! npNom ;
|
||||
a = np1.a
|
||||
} ;
|
||||
|
||||
AdAdV = cc2 ;
|
||||
|
||||
UttAdV adv = adv;
|
||||
-}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user