New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义分词报错 #42

Open
herenet opened this Issue Jul 13, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@herenet

herenet commented Jul 13, 2017

Fatal error: Uncaught [XSException] ../../ThinkPHP/Library/Vendor/Xunsearch/XS.php(2439): Task is canceled due to timeout/error(S#514)
thrown in /data/wwwroot/www.hongren.com/ThinkPHP/Library/Vendor/Xunsearch/XS.php on line 2439

在配置文件中配置了
[nickname]
type = title
tokenizer = duality

在XS中实现了方法。把父类的private变量改成了protected了。
class XSTokenizerDuality extends XSTokenizerScws {

public function __construct($arg = null)
{
	parent::__construct($arg);
}

public function getTokens($value, XSDocument $doc = null)
{
	$tokens = array();
	$this->setIgnore(true);
	$this->setDuality(false);
	$_charset = self::$_charset;
	self::$_charset = 'UTF-8';
	$words = $this->getResult($value);
	foreach ($words as $word) {
		$tokens[] = $word['word'];
	}
	self::$_charset = $_charset;
	return $tokens;
}

}

@herenet herenet changed the title from 自定议分词报错 to 自定义分词报错 Jul 13, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment