diff --git a/Cargo.toml b/Cargo.toml index 2b30e2e..e70c40a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ name = "jellyfish" crate-type = ["cdylib"] [dependencies] -pyo3 = { version = "0.22.2", features = ["gil-refs"] } +pyo3 = { version = "0.22.2", features = [] } unicode-segmentation = "^1.6.0" unicode-normalization = "^0.1" smallvec = "^1.13" diff --git a/src/rustyfish.rs b/src/rustyfish.rs index 0a8e04e..c983615 100644 --- a/src/rustyfish.rs +++ b/src/rustyfish.rs @@ -27,6 +27,7 @@ fn hamming_distance(a: &str, b: &str) -> PyResult { // Calculates the Jaccard index between two strings. #[pyfunction] +#[pyo3(signature=(a, b, ngram_size=None))] fn jaccard_similarity(a: &str, b: &str, ngram_size: Option) -> PyResult { Ok(_jaccard(a, b, ngram_size)) } @@ -39,6 +40,7 @@ fn jaro_similarity(a: &str, b: &str) -> PyResult { // Calculates the Jaro-Winkler similarity between two strings. #[pyfunction] +#[pyo3(signature=(a, b, long_tolerance=None))] fn jaro_winkler_similarity(a: &str, b: &str, long_tolerance: Option) -> PyResult { match long_tolerance { Some(true) => Ok(_jaro_winkler_long(a, b)), @@ -88,7 +90,7 @@ fn metaphone(a: &str) -> PyResult { /// A Python module implemented in Rust. #[pymodule] -pub fn _rustyfish(_py: Python, m: &PyModule) -> PyResult<()> { +pub fn _rustyfish(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> { m.add_function(wrap_pyfunction!(damerau_levenshtein_distance, m)?)?; m.add_function(wrap_pyfunction!(hamming_distance, m)?)?; m.add_function(wrap_pyfunction!(jaccard_similarity, m)?)?;