use hebrew_unicode_script::HebrewUnicodeScript;
use std::borrow::Cow;
pub fn remove_hbr_block(string: &str) -> Cow<'_, str> {
string.chars().filter(|&c| !c.is_hbr_block()).collect()
}
pub fn remove_hbr_accent(string: &str) -> Cow<'_, str> {
string.chars().filter(|&c| !c.is_hbr_accent()).collect()
}
pub fn remove_hbr_mark(string: &str) -> Cow<'_, str> {
string.chars().filter(|&c| !c.is_hbr_mark()).collect()
}
pub fn remove_hbr_point(string: &str) -> Cow<'_, str> {
string.chars().filter(|&c| !c.is_hbr_point()).collect()
}
pub fn remove_hbr_point_vowel(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_point_vowel())
.collect()
}
pub fn remove_hbr_point_semi_vowel(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_point_semi_vowel())
.collect()
}
pub fn remove_hbr_point_reading_sign(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_point_reading_sign())
.collect()
}
pub fn remove_hbr_punctuation(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_punctuation())
.collect()
}
pub fn remove_hbr_consonant(string: &str) -> Cow<'_, str> {
string.chars().filter(|&c| !c.is_hbr_consonant()).collect()
}
pub fn remove_hbr_consonant_normal(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_consonant_normal())
.collect()
}
pub fn remove_hbr_consonant_final(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_consonant_final())
.collect()
}
pub fn remove_hbr_yod_triangle(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_yod_triangle())
.collect()
}
pub fn remove_hbr_ligature_yiddish(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_ligature_yiddish())
.collect()
}
#[cfg(test)]
mod unit_test {
use crate::*;
#[test]
fn rem_hbr_accent() {
let test_str = "בְּרֵאשִׁ֖ית";
let test_str_filtered = remove_hbr_accent(test_str);
assert_eq!(test_str_filtered.as_ref(), "בְּרֵאשִׁית");
}
#[test]
pub fn rem_hbr_mark() {
let test_str = "ה֯";
let test_str_filtered = remove_hbr_mark(test_str);
assert_eq!(test_str_filtered.as_ref(), "ה");
}
#[test]
pub fn rem_hbr_point() {
let test_str = "בָ";
let test_str_filtered = remove_hbr_point(test_str);
assert_eq!(test_str_filtered.as_ref(), "ב");
}
#[test]
pub fn rem_hbr_point_vowel() {
let test_str = "ִל";
let test_str_filtered = remove_hbr_point_vowel(test_str);
assert_eq!(test_str_filtered.as_ref(), "ל");
}
#[test]
pub fn rem_hbr_point_semi_vowel() {
let test_str = "ֲדְגֱכֳע";
let test_str_filtered = remove_hbr_point_semi_vowel(test_str);
assert_eq!(test_str_filtered.as_ref(), "דגכע");
}
#[test]
pub fn rem_hbr_point_reading_sign() {
let test_str = "םּ";
let test_str_filtered = remove_hbr_point_reading_sign(test_str);
assert_eq!(test_str_filtered.as_ref(), "ם");
}
#[test]
pub fn rem_hbr_punctuation() {
let test_str = "וַֽיְהִי־בֹ֖קֶר";
let test_str_filtered = remove_hbr_punctuation(test_str);
assert_eq!(test_str_filtered.as_ref(), "וַֽיְהִיבֹ֖קֶר");
}
#[test]
pub fn rem_hbr_consonant() {
let test_str = "AאBףC";
let test_str_filtered = remove_hbr_consonant(test_str);
assert_eq!(test_str_filtered.as_ref(), "ABC");
}
#[test]
pub fn rem_hbr_consonant_normal() {
let test_str = "AאBףC";
let test_str_filtered = remove_hbr_consonant_normal(test_str);
assert_eq!(test_str_filtered.as_ref(), "ABףC");
}
#[test]
pub fn rem_hbr_consonant_final() {
let test_str = "AאBףC";
let test_str_filtered = remove_hbr_consonant_final(test_str);
assert_eq!(test_str_filtered.as_ref(), "AאBC");
}
#[test]
pub fn rem_hbr_yod_triangle() {
let test_str = format!("A{}Z", '\u{05EF}');
let test_str_filtered = remove_hbr_yod_triangle(&test_str);
assert_eq!(test_str_filtered.as_ref(), "AZ");
}
#[test]
pub fn rem_hbr_ligature_yiddish() {
let test_str = "XװױײZ";
let test_str_filtered = remove_hbr_ligature_yiddish(test_str);
assert_eq!(test_str_filtered.as_ref(), "XZ");
}
}