Skip to content

Commit

Permalink
initial
Browse files Browse the repository at this point in the history
  • Loading branch information
quesurifn committed Sep 25, 2022
0 parents commit 61e7afa
Show file tree
Hide file tree
Showing 9 changed files with 699 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
14 changes: 14 additions & 0 deletions .gitignore
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
21 changes: 21 additions & 0 deletions Cargo.toml
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 added src/.DS_Store
Binary file not shown.
12 changes: 12 additions & 0 deletions src/keywords/levenshtein.rs
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)
}
}
Loading

0 comments on commit 61e7afa

Please sign in to comment.