Giter VIP home page Giter VIP logo

sto's Introduction

Similar Text run only Once

Install

$ pip install -r requirements.txt
$ python setup.py install

Usage

from sto import Sto, Tokenizer

st = Sto(value_format='hh', # default 'h', means a short integer value.
         threshold=0.8, # default 0.8, similarity threshold
         num_perm=128,  # default 128
         num_part=32,   # default 32
         tokenizer=Tokenizer('zh') # default Tokenizer('zh')
        )
# Store the model result
value_list = []
for text in text_list:
    # r1, r2, ... should be int, just easy to store
    r1 = model1(text)
    r2 = model2(text)
    # should be a tuple(short int, short int), this is what the format 'hh' means.
    values = (r1, r2)
    value_list.append(values)
st.store(text_list, value_list)

# Query if the given text LSH is similar (of course the same) to the stored text.
values = st.query(text)

注意:

如果需要用 Cython 版的 Ngram,可以在 ngram 目录下编译:

$ python setup.py build_ext --inplace

如果需要用 cppjieba 分词,可以直接安装:

$ pip install cppjieba

sto's People

Contributors

hscspring avatar

Watchers

 avatar  avatar

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.