diff --git a/src/persian_chars/mod.rs b/src/persian_chars/mod.rs index 15e0b87..297cac1 100644 --- a/src/persian_chars/mod.rs +++ b/src/persian_chars/mod.rs @@ -1,11 +1,6 @@ use std::borrow::Cow; pub mod chars { - pub static FA_ALPHABET: &str = "ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی"; - pub static FA_NUMBER: &str = "۰۱۲۳۴۵۶۷۸۹"; - pub static FA_SHORT_VOWELS: &str = "َُِ"; - pub static FA_OTHERS: &str = "‌آاً"; - pub static FA_MIXED_WITH_ARABIC: &str = "ًٌٍَُِّْٰٔءك‌ةۀأإيـئؤ،"; pub static FA_TEXT: &str = "ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی۰۱۲۳۴۵۶۷۸۹َُِ‌آاً؟ "; pub static FA_COMPLEX_TEXT: &str = "ابپتثجچحخدذرزژسشصضطظعغفقکگلمنوهی۰۱۲۳۴۵۶۷۸۹َُِ‌آأًًٌٍَُِّْٰءك‌ةۀأإيـئؤ،؟ "; } diff --git a/src/remove_ordinal_suffix/mod.rs b/src/remove_ordinal_suffix/mod.rs index a91c090..4f537e1 100644 --- a/src/remove_ordinal_suffix/mod.rs +++ b/src/remove_ordinal_suffix/mod.rs @@ -10,21 +10,17 @@ where if word.ends_with("مین") { word = word[0..word.len() - ("مین".len())].to_string() - } - if word.ends_with("اُم") { + } else if word.ends_with("اُم") { word = word[0..word.len() - ("اُم".len())].trim().to_string() - } - if word.ends_with("ام") { + } else if word.ends_with("ام") { word = word[0..word.len() - ("ام".len())].trim().to_string() - } - - if word.ends_with("سوم") { + } else if word.ends_with("سوم") { word = word[0..word.len() - ("سوم".len())].to_string(); word += "سه"; - } - if word.ends_with('م') { + } else if word.ends_with('م') { word = word[0..word.len() - ("م".len())].to_string() } + word }