From: Daniel Karbach Date: Sat, 6 Apr 2024 13:02:06 +0000 (+0200) Subject: refine hi classification X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=d6d76247ada28bee99ff5f0a91706ce7edb68a7f;p=alttp.git refine hi classification --- diff --git a/app/Models/ChatLog.php b/app/Models/ChatLog.php index 79eab97..792e9e7 100644 --- a/app/Models/ChatLog.php +++ b/app/Models/ChatLog.php @@ -86,7 +86,7 @@ class ChatLog extends Model { if (Str::contains($rawText, ['haha', 'hehe', 'hihi', 'kekw', 'lol', 'lul', 'xd'])) { return 'lol'; } - if (Str::startsWith($rawText, ['ahoi', 'hallo', 'hello', 'hi', 'huhu']) || Str::endsWith($rawText, ['hi', 'wave'])) { + if (Str::startsWith($rawText, ['ahoi', 'hallo', 'hello', 'hi ', 'huhu']) || Str::endsWith($rawText, ['hi', 'wave'])) { return 'hi'; } if (Str::contains($rawText, ['pog', 'wow'])) { diff --git a/tests/Unit/Models/ChatLogTest.php b/tests/Unit/Models/ChatLogTest.php index 72fd172..30b8732 100644 --- a/tests/Unit/Models/ChatLogTest.php +++ b/tests/Unit/Models/ChatLogTest.php @@ -17,6 +17,7 @@ class ChatLogTest extends TestCase { $this->assertEquals('hi', ChatLog::classify('hi')); $this->assertEquals('hi', ChatLog::classify('hallo')); + $this->assertNotEquals('hi', ChatLog::classify('hier steht was')); $this->assertEquals('hype', ChatLog::classify('122 Hype!'));