]> git.localhorst.tv Git - alttp.git/commitdiff
fix number and space normalization
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 9 May 2024 18:09:58 +0000 (20:09 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Thu, 9 May 2024 18:09:58 +0000 (20:09 +0200)
app/Models/ChatLib.php

index ea16a2bd740efb4916a54881bceda3ff3b388f35..f4ab93f4798b28ebc87383b94f68e75728bbc7c9 100644 (file)
@@ -164,8 +164,8 @@ class ChatLib {
                $str = '';
                foreach ($tokens as $token) {
                        $replaced = preg_replace('/\d+/u', '0', $token);
                $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)) {
                        $replaced = strtolower($replaced);
                        foreach ($this->aliases as $canonical => $variants) {
                                if (in_array($replaced, $variants)) {