use whatlang::detect_script;
use crate::SegmentedToken;
use crate::augmentation::Augmenter;
#[derive(Debug, Clone, Default)]
pub struct AugmentationDetectScript {}
impl AugmentationDetectScript {
pub fn new() -> Self {
Default::default()
}
}
impl Augmenter for AugmentationDetectScript {
#[allow(clippy::collapsible_if)]
fn augment<'a>(&self, mut token: SegmentedToken<'a>) -> SegmentedToken<'a> {
if !token.is_known_word {
if let Some(script) = detect_script(token.text) {
token.detected_script = Some(script);
}
}
return token;
}
}