mirror of
https://github.com/mii443/tokenizers.git
synced 2025-08-23 00:35:35 +00:00
Python - Update bindings for Replace Normalizer
This commit is contained in:
@ -5,7 +5,7 @@ use pyo3::prelude::*;
|
||||
use pyo3::types::*;
|
||||
|
||||
use crate::error::ToPyResult;
|
||||
use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut};
|
||||
use crate::utils::{PyNormalizedString, PyNormalizedStringRefMut, PyPattern};
|
||||
use serde::ser::SerializeStruct;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use tk::normalizers::{
|
||||
@ -425,8 +425,11 @@ pub struct PyReplace {}
|
||||
#[pymethods]
|
||||
impl PyReplace {
|
||||
#[new]
|
||||
fn new(pattern: String, content: String) -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((PyReplace {}, Replace::new(pattern, content).into()))
|
||||
fn new(pattern: PyPattern, content: String) -> PyResult<(Self, PyNormalizer)> {
|
||||
Ok((
|
||||
PyReplace {},
|
||||
ToPyResult(Replace::new(pattern, content)).into_py()?.into(),
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user