translator: replace quotes

This commit is contained in:
E. S 2025-02-09 04:18:37 +03:00
parent e39369be88
commit 2ebf5f18fa

View File

@ -26,7 +26,15 @@ def translate(text):
translation.append(chat_completion.choices[0].message.content)
bufsize = 0
buf = []
return "\n\n".join(translation)
replacements = (
('', '"'),
('', '"'),
("", "'")
)
translation = "\n\n".join(translation)
for r in replacements:
translation = translation.replace(r[0], r[1])
return translation
def num_tokens_from_string(string, encoding_name="o200k_base"):