From 2ebf5f18fa5fd4e16cfdb9a5eb522ccbdf9965e0 Mon Sep 17 00:00:00 2001 From: "E. S" Date: Sun, 9 Feb 2025 04:18:37 +0300 Subject: [PATCH] translator: replace quotes --- idb/translator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/idb/translator.py b/idb/translator.py index f3ba945..f316cd4 100644 --- a/idb/translator.py +++ b/idb/translator.py @@ -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"):