]> git.localhorst.tv Git - alttp.git/blobdiff - app/Console/Commands/ChatlibDatabase.php
fix number and space normalization
[alttp.git] / app / Console / Commands / ChatlibDatabase.php
index b95bb64a06a6dbec47b333c2c9248493e0c8492d..b701ad144b3d0aed3abc26cb481813e4347b0b4e 100644 (file)
@@ -28,6 +28,8 @@ class ChatlibDatabase extends Command {
         * @return int
         */
        public function handle() {
+               $count = 0;
+
                $de = new ChatLib();
                $en = new ChatLib();
 
@@ -35,7 +37,9 @@ class ChatlibDatabase extends Command {
                        ->where('banned', '=', false)
                        ->whereNotNull('evaluated_at')
                        ->where('created_at', '<', now()->sub(7, 'day'))
-                       ->chunk(5000, function ($msgs) use ($de, $en) {
+                       ->whereNotIn('classification', ['gg', 'gl', 'number', 'o7'])
+                       ->whereRaw('LENGTH(`text_content`) > 12')
+                       ->chunk(5000, function ($msgs) use (&$count, $de, $en) {
                                foreach ($msgs as $msg) {
                                        if ($msg->detected_language === 'de') {
                                                $de->addMessage($msg);
@@ -45,7 +49,9 @@ class ChatlibDatabase extends Command {
                                                $de->addMessage($msg);
                                                $en->addMessage($msg);
                                        }
+                                       ++$count;
                                }
+                               $this->line($count);
                        });
 
                $de->compile();