Skip to content

Commit 939e0f9

Browse files
committed
add one more empty step
1 parent 36ec5f6 commit 939e0f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/translation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def translate_cn(input_file):
8585
file.write("")
8686

8787
for i, chunk in enumerate(chunks):
88-
max_retries = 1
88+
max_retries = 2
8989
retry_count = 0
9090

9191
while retry_count < max_retries:
@@ -113,7 +113,7 @@ def translate_cn(input_file):
113113

114114
# Append this chunk's translation to the output file immediately
115115
with open(output_file, 'a', encoding='utf-8') as file:
116-
file.write(response_text + "\n")
116+
file.write(response_text + "\n\n") # Add an extra newline for spacing between chunks
117117

118118
logging.info(f"Wrote chunk {i+1} translation to {output_file}")
119119
break # Success, exit retry loop
@@ -131,7 +131,7 @@ def translate_cn(input_file):
131131

132132
if __name__ == "__main__":
133133
directory = "lectures"
134-
max_workers = 3 # Adjust this based on your API rate limits and system capabilities
134+
max_workers = 2 # Adjust this based on your API rate limits and system capabilities
135135

136136
files = [f for f in os.listdir(directory) if f.endswith('.md') and os.path.isfile(os.path.join(directory, f))]
137137
logging.info(f'Files to translate: {files}')

0 commit comments

Comments
 (0)