-
Notifications
You must be signed in to change notification settings - Fork 3
/
__main__.py
44 lines (39 loc) · 1.16 KB
/
__main__.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
"""
A main file to execute CheckMyTex with CLI.
"""
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,
)
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)
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()