simstring-rust 0.3.1b2__cp37-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
Binary file
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: simstring-rust
|
|
3
|
+
Version: 0.3.1b2
|
|
4
|
+
Classifier: Programming Language :: Rust
|
|
5
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
|
+
Classifier: Programming Language :: Python :: 3
|
|
7
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
8
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Operating System :: POSIX
|
|
12
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
13
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Summary: A fast, native Rust implementation of the SimString algorithm with Python bindings.
|
|
16
|
+
Keywords: string-matching,nlp,simstring,fuzzy
|
|
17
|
+
Home-Page: https://github.com/PyDataBlog/simstring_rs
|
|
18
|
+
Author: Bernard Brenyah <bbrenyah@gmail.com>
|
|
19
|
+
Author-email: Bernard Brenyah <bbrenyah@gmail.com>
|
|
20
|
+
License: MIT
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
23
|
+
Project-URL: Homepage, https://github.com/PyDataBlog/simstring_rs
|
|
24
|
+
Project-URL: Repository, https://github.com/PyDataBlog/simstring_rs
|
|
25
|
+
|
|
26
|
+
# simstring_rust
|
|
27
|
+
|
|
28
|
+
[](https://github.com/PyDataBlog/simstring_rs/actions)
|
|
29
|
+
[](https://crates.io/crates/simstring_rust)
|
|
30
|
+
[](https://docs.rs/simstring_rust)
|
|
31
|
+
[](https://github.com/PyDataBlog/simstring_rs)
|
|
32
|
+
|
|
33
|
+
A native Rust implementation of the CPMerge algorithm, designed for approximate string matching. This crate is particularly useful for natural language processing tasks that require the retrieval of strings/texts from very large corpora (big amounts of texts). Currently, this crate supports both character and word-based N-grams feature generation, with plans to allow custom user-defined feature generation methods.
|
|
34
|
+
|
|
35
|
+
## Features
|
|
36
|
+
|
|
37
|
+
- ✅ Fast algorithm for string matching
|
|
38
|
+
- ✅ 100% exact retrieval
|
|
39
|
+
- ✅ Support for Unicode
|
|
40
|
+
- [ ] Support for building databases directly from text files
|
|
41
|
+
- [ ] Mecab-based tokenizer support
|
|
42
|
+
|
|
43
|
+
## Supported String Similarity Measures
|
|
44
|
+
|
|
45
|
+
- ✅ Dice coefficient
|
|
46
|
+
- ✅ Jaccard coefficient
|
|
47
|
+
- ✅ Cosine coefficient
|
|
48
|
+
- ✅ Overlap coefficient
|
|
49
|
+
- ✅ Exact match
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
Add `simstring_rust` to your `Cargo.toml`:
|
|
54
|
+
|
|
55
|
+
```toml
|
|
56
|
+
[dependencies]
|
|
57
|
+
simstring_rust = "0.3.0" # change version accordingly
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
For the latest features, you can add the master branch by specifying the Git repository:
|
|
61
|
+
|
|
62
|
+
```toml
|
|
63
|
+
[dependencies]
|
|
64
|
+
simstring_rust = { git = "https://github.com/PyDataBlog/simstring_rs.git", branch = "main" }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Note: Using the master branch may include experimental features and potential breakages. Use with caution!
|
|
68
|
+
|
|
69
|
+
To revert to a stable version, ensure your Cargo.toml specifies a specific version number instead of the Git repository.
|
|
70
|
+
|
|
71
|
+
## Usage
|
|
72
|
+
|
|
73
|
+
Here is a basic example of how to use simstring_rs in your Rust project:
|
|
74
|
+
|
|
75
|
+
```Rust
|
|
76
|
+
use simstring_rust::database::HashDb;
|
|
77
|
+
use simstring_rust::extractors::CharacterNgrams;
|
|
78
|
+
use simstring_rust::measures::Cosine;
|
|
79
|
+
use simstring_rust::Searcher;
|
|
80
|
+
|
|
81
|
+
use std::sync::Arc;
|
|
82
|
+
|
|
83
|
+
fn main() {
|
|
84
|
+
// 1. Setup the database
|
|
85
|
+
let feature_extractor = Arc::new(CharacterNgrams::new(2, "$"));
|
|
86
|
+
let mut db = HashDb::new(feature_extractor);
|
|
87
|
+
|
|
88
|
+
// 2. Index some strings
|
|
89
|
+
db.insert("hello".to_string());
|
|
90
|
+
db.insert("help".to_string());
|
|
91
|
+
db.insert("halo".to_string());
|
|
92
|
+
db.insert("world".to_string());
|
|
93
|
+
|
|
94
|
+
// 3. Search for strings
|
|
95
|
+
let measure = Cosine;
|
|
96
|
+
let searcher = Searcher::new(&db, measure);
|
|
97
|
+
let query = "hell";
|
|
98
|
+
let alpha = 0.5;
|
|
99
|
+
|
|
100
|
+
if let Ok(results) = searcher.ranked_search(query, alpha) {
|
|
101
|
+
println!("Found {} results for query '{}'", results.len(), query);
|
|
102
|
+
for (item, score) in results {
|
|
103
|
+
println!("- Match: '{}', Score: {:.4}", item, score);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<!-- ## Releasing -->
|
|
110
|
+
<!---->
|
|
111
|
+
<!-- This project uses [`cargo-release`](https://github.com/crate-ci/cargo-release) and [`git-cliff`](https://github.com/orhun/git-cliff) to automate the release process. -->
|
|
112
|
+
<!---->
|
|
113
|
+
<!-- ### Prerequisites -->
|
|
114
|
+
<!---->
|
|
115
|
+
<!-- Before creating a release, ensure you have installed the necessary tools: -->
|
|
116
|
+
<!---->
|
|
117
|
+
<!-- ```bash -->
|
|
118
|
+
<!-- cargo install cargo-release -->
|
|
119
|
+
<!-- cargo install git-cliff -->
|
|
120
|
+
<!-- ``` -->
|
|
121
|
+
<!---->
|
|
122
|
+
<!-- ### Creating a Release -->
|
|
123
|
+
<!---->
|
|
124
|
+
<!-- 1. Ensure your local `main` branch is up-to-date: -->
|
|
125
|
+
<!-- ```bash -->
|
|
126
|
+
<!-- git checkout main -->
|
|
127
|
+
<!-- git pull origin main -->
|
|
128
|
+
<!-- ``` -->
|
|
129
|
+
<!-- 2. Run `cargo release` with the desired release level (`patch`, `minor`, or `major`). The command runs in dry-run mode by default, so you can review the changes. -->
|
|
130
|
+
<!-- ```bash -->
|
|
131
|
+
<!-- cargo release <LEVEL> -->
|
|
132
|
+
<!-- ``` -->
|
|
133
|
+
<!-- 3. Once you have verified the plan, execute the release: -->
|
|
134
|
+
<!-- ```bash -->
|
|
135
|
+
<!-- cargo release <LEVEL> --execute -->
|
|
136
|
+
<!-- ``` -->
|
|
137
|
+
<!---->
|
|
138
|
+
<!-- This will automatically: -->
|
|
139
|
+
<!-- - Generate and update the `CHANGELOG.md`. -->
|
|
140
|
+
<!-- - Bump the version in `Cargo.toml`. -->
|
|
141
|
+
<!-- - Commit the changes and create a new Git tag. -->
|
|
142
|
+
<!-- - Push the commit and tag to GitHub, which triggers the CI/CD pipeline to publish the crate to `crates.io`. -->
|
|
143
|
+
|
|
144
|
+
## Contributing
|
|
145
|
+
|
|
146
|
+
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
|
|
147
|
+
License
|
|
148
|
+
|
|
149
|
+
This project is licensed under the MIT License.
|
|
150
|
+
|
|
151
|
+
## Acknowledgements
|
|
152
|
+
|
|
153
|
+
Inspired by the [SimString](https://www.chokkan.org/software/simstring/) project.
|
|
154
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
simstring_rust-0.3.1b2.dist-info/METADATA,sha256=K1DSDltY8lzw_nd3qh7F5WqYlbF_0Bhwn91eHEt9HQs,5746
|
|
2
|
+
simstring_rust-0.3.1b2.dist-info/WHEEL,sha256=w2DcmsZAr9ddjKlLMUTE23jGpzdTZ81PKXQO_ZXoN5A,94
|
|
3
|
+
simstring_rust-0.3.1b2.dist-info/licenses/LICENSE,sha256=1h9YYTCkdwcFEQugoPDFIvMfTply9WBS7b0q7BO6wq8,1093
|
|
4
|
+
simstring_rust/__init__.py,sha256=848LALFhj3KZD2jqtwOA_Zd5LkhRP-6Bdp6pagM93I0,139
|
|
5
|
+
simstring_rust/simstring_rust.pyd,sha256=o5tb6tynTLTkr4T75uFdnyfj40DMcd1h1EJZxvJ11go,603648
|
|
6
|
+
simstring_rust-0.3.1b2.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2021 Bernard Brenyah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|