Datasets:
Youssef Benhachem
commited on
Commit
·
332af39
1
Parent(s):
dd9fade
commited
Browse files
KHATT.py
CHANGED
@@ -90,17 +90,17 @@ class KHATT(datasets.GeneratorBasedBuilder):
|
|
90 |
idx = 0
|
91 |
for archive in archives:
|
92 |
for path, file in archive:
|
93 |
-
|
94 |
if path.endswith(".TIF"):
|
95 |
if split != "test":
|
96 |
# image filepath format: <FormNo>_<ParagraphNo>_<LineNo>.TIF
|
97 |
root, _ = os.path.splitext(path)
|
98 |
txt_path = root + ".txt"
|
99 |
-
print(txt_path)
|
100 |
# txt_path = path[:-4] + ".txt"
|
101 |
|
102 |
with open(txt_path, 'r', encoding='utf-8'):
|
103 |
text = txt_path.read()
|
|
|
104 |
|
105 |
else:
|
106 |
text = ""
|
|
|
90 |
idx = 0
|
91 |
for archive in archives:
|
92 |
for path, file in archive:
|
93 |
+
# If we have an image
|
94 |
if path.endswith(".TIF"):
|
95 |
if split != "test":
|
96 |
# image filepath format: <FormNo>_<ParagraphNo>_<LineNo>.TIF
|
97 |
root, _ = os.path.splitext(path)
|
98 |
txt_path = root + ".txt"
|
|
|
99 |
# txt_path = path[:-4] + ".txt"
|
100 |
|
101 |
with open(txt_path, 'r', encoding='utf-8'):
|
102 |
text = txt_path.read()
|
103 |
+
print(text)
|
104 |
|
105 |
else:
|
106 |
text = ""
|