-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdiscrepancy_discovery.py
29 lines (24 loc) · 1018 Bytes
/
discrepancy_discovery.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
import bible_dictionaries
import click
import re
@click.command()
@click.option('--language', help='language you are working with eg. swahili')
@click.option('--book', help='number of book you are aligning eg. 12')
def discrepancy_discovery(language, book):
eng = open("datasets/preprocessed/english/" + book + "." + bible_dictionaries.languages["english"][book] + ".txt", "r").read()
lang = open("datasets/preprocessed/" + language + "/" + book + "." + bible_dictionaries.languages[language][book] + ".txt", "r").read()
eng = eng.split('\n')
lang = lang.split('\n')
line = []
length = len(lang)
for i in range(0,length):
if (eng[i][0].isdigit()):
if (not lang[i][0].isdigit()):
print(i)
break
else:
if (re.search("^\d+\s", eng[i]).group(0) != re.search("^\d+\s", lang[i]).group(0)):
print(i)
break
if __name__ == '__main__':
discrepancy_discovery()