rust-censure is a Rust port of the Python library py-censure.
Currently, it supports two languages: Russian and English.
But you can add new languages by implementing the LangProvider trait
(check out the ru and en modules for examples)
In terms of optimization, the crate does two things:
- Uses regex for simple patterns and fancy-regex as a fallback for more complex ones (backrefs, lookarounds etc)
- Compiles and caches regexes on demand
It’s still basically a beta version, but it should already work reliably.
Note that this port does not follow the same rules as the original library.
Some tweaks were implemented.
Basic usage example:
use ;
let en_censor = new.unwrap;
let line = "dumb ass";
let res = en_censor.clean_line;
assert_eq!;
assert_eq!;