48 lines
1.1 KiB
Rust
48 lines
1.1 KiB
Rust
use crate::text_utils::*;
|
|
|
|
pub struct MessageBuilder {
|
|
content: String,
|
|
}
|
|
|
|
impl MessageBuilder {
|
|
pub fn new(content: String) -> Self {
|
|
Self { content }
|
|
}
|
|
|
|
pub fn fix_articles(mut self) -> Self {
|
|
self.content = fix_articles(&self.content);
|
|
self
|
|
}
|
|
|
|
pub fn capitalize_sentences(mut self, uppercase: bool, lowercase: bool) -> Self {
|
|
self.content = capitalize_sentences(&self.content, uppercase, lowercase);
|
|
self
|
|
}
|
|
|
|
pub fn fix_s(mut self) -> Self {
|
|
self.content = fix_s(&self.content);
|
|
self
|
|
}
|
|
|
|
pub fn remove_duplicates(mut self) -> Self {
|
|
self.content = remove_duplicates(&self.content);
|
|
self
|
|
}
|
|
|
|
pub fn replace_delimiter(mut self, delimiter: &str) -> Self {
|
|
self.content = self.content.replace(" ", delimiter);
|
|
self
|
|
}
|
|
|
|
pub fn strip_words(mut self, words: &Vec<String>) -> Self {
|
|
for word in words {
|
|
self.content = self.content.replace(word, "");
|
|
}
|
|
self
|
|
}
|
|
|
|
pub fn build(self) -> String {
|
|
self.content
|
|
}
|
|
}
|