translator: replace quotes
This commit is contained in:
parent
e39369be88
commit
2ebf5f18fa
@ -26,7 +26,15 @@ def translate(text):
|
|||||||
translation.append(chat_completion.choices[0].message.content)
|
translation.append(chat_completion.choices[0].message.content)
|
||||||
bufsize = 0
|
bufsize = 0
|
||||||
buf = []
|
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"):
|
def num_tokens_from_string(string, encoding_name="o200k_base"):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user