-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 61e7afa
Showing
9 changed files
with
699 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "yake-rust" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
regex = "1" | ||
streaming-stats = "0.1.28" | ||
contractions = "0.5.4" | ||
unicode-segmentation = "1.9.0" | ||
natural = "0.3.0" | ||
serde_json = "1.0" | ||
pragmatic-segmenter = "0.1.2" | ||
|
||
[profile.dev] | ||
opt-level = 0 | ||
|
||
[profile.release] | ||
opt-level = 3 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
use std::cmp::max; | ||
|
||
use natural::distance::levenshtein_distance; | ||
|
||
pub(crate) struct Levenshtein {} | ||
impl Levenshtein { | ||
pub fn ratio(seq1: String, seq2: String) -> f64 { | ||
let distance = levenshtein_distance(&seq1, &seq2); | ||
let length = max(seq1.len(), seq2.len()); | ||
1.0 - (distance as f64 / length as f64) | ||
} | ||
} |
Oops, something went wrong.