completed Documentation modules for English, Swedish, Bulgarian, German, Finnish, French. The examples for Finnish, German and French could still be improved. The old parsing grammars are now restored. The new Translation grammar still don't have statistical model.

This commit is contained in:
kr.angelov
2014-02-21 16:31:50 +00:00
parent 014f4e1e11
commit dc19edc05d
15 changed files with 1037 additions and 477 deletions

View File

@@ -14,43 +14,122 @@ in {
lincat
Inflection = {s : Str} ;
Inflection = {t : Str; s1,s2 : Str} ;
Document = {s : Str} ;
Tag = {s : Str} ;
oper
tdf : Str -> Str = \s -> td (intag "i" s) ;
heading : N -> Str = \n -> (nounHeading n).s ;
nounGender : CatFre.N -> Parameter = \n -> case n.g of {
Masc => masculine_Parameter ;
Fem => feminine_Parameter
} ;
lin
InflectionN noun = {
s = heading1 (heading noun_Category) ++
paragraph (intag "b" (heading (gender_ParameterType)) ++ ":" ++ heading (nounGender noun)) ++
paragraph (frameTable (
tr (th (heading singular_Parameter) ++ th (heading plural_Parameter) ) ++
tr (tdf (noun.s ! Sg) ++ tdf (noun.s ! Pl))
))
} ;
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 adj = {
s = heading1 (nounHeading adjective_Category).s ++
frameTable (
tr (th "" ++ th (heading singular_Parameter) ++ th (heading plural_Parameter)) ++
tr (th (heading masculine_Parameter) ++ tdf (adj.s ! Posit ! (AF Masc Sg)) ++ tdf (adj.s ! Posit ! (AF Masc Pl))) ++
tr (th (heading feminine_Parameter) ++ tdf (adj.s ! Posit ! (AF Fem Sg)) ++ tdf (adj.s ! Posit ! (AF Fem 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)))
)
} ;
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) ;
} ;
MkDocument b i e = ss (paragraph e.s ++ i.s ++ paragraph e.s) ; -- explanation appended in a new paragraph
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 : CatFre.Cl -> Str = \cl ->
@@ -58,64 +137,76 @@ oper
++ ";" ++ (S.mkUtt (S.mkS S.anteriorAnt cl)).s --# notpresent
;
inflectionVerb : Str -> CatFre.V -> {s : Str} = \ex,verb ->
inflVerb : Verb -> Str = \verb ->
let
vfin : CommonRomance.VF -> Str = \f ->
verb.s ! f ;
gforms : Number -> Person -> Str = \n,p ->
tdf (vfin (VFin (VPres Indic) n p)) ++
tdf (vfin (VFin (VPres Conjunct) n p))
++ tdf (vfin (VFin (VImperf Indic) n p)) --# notpresent
++ tdf (vfin (VFin (VImperf Conjunct) n p)) --# notpresent
;
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)))
) ;
gforms2 : Number -> Person -> Str = \n,p -> --# notpresent
tdf (vfin (VFin VPasse n p)) ++ --# notpresent
tdf (vfin (VFin VFut n p)) ++ --# notpresent
tdf (vfin (VFin VCondit n p)) --# notpresent
; --# notpresent
ttable : (Number -> Person -> Str) -> Str -> Str = \forms, theadings ->
paragraph (frameTable (
theadings ++
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" ++ forms Sg P1) ++
tr (th "2.p" ++ forms Sg P2) ++
tr (th "3.p" ++ forms Sg P3) ++
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" ++ forms Pl P1) ++
tr (th "2.p" ++ forms Pl P2) ++
tr (th "3.p" ++ forms Pl P3)
)) ;
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 {
s =
heading1 (heading verb_Category)
++ paragraph (intag "b" (heading exampleGr_N ++ ":") ++ intag "i" ex)
++ ttable gforms
(tr (intagAttr "th" "colspan=2 rowspan=2" ""
++ intagAttr "th" "colspan=2" (heading present_Parameter)
++ intagAttr "th" "colspan=2" (heading imperfect_Parameter)
) ++
tr ( th (heading indicative_Parameter) ++ th (heading conjunctive_Parameter)
++ th (heading indicative_Parameter) ++ th (heading conjunctive_Parameter)
)
)
++ ttable gforms2 --# notpresent
(tr (intagAttr "th" "colspan=2" "" ++ th (heading simple_past_Parameter) ++ --# notpresent
th (heading future_Parameter) ++ th (heading conditional_Parameter))) --# notpresent
++ paragraph (frameTable (
tr (intagAttr "th" "colspan=2" (heading infinitive_Parameter) ++ (tdf (vfin (VInfin False)))) ++
tr (intagAttr "th" "rowspan=3" (heading imperative_Parameter) ++ th "sg.2.p" ++ (tdf (vfin (VImper SgP2)))) ++
tr ( th "pl.1.p" ++ (tdf (vfin (VImper PlP1)))) ++
tr ( th "pl.2.p" ++ (tdf (vfin (VImper PlP2)))) ++
tr (intagAttr "th" "rowspan=2" (heading participle_Parameter) ++
th (heading past_Parameter) ++ (tdf (vfin (VPart Masc Sg)))) ++
tr ( th (heading present_Parameter) ++ (tdf (vfin VGer)))
)
)
} ;
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))
) ;
}

View File

@@ -1,4 +1,4 @@
--# -path=.:../english/:../abstract:../romance:alltenses
--# -path=.:../english/:../abstract:../romance:alltenses:../translator
concrete ParseFre of ParseEngAbs =
TenseFre,
-- CatFre,
@@ -21,7 +21,7 @@ concrete ParseFre of ParseEngAbs =
VPI, VPIForm, VPIInf, VPIPresPart, ListVPI, VV, MkVPI, BaseVPI, ConsVPI, ConjVPI, ComplVPIVV,
ClSlash, RCl, EmptyRelSlash],
DictEngFre **
DictionaryFre **
open PhonoFre, MorphoFre, ResFre, CommonRomance, ParadigmsFre, SyntaxFre, Prelude, (G = GrammarFre) in {
flags