Skip to content

Commit

Permalink
修复 scws 分词不完整的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
vanry committed Aug 1, 2018
1 parent fe55b17 commit ece71f7
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Tokenizers/ScwsTokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ public function getTokens($text)
{
$this->scws->sendText($text);

$result = $this->scws->getResult();
$tokens = [];

return $result === false ? [] : array_column($result, 'word');
while ($result = $this->scws->getResult()) {
$tokens = array_merge($tokens, array_column($result, 'word'));
}

return $tokens;
}

public function getScws()
Expand Down

0 comments on commit ece71f7

Please sign in to comment.