-
Notifications
You must be signed in to change notification settings - Fork 3
/
german.py
65 lines (60 loc) · 1.72 KB
/
german.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
"""
A main file modified to check german tex files. Not as powerful as the
english version.
"""
from checkmytex.cli import cli, parse_arguments
from checkmytex.document_analyzer import DocumentAnalyzer
from checkmytex.filtering import (
IgnoreIncludegraphics,
IgnoreLikelyAuthorNames,
IgnoreRefs,
IgnoreRepeatedWords,
IgnoreSpellingWithMath,
IgnoreWordsFromBibliography,
MathMode,
Whitelist,
)
from checkmytex.finding import (
AspellChecker,
CheckSpell,
ChkTex,
Cleveref,
Languagetool,
SiUnitx,
UniformNpHard,
)
def main():
"""
A main function, such that it can also be called with different entry
points
:return: None
"""
args = parse_arguments()
engine = DocumentAnalyzer()
engine.setup_default()
# Add filter
whitelist = Whitelist(args.whitelist)
aspell = AspellChecker(lang="de_DE")
if aspell.is_available():
engine.add_checker(aspell)
else:
engine.add_checker(CheckSpell(lang="de"))
engine.add_checker(ChkTex())
engine.add_checker(Languagetool(lang="de-DE"))
engine.add_checker(SiUnitx())
engine.add_checker(Cleveref())
engine.add_checker(UniformNpHard())
# Add filter
engine.add_filter(whitelist)
engine.add_filter(IgnoreIncludegraphics())
engine.add_filter(IgnoreRefs())
engine.add_filter(IgnoreRepeatedWords(["problem", "problems"]))
engine.add_filter(IgnoreLikelyAuthorNames())
engine.add_filter(IgnoreWordsFromBibliography())
engine.add_filter(IgnoreSpellingWithMath())
engine.add_filter(
MathMode({"SPELLING": None, "languagetool": None, "Proselint": None})
)
cli(engine, args=args, whitelist=whitelist)
if __name__ == "__main__":
main()