Module crowbook_text_processing::clean
source · Expand description
This module provides function to “clean” a text typographically.
Example
use crowbook_text_processing::clean;
let input = "Some 'text' whose formatting could be enhanced...";
let output = clean::quotes(clean::ellipsis(clean::whitespaces(input)));
assert_eq!(&output, "Some ‘text’ whose formatting could be enhanced…");
Functions
- Replace double dashes (
--
) and triple dashes (---
) to en dash and em dash, respectively. - Replace ellipsis (…) with the appropriate unicode character
- Replaces
<<
with«
and>>
with»
. - Replace straight quotes with more typographic variants
- Removes unnecessary whitespaces from a String.