{"id":15550080,"url":"https://github.com/hscspring/sto","last_synced_at":"2026-07-16T05:31:19.533Z","repository":{"id":37663006,"uuid":"263331908","full_name":"hscspring/sto","owner":"hscspring","description":"MinHash and LSH Based Store and Query.","archived":false,"fork":false,"pushed_at":"2022-06-22T02:00:09.000Z","size":10,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-22T10:49:34.717Z","etag":null,"topics":["dawg","lsh-ensemble","minhash","nlp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hscspring.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-12T12:36:59.000Z","updated_at":"2020-05-12T12:55:47.000Z","dependencies_parsed_at":"2022-09-08T01:12:10.221Z","dependency_job_id":null,"html_url":"https://github.com/hscspring/sto","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/hscspring/sto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hscspring%2Fsto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hscspring%2Fsto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hscspring%2Fsto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hscspring%2Fsto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hscspring","download_url":"https://codeload.github.com/hscspring/sto/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hscspring%2Fsto/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35532634,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-16T02:00:06.687Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dawg","lsh-ensemble","minhash","nlp"],"created_at":"2024-10-02T13:49:48.593Z","updated_at":"2026-07-16T05:31:19.517Z","avatar_url":"https://github.com/hscspring.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Similar Text run only Once\n\n## Install\n\n```bash\n$ pip install -r requirements.txt\n$ python setup.py install\n```\n\n## Usage\n\n```python\nfrom sto import Sto, Tokenizer\n\nst = Sto(value_format='hh', # default 'h', means a short integer value.\n         threshold=0.8, # default 0.8, similarity threshold\n         num_perm=128,  # default 128\n         num_part=32,   # default 32\n         tokenizer=Tokenizer('zh') # default Tokenizer('zh')\n        )\n# Store the model result\nvalue_list = []\nfor text in text_list:\n    # r1, r2, ... should be int, just easy to store\n    r1 = model1(text)\n    r2 = model2(text)\n    # should be a tuple(short int, short int), this is what the format 'hh' means.\n    values = (r1, r2)\n    value_list.append(values)\nst.store(text_list, value_list)\n\n# Query if the given text LSH is similar (of course the same) to the stored text.\nvalues = st.query(text)\n```\n\n注意：\n\n- 使用 add 批量添加时只会去重完本完全一致的，不会用相似度去重。\n- value format: [struct — Interpret bytes as packed binary data — Python 3.8.3rc1 documentation](https://docs.python.org/3/library/struct.html#format-strings)\n- threshold, num perm and num part: [MinHash LSH Ensemble — datasketch 1.0.0 documentation](http://ekzhu.com/datasketch/lshensemble.html)\n\n如果需要用 Cython 版的 Ngram，可以在 ngram 目录下编译：\n\n```bash\n$ python setup.py build_ext --inplace\n```\n\n如果需要用 cppjieba 分词，可以直接安装：\n\n```bash\n$ pip install cppjieba\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhscspring%2Fsto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhscspring%2Fsto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhscspring%2Fsto/lists"}