mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-01 23:32:51 -06:00
refactored Documentation to Terminology and Documentation proper. This makes it possible to functorize the display of tables, for instance show Swedish inflection tables with headings in English terminology. Carried out the functorization in Eng and Swe, other languages coming soon.
This commit is contained in:
@@ -1,111 +1,7 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
concrete DocumentationEng of Documentation = CatEng ** open
|
||||
ResEng,
|
||||
ParadigmsEng,
|
||||
(G = GrammarEng),
|
||||
(S = SyntaxEng),
|
||||
(L = LexiconEng),
|
||||
Prelude,
|
||||
HTML
|
||||
in {
|
||||
-- documentation of English in English: the default introduced in LangEng
|
||||
|
||||
concrete DocumentationEng of Documentation = CatEng **
|
||||
DocumentationEngFunctor with (Terminology = TerminologyEng) ;
|
||||
|
||||
lincat
|
||||
Category = G.N ;
|
||||
ParameterType = G.N ;
|
||||
Parameter = G.N ;
|
||||
|
||||
Heading = {s : Str} ;
|
||||
Inflection = {s : Str} ;
|
||||
|
||||
|
||||
lin
|
||||
noun_Category = mkN "noun" ;
|
||||
adjective_Category = mkN "adjective" ;
|
||||
verb_Category = mkN "verb" ;
|
||||
adverb_Category = mkN "adverb" ;
|
||||
|
||||
singular_Parameter = mkN "singular" ;
|
||||
plural_Parameter = mkN "plural" ;
|
||||
|
||||
masculine_Parameter = mkN "masculine" ;
|
||||
feminine_Parameter = mkN "feminine" ;
|
||||
neuter_Parameter = mkN "neuter" ;
|
||||
|
||||
nominative_Parameter = mkN "nominative" ;
|
||||
genitive_Parameter = mkN "genitive" ;
|
||||
dative_Parameter = mkN "dative" ;
|
||||
accusative_Parameter = mkN "accusative" ;
|
||||
|
||||
imperative_Parameter = mkN "imperative" ;
|
||||
indicative_Parameter = mkN "indicative" ;
|
||||
conjunctive_Parameter = mkN "konjunctive" ;
|
||||
infinitive_Parameter = mkN "infinitive" ;
|
||||
|
||||
present_Parameter = mkN "present" ;
|
||||
past_Parameter = mkN "past" ;
|
||||
future_Parameter = mkN "future" ;
|
||||
conditional_Parameter = mkN "conditional" ;
|
||||
perfect_Parameter = mkN "perfect" ;
|
||||
|
||||
participle_Parameter = mkN "participle" ;
|
||||
aux_verb_Parameter = mkN "auxiliary" ;
|
||||
|
||||
positive_Parameter = mkN "positive" ;
|
||||
comparative_Parameter = mkN "comparative" ;
|
||||
superlative_Parameter = mkN "superlative" ;
|
||||
predicative_Parameter = mkN "predicative" ;
|
||||
|
||||
nounHeading n = ss (n.s ! Sg ! Nom) ;
|
||||
|
||||
oper
|
||||
tdf : Str -> Str = \s -> td (intag "i" s) ;
|
||||
heading : N -> Str = \n -> (nounHeading n).s ;
|
||||
lin
|
||||
InflectionN noun = {
|
||||
s = heading1 (heading noun_Category) ++ frameTable (
|
||||
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
|
||||
tr (th (heading nominative_Parameter) ++ tdf (noun.s ! Sg ! Nom) ++ tdf (noun.s ! Pl ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ tdf (noun.s ! Sg ! Gen) ++ tdf (noun.s ! Pl ! Gen))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionA adj = {
|
||||
s = heading1 (heading adjective_Category) ++
|
||||
frameTable (
|
||||
tr (th (heading positive_Parameter) ++ tdf (adj.s ! AAdj Posit Nom)) ++
|
||||
tr (th (heading comparative_Parameter) ++ tdf (adj.s ! AAdj Compar Nom)) ++
|
||||
tr (th (heading superlative_Parameter) ++ tdf (adj.s ! AAdj Superl Nom)) ++
|
||||
tr (th (heading adverb_Category) ++ tdf (adj.s ! AAdv))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V v))) v ;
|
||||
InflectionV2 v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2 v) S.something_NP)) (lin V v) ;
|
||||
--- InflectionVV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin VV v) (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
InflectionV2V v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2V v) S.we_NP (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
|
||||
ExplainInflection e i = ss (i.s ++ paragraph e.s) ; -- explanation appended in a new paragraph
|
||||
|
||||
oper
|
||||
verbExample : Cl -> Str = \cl -> (S.mkUtt cl).s ;
|
||||
|
||||
inflectionVerb : Str -> V -> {s : Str} = \ex,verb -> {
|
||||
s = heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" ex) ++
|
||||
frameTable (
|
||||
tr (th (heading infinitive_Parameter) ++ tdf (verb.s ! VInf)) ++
|
||||
tr (th (heading present_Parameter) ++ tdf (verb.s ! VPres)) ++
|
||||
tr (th (heading past_Parameter) ++ tdf (verb.s ! VPast)) ++ --# notpresent
|
||||
tr (th (heading past_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPPart)) ++
|
||||
tr (th (heading present_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPresPart))
|
||||
)
|
||||
} ;
|
||||
|
||||
lin
|
||||
exampleGr_N = mkN "example" ;
|
||||
formGr_N = mkN "form" ;
|
||||
|
||||
|
||||
}
|
||||
64
lib/src/english/DocumentationEngFunctor.gf
Normal file
64
lib/src/english/DocumentationEngFunctor.gf
Normal file
@@ -0,0 +1,64 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
-- documentation of English in any language instantiating Terminology
|
||||
|
||||
incomplete concrete DocumentationEngFunctor of Documentation = CatEng ** open
|
||||
Terminology,
|
||||
ResEng,
|
||||
ParadigmsEng,
|
||||
(G = GrammarEng),
|
||||
(S = SyntaxEng),
|
||||
(L = LexiconEng),
|
||||
Prelude,
|
||||
HTML
|
||||
in {
|
||||
|
||||
|
||||
lincat
|
||||
Inflection = {s : Str} ;
|
||||
|
||||
oper
|
||||
tdf : Str -> Str = \s -> td (intag "i" s) ;
|
||||
heading : N -> Str = \n -> (nounHeading n).s ;
|
||||
lin
|
||||
InflectionN noun = {
|
||||
s = heading1 (heading noun_Category) ++ frameTable (
|
||||
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
|
||||
tr (th (heading nominative_Parameter) ++ tdf (noun.s ! Sg ! Nom) ++ tdf (noun.s ! Pl ! Nom)) ++
|
||||
tr (th (heading genitive_Parameter) ++ tdf (noun.s ! Sg ! Gen) ++ tdf (noun.s ! Pl ! Gen))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionA adj = {
|
||||
s = heading1 (heading adjective_Category) ++
|
||||
frameTable (
|
||||
tr (th (heading positive_Parameter) ++ tdf (adj.s ! AAdj Posit Nom)) ++
|
||||
tr (th (heading comparative_Parameter) ++ tdf (adj.s ! AAdj Compar Nom)) ++
|
||||
tr (th (heading superlative_Parameter) ++ tdf (adj.s ! AAdj Superl Nom)) ++
|
||||
tr (th (heading adverb_Category) ++ tdf (adj.s ! AAdv))
|
||||
)
|
||||
} ;
|
||||
|
||||
InflectionV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V v))) v ;
|
||||
InflectionV2 v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2 v) S.something_NP)) (lin V v) ;
|
||||
--- InflectionVV v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin VV v) (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
InflectionV2V v = inflectionVerb (verbExample (S.mkCl S.she_NP (lin V2V v) S.we_NP (S.mkVP (L.sleep_V)))) (lin V v) ;
|
||||
|
||||
ExplainInflection e i = ss (i.s ++ paragraph e.s) ; -- explanation appended in a new paragraph
|
||||
|
||||
oper
|
||||
verbExample : CatEng.Cl -> Str = \cl -> (S.mkUtt cl).s ;
|
||||
|
||||
inflectionVerb : Str -> CatEng.V -> {s : Str} = \ex,verb -> {
|
||||
s = heading1 (heading verb_Category) ++
|
||||
paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" ex) ++
|
||||
frameTable (
|
||||
tr (th (heading infinitive_Parameter) ++ tdf (verb.s ! VInf)) ++
|
||||
tr (th (heading present_Parameter) ++ tdf (verb.s ! VPres)) ++
|
||||
tr (th (heading past_Parameter) ++ tdf (verb.s ! VPast)) ++ --# notpresent
|
||||
tr (th (heading past_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPPart)) ++
|
||||
tr (th (heading present_Parameter ++ heading participle_Parameter) ++ tdf (verb.s ! VPresPart))
|
||||
)
|
||||
} ;
|
||||
|
||||
}
|
||||
6
lib/src/english/DocumentationEngSwe.gf
Normal file
6
lib/src/english/DocumentationEngSwe.gf
Normal file
@@ -0,0 +1,6 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
-- documentation of English in Swedish
|
||||
|
||||
concrete DocumentationEngSwe of Documentation = CatEng **
|
||||
DocumentationEngFunctor with (Terminology = TerminologySwe) ;
|
||||
69
lib/src/english/TerminologyEng.gf
Normal file
69
lib/src/english/TerminologyEng.gf
Normal file
@@ -0,0 +1,69 @@
|
||||
--# -path=.:../abstract:../common
|
||||
|
||||
concrete TerminologyEng of Terminology = CatEng ** open
|
||||
ResEng,
|
||||
ParadigmsEng,
|
||||
(G = GrammarEng),
|
||||
(S = SyntaxEng),
|
||||
(L = LexiconEng),
|
||||
Prelude
|
||||
in {
|
||||
|
||||
|
||||
lincat
|
||||
Category = G.N ;
|
||||
ParameterType = G.N ;
|
||||
Parameter = G.N ;
|
||||
Modifier = G.A ;
|
||||
|
||||
lin
|
||||
noun_Category = mkN "noun" ;
|
||||
adjective_Category = mkN "adjective" ;
|
||||
verb_Category = mkN "verb" ;
|
||||
adverb_Category = mkN "adverb" ;
|
||||
|
||||
gender_ParameterType = mkN "Gender" ;
|
||||
|
||||
singular_Parameter = mkN "singular" ;
|
||||
plural_Parameter = mkN "plural" ;
|
||||
|
||||
masculine_Parameter = mkN "masculine" ;
|
||||
feminine_Parameter = mkN "feminine" ;
|
||||
neuter_Parameter = mkN "neuter" ;
|
||||
uter_Parameter = mkN "uter" ;
|
||||
|
||||
nominative_Parameter = mkN "nominative" ;
|
||||
genitive_Parameter = mkN "genitive" ;
|
||||
dative_Parameter = mkN "dative" ;
|
||||
accusative_Parameter = mkN "accusative" ;
|
||||
|
||||
imperative_Parameter = mkN "imperative" ;
|
||||
indicative_Parameter = mkN "indicative" ;
|
||||
conjunctive_Parameter = mkN "konjunctive" ;
|
||||
infinitive_Parameter = mkN "infinitive" ;
|
||||
|
||||
definite_Parameter = mkN "definite" ;
|
||||
indefinite_Parameter = mkN "indefinite" ;
|
||||
|
||||
present_Parameter = mkN "present" ;
|
||||
past_Parameter = mkN "past" ;
|
||||
future_Parameter = mkN "future" ;
|
||||
conditional_Parameter = mkN "conditional" ;
|
||||
perfect_Parameter = mkN "perfect" ;
|
||||
supine_Parameter = mkN "supine" ;
|
||||
|
||||
participle_Parameter = mkN "participle" ;
|
||||
aux_verb_Parameter = mkN "auxiliary" ;
|
||||
|
||||
positive_Parameter = mkN "positive" ;
|
||||
comparative_Parameter = mkN "comparative" ;
|
||||
superlative_Parameter = mkN "superlative" ;
|
||||
predicative_Parameter = mkN "predicative" ;
|
||||
|
||||
nounHeading n = ss (n.s ! Sg ! Nom) ;
|
||||
|
||||
exampleGr_N = mkN "example" ;
|
||||
formGr_N = mkN "form" ;
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user