Giter Site home page Giter Site logo

goredisjieba's Introduction

version 0.0.5

config.xml

<?xml version="1.0" encoding="UTF-8" ?>
<config>
    <address>0.0.0.0:6379</address>
    <db>0</db>
    <dict>/data/dict</dict>
</config>
  • 其中db为dict定义目录下的一个子目录,所有字典存在该子目录下,当使用select db时可切换分词字典,使用refresh db时可以重新加载分词字典

usage

make linux

./bin/goRedisJieba_linux --config=config.xml

download

command

redis-cli --raw
127.0.0.1:6379> tag 我来到北京清华大学
我/r
来到/v
北京/ns
清华大学/nt
127.0.0.1:6379> cut 我来到北京清华大学 0
我
来到
北京
清华大学
127.0.0.1:6379> cut 我来到北京清华大学 1
我
来到
北京
清华大学
127.0.0.1:6379> cutAll 我来到北京清华大学
我
来到
北京
清华
清华大学
华大
大学
127.0.0.1:6379> cutforsearch 我来到北京清华大学 1
我
来到
北京
清华
华大
大学
清华大学
127.0.0.1:6379> cutforsearch 我来到北京清华大学 0
我
来到
北京
清华
华大
大学
清华大学
127.0.0.1:6379> extract 我来到北京清华大学  20
清华大学
来到
北京
127.0.0.1:6479> cutforsearch 天生愚钝所以努力学习块区链技术 0
天生
愚钝
所以
努力
力学
学习
努力学习
块
区
链
技术
127.0.0.1:6479> addword 块区
OK
127.0.0.1:6479> cutforsearch 天生愚钝所以努力学习块区链技术 0
天生
愚钝
所以
努力
力学
学习
努力学习
块区
链
技术
127.0.0.1:6479>
  • “区块链”已经存在于字典,为了模拟addword命令动态添加词语, 我们这里使用“块区”
  • 已实现command包含了redis的select,ping,version以及gojieba分词的cutall,cut,cutforsearch,tag,addword
  • refresh db 刷新db目录分词字典

php

<?php

$redis_handle = new Redis();
$redis_handle->connect('127.0.0.1', 6379, 10); //端口需要与config.xml配置保持一致
$redis_handle->select(0);

$result = $redis_handle->rawCommand('cutforsearch', '我来到北京清华大学', 1);
print_r($result);

更多疑问请+qq群 233415606

goredisjieba's People

Contributors

ixqbar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

goredisjieba's Issues

项目跟目录没有./bin/goRedisJieba_linux

#make linux 这个命令出现下面的错误
GOOS=linux GOARCH=amd64 go build -o ./bin/goRedisJieba_linux ./src
go: cannot find main module, but found .git/config in /usr/local/src/goredisjieba
to create a module there, run:
go mod init
make: *** [linux] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.