Selaa lähdekoodia

提取单词的时候判断长度

visuddhinanda 1 vuosi sitten
vanhempi
sitoutus
82a7b62b48
1 muutettua tiedostoa jossa 2 lisäystä ja 5 poistoa
  1. 2 5
      api-v8/app/Console/Commands/UpgradeCompound.php

+ 2 - 5
api-v8/app/Console/Commands/UpgradeCompound.php

@@ -149,7 +149,8 @@ class UpgradeCompound extends Command
                 $to = $max;
                 $to = $max;
             }
             }
             $words = WordIndex::whereBetween('id', [$from, $to])
             $words = WordIndex::whereBetween('id', [$from, $to])
-                ->where('len', '>', $this->option('min'))
+                ->where('len', '>=', $this->option('min'))
+                ->where('len', '<=', $this->option('max'))
                 ->orderBy('id')
                 ->orderBy('id')
                 ->selectRaw('id,word as real')
                 ->selectRaw('id,word as real')
                 ->cursor();
                 ->cursor();
@@ -224,10 +225,6 @@ class UpgradeCompound extends Command
                 }
                 }
             }
             }
             if (count($parts) === 0) {
             if (count($parts) === 0) {
-                if (mb_strlen($word->real, 'UTF-8') > $this->option('max')) {
-                    Log::error('超长,give up' . $word->real);
-                    continue;
-                }
                 $ts = new TurboSplit();
                 $ts = new TurboSplit();
                 if ($this->option('debug')) {
                 if ($this->option('debug')) {
                     $ts->debug(true);
                     $ts->debug(true);