fix split function

This commit is contained in:
Linus2punkt0
2024-03-10 10:34:44 +01:00
parent 12932e5579
commit 3e29891e7c

View File

@@ -58,8 +58,8 @@ def split_post(text):
sentences = text.split(". ")
i = 1
while len(first) > 280 and i < len(sentences):
first = ".".join(sentences[:(len(sentences) - i)]) + "."
second = ".".join(sentences[(len(sentences) - i):])
first = ". ".join(sentences[:(len(sentences) - i)]) + "."
second = ". ".join(sentences[(len(sentences) - i):])
i += 1
# If splitting by sentance does not result in a short enough post, we try splitting by words instead.
if len(first) > 280: