From 649cd8cc334209531b96d029550e186974ced924 Mon Sep 17 00:00:00 2001 From: vrubel Date: Sat, 20 Jun 2026 08:26:28 +0000 Subject: [PATCH] =?UTF-8?q?=D0=B2=D1=8B=D1=80=D0=B5=D0=B7=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=D0=B4=D0=BD=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BB=D0=BE=D0=B6=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B5=D1=81=D0=BB=D0=B8=20=D1=81=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D1=82=20=D1=81=D0=BB=D0=BE=D0=B2?= =?UTF-8?q?=D0=BE=20=D0=BC=D0=B0=D0=BA=D1=81=20(=D0=BB=D1=8E=D0=B1=D0=BE?= =?UTF-8?q?=D0=B9=20=D1=80=D0=B5=D0=B3=D0=B8=D1=81=D1=82=D1=80)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/bot.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/bot.py b/app/bot.py index 0a5dfc0..e143f47 100644 --- a/app/bot.py +++ b/app/bot.py @@ -69,7 +69,13 @@ def clean_text(text: str) -> str: text = re.sub(r'@\S+\s*', '', text) text = re.sub(r'[ \t]+', ' ', text) text = re.sub(r'\n{2,}', '\n', text) + text = re.sub(r'\n', ' ', text) text = text.strip() + + parts = re.split(r'(?<=[.!?])\s+', text) + if parts and re.search(r'макс', parts[-1], re.IGNORECASE): + text = ' '.join(p.strip() for p in parts[:-1] if p.strip()) + if text: text += '\nПип.' return text