dreamsxin/cphalcon — pull request #64 by dreamsxin (2013-09-28 09:45:23+00:00)
Title: Text segmentation

```php
$scws = new Phalcon\Utils\Scws('utf8');
$scws->set_dict("/var/www/dict.utf8.xdb");
$scws->set_rule("/var/www/rule.utf8.ini");
$scws->send_text("我是一个中国人,我会C++语言,我也有很多T恤衣服");
$tops = $scws->get_tops(5);
$tmp = '';
foreach($tops as $top) {
$tmp = $tmp ? $tmp.'|'.$top['word'] : $top['word'];
}
print_r($tmp);
$tmp = '';
while ($tops = $scws->get_result())
{
foreach($tops as $top) {
$tmp = $tmp ? $tmp.'|'.$top['word'] : $top['word'];
}
}
print_r($tmp);
```