XSTokenizerXlen
包 | XS.tokenizer |
---|---|
继承关系 | class XSTokenizerXlen |
实现接口 | XSTokenizer |
版本 | 1.0.0 |
源代码 | sdk/php/lib/XSTokenizer.class.php |
内置的定长分词器
方法明细
__construct()
方法
public void __construct($arg=NULL)
| ||
$arg |
源码: sdk/php/lib/XSTokenizer.class.php#L104 (显示)
public function __construct($arg = null)
{
if ($arg !== null && $arg !== '')
{
$this->arg = intval($arg);
if ($this->arg < 1 || $this->arg > 255)
throw new XSException('Invalid argument for ' . __CLASS__ . ': ' . $arg);
}
}
getTokens()
方法
public void getTokens($value, $doc=NULL)
| ||
$value | ||
$doc |
源码: sdk/php/lib/XSTokenizer.class.php#L114 (显示)
public function getTokens($value, XSDocument $doc = null)
{
$terms = array();
for ($i = 0; $i < strlen($value); $i += $this->arg)
{
$terms[] = substr($value, $i, $this->arg);
}
return $terms;
}