Skip to content

Commit

Permalink
add more test cases and adjust the transliteration
Browse files Browse the repository at this point in the history
  • Loading branch information
alpancs committed Mar 20, 2024
1 parent 613930a commit 41d9bb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/quranize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ mod tests {
assert_eq!(q.e("robbil alamin"), vec!["رَبِّ العٰلَمينَ"]);
assert_eq!(q.e("husnul maab"), vec!["حُسنُ المَـٔابِ"]);
assert_eq!(q.e("kufuwan"), vec!["كُفُوًا"]);
assert_eq!(q.e("yukhodiun"), vec!["يُخٰدِعونَ"]);
assert_eq!(q.e("indallah"), vec!["عِندَ اللَّهِ", "عِندِ اللَّهِ"]);
assert_eq!(q.e("alimul ghoibi"), vec!["عٰلِمُ الغَيبِ"]);
}

#[test]
Expand Down
7 changes: 4 additions & 3 deletions src/quranize/transliterations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub(super) fn map(c: char) -> &'static [&'static str] {
LETTER_WAW_WITH_HAMZA_ABOVE => &["u"],
LETTER_ALEF_WITH_HAMZA_BELOW => &["i"],
LETTER_YEH_WITH_HAMZA_ABOVE => &["'", "a", "i"],
LETTER_ALEF => &["a", "o", "aa", "oo"],
LETTER_ALEF => &["a", "aa", "o", "oo"],
LETTER_BEH => &["b"],
LETTER_TEH_MARBUTA => &["h", "t"],
LETTER_TEH => &["t"],
Expand All @@ -32,7 +32,7 @@ pub(super) fn map(c: char) -> &'static [&'static str] {
LETTER_DAD => &["d", "dh", "dz"],
LETTER_TAH => &["t", "th"],
LETTER_ZAH => &["d", "dh", "dz"],
LETTER_AIN => &["'", "a", "k"],
LETTER_AIN => &["'", "a", "u", "i", "k"],
LETTER_GHAIN => &["g", "gh"],

TATWEEL => &["a", "o"],
Expand All @@ -44,7 +44,7 @@ pub(super) fn map(c: char) -> &'static [&'static str] {
LETTER_MEEM => &["m"],
LETTER_NOON => &["n"],
LETTER_HEH => &["h"],
LETTER_WAW => &["w", "u"],
LETTER_WAW => &["w", "u", "uu"],
LETTER_ALEF_MAKSURA => &["a", "o", "i"],
LETTER_YEH => &["y", "i", "ii"],

Expand All @@ -67,6 +67,7 @@ pub(super) fn contextual_map(c0: char, c1: char) -> &'static [&'static str] {
(SPACE, LETTER_ALEF)
| (LETTER_HAMZA, LETTER_ALEF)
| (LETTER_ALEF, LETTER_LAM)
| (LETTER_AIN, LETTER_WAW)
| (LETTER_AIN, LETTER_SUPERSCRIPT_ALEF)
| (LETTER_WAW, LETTER_ALEF)
| (FATHATAN, LETTER_ALEF)
Expand Down

0 comments on commit 41d9bb4

Please sign in to comment.