From e1e352a985c2da1cc0e4ad4716244261445a2604 Mon Sep 17 00:00:00 2001 From: Daniel Karbach Date: Thu, 9 May 2024 20:09:58 +0200 Subject: [PATCH] fix number and space normalization --- app/Models/ChatLib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Models/ChatLib.php b/app/Models/ChatLib.php index ea16a2b..f4ab93f 100644 --- a/app/Models/ChatLib.php +++ b/app/Models/ChatLib.php @@ -164,8 +164,8 @@ class ChatLib { $str = ''; foreach ($tokens as $token) { $replaced = preg_replace('/\d+/u', '0', $token); - $replaced = preg_replace('/\s+/u', ' ', $token); - $replaced = preg_replace('/(.)\1{2,}/u', '$1$1', $token); + $replaced = preg_replace('/\s+/u', ' ', $replaced); + $replaced = preg_replace('/(.)\1{2,}/u', '$1$1', $replaced); $replaced = strtolower($replaced); foreach ($this->aliases as $canonical => $variants) { if (in_array($replaced, $variants)) { -- 2.39.2