Skip to main content

normalize_sentence

Function normalize_sentence 

Source
pub fn normalize_sentence(input: &str) -> String
Expand description

Normalize a full sentence, replacing spoken-form spans with written form.

Unlike normalize which expects the entire input to be a single expression, this function scans for normalizable spans within a larger sentence. Uses a default max span of 16 tokens.

use text_processing_rs::normalize_sentence;

assert_eq!(normalize_sentence("I have twenty one apples"), "I have 21 apples");
assert_eq!(normalize_sentence("hello world"), "hello world");