X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FConsole%2FCommands%2FChatlibDatabase.php;h=b701ad144b3d0aed3abc26cb481813e4347b0b4e;hb=e1e352a985c2da1cc0e4ad4716244261445a2604;hp=bfe0135c4b8e00e684a9f2974faf862f447296fd;hpb=c2cc99020eee56f7790d1358abb44df078f2e655;p=alttp.git diff --git a/app/Console/Commands/ChatlibDatabase.php b/app/Console/Commands/ChatlibDatabase.php index bfe0135..b701ad1 100644 --- a/app/Console/Commands/ChatlibDatabase.php +++ b/app/Console/Commands/ChatlibDatabase.php @@ -28,13 +28,18 @@ class ChatlibDatabase extends Command { * @return int */ public function handle() { + $count = 0; + $de = new ChatLib(); $en = new ChatLib(); ChatLog::where('type', '=', 'chat') ->where('banned', '=', false) ->whereNotNull('evaluated_at') - ->chunk(5000, function ($msgs) use ($de, $en) { + ->where('created_at', '<', now()->sub(7, 'day')) + ->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); @@ -44,20 +49,16 @@ class ChatlibDatabase extends Command { $de->addMessage($msg); $en->addMessage($msg); } + ++$count; } + $this->line($count); }); $de->compile(); - $en->compile(); + $de->saveAs('de'); - $this->line(''); - for ($i = 0; $i < 50; ++$i) { - $this->line($de->generate()); - } - $this->line(''); - for ($i = 0; $i < 50; ++$i) { - $this->line($en->generate()); - } + $en->compile(); + $en->saveAs('en'); return 0; }