1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Lightweight library for removing hebrew diacritics ("Niqqud", Hebrew: נִקּוּד) from a string.
//!
//! reference: <https://www.unicode.org/charts/PDF/U0590.pdf>
//!
//! Examples
//! --------
//! ```
//! let diacrited_quoted = "״שָׁלוֹם עוֹלָם״";
//!
//! // Remove only the diacritics (keep '״' chars)
//! let quoted = niqqud::remove(diacrited_quoted);
//! assert_eq!("״שלום עולם״", quoted);
//!
//! // Remove diacritics and hebrew quotes (double '״' and single '׳')
//! let unquoted = niqqud::remove_thorough(diacrited_quoted);
//! assert_eq!("שלום עולם", unquoted);
//! ```
use Cow;
/// Removes hebrew diacritics from a string.
///
/// Note: this function does NOT remove hebrew quotes ('״', '׳').
/// ```
///
/// let word = niqqud::remove("נִקּוּד");
/// assert_eq!("נקוד", word);
/// ```
///
/// Removes hebrew diacritics from a string, while also removing hebrew quotes ('״', '׳').
/// ```
///
/// let word = niqqud::remove_thorough("״גֵּרְשַׁיִם״");
/// assert_eq!("גרשים", word);
/// ```
///
/// Returns true if the character is a diacritic
/// Returns true if the character is a special (HEB) character, such as hebrew quotes '״' ("Gershayim", Hebrew: גֵּרְשַׁיִם)