use pyo3::prelude::*;
#[pyfunction]
#[pyo3(signature = (text, *, digit_policy="numeric"))]
pub fn _canonicalize(text: &str, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::canonicalize_with(
text,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, digit_policy="numeric"))]
pub fn _skeleton_key(text: &str, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::skeleton_key(text, digit_policy)?.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, preset="canonicalize"))]
pub fn _is_canonical(text: &str, preset: &str) -> PyResult<bool> {
Ok(crate::presets::is_canonical(text, preset)?)
}
#[pyfunction]
#[pyo3(signature = (text, *, lang=None, emoji_style="cldr", fold_case=true))]
pub fn _ml_normalize(
text: &str,
lang: Option<&str>,
emoji_style: &str,
fold_case: bool,
) -> PyResult<String> {
Ok(crate::presets::ml_normalize(text, lang, emoji_style, fold_case)?.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, lang=None, strict_iso9=false, digit_policy="numeric"))]
pub fn _catalog_key(
text: &str,
lang: Option<&str>,
strict_iso9: bool,
digit_policy: &str,
) -> PyResult<String> {
Ok(crate::presets::catalog_key_with(
text,
lang,
strict_iso9,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, lang=None, digit_policy="numeric"))]
pub fn _search_key(text: &str, lang: Option<&str>, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::search_key_with(
text,
lang,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, lang=None, digit_policy="numeric"))]
pub fn _sort_key(text: &str, lang: Option<&str>, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::sort_key_with(
text,
lang,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_format(text: &str) -> String {
crate::presets::strip_format(text).into_owned()
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_bidi(text: &str) -> String {
crate::presets::strip_bidi(text)
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_tags(text: &str) -> String {
crate::api::strip_tags(text)
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_variation_selectors(text: &str) -> String {
crate::api::strip_variation_selectors(text)
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_noncharacters(text: &str) -> String {
crate::api::strip_noncharacters(text)
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _fold_punctuation(text: &str) -> String {
crate::api::fold_punctuation(text).into_owned()
}
#[pyfunction]
#[pyo3(signature = (text,))]
pub fn _strip_pua(text: &str) -> String {
crate::api::strip_pua(text)
}
#[pyfunction]
#[pyo3(signature = (text, *, digit_policy="numeric"))]
pub fn _canonicalize_strict(text: &str, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::canonicalize_strict_with(
text,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}
#[pyfunction]
#[pyo3(signature = (text, *, digit_policy="numeric"))]
pub fn _strip_obfuscation(text: &str, digit_policy: &str) -> PyResult<String> {
Ok(crate::presets::strip_obfuscation_with(
text,
crate::confusables::DigitPolicy::from_token(digit_policy)?,
)?
.into_owned())
}