$channel) { $db = Sentence::where('channel_uid',$channel); $bar = $this->output->createProgressBar($db->count()); $srcDb = $db->select(['book_id','paragraph', 'word_start','word_end', 'content','content_type'])->cursor(); foreach ($srcDb as $sent) { $content = MdRender::render($sent->content, [$channel], null, 'read', 'translation', $sent->content_type, 'text', ); $origin = PaliSentence::where('book',$sent->book_id) ->where('paragraph',$sent->paragraph) ->where('word_begin',$sent->word_start) ->where('word_end',$sent->word_end) ->value('text'); $currData = array( $origin, str_replace("\n", "", $content), ); fwrite($fp, implode("\t", $currData)."\n"); $bar->advance(); } } fclose($fp); $this->info((time() - $start).' seconds'); $this->call('export:zip',[ 'filename'=>$filename, 'title' => 'wikipali ai training data', 'format'=> $this->option('format'), ]); return 0; } }