<commit_before><?php

namespace App\Console\Commands;

use App\Course;
use Illuminate\Console\Command;

class CourseParse extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'course:parse';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Parse all courses';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        /** @var Course[] $courses */
        $courses = Course::all();

        //進度條
        $bar = $this->output->createProgressBar(count($courses));
        $bar->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%");
        $bar->setMessage('Task starts');
        $bar->start();
        foreach ($courses as $course) {
            //顯示用訊息
            $message = 'Parse: ' . $course->id . ' ' . $course->sub_name;
            $course->parse();
            $bar->setMessage($message);
            $bar->advance();
        }
        $bar->finish();

        $this->info('');
        $this->info('Course parse finished');
    }
}
<commit_msg>Parse start from oldest course<commit_after><?php

namespace App\Console\Commands;

use App\Course;
use Illuminate\Console\Command;

class CourseParse extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'course:parse';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Parse all courses';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        /** @var Course[] $courses */
        $courses = Course::orderBy('updated_at')->get();

        //進度條
        $bar = $this->output->createProgressBar(count($courses));
        $bar->setFormat(" %message%\n %current%/%max% [%bar%] %percent:3s%%");
        $bar->setMessage('Task starts');
        $bar->start();
        foreach ($courses as $course) {
            //顯示用訊息
            $message = 'Parse: ' . $course->id . ' ' . $course->sub_name;
            $course->parse();
            $bar->setMessage($message);
            $bar->advance();
        }
        $bar->finish();

        $this->info('');
        $this->info('Course parse finished');
    }
}

{'fraction_non_alphanumeric': 0.1593245227606461, 'fraction_numerical': 0.0007342143906020558, 'mean_word_length': 1.8805496828752644, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 30, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2215090', 'n_tokens_mistral': 810, 'n_tokens_neox': 807, 'n_words': 180}