企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[Xunsearch PHP-SDK](http://www.xunsearch.com) v1.4.8 API 参考文档 # XSTokenizerXstep [All Packages](#)| [方法(函数)](#) | 包 | [XS.tokenizer](#) | |-----|-----| | 继承关系 | class XSTokenizerXstep | | 实现接口 | [XSTokenizer](#) | | 版本 | 1.0.0 | | 源代码 | [sdk/php/lib/XSTokenizer.class.php](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php) | 内置的步长分词器 ### Public 方法 [隐去继承来的方法](#) | 名称 | 描述 | 定义于 | |-----|-----|-----| | [__construct()](#) | | XSTokenizerXstep | | [getTokens()](#) | | XSTokenizerXstep | ### 方法明细 __construct()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>__construct</b>($arg=NULL)</div></td></tr><tr><td class="paramNameCol">$arg</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr></table> **源码:**[sdk/php/lib/XSTokenizer.class.php#L137](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php#L137) (**[显示](#)**) `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()方法 <table class="summaryTable"><tr><td colspan="3"><div class="signature2">public void <b>getTokens</b>($value, $doc=NULL)</div></td></tr><tr><td class="paramNameCol">$value</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr><tr><td class="paramNameCol">$doc</td> <td class="paramTypeCol"></td> <td class="paramDescCol"></td></tr></table> **源码:**[sdk/php/lib/XSTokenizer.class.php#L147](https://github.com/hightman/xunsearch/blob/master/sdk/php/lib/XSTokenizer.class.php#L147) (**[显示](#)**) `public function getTokens($value, XSDocument $doc = null) {     $terms = array();     $i = $this->arg;     while (true) {         $terms[] = substr($value, 0, $i);         if ($i >= strlen($value)) {             break;         }         $i += $this->arg;     }     return $terms; }` Copyright © 2008-2011 by [杭州云圣网络科技有限公司](http://www.xunsearch.com) All Rights Reserved.