use hebrew_unicode_script::HebrewUnicodeScript;
use std::borrow::Cow;
pub fn show_hbr_accent(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_accent())
.collect()
}
pub fn show_hbr_mark(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_mark())
.collect()
}
pub fn show_hbr_point(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_point())
.collect()
}
pub fn show_hbr_point_vowel(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_point_vowel())
.collect()
}
pub fn show_hbr_point_semi_vowel(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_point_semi_vowel())
.collect()
}
pub fn show_hbr_point_reading_sign(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_point_reading_sign())
.collect()
}
pub fn show_hbr_punctuation(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_punctuation())
.collect()
}
pub fn show_hbr_consonant(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant())
.collect()
}
pub fn show_hbr_consonant_normal(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant_normal())
.collect()
}
pub fn show_hbr_consonant_final(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant_final())
.collect()
}
pub fn show_hbr_yod_triangle(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_yod_triangle())
.collect()
}
pub fn show_hbr_ligature_yiddish(string: &str) -> Cow<'_, str> {
string
.chars()
.filter(|&c| !c.is_hbr_block() || c.is_hbr_consonant() || c.is_hbr_ligature_yiddish())
.collect()
}
#[cfg(test)]
mod unit_test {
use crate::*;
#[test]
fn test_showing_hbr_accent() {
let input_str = "בְּרֵאשִׁ֖ית";
let input_str_showed = show_hbr_accent(input_str);
assert_eq!(input_str_showed.as_ref(), "בראש֖ית");
}
#[test]
pub fn test_showing_hbr_mark() {
let input_str = "Q מִצְרָ֑יְמָה ה֯";
let input_str_showed = show_hbr_mark(input_str);
assert_eq!(input_str_showed.as_ref(), "Q מצרימה ה֯");
}
#[test]
pub fn test_showing_hbr_point() {
let input_str = "שִׁבְעִ֣ים";
let input_str_showed = show_hbr_point(input_str);
assert_eq!(input_str_showed.as_ref(), "שִׁבְעִים");
}
#[test]
pub fn test_showing_hbr_point_vowel() {
let input_str = "שִׁבְעִ֣יםֱ";
let input_str_showed = show_hbr_point_vowel(input_str);
assert_eq!(input_str_showed.as_ref(), "שִבעִים");
}
#[test]
pub fn test_showing_hbr_point_semi_vowel() {
let input_str = "ֲדְ נָפֶשׁ גֱכֳע";
let input_str_showed = show_hbr_point_semi_vowel(input_str);
assert_eq!(input_str_showed.as_ref(), "ֲדְ נפש גֱכֳע");
}
#[test]
pub fn test_showing_hbr_point_reading_sign() {
let input_str = "נִתְחַכְּמָה";
let input_str_showed = show_hbr_point_reading_sign(input_str);
assert_eq!(input_str_showed.as_ref(), "נתחכּמה");
}
#[test]
pub fn test_showing_hbr_punctuation() {
let input_str = "וַֽיְהִי־בֹ֖קֶר";
let input_str_showed = show_hbr_punctuation(input_str);
assert_eq!(input_str_showed.as_ref(), "ויהי־בקר");
}
#[test]
pub fn test_showing_hbr_consonant() {
let input_str = "A ֱאB ֵףC";
let input_str_showed = show_hbr_consonant(input_str);
assert_eq!(input_str_showed.as_ref(), "A אB ףC");
}
#[test]
pub fn test_showing_hbr_consonant_normal() {
let input_str = "A ֱאB ָףC";
let input_str_showed = show_hbr_consonant_normal(input_str);
assert_eq!(input_str_showed.as_ref(), "A אB C");
}
#[test]
pub fn test_showing_hbr_consonant_final() {
let input_str = "A ֱאB ָףC";
let input_str_showed = show_hbr_consonant_final(input_str);
assert_eq!(input_str_showed.as_ref(), "A B ףC");
}
#[test]
pub fn test_showing_hbr_yod_triangle() {
let input_str = format!("A הָבָה {} Z", '\u{05EF}');
let input_str_showed = show_hbr_yod_triangle(&input_str);
let expected_output = format!("A הבה {} Z", '\u{05EF}');
assert_eq!(input_str_showed.as_ref(), expected_output);
}
#[test]
pub fn test_showing_hbr_ligature_yiddish() {
let input_str = "X נִֽתְחַכְּמָ֖ה װױײ Z";
let input_str_showed = show_hbr_ligature_yiddish(input_str);
assert_eq!(input_str_showed.as_ref(), "X נתחכמה װױײ Z");
}
}