Skip to content

Commit 2cef170

Browse files
committed
able to create a dictionary and return it. However, its not as clean as what chatgpt gives. so manually create this dictionary/tsv using chatgpt , maybe 26 times once for each alphabet
1 parent ea0191e commit 2cef170

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

classify.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,19 @@ def read_glue_data(dataset_downloaded,split,lines_to_read=0):
558558

559559

560560
def read_usp_spanish_dictionary(file_path):
561-
with open(file_path) as f:
562-
for line in f:
563-
line_split = line.split(" ")
564-
print(line_split)
561+
with open(file_path) as f:
562+
# Extracting word pairs
563+
uspantek_to_spanish = {}
564+
for text_input in f:
565+
for line in text_input.strip().split("\n"):
566+
parts = line.split(maxsplit=2)
567+
if len(parts) >= 3:
568+
key = parts[0].strip()
569+
value = parts[2].strip()
570+
uspantek_to_spanish[key] = value
571+
return uspantek_to_spanish
572+
573+
565574

566575
def read_data(filename,lines_to_read):
567576
labels, sentences = [], []

0 commit comments

Comments
 (0)