Ngram-based indexing of strings into a binary file
Project description
This library allows indexing many strings into a file, and then efficiently fuzzy-matching strings against what’s been indexed.
Currently, the structure is built from the Rust program in memory before being written to the file, so that phase uses a lot of RAM. You cannot create/change an index from Python.
String search is done from the file and requires little memory.
The index is a trie structure in which trigrams can be looked up; results for each trigrams of the input are matched and sorted to get the most similar strings.
Example:
>>> from ngram_search import Ngrams >>> ngrams = Ngrams(path) >>> ngrams.search("ham", 0.24) [(0, 1.0), (2, 0.25)] >>> ngrams.search("spa", 0.2) [(0, 0.2222222222222222)]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ngram-search-0.1.1.tar.gz
.
File metadata
- Download URL: ngram-search-0.1.1.tar.gz
- Upload date:
- Size: 51.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 819aad2750a119f25bdc956f6c4d03115ee2b1439ab6f8cd9771a5970726520d |
|
MD5 | 0b1ee6ab55fdb62120be55d382c31f3e |
|
BLAKE2b-256 | 74566944c230134f905d7c6b1df19f4f492234ad2472cc18d3b21ab27feadf09 |