-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
56 lines (49 loc) · 1.57 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
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Script for performing basic QA checks on a tmx file of a Japanese to English translation.
Checks for the following issues:
Untranslated segments
Inconsistent numbers
Consecutive spaces
Leading spaces
Trailing spaces
Repeated words
Repeated two-word combinations
Unpaired symbols
Leading capitalization
Inconsistent ending punctuation
Fullwidth characters in target
Takes three arguments to execute from the command line:
python3 checker.py yourfile.tmx
Results sent to stdout.
'''
import sys
import verify
import gather
import untranslated
import digits
import spaces
import repeaters
import unpaired
import capitals
import punctuation
import characters
import output
def main():
if verify.user_input_check(sys.argv):
segments = gather.gather_segments(sys.argv[1])
segments = untranslated.untranslated_check(segments)
segments = digits.digit_check(segments)
segments = spaces.consecutive_space_check(segments)
segments = spaces.leading_space_check(segments)
segments = spaces.trailing_space_check(segments)
segments = repeaters.single_word_check(segments)
segments = repeaters.double_word_check(segments)
segments = unpaired.unpaired_symbol_check(segments)
segments = capitals.leading_capital_check(segments)
segments = punctuation.ending_punctuation_check(segments)
segments = characters.asian_character_check(segments)
output.output_results(segments)
if __name__ == '__main__':
main()