<<

Article

Journal of Information Science 1–10 Extracting the roots of The Author(s) 2014 Reprints and permissions: without removing sagepub.co.uk/journalsPermissions.nav DOI: 10.1177/0165551514526348 jis.sagepub.com

Qussai Yaseen Yarmouk University, Jordan

Ismail Hmeidi Jordan University of Science and Technology, Jordan

Abstract Most research in Arabic roots extraction focuses on removing affixes from Arabic words. This process adds processing overhead and may remove non- letters, which leads to the extraction of incorrect roots. This paper advises a new approach to dealing with this issue by introducing a new algorithm for extracting Arabic words’ roots. The proposed algorithm, which is called the Substring Algorithm, does not remove affixes during the extraction process. Rather, it is based on producing the set of all substrings of an Arabic word, and uses the Arabic roots file, the Arabic patterns file and a concrete set of rules to extract correct roots from substrings. The experiments have shown that the proposed approach is competitive and its accuracy is 83.9%, Furthermore, its accu- racy can be enhanced more in the sense that, for about 9.9% of the tested words, the WSS algorithm retrieves two candidates (in most cases) for the correct root.

Keywords Arabic roots; information retrieval; search engines; stemming

1. Introduction In this era of the internet and with the extensive number of documents that are posted every single minute, extracting rel- evant documents is getting more difficult. Therefore, extracting the roots of words (or stemming), which is used to facil- itate retrieving relevant documents, has become an important issue. Stemming is a major part of many applications, such as data compression, spelling checkers, text summarization and machine translation. Moreover, word-roots are used to extend queries to retrieve the most relevant information with higher recall and precision. In some , such as English, stemming is an easy process since it can be performed by removing . In Arabic, however, extracting roots is a difficult and a complicated issue owing to the fact that Arabic has a rich and com- plex . An Arabic word may have , infixes and suffixes. Furthermore, some Arabic words may con- where both have omitted root letters. In addition, affixes ,( ُﻗﻞ)and(ﻋـِ) sist of only one or two letters, such as the words consist of different numbers of characters. Arabic words have a sophisticated morphology; they can be built using roots and patterns, where patterns can be F’al) and ﻓﻌﻞ) described as templates with grammatical rules. A template can be represented as a combination of the root f´al) and the ﻓﻌﻞ) fa´ael) is a combination of the root ﻓﺎﻋﻞ) a set of prefixes, infixes or suffixes. For example, the template f´al) in an appropriate template ﻓﻌﻞ) a). An Arabic word can be constructed by replacing the letters of the root ﺍ) infix aalem) in´ﻋﺎﻟﻢ) ’with the letters of the root for the word to be constructed. For example, to construct the word ‘scientist (alem´ ﻋﻠﻢ) f´al) with the letters of the root ﻓﻌﻞ) fa´ael) and replace the letters of ﻓﺎﻋﻞ) Arabic, we should use the pattern .(a ﺍ) and keep the infix

Corresponding author: Qussai Yaseen, Computer Science Department, Yarmouk University, Irbid, Jordan. Email: [email protected] Yaseen and Hmeidi 2

Most researchers have focused on reversing the process discussed in the previous paragraph by removing affixes to obtain the correct root. However, the aforementioned process is not easy and may remove original letters (non-affix let- ters) during the filtering process, which may produce incorrect roots. This paper deals with the problem from a different angle by extracting word roots without removing affixes. The paper introduces a new algorithm called Word Substring Stemming (WSS), which works based on the fact that an Arabic word consists of its root’s letters separated by affixes (with some exceptions discussed in Section 3.2.2). The algorithm extracts all substrings of a given word and uses Arabic tasareef) to choose the correct root from the substrings. We should mention here that (ﺍﻟﺘﺼﺎﺭﻳﻒ roots file and patterns file most Arabic roots consist of three (trilateral) or four letters (quadric) [1]. Therefore, this paper deals with extracting only those roots and does not consider other types. The rest of the paper is organized as follows. The next section introduces some related work. Section 3 demonstrates the WSS algorithm. The experiments and results are discussed in Section 4. Finally, Section 5 presents the conclusion and future work.

2. Related work The retrieval of documents in Arabic has become a significant issue owing to the continuous evolution of the Internet and the huge spread of Arabic documents. Extensive work has been performed to enhance the precision of retrieving relevant documents by constructing good Arabic stemmers. Some researchers developed stemmers by remov- ing some prefixes and/or suffixes without dealing with infixes [2–4]. Taghva et al. [3] developed a stemmer that is based on matching patterns and removing prefixes and suffixes to extract the root. To enhance the matching process, they used a set of diacritical marks, affixes and patterns. Similarly, Momani and Faraj [4] developed a stemmer based on and removal. The proposed stemmer sorts the term letters and removes double letters that belong to the set of The removing process continues . {ﺱ ,ﺃ ,ﻝ ,ﺕ ,ﻡ ,ﻭ ,ﻥ ,ﻱ ,ﻩ ,ﺍ} extra characters, which consists of the following letters until only three letters remain. However, the method of extracting roots by removing a fixed set of prefixes and suffixes suffers from some problems, such as the inability to distinguish between extra letters and root letters [5]. In a more inter- esting work, Khoja and Garside’s algorithm [6] removes affixes and uses pattern matching to extract roots; however, it has problems when dealing with nouns. Word-pattern matching techniques were used in extracting Arabic roots [7–9]. Based on this idea, a root is extracted after removing the affixes attached to the given word. The root extraction is performed by matching the positions of the word letters with the corresponding pattern. Al-Fedaghi and A1-Anzi [9] developed a stemmer that matches each word with all possible patterns that have the same length of letters. Then, the stemmer extracts the trilateral substring in the L). The retrieved substring is considered the root of the word if the retrieved substring exists ﻝ) a), and# ﻉ) ,(f ﻑ) positions in the roots’ file. N-gram systems [10] and clustering methods [11] are also used to extract Arabic roots. Rogati et al. [12] presented an unsupervised learning approach to build an Arabic stemmer. They used a statistical machine translation approach that learns to retrieve the prefix, stem and suffix of a word using a training set. Harmanani et al. [13] proposed a rule-based stemmer for Arabic information retrieval. Their algorithm uses a rule engine that extracts stems based on a set of language-dependent rules. Chen and Gey [14] clustered Arabic words into stem classes using their mappings to English stem classes. They performed this process based on a parallel English–Arabic corpus and an English stemmer. Kadri et al. [15] developed a stemmer that extract roots according to linguistic rules. Boudlal et al. [16] used an approach based on hidden Markov models and claimed that this model can achieve very good precision in extracting Arabic roots. Al-Nashashibi et al. [17] introduced some corrections or enhancements such as replacing long and handling specific cases of hamzated words, which can be used in existing algorithms to improve their performance. They showed that using the corrections in the light stemmer proposed by Al-Ameed [18] can improve its performance by about 14%. Hmeidi et al. [19] proposed an algorithm that is based on bigrams. They used two similarity measures – Manhatten distance and Dice’s measure – to test the algorithm’s accuracy, which was claimed to be 86% for trilateral roots. Al-Kabi and Al-Mustafa [20] proposed an algorithm that is based on affixes removal and the knowledge extracted from structural . However, the level of complexity of the algorithm is high, and its accuracy depends on the arranging of root patterns. Similarly, Al-Sarhan et al. [21] introduced a new algorithm that is based on Arabic root pat- terns. Nonetheless, their algorithm assigns numeric values to listed letters and uses those values in roots extraction. Ghawanmeh et al. [22] suggested an algorithm based on Arabic root patterns; however, they used only 81 patterns in the extraction process, which reduces the time needed for extracting Arabic roots. Most of the aforementioned approaches focused on removing the affixes of a word to extract its root. However, these approaches suffer from the problem of distinguishing between the letters of affixes and the letters of roots. Moreover,

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 3 they add processing overhead that may not be acceptable in some systems. This paper introduces a new approach that deals with the stemming problem from a different angle by eliminating the need to remove affixes in root extraction. This has an advantage of the elimination of the uncertainty resulting from the distinction between the affix letters and the root letters. It also does not add any processing and computations overhead.

3. The WSS-based algorithm The proposed approach consists of two phases, which are the pre-processing of words and extracting roots. This section introduces the WSS algorithm and explains its phases in details.

3.1. Preparing the word (pre-processing) Before using the WSS algorithm to extract a word’s root, the word is prepared by removing letters that are highly proba- bly not the root’s letters. We should mention here that this phase is simple and does not aim to remove affixes. Strictly speaking, it aims to reduce the number of substrings of a word used in the WSS algorithm, and to enhance the probabil- ity of finding the correct root. In this phase, the following letters are removed before using the algorithm:

Al) is a particle (harf) that is ﺍﻝ) al#elm Science). The) ﺍﻟﻌﻠﻢ such as in the word ,(ﺍﻝ ﺍﻟﺘﻌﺮﻳﻒ) (Al ﺍﻝ) The letters (1) always used to render the noun on which it is prefixed definite. That is, it is not part of roots and should be elim- inated from any word. t) is used in ﺓ) khazanat Locker). The letter) ﺧﺰﺍﻧﺔ t) at the end of the word, such as in the word ﺓ) The letter (2) Arabic to distinguish the word either as male or as female, therefore, it should be eliminated. molahazat Notes). They are used in Arabic) ﻣﻼﺣﻈﺎﺕ at) at the end of the word, such as the word ﺍﺕ) The letters (3) to indicate plurals. bebab At the) ﺑﺒﺎﺏ b) in the word ﺏ) One of the doubled letters at the beginning of a word, such as the letter (4) Door). This is a preposition in Arabic and means in. a) in the word ﺍ) The second weak letter when there are two successive weak letters in a word, such as the letter (5) wajeb Duty ). In Arabic, if any two weak letters comes one after another, then the second letter is) ﻭﺍﺟﺐ considered as extra and should be eliminated because it will not be part of the root. and,ﺃto,ﺁ ,ﺅ to ﺉ In addition, the preparation process converts some letters to their original forms, such as converting ,in their original forms only. Moreover {ﺉ, ﺁ, ﻯ} This process is performed since Arabic roots contain the letters .ﻱ into ﻯ Y) are added to the end ﻱ ) O) and ﻭ) ae Realize), the letters#) ِﻉ if the word consists of one letter only such as the word wa#aya Realization). This type of words exists) ﻭﻋﻲ ae) becomes# ِﻉ) ,and to the beginning, respectively. For example are omitted. In other (ﻱ ,ﻭ ,ﺍ} (ﺃﺣﺮﻑ ﺍﻟﻌﻠﺔ) in which the weak letters (ﺻﻴﻐﺔ ﺃﻣﺮ) when transforming some words into the at the ﻭ words, without loss of generality, when a word consists of one letter only, it means that it misses the letter .at the end. Therefore, they should be added before using the algorithm ﻱ beginning and the letter

3.2. The WSS algorithm The WSS algorithm is used to extract both trilateral and quadric roots. Basically, the algorithm extracts all syntactically correct substrings from the given word, where a substring is defined as follows:

Definition 1. Given a word W that consists of a set of ordered letters from right to left K ={k1, k2, ., kn}, A subset B ={ki,ki + 1, ., kl} is a substring of W iff B 5 K ^ ("ki"kj position(ki) < position(kj)inB ! position(ki) < position(kj)inW).

The algorithm assumes that the correct root of a word is highly probably found among the retrieved substrings. tasareef) and some rules to pick the correct root. Algorithm 1 ﺍﻟﺘﺼﺎﺭﻳﻒ) Therefore, it uses the roots file, the patterns file (WSS algorithm) shows the complete process of extracting the roots of Arabic words. Before discussing the algorithm, .(ﺃﺣﺮﻑ ﺍﻟﻌﻠﺔ) and the set of Weak Letters ,(ﺃﺣﺮﻑ ﺍﻟﺰﻳﺎﺩﺓ) let us define the Set of Extra Letters

Definition 2. Given an Arabic word W that consists of a set of ordered letters from right to left W ={W1,W2, ., Wn}. If a letter L ∈ W is not a root letter, L is called an extra letter (affix letter), and the set of letters that may exist as affixes letter, which is .sa#ltmonyha), is called the set of extra letters ﺳـﺄﻟﺘﻤﻮﻧﻴﻬﺎ) {ﺍ ﻩ ﻱ ﻥ ﻭ ﻡ ﺕ ﻝ ﺃ ﺱ} the set

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 4

Algorithm 1. WSS algorithm

Input: An Arabic word W, an empty set of candidate roots CR, an empty set of substrings S, Quadric Root File QRF, Trilateral Root File TRF, Patterns File PF, an empty set of Correct Roots RR. Output: The root of W. Method: Apply the following steps in order to get the root. In the third and fourth steps, apply the steps in order. If a step succeeds in extracting the root, retrieve the root and exit the algorithm. ﺍﻝ, ﺍﺕ . Prepare W // i.e. remove .1 2. Extract all trilateral and quadric substrings from W. 3. For each substring G 4. CHECKSPELLING(G)//Check the spelling of G (using VBA(visual basic for applications)) 5. If SPELLING(G) = TRUE //Pick the (syntactically) correct substrings as substrings candidates 6. S ß S ∪ {G} //store G in the set S. 7. Search of quadric root (QR) candidates using the following rules. 8. If dG ∈ S ^ QR(G) ^ (EXTRA(G) =0)//Search for a quadric substring(s)(QR) in S that has no extra letters 9. CR ß CR ∪ {G}//store G in the set of root candidates CR. 10. Else If dG ∈ S ^ QR(G) ^ (EXTRA(G) =1) //Search for a QR in S that has one extra letter 11. CR ß CR ∪ {G}//store G in the set of root candidates CR. 12. Else If dG ∈ S ^ QR(G) ^ (EXTRA(G)=2)//Search for a QR in S that has two extra letter 13. CR ß CR ∪ {G}//store G in the set of root candidates CR. 14. Else If dG ∈ S ^ QR(G) ^ (EXTRA(G)=3)//Search for a QR in S that has three extra letter 15. CR ß CR ∪ {G}//store G in the set of root candidates CR. 16. Else If dG ∈ S ^ QR(G) ^ (EXTRA(G)=4)//Search for a QR in S that has four extra letter 17. CR ß CR ∪ {G}//store G in the set of root candidates CR. 18. If LENGTH(CR) = 0 // no quadric root exists 19. Go to Step 33 20. Else If LENGTH(CR) > = 1//CR contains one or more root candidates 21. For each G ∈ CR 22. If CONTIGUOUS(G,W) ^ G ∈ QRF //Choose G that is contiguous in W and exists in quadric root file 23. Root ß Root ∪ {G} 24. If LENGTH(Root) = 0 // steps 21–23 failed to find a root #remove the weak letters from W to form a new word W// {ﺍ,ﻭ,ﻱ}–W# ß W .25 26. For each G ∈ CR 27. If CONTIGUOUS(G,W#)^G ∈ QRF//Choose G that is contiguous in W# and exists in quadric root file 28. Root ß Root ∪ {G} 29. If LENGTH(Root) = 0 // steps 24–28 failed to find a root 30. For each G ∈ CR 31. If G ∈ QRF//Choose G that exists in quadric root file 32. Root ß Root ∪ {G} 33.If LENGTH(Root) = 0 //If No Quadric root exists, search for a trilateral root TR using the following rules 34. Length(CR)0 //empty CR for a new round 35.Search for trilateral root (TR) candidates using the following rules: 36.If dG ∈ S ^ TR(G) ^ (EXTRA(G) =0)//a trilateral substring(s)(TR) in S that has no extra letter 37. CR ß CR ∪ {G}//store G in the set of root candidates CR. 38.Else If dG ∈ S ^ TR(G) ^ (EXTRA(G) =1) //a trilateral substring(s)(TR) in S that has one extra letters 39. CR ß CR ∪ {G}//store G in the set of root candidates CR. 40.Else If dG ∈ S ^ TR(G) ^ (EXTRA(G)=2)//a trilateral substring(s)(TR) in S that has two extra letters 41. CR ß CR ∪ {G}//store G in the set of root candidates CR. 42.Else If dG ∈ S ^ TR(G) ^ (EXTRA(G)=3)//a trilateral substring(s)(TR) in S that has three extra letters 43. CR ß CR ∪ {G}//store G in the set of root candidates CR. 44.If LENGTH(CR) = 1//if one candidate root exist, retrieve it as the root 45. Root ß CR 46.Else If LENGTH(CR) > 1//CR contains more than one root candidates 47. For each G ∈ CR 48. If (G ; TRF) //if G is not in the trilateral roots file 49. CR ß CR – {G} //Remove G from CR 50. If LENGTH(CR) = 1 //if one candidate root exist, retrieve it as the root 51. Root ß CR 52. Else If LENGTH(CR) > 1 53. For each G ∈ CR {ﻓﻌﻞ،ﻣﻔﺎﻋﻞ، ﻓﻌﻮﻝ .} (ﺍﻟﺘﺼﺎﺭﻳﻒ) For each P ∈ PF //for each pattern in patterns file .54 in P by the letters of G respectively ﻝ ﻉ ﻑ NP ß P(G)/produce the pattern of G by replacing the letters .55 (continued)

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 5

Algorithm 1. (continued)

56. If NP = W //if the produced pattern is the same as W, add G to a new set RR 57. RR ß RR ∪ {G} 58. If LENGTH(RR) = 1//one root 59. Root ß RR //if RR contains one root, retrieve it as the root of W. 60. Else If LENGTH(RR) > 1 //more than one candidate root 61. For each K ∈ RR ^ Contiguous(K,W) //Choose K that has contiguous letters in W as root 62. Root ß Root ∪ {K} 63. If LENGTH(Root) = 0 //steps 61–62 failed to find a root #Choose K that is contiguous in W ,({ﺍ,ﻭ,ﻱ})For each K ∈ RR ^ Contiguous(K,W#) //where W#=W–infixes .64 65. Root ß Root ∪ {K} 66. If LENGTH(Root) = 0 //steps 64–65 failed to find a root 67. Root ß RR //Retrieve the substring(s) in RR as root(s). 68. If LENGTH(root) = 0 //fails to retrieve a root after using patterns file PF 69. Retrieve CR in step 49 as the set of root candidates for W

Definition 3. Consider the vowels in ; Arabic letters that have similar properties to the vowels in English lan- .(’ya) ﻱ waw), and) ﻭ ,(alif) ﺍ guage are called weak letters, which are

3.2.1. Analysis. The algorithm starts by preparing the given word as discussed in Section 3.1. Next, in step 2, it extracts all quadric and trilateral substrings of the word. In steps 3–6, the algorithm keeps valid (syntactically correct) substrings only. After this step, it searches for a quadric root. The algorithm searches for valid quadric substrings that have no extra letters as shown in steps 8–9. It assumes that, if such a substring exists, it is most probably a root candidate; therefore, the algorithm adds the substring to the set of root candidates (CR). If there is no substring with all letters original (has no extra letters), the algorithm searches for a substring that has the minimum number of extra letters and adds it to the set of root candidates (as shown in steps 10–17). The algorithm assumes that original letters in a word have very high probability of being root letters. This process is logical since other letters could be extra as it is purposely called ‘extra letters’, which are letters (affixes) that are added to roots to form various Arabic language words. Extra letters may exist as root letters too; meanwhile, original letters do not exist in a word as extra letters. After finishing this phase, the algo- rithm checks the set of retrieved root candidates (CR). If the algorithm fails to find a four-letter root candidate (step 18), the algorithm jumps to step 33 to search for a trilateral root. If there are quadric root candidates, the algorithm checks CR and searches for a root candidate that exists in the file of four-letter roots, and its letters are contiguous in the given word (W). If such candidate exists, it retrieves it as the root of W (steps 20–23). The algorithm assumes that the letters of the root of a word are highly probably contiguous in the word or separated by weak letters. Thus, if there is no candi- date contiguous in W, the algorithm searches for a candidate that is separated by weak letters (as infixes) (steps 24–25). Notice that the algorithm checks the retrieved root candidate against the quadric roots file to ensure that it is a root. If no quadric roots exist (step 33), the algorithm searches for a trilateral root. As performed in the searching process for a quadric root, the algorithm searches for a trilateral substring(s) that has the least extra letters (36–43) and adds it to the set of root candidates (CR). After these steps, if there is one three-letter root candidate only, the algorithm retrieves it as the root of the given word (steps 44–45). However, if there is more than one trilateral root candidate, the algorithm uses the trilateral roots file (TRF) to filter CR and removes any root candidate that does not exist in the TRF (steps 46– 49). After the filtering process, if only one root candidate remains in CR, the algorithm retrieves it as the root of the to retrieve the correct root (ﺍﻟﺘﺼﺎﺭﻳﻒ) given word (W) (steps 50-51). Otherwise, the algorithm uses the patterns file PF among the remaining root candidates. This process is performed by converting each root candidate in CR to each possi- ble pattern in PF and produce new words. If a new word is the same as the given word (W), the corresponding root can- ﻉ ﻝ) didate is added to a new set called RR (steps 53–57). The converting process is performed by replacing the letters f #a l) in a pattern by the letters of the root candidate in order from right to left. For example, to convert the candidate ﻑ which produces the ,ﺭ by ﻝ and ,ﻭ by ﻉ ,ﺙ by ﻑ f#alyoon), we replace ﻓﻌﻠﻴﻮﻥ) thawar Revolve) to the pattern) ﺛﻮﺭ root is the same as the given word W of which the algorithm ﺛﻮﺭﻳﻮﻥ thawryoon Revolutionists). If the new word) ﺛﻮﺭﻳﻮﻥ word and is added to the set RR. In the ﺛﻮﺭﻳﻮﻥ is most probably the root of ﺛﻮﺭ is trying to find the root, the root candidate tharya), and both root candidates ﺛﺮﻱ) and ﺛﻮﺭ contains the root candidates ﺛﻮﺭﻳﻮﻥ aforementioned example, the word can be ﺛﻮﺭ exist in the trilateral roots file. However, when converting both root candidates using the patterns file, only .ﻓﻌﻠﻴﻮﻥ which is produced using the pattern ,ﺛﻮﺭﻳﻮﻥ converted to the word After finishing the process of converting root candidates to patterns, if there is one root candidate in RR, the algorithm retrieves it as the root of W (steps 58–59). Otherwise, the algorithm prefers the root candidate that is contiguous in W and

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 6

.ﻣﻨﺒﻊ Figure 1. Extracting the root of retrieves it as the root (61–62). If there is no contiguous root candidate in W, the algorithm prefers the one that is sepa- rated by weak letters (as infixes) (64–65). If the previous steps fail, the algorithm retrieves all root candidates in RR as potential roots for W (65–66). This behaviour is based on the fact that Arabic words may have no infixes such as the word Thus, the algorithm assumes first that there are no infixes in the given word, and chooses a root candidate that is .ﺛﻮﺭﻳﻮﻥ contiguous in the given word. If it fails, it assumes that the word contains weak letters (as infixes) which separate the let- ters of the correct root. Therefore, the algorithm removes the weak letters, and then it searches for a root candidate that is contiguous in the new word (without infixes weak letters). Steps 68–69 are stated owing to the probability that not all pat- terns exist in the patterns file PF. Thus, when the algorithm fails to retrieve one correct root from a set of candidates, it retrieves the entire set. We should mention here that steps 60–69 are rarely executed since after converting root candi- dates using the patterns file, the correct root is highly probably retrieved. manb#a Source). As shown, the algorithm extracts) ﻣﻨﺒﻊ Figure 1 shows how the algorithm extracts the root of the word step 2). Next, it checks the spelling of this substring and keeps it) ﻣﻨﺒﻊ manb#a), which is) ﻣﻨﺒﻊ the four-letter substrings of is the only four-letter substring, the algorithm adds it to the set of ﻣﻨﺒﻊ since it is syntactically correct (steps 3–6). Since -is excluded by steps 22–23 because it does not exist in the four ﻣﻨﺒﻊ ,four-letter root candidates (steps 12–13). However letter roots file QRF. Since it does not exist in the roots file, the algorithm starts searching for a three-letter root. The cor- contains ﻧﺒﻊ nab#a Source) (steps 2–6). However, since) ﻧﺒﻊ man#a Prevents) and) ﻣﻨﻊ are ﻣﻨﺒﻊ rect three-letter substrings of only to the set of root ﻧﺒﻊ m), the algorithm adds) ﻡ n) and) ﻥ contains two extra letters ﻣﻨﻊ n), and) ﻥ one extra letter steps) ﻣﻨﺒﻊ is the only root candidate, the algorithm retrieves it as the root of ﻧﺒﻊ candidates (steps 38–39). Next, because 44–45). More examples are demonstrated in Figure 2, which shows how to use the algorithm to extract the roots of the words Almawashi The Livestock). The symbol ‘S X’ or ‘S X–Y’ on an output box) ﺍﻟﻤﻮﺍﺵ} Almotadahrej Rolling) and) ﺍﻟﻤﺘﺪﺣﺮﺝ indicates the step(s) that are used to generate the output, where S is an abbreviation to ‘Step’ and X or Y represents a the algorithm reaches a point where the substrings ,ﺍﻟﻤﻮﺍﺷﻲ step number. Note that, in the process of extracting the root of is ﻣﺸﻲ washya Tattle) are root candidates even after using the patterns file, where) ﻭﺷﻲ mashya Walked) and) ﻣﺸﻲ is converted to the same word using ﻭﺷﻲ fwa#ael), and) ﻓﻮﺍﻋﻞ mawashya Livestock) using the pattern) ﻣﻮﺍﺷﻲ converted to ,mafa’ael). Although it is uncommon case, the algorithm needs to deal with it. As shown in the figure) ﻣﻔﺎﻋﻞ the pattern the algorithm prefers the root candidate that is contiguous in the filtered word (without weak letters as infixes), which is is not contiguous in the filtered ﻭﺷﻲ since there is no root candidate contiguous in the original word. Notice that ,ﻣﺸﻲ word.

3.2.2. Special cases. Some Arabic words cannot be manipulated using the mentioned rules in the algorithm such as the Shadda) ﺷّﺪ ,(Madda Stretched) ﻣّﺪ ,(Jehat Direction) ﺟﻬﺔ words that do not contain one of their root’s letters like

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 7

.ﺍﻟﻤﻮﺍﺷﻲ and ﺍﻟﻤﺘﺪﺣﺮﺝ Figure 2. Extracting the root of the words

.((qey Protect) ِﻕ ,(aey Realize#) ِﻉ) Loghat Language) and the words that contain one letter only, like) ﻟﻐﺔ Tightened) and These cases are manipulated using additional rules, which are not mentioned in the algorithm for simplicity. After the preparation process, if the length of a word is less than three letters, the algorithm assumes that the word is a special case, and uses additional rules to extract the root of the word. In the case of the word that does not contain one of its root letters, the word letters are doubled one by one. After doubling a letter, the spelling of the produced word is checked. If it is syntactically correct, the algorithm is used to extract its root. If there is no valid root or there is no valid y) is added to the beginning or to the end of the) ﻱ w) or) ﻭ new word after doubling a letter of the given word, a letter word, and the spelling is checked at each time. Then, the algorithm is used to extract the root of the new word. For madada). Then, using the) ﻣﺪﺩ madda) to produce the new word) ﻣّﺪ d) is doubled in the word) ﺩ instance, the letter t) is removed in) ﺓ loghat), the letter) ﻟﻐﺔ which is correct. In the case of words like ,ﻣﺪﺩ algorithm, the root of this word is w) is) ﻭ the preparation process. Doubling one of its letters fails in finding the correct root. Meanwhile, when the letter laghawa). Again, using the algorithm, the root of) ﻟﻐﻮ added to the end of the word, a new word is produced, which is y) is) ﻱ yasel arrive). The first letter) ﻳﺼﻞ which is correct. The same thing is used for the word ,ﻟﻐﻮ the new word is

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 8

Accuracy 100.0% 80.0% 83.90% 60.0% 40.0% 20.0% 16.10% 9.90% 0.0%

Correct Roots Incorrect Roots More than one root candidate

Figure 3. The accuracy of the WSS algorithm.

Accuracy Comparisons

100% 95.0% 90% 86.0% 80% 83.9% 70% 69.0% 60% 60.0% 50% 40% 38.0% 30% 20% 10% 0%

Al-Sarhan Al-Kabi Ghawanmeh Taghva Hmeidi WSS-based Algorithm Algorithm Algorithm Algorithm Algorithm Algorithm

Figure 4. A comparison between the accuracy of the WSS stemmer and the stemmers of Al-Kabi, Al-Sarhan, Ghawanmeh, Taghva and Hmeidi. wasal) ﻭﺻﻞ w) is added to the beginning to produce the word) ﻭ removed in the preparation process and the letter w) is added to the) ﻭ arrived), which is extracted as the root. In case of words that contain one letter only, the letter .y) is added to the end of the word. Then, the new word is considered as the root) ﻱ beginning of the word and the letter .w#aya), which is the correct root) ﻭﻋﻲ aey) is converted to the word#) ِﻉ For instance, the word

