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:
aarne
2013-12-14 09:21:15 +00:00
parent b394d16ed0
commit ced38d5f9f
16 changed files with 685 additions and 564 deletions

View File

@@ -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" ;
}

View 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))
)
} ;
}

View File

@@ -0,0 +1,6 @@
--# -path=.:../abstract:../common
-- documentation of English in Swedish
concrete DocumentationEngSwe of Documentation = CatEng **
DocumentationEngFunctor with (Terminology = TerminologySwe) ;

View 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" ;
}