diff --git a/instant-segment-py/Cargo.toml b/instant-segment-py/Cargo.toml index 5ddc989..12a1f9b 100644 --- a/instant-segment-py/Cargo.toml +++ b/instant-segment-py/Cargo.toml @@ -18,5 +18,5 @@ crate-type = ["cdylib"] [dependencies] bincode = "1.3.2" instant-segment = { version = "0.11", path = "../instant-segment", features = ["with-serde"] } -pyo3 = { version = "0.22", features = ["extension-module"] } +pyo3 = { version = "0.23", features = ["extension-module"] } smartstring = "1" diff --git a/instant-segment-py/src/lib.rs b/instant-segment-py/src/lib.rs index d72a72c..607d88d 100644 --- a/instant-segment-py/src/lib.rs +++ b/instant-segment-py/src/lib.rs @@ -34,7 +34,7 @@ impl Segmenter { #[new] fn new(unigrams: &Bound<'_, PyIterator>, bigrams: &Bound<'_, PyIterator>) -> PyResult { let unigrams = unigrams - .iter()? + .try_iter()? .map(|result| { let item = result?; let key = item.get_item(0)?; @@ -46,7 +46,7 @@ impl Segmenter { .collect::, PyErr>>()?; let bigrams = bigrams - .iter()? + .try_iter()? .map(|item| { let item = item?; @@ -108,7 +108,7 @@ impl Segmenter { /// this `Segmenter`. Will return `None` iff given an empty iterator argument. fn score_sentence(&self, words: &Bound<'_, PyIterator>) -> PyResult> { let words = words - .iter()? + .try_iter()? .map(|result| result?.extract::()) .collect::, _>>()?; Ok(self.inner.score_sentence(words.iter().map(|s| &**s)))