Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error of main.py #233

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Fixed error of main.py #233

wants to merge 2 commits into from

Conversation

gimanul
Copy link

@gimanul gimanul commented Jun 2, 2024

line 5:
Changed li = open(path, 'w') to lines = open(path, 'r').read().split("\n")
The original code opened the file in write mode ('w'), which erases the file content and does not allow reading. It should open in read mode ('r') and read lines.

line 20:
Changed file = file.replace('\\', '\\') to file = file.replace('\\', '\\\\')
The original code did not properly escape backslashes, which could cause issues in JSON formatting.

line 28:
Changed template_start = '{\"German\":\"' to `template_start = '{"English":"'
The original code incorrectly used "German" instead of "English" in the JSON template.

line 30:
Changed template_start + german_file + template_start to template_start + english_file + template_mid + german_file + template_end
The original code incorrectly concatenated strings, leading to an invalid JSON format.

line 36:
Changed with open(path, 'r') as f: to with open(path, 'w') as f:
The original code opened the file in read mode ('r') instead of write mode ('w'), preventing writing to the file.

line 38:
Added f.write(file + '\n')
The original code did not write the file list content to the output file.

line 46:
Changed german_file_list = path_t_file_list(german_path) to german_file_list = path_to_file_list(german_path)
The original code had a typo in the function name, causing a function call error.

line 48:
Changed processed_file_list = train_file_list_t_json(english_file_list, german_file_list) to processed_file_list = train_file_list_to_json(english_file_list, german_file_list)
The original code had a typo in the function name, causing a function call error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant