| 1 | package Lingua::AR::Word; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use utf8; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | |||
| 7 | 1 | ▶ | sub encode{ |
|
Subroutine
encode: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 8 | |||
| 9 | 1 | my $word=shift; | |
| 10 | |||
| 11 | # let's take away the FIRST hamza ON/UNDER the alef from the word | ||
| 12 | 1 | $word=~s/\x{0623}//; #HAMZA ON ALEF | |
| 13 | 1 | $word=~s/\x{0625}//; #HAMZA UNDER ALEF | |
| 14 | |||
| 15 | # let's take away the double-letters (=letter+shadda) | ||
| 16 | 1 | $word=~s/\x{0628}\x{0651}/bb/g; | |
| 17 | 1 | $word=~s/\x{062A}\x{0651}/tt/g; | |
| 18 | 1 | $word=~s/\x{062B}\x{0651}/_t_t/g; | |
| 19 | 1 | $word=~s/\x{062C}\x{0651}/^g^g/g; | |
| 20 | 1 | $word=~s/\x{062D}\x{0651}/.h.h/g; | |
| 21 | 1 | $word=~s/\x{062E}\x{0651}/_h_h/g; | |
| 22 | 1 | $word=~s/\x{062F}\x{0651}/dd/g; | |
| 23 | 1 | $word=~s/\x{0630}\x{0651}/_d_d/g; | |
| 24 | 1 | $word=~s/\x{0632}\x{0651}/zz/g; | |
| 25 | 1 | $word=~s/\x{0633}\x{0651}/ss/g; | |
| 26 | 1 | $word=~s/\x{0634}\x{0651}/^s^s/g; | |
| 27 | 1 | $word=~s/\x{0635}\x{0651}/.s.s/g; | |
| 28 | 1 | $word=~s/\x{0636}\x{0651}/.d.d/g; | |
| 29 | 1 | $word=~s/\x{0637}\x{0651}/.t.t/g; | |
| 30 | 1 | $word=~s/\x{0638}\x{0651}/.z.z/g; | |
| 31 | 1 | $word=~s/\x{0639}\x{0651}/``/g; | |
| 32 | 1 | $word=~s/\x{063A}\x{0651}/.g.g/g; | |
| 33 | 1 | $word=~s/\x{0641}\x{0651}/ff/g; | |
| 34 | 1 | $word=~s/\x{0642}\x{0651}/qq/g; | |
| 35 | 1 | $word=~s/\x{0643}\x{0651}/kk/g; | |
| 36 | 1 | $word=~s/\x{0644}\x{0651}/ll/g; | |
| 37 | 1 | $word=~s/\x{0645}\x{0651}/mm/g; | |
| 38 | 1 | $word=~s/\x{0646}\x{0651}/nn/g; | |
| 39 | 1 | $word=~s/\x{0647}\x{0651}/hh/g; | |
| 40 | 1 | $word=~s/\x{0648}\x{0651}/ww/g; | |
| 41 | 1 | $word=~s/\x{064A}\x{0651}/yy/g; | |
| 42 | 1 | $word=~s/\x{0631}\x{0651}/rr/g; | |
| 43 | |||
| 44 | # now let's think of single letters | ||
| 45 | 1 | $word=~s/\x{0627}/A/g; #ALEF; | |
| 46 | 1 | $word=~s/\x{062A}/t/g; #TEH; | |
| 47 | 1 | $word=~s/\x{0643}/k/g; #KAF | |
| 48 | 1 | $word=~s/\x{0628}/b/g; #BEH | |
| 49 | 1 | $word=~s/\x{0642}/q/g; #QAF | |
| 50 | 1 | $word=~s/\x{062E}/_h/g; #KHAH | |
| 51 | 1 | $word=~s/\x{0629}/T/g; #TEH MARBUTA | |
| 52 | 1 | $word=~s/\x{0631}/r/g; #REH | |
| 53 | 1 | $word=~s/\x{062C}/^g/g; #JEEM | |
| 54 | 1 | $word=~s/\x{0634}/^s/g; #SHEEN | |
| 55 | 1 | $word=~s/\x{0633}/s/g; #SEEN | |
| 56 | 1 | $word=~s/\x{0635}/.s/g; #SAD | |
| 57 | 1 | $word=~s/\x{062F}/d/g; #DAL | |
| 58 | 1 | $word=~s/\x{0630}/_d/g; #THAL | |
| 59 | 1 | $word=~s/\x{062B}/_t/g; #THEH | |
| 60 | 1 | $word=~s/\x{062D}/.h/g; #HAH | |
| 61 | 1 | $word=~s/\x{0636}/.d/g; #DAD | |
| 62 | 1 | $word=~s/\x{0641}/f/g; #FEH | |
| 63 | 1 | $word=~s/\x{0632}/z/g; #ZAIN | |
| 64 | 1 | $word=~s/\x{0637}/.t/g; #TAH | |
| 65 | 1 | $word=~s/\x{0638}/.z/g; #ZAH | |
| 66 | 1 | $word=~s/\x{063A}/.g/g; #GHAIN | |
| 67 | 1 | $word=~s/\x{0644}/l/g; #LAM | |
| 68 | 1 | $word=~s/\x{0645}/m/g; #MEEM | |
| 69 | 1 | $word=~s/\x{0646}/n/g; #NOON | |
| 70 | 1 | $word=~s/\x{0647}/h/g; #HEH | |
| 71 | 1 | $word=~s/\x{0648}/w/g; #WAW | |
| 72 | 1 | $word=~s/\x{0649}/_A/g; #ALEF MAKSURA | |
| 73 | 1 | $word=~s/\x{067E}/p/g; #PEH | |
| 74 | 1 | $word=~s/\x{06A4}/v/g; #VEH | |
| 75 | 1 | $word=~s/\x{06AF}/g/g; #GAF | |
| 76 | #$word=~s/\x{0681}/c/g; #HAMZA ON HAH | ||
| 77 | 1 | $word=~s/\x{0686}/^c/g; #HAH WITH MIDDLE 3 DOTS DOWNWARD | |
| 78 | #$word=~s/\x{0695}/.r/g; #REH WITH SMALL V BELOW | ||
| 79 | 1 | $word=~s/\x{064B}/aN/g; #FATHATAN | |
| 80 | 1 | $word=~s/\x{064C}/uN/g; #DAMMATAN | |
| 81 | 1 | $word=~s/\x{064D}/iN/g; #KASRATAN | |
| 82 | 1 | $word=~s/\x{064E}/a/g; #FATHA | |
| 83 | 1 | $word=~s/\x{064F}/u/g; #DAMMA | |
| 84 | 1 | $word=~s/\x{0650}/i/g; #KASRA | |
| 85 | 1 | $word=~s/\x{0670}/_a/g; #LETTER SUPERSCRIPT ALEF = DAGGER ALIF | |
| 86 | #$word=~s/\x{0657}/_u/g; #INVERTED DAMMA | ||
| 87 | #$word=~s/\x{0656}/_i/g; #SUBSCRIPT ALEF | ||
| 88 | 1 | $word=~s/\x{060C}/,/g; #COMMA | |
| 89 | 1 | $word=~s/\x{061B}/;/g; #SEMICOLON | |
| 90 | 1 | $word=~s/\x{061F}/?/g; #QUESTION MARK | |
| 91 | #$word=~s/\x{0695}/'A/g; #REH WITH SMALL V BELOW | ||
| 92 | 1 | $word=~s/\x{0621}/'/g; #HAMZA | |
| 93 | 1 | $word=~s/\x{0622}/'A/g; #MADDA ON ALEF | |
| 94 | 1 | $word=~s/\x{0623}/'/g; #HAMZA ON ALEF | |
| 95 | 1 | $word=~s/\x{0624}/'/g; #HAMZA ON WAW | |
| 96 | 1 | $word=~s/\x{0625}/'/g; #HAMZA UNDER ALEF | |
| 97 | 1 | $word=~s/\x{0626}/'/g; #HAMZA ON YEH | |
| 98 | 1 | $word=~s/\x{0639}/`/g; #AIN | |
| 99 | 1 | $word=~s/\x{0640}/--/g; #TATWEEL | |
| 100 | 1 | $word=~s/\x{064A}/y/g; #YEH | |
| 101 | 1 | $word=~s/\x{0652}//g; #SUKUN | |
| 102 | 1 | $word=~s/\x{0671}/A/g; #ALIF WASLA | |
| 103 | #$word=~s/\x{0685}/,c/g; #HAH WITH 3 DOTS ABOVE | ||
| 104 | 1 | $word=~s/\x{0698}/^z/g; #REH WITH 3 DOTS ABOVE = JEH | |
| 105 | #$word=~s/\x{06AD}/^n/g; #KAF WITH 3 DOTS ABOVE = NG | ||
| 106 | #$word=~s/\x{06B5}/^l/g; #LAM WITH SMALL V | ||
| 107 | 1 | return $word; | |
| 108 | } | ||
| 109 | |||
| 110 | 1 | 1; | |
| 111 | __END__ | ||