INNER CODE UNIT · Rust

pipe

bminixhofer/nlprule · python/src/lib.rs:354

    fn pipe(&self, py: Python, text_or_texts: PyObject) -> PyResult<PyObject> {
        text_guard(py, text_or_texts, |text| {
            let tokens = self
                .tokenizer
                .pipe(&text)
                .map(|sentence| {
                    sentence
                        .into_iter()
                        .map(|x| PyCell::new(py, PyToken::from(x.to_owned_token())))
                        .collect::<PyResult<Vec<_>>>()
                })
                .collect::<PyResult<Vec<Vec<_>>>>()?;

            Ok(tokens)
        })
    }

    pub fn __setstate__(&mut self, py: Python, state: PyObject) -> PyResult<()> {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…