1 Star 0 Fork 5

walkany / sphinx-jieba

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
README.md 1.16 KB
一键复制 编辑 原始数据 按行查看 历史
qqcdn 提交于 2019-06-10 02:53 . Update README.md

sphinx-jieba

Sphinx for Chinese with cppJieba

仿照Sphinx for Chinese,基于sphinx 2.2.9版本,结合cppJieba分词系统,让sphinx支持中文。

安装

解压

$ git clone https://github.com/qqcdn/sphinx-jieba
$ cd sphinx-jieba
$ git submodule update --init --recursive

编译(假设安装到/usr/local/sphinx目录,下文同)

$ sudo apt install gcc cmake automake
$ sudo apt install libmysqld-dev
$ ./configure --prefix=/usr/local/sphinx-jieba
--prefix 指定安装路径
--with-mysql 编译mysql支持
--with-pgsql 编译pgsql支持
$ make
$ make install

配置中文支持

修改sphinx.conf索引配置文件

在索引配置项中添加以下两项:

charset_type = utf-8
chinese_dictionary = /usr/local/sphinx/etc/xdict

注意在source部分一定加上如下字段,否则中文分词无法起作用。

sql_query_pre = SET NAMES utf8

TODOs:

  1. 在index时,添加同义词功能 a. 本身在Sphinx GetToken时可以返回多个同义Token b. 增加同义词典
  2. 字典支持二进制形式
  3. cmake make sure the expat and int64_t varible set.
C++
1
https://gitee.com/walkany/sphinx-jieba.git
git@gitee.com:walkany/sphinx-jieba.git
walkany
sphinx-jieba
sphinx-jieba
master

搜索帮助