4. Experiments and results The implementation was performed using Visual Basic for Applications (VBA) in Microsoft Word. The spelling checker in VBA in MS Word was used to check the correctness of the substrings of a word. The paper used the Holy , which is the holy book in the Islamic religion, as the dataset to test the precision of the WSS algorithm. The Quran is written in Arabic language, and it contains 87,025 words, including stop words. The Quran text was filtered prior the .ala), etc‘) ﻋﻠﻰ ,(mena) ﻣﻦ testing process by removing all diacritics and stop words such as Figure 3 shows the accuracy of the WSS algorithm. To calculate the accuracy, a file that contains Arabic words and The accuracy .(ﻟﺴﺎﻥ ﺍﻟﻌﺮﺏ their correct roots was created. The file was prepared using an Arabic (Lesan Alarab was computed by comparing the roots extracted by the WSS algorithm with the correct roots in the file. As shown in Figure 3, the proposed algorithm retrieves the correct roots for 83.9% of the tested words. Moreover, it shows that the algorithm retrieves more than one root candidate for 9.9% of the tested words. That is, when the algorithm fails to retrieve one correct root in some cases, it retrieves more than one root candidate (two candidates in most cases), indicat- ing that the root is among these candidates, but the algorithm cannot decide which one exactly. We should mention here that the words with multiple root candidates were not included in the computation of the accuracy. That is, they were considered as incorrect roots.

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 9

Figure 4 shows the comparison between the accuracy of the WSS algorithm and five algorithms for Arabic roots extraction, which are Al-kabi [20] algorithm, Al-Sarhan [21] algorithm, Ghawanmeh algorithm [22], Taghva algorithm [3] and Hmeidi Algorithm [19]. A short description of these algorithms has been given in Section 2. The algorithms were tested using the words of the Quran as a dataset. As shown in Figure 4, the WSS approach has a competitive accu- racy as it occupies rank 3 among the algorithms. Ghawanmeh’s stemmer occupies rank 1 as it achieves an accuracy of 95%, while Taghva’s stemmer has the least accuracy, about 38%. We should mention here that as there exist special cases that do not follow the rules of stemmers; a stemmer can be enhanced by addressing extra rules that deal with spe- cial cases similar to those handled in this paper in Section 3.2.2. That is, the accuracy of the aforementioned stemmers can be increased by dealing with special cases that cannot be dealt with using the stated rules. As a matter of fact, some strong stemmers fail to find the correct roots of words which are extracted correctly by some weak stemmers. Therefore, an enhanced stemmer can be built by combining the strength of two or more strong stemmers [23]. The Al-Kabi, Ghawanmeh, Taghva and Hmeidi algorithms are all based on affix removal. Normalizing words by removing affixes has a major flaw, which is the inability to differentiate between root and non-root (extra) letters in some (Faqeya) ﻓﻘﻲ cases; therefore, incorrect roots may be produced. For example, Ghawanmeh’s approach extracts the root .as a prefix ﺃ Afaqa). The approach considers the letter) ﺃﻓﻖ Ofoqeya), where the root is ﺃﻓﻘﻴﺔ) for the word Horizontal Awlaweyah), where the correct ﺃﻭﻟﻮﻳﺔ) waleya) for the word Priority) ﻭﻟﻲ Similarly, Taghva’s approach extracts the root as a prefix, while, it is a root letter. Besides the probability of removing root ﺃ Awala). It considers the letter) ﺃﻭﻝ root is letters, identifying and removing affixes poses extra processing overhead during root extraction. Unlike the aforemen- tioned approaches, the WSS-based algorithm extracts roots without removing affixes. This feature eliminates the prob- ability of removing roots letters during the extracting process, and reduces the time needed for root extraction. Removing affixes is not performed in Al-Sarhan’s approach. It is based on assigning weights and ranks to the letters of words. Weights are real numbers in the range 0–5, which were determined by some experimentation on an Arabic text. After determining the weights of letters, the approach multiplies the rank of a letter (the order of a letter in a word) by its weight. Then, the three letters with the least product value are chosen as the three-letter root. Obviously, the effi- ciency of this approach depends on the correctness of the weights of letters and the formula it uses, which can be tested by running some evaluations on a good dataset. As shown in Figure 4, the accuracy of this approach is only 69%. However, Figure 4 shows that the accuracy of WSS-based algorithm is better than that of the Al-Sarhan algorithm. In addition, it was observed during the testing that Al-Sarhan’s approach failed to extract the correct root for simple words. .(a#azal) ﻋﺰﻝ Faa#zal), whereas the correct root is ﻓﻌﺰﻝ) Faa#za) for the word isolate) ﻓﻌﺰ For example, it extracted the root In light of the previous discussion, WSS-based algorithm is a competitive approach with new features that avoid pos- sible flaws that may be produced by affix removal, which exist in traditional stemmers. However, WSS-based algorithm retrieves more than one candidate roots for about 9.9% of tested words, which reduces its efficiency against some tradi- tional stemmers. Therefore, improving WSS-based by adding new rules that decrease the aforementioned percentage will greatly boost its efficiency.

5. Conclusions and future work This paper has introduced a new approach, which is called WSS Algorithm, for extracting both three- and four-letter roots of Arabic words. The WSS algorithm does not remove affixes when extracting roots except some rendering in the preparation process to reduce the computations needed later. The algorithm was tested using the Holy Quran. The experiments showed that the accuracy of the WSS algorithm is 83.9%, and the percentage of words with more than one root candidate retrieved is 9.9% of the tested words. A comparison between the WSS stemmer and five popular Arabic stemmers showed that it achieves a competitive accuracy as it has occupied rank 3 among them. The WSS algorithm represents a promising approach for dealing with Arabic root extraction. Therefore, as future work, we plan to add more rules to reduce the percentage of words with more than one retrieved root candidate and enhance the accuracy of the algorithm.

Funding This research received no specific grant from any funding agency in the public, commercial or not-for-profit sectors.

References [1] Duwairi R. Arabic text categorization. The International Arab Journal of Information Technology 2007; 4: 125–131.

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348 Yaseen and Hmeidi 10

[2] Chowdhury A, Aljlayl M, Jensen E et al. Linear combinations based on document structure and varied stemming for Arabic retrieval. In: IIT at TREC 2002, Gaithersburg, MD, 2002. [3] Taghva K, Elkhoury R and Coombs J. Arabic stemming without a root dictionary. In: The international conference on informa- tion technology: Coding and computing (ITCC’05), Washington, DC, 2005. [4] Momani M and Faraj J. A novel algorithm to extract tri-literal Arabic roots. In: The IEEE/ACS international conference on com- puter systems and applications, proceedings, Los Alamitos, CA, 2007. [5] Al-Shammari E and Lin J. Towards an error-free Arabic stemming. In: The 2nd ACM workshop on improving non-English web searching, New York, 2008. [6] Khoja S and Garside R. Stemming Arabic text, http://zeus.cs.pacificu.edu/shereen/research.htm. (2008, accessed 1 September 2013). [7] Al-Sughaiyer I and Al-Kharashi I. Arabic morphological analysis techniques: A comprehensive survey. Journal of the American Society for Information Science and Technology 2004; 55: 189–213. [8] Beesley K. Arabic morphological analysis on the Internet. In: The 6th international conference and exhibition on multilingual computing, Cambridge, UK, 1998. [9] Al-Fedaghi S and Al-Anzi F. A new algorithm to generate Arabic root-pattern forms. In: The 11th national computer conference and exhibition, Dahran, Saudi Arabia, 1989. [10] Mayfield J, McNamee P, Costello C et al. JHU/APL at TREC 2001: Experiments in filtering and in Arabic, video, and web retrieval. In: TREC 2001, Gaithersburg, MD, 2001. [11] De Roeck A and Al-Fares W. A morphologically sensitive clustering algorithm for identifying Arabic roots. In: The 38th annual meeting of the Association of Computational Linguistics, Hong Kong, 2000. [12] Rogati M, McCarley S and Yang Y. Unsupervised learning of Arabic stemming using a parallel corpus. In: The 41st annual meeting of the Association for Computational Linguistics, Jeju Island, Korea, 2003. [13] Harmanani H, Keirouz W and Raheel S. A rule-based extensible stemmer for information retrieval with application to Arabic. The International Arab Journal of Information Technology 2006; 3: 265–272. [14] Chen A and Gey F. Building an Arabic stemmer for information retrieval. In: TREC 2002, Gaithersburg, MD, 2002. [15] Kadri Y and Nie J. Effective stemming for Arabic information retrieval. In: The challenge of Arabic for NLP/MT conference, London, 2006. [16] Boudlal A, Belahbib R, Lakhouaja A et al. A Markovian approach for Arabic root extraction. International Arab Journal of Information Technology 2011; 8: 91–98. [17] Al-Nashashibi M, Neagu D and Yaghi A. An improved root extraction technique for Arabic words. In: The 2nd international conference on computer technology and development (ICCTD), Cairo, 2010. [18] Al-Ameed H. A proposed new model using a light stemmer for increasing the success of search in Arabic terms. PhD Thesis, University of Bradford, Bradford, 2006. [19] Hmeidi I, Al-Shalabi R, Al-Taani A et al. A novel approach to the extraction of roots from Arabic words using bigrams. Journal of the American Society for Information Science and Technology 2010; 61: 583–591. [20] Al-Kabi M and Al-Mustafa R. Arabic root based stemmer. In: The international Arab conference on information technology, Jordan, 2006. [21] Al-Sarhan H, Al-Shalabi R and Kanaan G. New approach for extracting Arabic roots. In: The 2003 Arab conference on informa- tion technology, Egypt, 2003. [22] Ghawanmeh S, Al-Shalabi R, Kanaan G et al. An algorithm for extracting the root for the Arabic language. In: The 5th interna- tional conference of the Business Information Management Association, Cairo, Egypt, 2005. [23] Al-Kabi M, Al-Radaideh Q and Akkawi K. Benchmarking and assessing the performance of Arabic stemmers. Journal Information Science 2011; 37: 111–119.

Journal of Information Science, 2014, pp. 1–10 The Author(s), DOI: 10.1177/0165551514526348