# A New Rule-Based Approach for Classical Arabic in Natural Language Processing

Authors: Ramzi Salah; Muaadh Mukred; Lailatul Qadri binti Zakaria; Rashad Ahmed; Hasan Sari
Journal: Journal of Mathematics
 (2022)

---

## Abstract

Named entity recognition (NER) is fundamental in several natural language processing applications. It involves finding and categorizing text into predefined categories such as a person's name, location, and so on. One of the most famous approaches to identify named entity is the rule-based approach. This paper introduces a rule-based NER method that can be used to examine Classical Arabic documents. The proposed method relied on triggers words, patterns, gazetteers, rules, and blacklists generated by the linguistic information about entities named in Arabic. The method operates in three stages, operational stage, preprocessing stage, and processing the rule application stage. The proposed approach was evaluated, and the results indicate that this approach achieved a 90.2% rate of precision, an 89.3% level of recall, and an F-measure of 89.5%. This new approach was introduced to overcome the challenges related to coverage in rule-based NER systems, especially when dealing with Classical Arabic texts. It improved their performance and allowed for automated rule updates. The grammar rules, gazetteers, blacklist, patterns, and trigger words were all integrated into the rule-based system in this way.


---

## Body

## 1. Introduction

Named entity recognition is a crucial step in numerous natural language processing (NLP) applications such as machine translation, question answering, and information retrieval, to name a few [1, 2]. NER is typically described as a sequence labeling task in which each word in a phrase is given a unique label. Sequence labeling has long been used to model and solve NLP tasks. The input values are often words; however, they can be smaller units like individual characters depending on the task [3].Arabic is one of the most widely spoken languages in the world, with around 420 million people speaking it. Arabic is the official language of 24 countries [4], most of which are located in the Middle East and North Africa. Due to applications and tools for translation and information retrieval, languages are becoming a crucial aspect of technology. Because of the development in Arabic language presence in the technology and social media landscape, research in Arabic language processing should be prioritized to keep up with modern technologies. There has been extensive research on NER in English text. However, in comparison to English, Arabic language processing research is still in its infancy [5, 6]. Beyond that, there are challenges inherent in the Arabic language and a dearth of annotated corpora and resources. For the Arabic language, extracting named entities is quite challenging due to its morphological structure [7, 8]. Arabic is a morphologically complex language due to its inflectional nature; it has a general form of a word: prefix(es) + stem + suffix(es), with the number of prefixes and suffixes ranging from 0 to many. Another issue is that, depending on its position in the world, an Arabic letter can take up to three different forms [9, 10]. In his paper, we introduce a rule-based NER method that can be used to examine Classical Arabic documents. The proposed method relied on triggers words, patterns, gazetteers, rules, and blacklists generated by the linguistic information pertaining to entities named in Arabic.The remainder of this paper is structured as follows. Related work is introduced in Section2. The linguistic sources used to identify Arabic NEs are listed in Section 3. The rule-based NER method proposed in this study is introduced in Section 4, which outlines the operation, preprocessing, and processing steps incorporated in this method. Each step has been described in the subsections. An evaluation of the proposed method is presented in Section 5. Finally, we conclude our paper in Section 6.


## 2. Related Work

Name entity recognition, NER, is a common task in the natural language processing fields. Researchers have used three main approaches for NER [1]. They are linguistic rule-based, statistical and machine learning-based, and hybrid approaches. Rule-based approaches require a lexicon of proper names and a set of patterns to match NEs. Matching is achieved by using internal evidence (gazetteers) and external evidence provided by the context in which the NEs appear. Statistical and machine learning approaches are based on a large amount of manually annotated training data. Hybrid methods combine statistical and rule-based approaches [11]. Aboaoga and Ab Aziz [12] proposed a rule-based approach to recognize person names. The developed rules are based on the position of the name. They evaluated their method based on a collected corpus. They reported 92.66, 92.04, and 90.43% performance in terms of F-measure in sports, economic, and political domains. Shaalan and Oudah [13] proposed a rule-based approach that contains a lexicon and a set of grammar rules for NER for the political domain. The proposed approach is evaluated on ANER corpus, and the reported results were 82.76%, 98.3%, and 100% for the person, location, and organization names, respectively.Shahina [14] used a deep learning-based approach for Arabic NER. The author made use of three well-known architectures, recurrent neural network (RNN), long short-term memory (LSTM), and gated recurrent unit (GRU). The author also experimented on ANERcorp dataset and reported performance of 96.68% in terms of accuracy. Another deep learning-based approach was proposed in [15]. The author introduced a deep learning model that consists of bidirectional long short-term memory and conditional random field. Different network layers such as word embedding, convolutional neural network, and character embedding were used. The proposed method was evaluated by combining two datasets ANERCorp [10] and AQMAR Arabic Wikipedia Named Entity Corpus and Tagger [16]. The reported performance was 76.65% in terms of F1 score for ANER. In [17], the author proposed a machine learning-based approach for Arabic named entity recognition. The author combined radial basis function (RBF) cascaded with a sequential convolutional neural network (CNN) and bidirectional long short-term memory (BiLSTM) in the classification process. The obtained results were 95% in terms of F1 score. Sajadi and Minaei [18] presented a new Classical Arabic corpus and a gazetteer named NoorGazet, about 18000 names. They also developed a new approach based on ensemble learning for named entity extraction. They reported 96.04% in terms of F-measure. Mohammed and Omar [19] conducted a study where they applied a neural network-based approach to identify NER for the Arabic language. The proposed method gave 92% accuracy.Shaalan and Oudah [13] proposed a hybrid NER that combines rule-based and machine learning-based approaches to recognize 11 types of Arabic named entities. They used decision trees, support vector machines, and logistic regression classifiers. They evaluated their method using the ANERcorp dataset and reported a 94% F-measure for the person name entity. Balgasem and Zakaria [20] proposed a hybrid approach to recognize Arabic names from Hadith. They identified person name candidates using a rule-based method based on keywords that identify the start and the end of the name. The candidate name is fed to a statistical model to identify the possibility of the candidate name. The obtained results were 86% of F-measure for the rule-based method, while LLR has outperformed the other statistical methods by obtaining 85% of precision. Another hybrid model for Arabic named entity recognition was proposed in [21]. The proposed method combines conditional random fields (CRFs), bilingual NE lexicon, and grammar rules to identify named entities. The proposed method is evaluated using the ANERcorp, and the reported results show that their method outperforms the state of the art of Arabic NER in terms of precision with F-measures 83.36% for person, 89.58% for location, and 72.26% for organization. Abdallah et al. [11] integrated machine learning with rule-based approaches for Arabic named entity recognition. The integration is done by using the output of the rule-based system as a feature of the machine learning classifier. Experimental results showed that the proposed approach increases the F-measure by 8 to 14% when compared to the rule-based system and the machine learning approach.Mohd et al. [8] came up with a way to recognize Quranic text using a convolutional neural network (CNN) and a recurrent neural network (RNN). Because they tested it on many data, they found that it had an accuracy rate of 98% on the validation data. Furthermore, the test data had a 95% WRR and a 99% CRR.In a related study, Boudjellal [22] presented a BERT-based model to identify biomedical named entities in Arabic text data that investigates the effectiveness of pertaining a monolingual Bidirectional Encoder Representations from Transformers (BERT) model with a small-scale biomedical dataset on enhancing the model understanding of Arabic biomedical text. When the model's performance was compared to that of two state-of-the-art models, it outperformed both with an F1 score of 85%.


## 3. Linguistic Resources

Rule-based methods, also known as knowledge engineering methods [23], work by applying predefined rules to natural language documents [12, 24–27]. These methods depend on the information provided by linguists that identify NEs [28, 29]. Access to enough domain-relevant texts that can be tested manually is essential [30] if effective rules are to be developed. The expertise and ability of the knowledge engineer are critical to developing an effective system.The development of an accurate system required repetitive procedures to fine-tune the system. Each procedure begins by creating rules about a set of sample texts. The results of these tests are examined to determine if the rules should be modified [31, 32]. This section discussed the knowledge sources required to identify NEs in classic Arabic texts.


### 3.1. Dataset

We used the CANERCorpus as our dataset, which is a Classical Arabic NER corpus that is manually annotated by human experts. It contains more than 7,000 Hadiths (Prophet Muhammad’s sayings) from Sahih Al-Bukhari book that are annotated using 21 named entity classes. These classes include person (Pers), location (Loc), organization (Org), measurement (Meas), money (Mon), book (Book), date (Date), time (Time), clan (Clan), natural object (NatOb), crime (Crime), day (Day), number (Num), god (Allah), prophet (Prophet), religion (Rlig), sect (Sect), paradise (Para), hell (Hell), month (Month), and others (O). The corpus contains around 72,108 named entities and 258,264 words. Table1 shows the number of named entities in each tag [33].Table 1
Word count and percentage of each NE class.
TypeCountPercentageAllah781112.95Prophet650210.77Pers3915964.87Loc13492.09Org90.01Meas1470.24Mon1390.23Book1832.24Date5960.95Time1020.17Rlig1840.31Sect170.03Clan6741.11NatOb6701.11Crime2120.35Para2940.49Hell2450.41Month770.13Day310.05Num137071.51NamedEntity72108100.00In CANERCorpus, as shown in Figure1, the NE was classified into two main types. The first is the general type covering persons, locations, organizations, measurement, money, book, date, time, natural object, crime, day, and number where you can find this type in many domains such as politics, economy, sport, and crime, and others.Figure 1
NE classification.The second type known as the specific domain is related to CA (Islamic domain), including Allah, prophet, religion, sect, paradise, and hell. However, the corpus context that includes general and specific NEs focuses on the Islamic domain. Therefore, there are many differences in the names, meanings, and roles between the Islamic domain and other domains.


### 3.2. Data Collection

This section is concerned with how the statistical linguistic resources were collected from Islamic texts found in the AL-Shamela library where shamela.ws contains over 6100 books. Table2 shows the number of improvements made to reinforce the rule-based approach, including grammatical rules, patterns, gazetteers, trigger words, and a blacklist, that were extracted from books in the Al-Shamela library.Table 2
Data Resource.
Number of NE typeGrammar rulesGazetteersPatternsTrigger wordsBlacklistBeforeB&AAfterStop wordsReject wordsAllah (god)9115—241121034871311231Prophet829—1044138625Person1194115—70168643397Location44418—113022513134Organization—9—————Measurement474172834614Money42241102817319Crime439—91436711Natural object4142—48524729021Book432—151427017Date45516634274Time56313122125Month44312161607710Day471450338618Number61372632107812Paradise417—2242421197Hell418—35628310311Religion412—324219889Sect473—9250247Clan735—21493864All6699657872835574235813112159


### 3.3. Trigger Words

(TW) Proper names are typically found next to cue or trigger words such as titles. Trigger words were used in the proposed rule-based NER method [12, 27, 29]. The list of trigger words included political, military, and occupational titles such as Dr. or Mr. (الشيخ, الإمام). This list also included verbs such as “said” or “declared.” The trigger word list used in this study was developed manually using semiautomatic procedures, by finding the most common left and right-hand side and both contexts of known Arabic NEs and by using rules developed using an initial list of seed words to find the context for NEs. A list of 15,215 trigger words was established for use in this study. The trigger words were categorized depending on their position in the classic Arabic texts.


### 3.4. Trigger Words before and after NE

(TWBA) The trigger words that were found before or after a named entity TWBA included verbs or nouns that introduced a NE. This category of trigger words is the strongest of the three trigger word categories. To the best of our knowledge, this study is the first to mention this subject. Table3 provides some examples found on the TWBA list.Table 3
Examples of TWBA.
Type of NEBefore featureNEAfter featureAllahقال/saidالله/Allahعزوجل/almightyProphetالمسيح/Jesusعيسى/Eissaعليه السلام/peace be upon himPersonالإمام/Imamأحمد/Ahmedرحمه الله/may god have mercy on himLocationمن/fromتهامة/Tahamahإلى/toMeasurementفأخذت/I tookالقدح/the mugفجعلت/and made itMoneyبربح/profitدينار/dinarلكل for everyCrimeحد/the limit ofالسرقة/theftونصابها/and its quorumNatural objectوركب/and he rodeحماراً/donkeyفانطلق so he wentBookكتاب/bookالرجال/menللإمام/for the imamDateعام/year1400هـ/HijriTimeطلوع/downالفجر/Al-fajrفأوترت/Witr prayerMonthصام/fastرمضان/Ramadanإيماناً/faithDayيوم/dayثلاثاء/Tuesdayأو/orNumberسير/walkسبعين/seventyسنة/yearParadiseفي/inالفردوس/paradiseالأعلى/the higherHellحجبت/hideالنار/hellبالشهوات/with lustsReligionقبل/beforeالإسلام/Islamكان/wasSectقال/saidالحنفية/alhanfiaبجواز/with permission


### 3.5. Trigger Words before NE Only

(TWB) The TWB list contains words that identify a NE as shown in Table4. A handful of the words in the introductory verb list (IVL) and introductory word list (IWL) were gathered from earlier studies conducted in [12, 27, 34]. The remaining words were gathered during the corpora analysis phase of this study.Table 4
Examples of TWB.
Type of NETrigger beforeNEAllahاتق/fearالله/AllahProphetبعث/sentالنبي/the prophetPersonحدثنا/tell usابن عباس/Ibn AbbasLocationأهل/the people ofاليمن/YemenMeasurementمقدار/the amount ofصاعه/SaMoneyوينقده/save himديناراً/DinarCrimeالمجاهرة/in publicبالزنا/prostitutionNatural objectواستاقوا/and they takeالإبل/the camelsBookكتاب/bookصحيح البخاري/Sahih BukhariDateفي/inيوم أحد/Ohod dayTimeأنام/I sleep theأول الليل/first nightMonthشهر/month ofرجب/RajabDayيوم/dayالخميس/ThursdayNumberزهاء/aboutثلاث مائة/three hundredParadiseوبشره/he surprised himبالجنة/with paradiseHellعذاب/torture ofالنار/hellReligionدين/the religion ofالإسلام/IslamSectمذهب/madhhabأهل السنة/SunnahClanمولى/salveبني حارثة/Bani Haritha


### 3.6. Trigger Words after NE Only

(TWA) The TWA list is composed of words that identify a NE found after the NEW. A few of these words are shown in Table5. The words in this list were collected during the corpora analysis phase of this study.Table 5
Examples of TWA.
Type of NENETrigger afterAllahالله/Allahتبارك/almightyProphetالنبي/prophetصلى الله عليه وسلم/peace be upon himPersonأحمد/Ahmedحفظه الله/may Allah preserve himLocationمكة/Makkahإلى/toMeasurementمدنا/almadaوصاعنا/saaeMoneyديناراً/Dinnarأقرضه/lend itCrimeبهتان/falsehoodتفترونه/defamationNatural objectجمل/the camelفأناخه/he loweredDateعام الفيل/elephant yearولد/bornTimeبالعشي/night-timeوالإشراق/Sun riseMonthرمضان/Ramadanإيماناً واحتساباً/faith and anticipationDayصام/he fastsالإثنين/MondayNumberعشرة/tenمساكين/poorParadiseالجنة/paradiseدار المتقين/Dar Al MotaqinHellالنار/hellأجارنا الله/may Allah keep us out of the hellReligionالإسلام/Islamدين الحق/true religionSectالشيعة/Shiaفرقة/sectClanالمهاجرون/migrantsوالأنصار/and supporters


### 3.7. Gazetteers

(Dictionaries) Another primary linguistic resource is the gazetteer, which is a collection of predefined lists of typed entities. A gazetteer is also known as a dictionary or whitelist [35]. The whitelists were dictionaries of NEs that matched the target texts and that were not dependent on the rules. Whitelists contain complete names that are not found anywhere else, and dictionaries contain single names that can be found in different places [29, 36]. Examples of gazetteers are shown in Table 6.Table 6
Examples of gazetteers.
Type of NENEMeaningAllahالرحمنRahmanProphetالنبي محمدThe prophet MuhammadPersonعمرOmarLocationمكةMakkahMeasurementأوقيةAwqiaMoneyدرهمDirhamCrimeالقتلThe killNatural objectالجملCamelBookصحيح مسلمSahih MuslimDateيوم عرفةARAFFA dayTimeالضحوةAldahwaMonthشوالShawwalDayالسبتSaturdayNumberثلاثةThreeParadiseالجنةParadiseHellجهنمHellReligionالنصرانيةChristianitySectالصوفيةSufismClanقريشQuraysh


### 3.8. Blacklist

(Reject Word) A filtration procedure was completed during the last stage of the NER in the NERA system to create a list of rejected words [36]. Incorrect words used to identify NE were found and filtered out. The filtration process used blacklist dictionaries containing incorrect words to identify NE. The blacklist contained stop words, trigger words, and rejected words.


### 3.9. Stop Word List

Stop words are non-descriptive common words that cannot be included as an identifying feature of a NE [27]. In this study, 13112 of the most common stop words found in the CA were collected. The resulting list of stop words was composed mainly of prepositions, adverbs, verbs, and demonstrative words, as shown in Table 7.Table 7
Examples of stop words.
CategoriesStop wordTranslationDemonstrative nounsهذاThisRelative pronounالذيWho, whichRelative pronounالتيAdverbsهناكThere


## 3.1. Dataset

We used the CANERCorpus as our dataset, which is a Classical Arabic NER corpus that is manually annotated by human experts. It contains more than 7,000 Hadiths (Prophet Muhammad’s sayings) from Sahih Al-Bukhari book that are annotated using 21 named entity classes. These classes include person (Pers), location (Loc), organization (Org), measurement (Meas), money (Mon), book (Book), date (Date), time (Time), clan (Clan), natural object (NatOb), crime (Crime), day (Day), number (Num), god (Allah), prophet (Prophet), religion (Rlig), sect (Sect), paradise (Para), hell (Hell), month (Month), and others (O). The corpus contains around 72,108 named entities and 258,264 words. Table1 shows the number of named entities in each tag [33].Table 1
Word count and percentage of each NE class.
TypeCountPercentageAllah781112.95Prophet650210.77Pers3915964.87Loc13492.09Org90.01Meas1470.24Mon1390.23Book1832.24Date5960.95Time1020.17Rlig1840.31Sect170.03Clan6741.11NatOb6701.11Crime2120.35Para2940.49Hell2450.41Month770.13Day310.05Num137071.51NamedEntity72108100.00In CANERCorpus, as shown in Figure1, the NE was classified into two main types. The first is the general type covering persons, locations, organizations, measurement, money, book, date, time, natural object, crime, day, and number where you can find this type in many domains such as politics, economy, sport, and crime, and others.Figure 1
NE classification.The second type known as the specific domain is related to CA (Islamic domain), including Allah, prophet, religion, sect, paradise, and hell. However, the corpus context that includes general and specific NEs focuses on the Islamic domain. Therefore, there are many differences in the names, meanings, and roles between the Islamic domain and other domains.


## 3.2. Data Collection

This section is concerned with how the statistical linguistic resources were collected from Islamic texts found in the AL-Shamela library where shamela.ws contains over 6100 books. Table2 shows the number of improvements made to reinforce the rule-based approach, including grammatical rules, patterns, gazetteers, trigger words, and a blacklist, that were extracted from books in the Al-Shamela library.Table 2
Data Resource.
Number of NE typeGrammar rulesGazetteersPatternsTrigger wordsBlacklistBeforeB&AAfterStop wordsReject wordsAllah (god)9115—241121034871311231Prophet829—1044138625Person1194115—70168643397Location44418—113022513134Organization—9—————Measurement474172834614Money42241102817319Crime439—91436711Natural object4142—48524729021Book432—151427017Date45516634274Time56313122125Month44312161607710Day471450338618Number61372632107812Paradise417—2242421197Hell418—35628310311Religion412—324219889Sect473—9250247Clan735—21493864All6699657872835574235813112159


## 3.3. Trigger Words

(TW) Proper names are typically found next to cue or trigger words such as titles. Trigger words were used in the proposed rule-based NER method [12, 27, 29]. The list of trigger words included political, military, and occupational titles such as Dr. or Mr. (الشيخ, الإمام). This list also included verbs such as “said” or “declared.” The trigger word list used in this study was developed manually using semiautomatic procedures, by finding the most common left and right-hand side and both contexts of known Arabic NEs and by using rules developed using an initial list of seed words to find the context for NEs. A list of 15,215 trigger words was established for use in this study. The trigger words were categorized depending on their position in the classic Arabic texts.


## 3.4. Trigger Words before and after NE

(TWBA) The trigger words that were found before or after a named entity TWBA included verbs or nouns that introduced a NE. This category of trigger words is the strongest of the three trigger word categories. To the best of our knowledge, this study is the first to mention this subject. Table3 provides some examples found on the TWBA list.Table 3
Examples of TWBA.
Type of NEBefore featureNEAfter featureAllahقال/saidالله/Allahعزوجل/almightyProphetالمسيح/Jesusعيسى/Eissaعليه السلام/peace be upon himPersonالإمام/Imamأحمد/Ahmedرحمه الله/may god have mercy on himLocationمن/fromتهامة/Tahamahإلى/toMeasurementفأخذت/I tookالقدح/the mugفجعلت/and made itMoneyبربح/profitدينار/dinarلكل for everyCrimeحد/the limit ofالسرقة/theftونصابها/and its quorumNatural objectوركب/and he rodeحماراً/donkeyفانطلق so he wentBookكتاب/bookالرجال/menللإمام/for the imamDateعام/year1400هـ/HijriTimeطلوع/downالفجر/Al-fajrفأوترت/Witr prayerMonthصام/fastرمضان/Ramadanإيماناً/faithDayيوم/dayثلاثاء/Tuesdayأو/orNumberسير/walkسبعين/seventyسنة/yearParadiseفي/inالفردوس/paradiseالأعلى/the higherHellحجبت/hideالنار/hellبالشهوات/with lustsReligionقبل/beforeالإسلام/Islamكان/wasSectقال/saidالحنفية/alhanfiaبجواز/with permission


## 3.5. Trigger Words before NE Only

(TWB) The TWB list contains words that identify a NE as shown in Table4. A handful of the words in the introductory verb list (IVL) and introductory word list (IWL) were gathered from earlier studies conducted in [12, 27, 34]. The remaining words were gathered during the corpora analysis phase of this study.Table 4
Examples of TWB.
Type of NETrigger beforeNEAllahاتق/fearالله/AllahProphetبعث/sentالنبي/the prophetPersonحدثنا/tell usابن عباس/Ibn AbbasLocationأهل/the people ofاليمن/YemenMeasurementمقدار/the amount ofصاعه/SaMoneyوينقده/save himديناراً/DinarCrimeالمجاهرة/in publicبالزنا/prostitutionNatural objectواستاقوا/and they takeالإبل/the camelsBookكتاب/bookصحيح البخاري/Sahih BukhariDateفي/inيوم أحد/Ohod dayTimeأنام/I sleep theأول الليل/first nightMonthشهر/month ofرجب/RajabDayيوم/dayالخميس/ThursdayNumberزهاء/aboutثلاث مائة/three hundredParadiseوبشره/he surprised himبالجنة/with paradiseHellعذاب/torture ofالنار/hellReligionدين/the religion ofالإسلام/IslamSectمذهب/madhhabأهل السنة/SunnahClanمولى/salveبني حارثة/Bani Haritha


## 3.6. Trigger Words after NE Only

(TWA) The TWA list is composed of words that identify a NE found after the NEW. A few of these words are shown in Table5. The words in this list were collected during the corpora analysis phase of this study.Table 5
Examples of TWA.
Type of NENETrigger afterAllahالله/Allahتبارك/almightyProphetالنبي/prophetصلى الله عليه وسلم/peace be upon himPersonأحمد/Ahmedحفظه الله/may Allah preserve himLocationمكة/Makkahإلى/toMeasurementمدنا/almadaوصاعنا/saaeMoneyديناراً/Dinnarأقرضه/lend itCrimeبهتان/falsehoodتفترونه/defamationNatural objectجمل/the camelفأناخه/he loweredDateعام الفيل/elephant yearولد/bornTimeبالعشي/night-timeوالإشراق/Sun riseMonthرمضان/Ramadanإيماناً واحتساباً/faith and anticipationDayصام/he fastsالإثنين/MondayNumberعشرة/tenمساكين/poorParadiseالجنة/paradiseدار المتقين/Dar Al MotaqinHellالنار/hellأجارنا الله/may Allah keep us out of the hellReligionالإسلام/Islamدين الحق/true religionSectالشيعة/Shiaفرقة/sectClanالمهاجرون/migrantsوالأنصار/and supporters


## 3.7. Gazetteers

(Dictionaries) Another primary linguistic resource is the gazetteer, which is a collection of predefined lists of typed entities. A gazetteer is also known as a dictionary or whitelist [35]. The whitelists were dictionaries of NEs that matched the target texts and that were not dependent on the rules. Whitelists contain complete names that are not found anywhere else, and dictionaries contain single names that can be found in different places [29, 36]. Examples of gazetteers are shown in Table 6.Table 6
Examples of gazetteers.
Type of NENEMeaningAllahالرحمنRahmanProphetالنبي محمدThe prophet MuhammadPersonعمرOmarLocationمكةMakkahMeasurementأوقيةAwqiaMoneyدرهمDirhamCrimeالقتلThe killNatural objectالجملCamelBookصحيح مسلمSahih MuslimDateيوم عرفةARAFFA dayTimeالضحوةAldahwaMonthشوالShawwalDayالسبتSaturdayNumberثلاثةThreeParadiseالجنةParadiseHellجهنمHellReligionالنصرانيةChristianitySectالصوفيةSufismClanقريشQuraysh


## 3.8. Blacklist

(Reject Word) A filtration procedure was completed during the last stage of the NER in the NERA system to create a list of rejected words [36]. Incorrect words used to identify NE were found and filtered out. The filtration process used blacklist dictionaries containing incorrect words to identify NE. The blacklist contained stop words, trigger words, and rejected words.


## 3.9. Stop Word List

Stop words are non-descriptive common words that cannot be included as an identifying feature of a NE [27]. In this study, 13112 of the most common stop words found in the CA were collected. The resulting list of stop words was composed mainly of prepositions, adverbs, verbs, and demonstrative words, as shown in Table 7.Table 7
Examples of stop words.
CategoriesStop wordTranslationDemonstrative nounsهذاThisRelative pronounالذيWho, whichRelative pronounالتيAdverbsهناكThere


## 4. The Rule-Based Method’s Step by Step Process

This study used a hybrid approach. The new rule-based approach introduced in this study achieved good results as it examined a new domain. The researchers also relied on several other rule-based methods to obtain the best results.This section describes the proposed rule-based technique for identifying NEs in classic Arabic texts. This method consists of an operational step, preprocessing step, and processing the rule application step. Figure2 illustrates the framework of the rule-based method proposed for the CANER.Figure 2
A framework of the CANER.


### 4.1. Operation Stage

The operational stage automatically created system controls and added new dynamic classifications. This stage facilitated the construction process to create a fully automated system. Furthermore, this stage could be generalized and applied to several different domains. The operational stage was followed only once when the system began to identify NE in classic Arabic texts. The steps for the operational stage are shown in Figure3.Figure 3
Operation stage of the proposed system.


#### 4.1.1. Reading Operation File

Rule-based systems rely on sources that can be used to identify NEs in the operational stage. Consequently, the first operational step is to read the operational files. The reading operation file step was conducted when the system starts to load all files to the data table.Formally, this step was employed to read the following files:(i)
Operation type.(ii)
A symbol file that contained short words to identify each token.(iii)
A color file that contained the colors that correspond to each NE. Each type of NE was assigned a unique color because the proposed system can visualize the output of the rule-based method.(iv)
A type file composed of the different types of NEs including personal, organizational, and location names. This file was used in the proposed system so that it could be enlarged to include different types of NEs. In addition, this file allows a user to ask the system to identify only some of the NEs.(v)
A blacklist file containing the paths used for each type of NEs in Arabic (refer to Table8).Table 8
Example of short and color tags.
TypeShortColorPersonPersRedLocationLocBlueOrganizationOrgGray


#### 4.1.2. Reading Linguistic Resource

The cornerstone for the rule-based method developed for this study was to identify the NEs which were the linguistic resources. The goal of this step is to read the Arabic NER language resources as follows:(1)
Gazetteers.(2)
Rules that contain the following files:(i)
Keywords before NER only.(ii)
Keywords after NER only.(iii)
Keywords before and after NER.(3)
Special rules, such as rules for surnames.(4)
Regular expressions or patterns for CANER, such as date, time, and number.(5)
A blacklist or list of rejecting words that sets out those words that do not identify Nes.


#### 4.1.3. Creating Regex and Rules

Once the operational file was read, the next step for the system was to determine what process would be used for a file and to configure the expression operation for each category. Occasionally, instances occur where a file contains an item that was classified according to the following rules:(1)
Keywords before NER only.(2)
Keywords after NER only.(3)
Keywords before and after NER.(4)
List of names to get direct NER.


### 4.2. Preprocessing Stage

When used effectively, computerized systems can generate NLP solutions but only after the relevant documents are delimited into meaningful units. For example, many NLP solutions require inputs to be divided into sentences that are further broken down into tokens. Unfortunately, actual documents do not have well-defined structures. As a result, the data from the documents must be prepared and the sentences must be split and tokenized. This can be a challenging process.A collection of Hadiths is an example of a text without a well-defined structure. These texts typically contain spelling errors, duplicated words, and characters, as well as words that are no longer in use and thus have been omitted from dictionaries. If NLP methods are used without any modifications, they will perform poorly. One way to improve the performance of NLP methods is to start with a data preprocessing step. In this study, the procedures recommended by Saif and Aziz [37] for Arabic texts were applied. The input for the preprocessing step was the raw text that was normalized by extracting the words, removing stop words before stemming the remained words, as shown in Figure 4.Figure 4
The preprocessing step.


#### 4.2.1. Normalization of Input Text

Before tokenization can take place, normalization must be conducted in the preliminary stage so that the resulting text will be consistent and predictable. In this study, decorative Kashida and all diacritics were removed as they were redundant and misplaced white spaces. These steps meant that the tokenizer was working on a consistent and predictable text. In actual documents, the use of white spaces may be irregular and inconsistent. For example, more than two spaces or a tab may be used instead of a single space. Additionally, spaces may be added before or after punctuation marks. A tool was needed to remove inappropriate white spaces so that the tokenization process could identify and analyze words and expressions. In this study, a normalizer was created to review the texts and correct white space errors using the following steps:(i)
Remove the extra spaces between words.(ii)
Delete non-Arabic letters such as English letters or symbols.(iii)
Normalize the different forms for the Arabic letters “Alef.“ For example ئ,ء,إ,أ were normalized to ا.(iv)
Short vowels diacritics were deleted.(v)
Kashida عــلـــي was changed to علي.(vi)
Punctuation, numbers, and special characters were removed.(vii)
When a character is repeated to express affirmation or to accentuate meaning, the duplicate characters are replaced.(viii)
The final letter ي was replaced with ى.(ix)
The final letter ة was replaced with ٥.


#### 4.2.2. Sentence Splitter

The sentence splitter separated the input text into separate sentences. The boundaries of a sentence are determined by a full stop or other punctuation. Once the sentences were segmented, each sentence and boundary were annotated. However, the proposed system did not use a sentence splitter because texts written in Modern Standard Arabic do not use full stops or punctuation. Instead, the system developed for this study used a tokenizer.


#### 4.2.3. Tokenization

“Tokenization” refers to the process of breaking down a sentence into meaningful units. These meaningful units are called tokens. Identifying tokens is an important initial task because all subsequent tasks are based on the tokens. The tokenizer used in this study split the text into word tokens separated by either a white space or punctuation. Each Hadith was tokenized into multiple tokens separated by white spaces.


### 4.3. Processing Stage

The rule-based approach used rules that were generated to Arabic linguistic information related to the NEs. The purpose of the processing step was to identify the NEs that were not found in the gazetteers. In this study, the NEs were identified based on trigger words, gazetteers, patterns, and rules.


#### 4.3.1. Trigger Words

In this step, the NEs were identified using the trigger words found either before or after the NE in a sentence. The system begins by checking the first word in the sentence to determine if that word is a trigger word. The terms that occur before and after the trigger words are classified as NEs.The purpose of this step was to use the trigger words to find the NEs that were not found in the gazetteers. For these NEs, linguistic items such as introductory verbs and words and place names were used to identify the NEs. In the system developed for this study, these items functioned as cues that signaled the presence of NEs in a new text.


#### 4.3.2. Gazetteer Lookup

The gazetteers contained lists of different types of NEs, such as the names of people, places, organizations, and the titles of books. These lists acted as lookup lists to find occurrences of these names in Arabic texts [38]. A word should be an exact match with at least one word in the gazetteer. The sensitive matching means that flexible matching conditions were required. Several NER systems combine gazetteers with rules that consider the surrounding text. In this study, the first step to recognizing NEs in Arabic texts was to use a gazetteer as a lookup list to form a strong feature in the rule-based method. The following techniques were used as part of this method:(i)
Exact match: the Aho–Corasick Algorithm with a linear running time in terms of the input length and the number of matching entries in a gazetteer was used to conduct searches. When a word sequence matched an entry in the gazetteer, EM-GAZ for the first word used the value B-<NE class> where <NE class> was one of the categories of PER, LOC, and ORG. Other words were assigned to the I-<NE class>, where the <NE class> was given the same value as the matched head of the sequence.(ii)
Partial match PM-GAZ: this feature was developed to deal with compound gazetteer entries. If the token was part of a compound name, then this feature was true. For example, if gazetteer contained the compound name “أحمد بن حنبل” “Ahmad ibn Hanbal” and the input text was “أحمد بن حنبل,” then Ahmed for the token “أحمد” was set to true. This feature was helpful for PER because it could identify a large list of first names found as part of a compound name.


#### 4.3.3. Regular Expressions

A set of predefined patterns was used to find NEs in Arabic texts. The extraction method exploited the regularities inherent in natural languages. This study used regular expressions or patterns for numbers, dates, times, and special characters, as seen in Table9.Table 9
Example of patterns.
Type of named entityPatternSpecial charactersreturn @“\W+“;Numberreturn @“\d+“;Datereturn @“((\w+,\s+\d+\s+\w+\s+\d[39][38][37][36][36][36][35][34][33][33][32][32][32][31][30](Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (|((\d+) ([.]|[/]|[:]) (\d+) ([.]|[/]|[:]) (\d+)))“;Timereturn @“((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]:[0–5][0–9]))|((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]))“;Standard Arabic contains an almost unlimited number of patterns, unlike classic Arabic, which contains very few patterns. In classic Arabic, numbers are usually expressed using words, for example, ثلاثة instead of using the numeral 3. Dates are usually described by referring to an event, but there is no specific formula. Time is typically not given as a specific hour; instead, time is defined as night, day, or prayer times.


#### 4.3.4. Grammar Rules

The rule-based approach was composed of linguistic items and rules. The heuristic rules were consistent with Arabic grammatical rules to handle the names. These heuristic rules and linguistic items were used to identify the NEs in new texts. Table10 presents the statistical information about new grammar rules.Table 10
Statistical information about new grammar rules.
WordValueGeneral rules4Allah rules6Prophet rules2Person rules4Clan rules2Number rules1Time rules3All22As shown in Table10, there are 22 new grammar rules most of them for the new types of NE in CA.(1) General Rules. The general rules were used for all the NEs. The following sections discuss the general rules used in this study.(i)
Conjunctions connect sentences or groups of words. In Arabic, some conjunction may be attached to a word and not separated as they are in English. This can make recognizing NEs challenging. In this study, the conjunctions were separated from the NE by examining words beginning with ك/k, ف/f, و/w, ل/l, and ال/al such as ومكة or Makah. This study also examined words ending with ا/a, for example, يمنا/Yemen. The original word for Yemen was يمن which meant that the last letters were separated from the rest of the word to allow for the application of the rule to arrive at the correct name.(ii)
Categorizing a NE depends on the words found before the NE. For example, King Salman University is the name of an organization. King Salman is a scientific name. When names are linked, the previous words are examined, so when linking names, generally look at the previous word. As an example, King Salman University, the words are classified as the name of organization.(iii)
Sequences (conjunctions) with the letter (عن/an, or و/and) are words that connect sentences or groups of words. For example, (أخبرنا محمد وعلي وصالح/Mohammed and Ali and Saleh tell us) if the first word belongs to the NE, then all words between the conjunctions are classified as NE.(iv)
If the word occurs next to the letter و/and, it was classified as a NE. For example, in the sentence عبد الجبار وأحمد ومنير ذهبوا إلى المدرسة, which is translated as Abdul Jabbar, Ahmad, and Munir went to school, the names between و/and were classified as the name of a person.(2) Allah Rules. Allah has 99 names. The 99 names of Allah fall into two categories. The first category contains names that are only used to describe Allah and no one else. If these names are found in a text, they are directly linked to the Allah NE. Names that fall into this category include Allah الله, Ar-Rahman الرحمن, As-Samad الصمد, and Dhu-al-Jalal wa-al-Ikram ذو الجلال و الإكرام. The second category contains names that are not specific to Allah, and that can be used to describe others. Al-Ghani الغنى and “The Rich One” are examples of this kind of name. These names are identified by the following:(i)
The name should not include any of the tokens associated with specific names for Allah as discussed above.(ii)
The name should not come after the token Abd, عبد.(iii)
The name should not be preceded by the word “said.”(iv)
The name should not come after a token one of the following descriptions سبحانه “subhanah,” جلا “Gla,” or تعالى“taealaa“- Almighty.(3) Prophets. A NE is labeled as a “Prophet Type” if the names comes before or after one of the following descriptions: “alnnabaya/النبي,” “alrrasula/الرسول,” “slaa alllah ealayh wasalama/صلى الله عليه وسلم,” “elih alssalam/عليه السلام,” “sydna/سيدنا,” “khatm alnnabyn/خاتم النبيين,” “syd almrsalin/سيد المرسلين,” “rssul allh/رسول الله,” or “syd alrrusul/سيد الرسل.”(4) Person. The entities associated with the names of people are categorized as follows. All words that are found before or after bin/بن or bint/بنت are classified as names of people. Many of the NEs in Classic Arabic are words related to people such as the word for son/بن and daughter/بنت. It is rare to use these words without using a name, for example, Mohammed bin Abdullah and Fatima bint Mohammed. If the word begins with ال/al and ends with ي/ya and is preceded by a Person Name, then ال/al and ي/ya will also be categorized as a person name. For example, رمزي السماوي/Ramzi Alssamawi contains Ramzi/رمزي, which is the name of a person. This name starts with ال/al and ends with ي/ya السماوي/alssamawi, both of which will now be classified as the name of a person.(5) Number. A list of numbers recorded as words rather than numbers was added. This is typical in classic Arabic, for example, the 10th of Dhul-Hijjah is recorded as العاشر من ذي الحجة.(6) Time. Time in classic Arabic is only defined as either night or day or as a time for prayer. If the word أول/first or the word آخر/last is found preceding a word that begins with ال/ala such as the أول الليل/first night or آخر النهار/the last day, then all these words are classified as a time NE. Prayer times were seen as falling into the time NE category, for example, بعد صلاة العصر/after Asr Prayer, which refers to the moment before sunset. The token was also categorized as a time NE if it was قبل/before, بعد/after, or في/in and the next word was one of the following: الضحى/dhaa, ضحوة/dihwtu, صبح/sibha, صباح/sibah, الظهر/alzhr, الظهيرة/alzzahirti, غداة/ghidati, العصر/aliesri, النهار/alnnahar, 'أول النهار/uwl alnnahar, نصف النهار/nisf alnnuhar, آخر النهار/akhur alnnahar, المغرب/almaghrib, مغرب/mighrab, العشاء/alesha', المساء/almasa', الليل/alllila, 'أول الليل/awl allili, آخر الليل/akhar allyl, الزوال/alzwal, الغروب/alghrwb, هاجرة/hajr.


#### 4.3.5. Blacklist

Blacklist contains all words that were not related to a NE. In the proposed rule-based system, if any words come as NE and it is one of the blacklist, it will change the rule from NE to others. In the example قال الإمام محمد, Imam Mohammed Said, قال is a trigger word, and according to the rules, the next word should be a person’s name. However, in this case, the next word is الإمام/Imam, which is on the blacklist, and thus this this token was not categorized as a NE.


#### 4.3.6. Integrating Linguistic Resources in the Rule-Based System

In earlier studies, the steps in rule-based methods were separate as some methods relied only on trigger words or grammatical rules. In this study, a rule-based method was devised that would use every available resource before comparing the results (see Figure5).Figure 5
Operational stage for the proposed system.Three cases are displayed in Figure5. If all the features extracted from a token using different resources are false, then the token is not related to any NE. If only one of the features extracted from a token is found on a blacklist, then the token is not related to any type of NE. If the features extracted from a token are found on a blacklist is false and there is more than one feature, the token is related to more than one type of NE.


#### 4.3.7. Annotation Coding

Encoding schemes are required to represent the annotated NEs internally. Encoding scheme tag each token in a text. The most straightforward encoding scheme is IO encoding, which tags each token as either a NE (“I”) or not a NE (“O”). IO encoding does not represent two NEs found next to each other. Another encoding scheme is BIO encoding. BIO encoding is frequently used as it solves the boundary issues found in TO encoding schemes. In BIO encoding, tokens related to NE can be tagged with a “B” indicating that it is the first token or the beginning of the name of a NE or an “I” indicating that this token is also related to a NE. A tag of “O” indicates that the token is not related to a NE.


## 4.1. Operation Stage

The operational stage automatically created system controls and added new dynamic classifications. This stage facilitated the construction process to create a fully automated system. Furthermore, this stage could be generalized and applied to several different domains. The operational stage was followed only once when the system began to identify NE in classic Arabic texts. The steps for the operational stage are shown in Figure3.Figure 3
Operation stage of the proposed system.


### 4.1.1. Reading Operation File

Rule-based systems rely on sources that can be used to identify NEs in the operational stage. Consequently, the first operational step is to read the operational files. The reading operation file step was conducted when the system starts to load all files to the data table.Formally, this step was employed to read the following files:(i)
Operation type.(ii)
A symbol file that contained short words to identify each token.(iii)
A color file that contained the colors that correspond to each NE. Each type of NE was assigned a unique color because the proposed system can visualize the output of the rule-based method.(iv)
A type file composed of the different types of NEs including personal, organizational, and location names. This file was used in the proposed system so that it could be enlarged to include different types of NEs. In addition, this file allows a user to ask the system to identify only some of the NEs.(v)
A blacklist file containing the paths used for each type of NEs in Arabic (refer to Table8).Table 8
Example of short and color tags.
TypeShortColorPersonPersRedLocationLocBlueOrganizationOrgGray


### 4.1.2. Reading Linguistic Resource

The cornerstone for the rule-based method developed for this study was to identify the NEs which were the linguistic resources. The goal of this step is to read the Arabic NER language resources as follows:(1)
Gazetteers.(2)
Rules that contain the following files:(i)
Keywords before NER only.(ii)
Keywords after NER only.(iii)
Keywords before and after NER.(3)
Special rules, such as rules for surnames.(4)
Regular expressions or patterns for CANER, such as date, time, and number.(5)
A blacklist or list of rejecting words that sets out those words that do not identify Nes.


### 4.1.3. Creating Regex and Rules

Once the operational file was read, the next step for the system was to determine what process would be used for a file and to configure the expression operation for each category. Occasionally, instances occur where a file contains an item that was classified according to the following rules:(1)
Keywords before NER only.(2)
Keywords after NER only.(3)
Keywords before and after NER.(4)
List of names to get direct NER.


## 4.1.1. Reading Operation File

Rule-based systems rely on sources that can be used to identify NEs in the operational stage. Consequently, the first operational step is to read the operational files. The reading operation file step was conducted when the system starts to load all files to the data table.Formally, this step was employed to read the following files:(i)
Operation type.(ii)
A symbol file that contained short words to identify each token.(iii)
A color file that contained the colors that correspond to each NE. Each type of NE was assigned a unique color because the proposed system can visualize the output of the rule-based method.(iv)
A type file composed of the different types of NEs including personal, organizational, and location names. This file was used in the proposed system so that it could be enlarged to include different types of NEs. In addition, this file allows a user to ask the system to identify only some of the NEs.(v)
A blacklist file containing the paths used for each type of NEs in Arabic (refer to Table8).Table 8
Example of short and color tags.
TypeShortColorPersonPersRedLocationLocBlueOrganizationOrgGray


## 4.1.2. Reading Linguistic Resource

The cornerstone for the rule-based method developed for this study was to identify the NEs which were the linguistic resources. The goal of this step is to read the Arabic NER language resources as follows:(1)
Gazetteers.(2)
Rules that contain the following files:(i)
Keywords before NER only.(ii)
Keywords after NER only.(iii)
Keywords before and after NER.(3)
Special rules, such as rules for surnames.(4)
Regular expressions or patterns for CANER, such as date, time, and number.(5)
A blacklist or list of rejecting words that sets out those words that do not identify Nes.


## 4.1.3. Creating Regex and Rules

Once the operational file was read, the next step for the system was to determine what process would be used for a file and to configure the expression operation for each category. Occasionally, instances occur where a file contains an item that was classified according to the following rules:(1)
Keywords before NER only.(2)
Keywords after NER only.(3)
Keywords before and after NER.(4)
List of names to get direct NER.


## 4.2. Preprocessing Stage

When used effectively, computerized systems can generate NLP solutions but only after the relevant documents are delimited into meaningful units. For example, many NLP solutions require inputs to be divided into sentences that are further broken down into tokens. Unfortunately, actual documents do not have well-defined structures. As a result, the data from the documents must be prepared and the sentences must be split and tokenized. This can be a challenging process.A collection of Hadiths is an example of a text without a well-defined structure. These texts typically contain spelling errors, duplicated words, and characters, as well as words that are no longer in use and thus have been omitted from dictionaries. If NLP methods are used without any modifications, they will perform poorly. One way to improve the performance of NLP methods is to start with a data preprocessing step. In this study, the procedures recommended by Saif and Aziz [37] for Arabic texts were applied. The input for the preprocessing step was the raw text that was normalized by extracting the words, removing stop words before stemming the remained words, as shown in Figure 4.Figure 4
The preprocessing step.


### 4.2.1. Normalization of Input Text

Before tokenization can take place, normalization must be conducted in the preliminary stage so that the resulting text will be consistent and predictable. In this study, decorative Kashida and all diacritics were removed as they were redundant and misplaced white spaces. These steps meant that the tokenizer was working on a consistent and predictable text. In actual documents, the use of white spaces may be irregular and inconsistent. For example, more than two spaces or a tab may be used instead of a single space. Additionally, spaces may be added before or after punctuation marks. A tool was needed to remove inappropriate white spaces so that the tokenization process could identify and analyze words and expressions. In this study, a normalizer was created to review the texts and correct white space errors using the following steps:(i)
Remove the extra spaces between words.(ii)
Delete non-Arabic letters such as English letters or symbols.(iii)
Normalize the different forms for the Arabic letters “Alef.“ For example ئ,ء,إ,أ were normalized to ا.(iv)
Short vowels diacritics were deleted.(v)
Kashida عــلـــي was changed to علي.(vi)
Punctuation, numbers, and special characters were removed.(vii)
When a character is repeated to express affirmation or to accentuate meaning, the duplicate characters are replaced.(viii)
The final letter ي was replaced with ى.(ix)
The final letter ة was replaced with ٥.


### 4.2.2. Sentence Splitter

The sentence splitter separated the input text into separate sentences. The boundaries of a sentence are determined by a full stop or other punctuation. Once the sentences were segmented, each sentence and boundary were annotated. However, the proposed system did not use a sentence splitter because texts written in Modern Standard Arabic do not use full stops or punctuation. Instead, the system developed for this study used a tokenizer.


### 4.2.3. Tokenization

“Tokenization” refers to the process of breaking down a sentence into meaningful units. These meaningful units are called tokens. Identifying tokens is an important initial task because all subsequent tasks are based on the tokens. The tokenizer used in this study split the text into word tokens separated by either a white space or punctuation. Each Hadith was tokenized into multiple tokens separated by white spaces.


## 4.2.1. Normalization of Input Text

Before tokenization can take place, normalization must be conducted in the preliminary stage so that the resulting text will be consistent and predictable. In this study, decorative Kashida and all diacritics were removed as they were redundant and misplaced white spaces. These steps meant that the tokenizer was working on a consistent and predictable text. In actual documents, the use of white spaces may be irregular and inconsistent. For example, more than two spaces or a tab may be used instead of a single space. Additionally, spaces may be added before or after punctuation marks. A tool was needed to remove inappropriate white spaces so that the tokenization process could identify and analyze words and expressions. In this study, a normalizer was created to review the texts and correct white space errors using the following steps:(i)
Remove the extra spaces between words.(ii)
Delete non-Arabic letters such as English letters or symbols.(iii)
Normalize the different forms for the Arabic letters “Alef.“ For example ئ,ء,إ,أ were normalized to ا.(iv)
Short vowels diacritics were deleted.(v)
Kashida عــلـــي was changed to علي.(vi)
Punctuation, numbers, and special characters were removed.(vii)
When a character is repeated to express affirmation or to accentuate meaning, the duplicate characters are replaced.(viii)
The final letter ي was replaced with ى.(ix)
The final letter ة was replaced with ٥.


## 4.2.2. Sentence Splitter

The sentence splitter separated the input text into separate sentences. The boundaries of a sentence are determined by a full stop or other punctuation. Once the sentences were segmented, each sentence and boundary were annotated. However, the proposed system did not use a sentence splitter because texts written in Modern Standard Arabic do not use full stops or punctuation. Instead, the system developed for this study used a tokenizer.


## 4.2.3. Tokenization

“Tokenization” refers to the process of breaking down a sentence into meaningful units. These meaningful units are called tokens. Identifying tokens is an important initial task because all subsequent tasks are based on the tokens. The tokenizer used in this study split the text into word tokens separated by either a white space or punctuation. Each Hadith was tokenized into multiple tokens separated by white spaces.


## 4.3. Processing Stage

The rule-based approach used rules that were generated to Arabic linguistic information related to the NEs. The purpose of the processing step was to identify the NEs that were not found in the gazetteers. In this study, the NEs were identified based on trigger words, gazetteers, patterns, and rules.


### 4.3.1. Trigger Words

In this step, the NEs were identified using the trigger words found either before or after the NE in a sentence. The system begins by checking the first word in the sentence to determine if that word is a trigger word. The terms that occur before and after the trigger words are classified as NEs.The purpose of this step was to use the trigger words to find the NEs that were not found in the gazetteers. For these NEs, linguistic items such as introductory verbs and words and place names were used to identify the NEs. In the system developed for this study, these items functioned as cues that signaled the presence of NEs in a new text.


### 4.3.2. Gazetteer Lookup

The gazetteers contained lists of different types of NEs, such as the names of people, places, organizations, and the titles of books. These lists acted as lookup lists to find occurrences of these names in Arabic texts [38]. A word should be an exact match with at least one word in the gazetteer. The sensitive matching means that flexible matching conditions were required. Several NER systems combine gazetteers with rules that consider the surrounding text. In this study, the first step to recognizing NEs in Arabic texts was to use a gazetteer as a lookup list to form a strong feature in the rule-based method. The following techniques were used as part of this method:(i)
Exact match: the Aho–Corasick Algorithm with a linear running time in terms of the input length and the number of matching entries in a gazetteer was used to conduct searches. When a word sequence matched an entry in the gazetteer, EM-GAZ for the first word used the value B-<NE class> where <NE class> was one of the categories of PER, LOC, and ORG. Other words were assigned to the I-<NE class>, where the <NE class> was given the same value as the matched head of the sequence.(ii)
Partial match PM-GAZ: this feature was developed to deal with compound gazetteer entries. If the token was part of a compound name, then this feature was true. For example, if gazetteer contained the compound name “أحمد بن حنبل” “Ahmad ibn Hanbal” and the input text was “أحمد بن حنبل,” then Ahmed for the token “أحمد” was set to true. This feature was helpful for PER because it could identify a large list of first names found as part of a compound name.


### 4.3.3. Regular Expressions

A set of predefined patterns was used to find NEs in Arabic texts. The extraction method exploited the regularities inherent in natural languages. This study used regular expressions or patterns for numbers, dates, times, and special characters, as seen in Table9.Table 9
Example of patterns.
Type of named entityPatternSpecial charactersreturn @“\W+“;Numberreturn @“\d+“;Datereturn @“((\w+,\s+\d+\s+\w+\s+\d[39][38][37][36][36][36][35][34][33][33][32][32][32][31][30](Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (|((\d+) ([.]|[/]|[:]) (\d+) ([.]|[/]|[:]) (\d+)))“;Timereturn @“((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]:[0–5][0–9]))|((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]))“;Standard Arabic contains an almost unlimited number of patterns, unlike classic Arabic, which contains very few patterns. In classic Arabic, numbers are usually expressed using words, for example, ثلاثة instead of using the numeral 3. Dates are usually described by referring to an event, but there is no specific formula. Time is typically not given as a specific hour; instead, time is defined as night, day, or prayer times.


### 4.3.4. Grammar Rules

The rule-based approach was composed of linguistic items and rules. The heuristic rules were consistent with Arabic grammatical rules to handle the names. These heuristic rules and linguistic items were used to identify the NEs in new texts. Table10 presents the statistical information about new grammar rules.Table 10
Statistical information about new grammar rules.
WordValueGeneral rules4Allah rules6Prophet rules2Person rules4Clan rules2Number rules1Time rules3All22As shown in Table10, there are 22 new grammar rules most of them for the new types of NE in CA.(1) General Rules. The general rules were used for all the NEs. The following sections discuss the general rules used in this study.(i)
Conjunctions connect sentences or groups of words. In Arabic, some conjunction may be attached to a word and not separated as they are in English. This can make recognizing NEs challenging. In this study, the conjunctions were separated from the NE by examining words beginning with ك/k, ف/f, و/w, ل/l, and ال/al such as ومكة or Makah. This study also examined words ending with ا/a, for example, يمنا/Yemen. The original word for Yemen was يمن which meant that the last letters were separated from the rest of the word to allow for the application of the rule to arrive at the correct name.(ii)
Categorizing a NE depends on the words found before the NE. For example, King Salman University is the name of an organization. King Salman is a scientific name. When names are linked, the previous words are examined, so when linking names, generally look at the previous word. As an example, King Salman University, the words are classified as the name of organization.(iii)
Sequences (conjunctions) with the letter (عن/an, or و/and) are words that connect sentences or groups of words. For example, (أخبرنا محمد وعلي وصالح/Mohammed and Ali and Saleh tell us) if the first word belongs to the NE, then all words between the conjunctions are classified as NE.(iv)
If the word occurs next to the letter و/and, it was classified as a NE. For example, in the sentence عبد الجبار وأحمد ومنير ذهبوا إلى المدرسة, which is translated as Abdul Jabbar, Ahmad, and Munir went to school, the names between و/and were classified as the name of a person.(2) Allah Rules. Allah has 99 names. The 99 names of Allah fall into two categories. The first category contains names that are only used to describe Allah and no one else. If these names are found in a text, they are directly linked to the Allah NE. Names that fall into this category include Allah الله, Ar-Rahman الرحمن, As-Samad الصمد, and Dhu-al-Jalal wa-al-Ikram ذو الجلال و الإكرام. The second category contains names that are not specific to Allah, and that can be used to describe others. Al-Ghani الغنى and “The Rich One” are examples of this kind of name. These names are identified by the following:(i)
The name should not include any of the tokens associated with specific names for Allah as discussed above.(ii)
The name should not come after the token Abd, عبد.(iii)
The name should not be preceded by the word “said.”(iv)
The name should not come after a token one of the following descriptions سبحانه “subhanah,” جلا “Gla,” or تعالى“taealaa“- Almighty.(3) Prophets. A NE is labeled as a “Prophet Type” if the names comes before or after one of the following descriptions: “alnnabaya/النبي,” “alrrasula/الرسول,” “slaa alllah ealayh wasalama/صلى الله عليه وسلم,” “elih alssalam/عليه السلام,” “sydna/سيدنا,” “khatm alnnabyn/خاتم النبيين,” “syd almrsalin/سيد المرسلين,” “rssul allh/رسول الله,” or “syd alrrusul/سيد الرسل.”(4) Person. The entities associated with the names of people are categorized as follows. All words that are found before or after bin/بن or bint/بنت are classified as names of people. Many of the NEs in Classic Arabic are words related to people such as the word for son/بن and daughter/بنت. It is rare to use these words without using a name, for example, Mohammed bin Abdullah and Fatima bint Mohammed. If the word begins with ال/al and ends with ي/ya and is preceded by a Person Name, then ال/al and ي/ya will also be categorized as a person name. For example, رمزي السماوي/Ramzi Alssamawi contains Ramzi/رمزي, which is the name of a person. This name starts with ال/al and ends with ي/ya السماوي/alssamawi, both of which will now be classified as the name of a person.(5) Number. A list of numbers recorded as words rather than numbers was added. This is typical in classic Arabic, for example, the 10th of Dhul-Hijjah is recorded as العاشر من ذي الحجة.(6) Time. Time in classic Arabic is only defined as either night or day or as a time for prayer. If the word أول/first or the word آخر/last is found preceding a word that begins with ال/ala such as the أول الليل/first night or آخر النهار/the last day, then all these words are classified as a time NE. Prayer times were seen as falling into the time NE category, for example, بعد صلاة العصر/after Asr Prayer, which refers to the moment before sunset. The token was also categorized as a time NE if it was قبل/before, بعد/after, or في/in and the next word was one of the following: الضحى/dhaa, ضحوة/dihwtu, صبح/sibha, صباح/sibah, الظهر/alzhr, الظهيرة/alzzahirti, غداة/ghidati, العصر/aliesri, النهار/alnnahar, 'أول النهار/uwl alnnahar, نصف النهار/nisf alnnuhar, آخر النهار/akhur alnnahar, المغرب/almaghrib, مغرب/mighrab, العشاء/alesha', المساء/almasa', الليل/alllila, 'أول الليل/awl allili, آخر الليل/akhar allyl, الزوال/alzwal, الغروب/alghrwb, هاجرة/hajr.


### 4.3.5. Blacklist

Blacklist contains all words that were not related to a NE. In the proposed rule-based system, if any words come as NE and it is one of the blacklist, it will change the rule from NE to others. In the example قال الإمام محمد, Imam Mohammed Said, قال is a trigger word, and according to the rules, the next word should be a person’s name. However, in this case, the next word is الإمام/Imam, which is on the blacklist, and thus this this token was not categorized as a NE.


### 4.3.6. Integrating Linguistic Resources in the Rule-Based System

In earlier studies, the steps in rule-based methods were separate as some methods relied only on trigger words or grammatical rules. In this study, a rule-based method was devised that would use every available resource before comparing the results (see Figure5).Figure 5
Operational stage for the proposed system.Three cases are displayed in Figure5. If all the features extracted from a token using different resources are false, then the token is not related to any NE. If only one of the features extracted from a token is found on a blacklist, then the token is not related to any type of NE. If the features extracted from a token are found on a blacklist is false and there is more than one feature, the token is related to more than one type of NE.


### 4.3.7. Annotation Coding

Encoding schemes are required to represent the annotated NEs internally. Encoding scheme tag each token in a text. The most straightforward encoding scheme is IO encoding, which tags each token as either a NE (“I”) or not a NE (“O”). IO encoding does not represent two NEs found next to each other. Another encoding scheme is BIO encoding. BIO encoding is frequently used as it solves the boundary issues found in TO encoding schemes. In BIO encoding, tokens related to NE can be tagged with a “B” indicating that it is the first token or the beginning of the name of a NE or an “I” indicating that this token is also related to a NE. A tag of “O” indicates that the token is not related to a NE.


## 4.3.1. Trigger Words

In this step, the NEs were identified using the trigger words found either before or after the NE in a sentence. The system begins by checking the first word in the sentence to determine if that word is a trigger word. The terms that occur before and after the trigger words are classified as NEs.The purpose of this step was to use the trigger words to find the NEs that were not found in the gazetteers. For these NEs, linguistic items such as introductory verbs and words and place names were used to identify the NEs. In the system developed for this study, these items functioned as cues that signaled the presence of NEs in a new text.


## 4.3.2. Gazetteer Lookup

The gazetteers contained lists of different types of NEs, such as the names of people, places, organizations, and the titles of books. These lists acted as lookup lists to find occurrences of these names in Arabic texts [38]. A word should be an exact match with at least one word in the gazetteer. The sensitive matching means that flexible matching conditions were required. Several NER systems combine gazetteers with rules that consider the surrounding text. In this study, the first step to recognizing NEs in Arabic texts was to use a gazetteer as a lookup list to form a strong feature in the rule-based method. The following techniques were used as part of this method:(i)
Exact match: the Aho–Corasick Algorithm with a linear running time in terms of the input length and the number of matching entries in a gazetteer was used to conduct searches. When a word sequence matched an entry in the gazetteer, EM-GAZ for the first word used the value B-<NE class> where <NE class> was one of the categories of PER, LOC, and ORG. Other words were assigned to the I-<NE class>, where the <NE class> was given the same value as the matched head of the sequence.(ii)
Partial match PM-GAZ: this feature was developed to deal with compound gazetteer entries. If the token was part of a compound name, then this feature was true. For example, if gazetteer contained the compound name “أحمد بن حنبل” “Ahmad ibn Hanbal” and the input text was “أحمد بن حنبل,” then Ahmed for the token “أحمد” was set to true. This feature was helpful for PER because it could identify a large list of first names found as part of a compound name.


## 4.3.3. Regular Expressions

A set of predefined patterns was used to find NEs in Arabic texts. The extraction method exploited the regularities inherent in natural languages. This study used regular expressions or patterns for numbers, dates, times, and special characters, as seen in Table9.Table 9
Example of patterns.
Type of named entityPatternSpecial charactersreturn @“\W+“;Numberreturn @“\d+“;Datereturn @“((\w+,\s+\d+\s+\w+\s+\d[39][38][37][36][36][36][35][34][33][33][32][32][32][31][30](Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (Ruževičius & Gedminaitė) (|((\d+) ([.]|[/]|[:]) (\d+) ([.]|[/]|[:]) (\d+)))“;Timereturn @“((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]:[0–5][0–9]))|((?:0?[0–9]|1[0–9]|2[0–3]) () ([0–5][0–9]))“;Standard Arabic contains an almost unlimited number of patterns, unlike classic Arabic, which contains very few patterns. In classic Arabic, numbers are usually expressed using words, for example, ثلاثة instead of using the numeral 3. Dates are usually described by referring to an event, but there is no specific formula. Time is typically not given as a specific hour; instead, time is defined as night, day, or prayer times.


## 4.3.4. Grammar Rules

The rule-based approach was composed of linguistic items and rules. The heuristic rules were consistent with Arabic grammatical rules to handle the names. These heuristic rules and linguistic items were used to identify the NEs in new texts. Table10 presents the statistical information about new grammar rules.Table 10
Statistical information about new grammar rules.
WordValueGeneral rules4Allah rules6Prophet rules2Person rules4Clan rules2Number rules1Time rules3All22As shown in Table10, there are 22 new grammar rules most of them for the new types of NE in CA.(1) General Rules. The general rules were used for all the NEs. The following sections discuss the general rules used in this study.(i)
Conjunctions connect sentences or groups of words. In Arabic, some conjunction may be attached to a word and not separated as they are in English. This can make recognizing NEs challenging. In this study, the conjunctions were separated from the NE by examining words beginning with ك/k, ف/f, و/w, ل/l, and ال/al such as ومكة or Makah. This study also examined words ending with ا/a, for example, يمنا/Yemen. The original word for Yemen was يمن which meant that the last letters were separated from the rest of the word to allow for the application of the rule to arrive at the correct name.(ii)
Categorizing a NE depends on the words found before the NE. For example, King Salman University is the name of an organization. King Salman is a scientific name. When names are linked, the previous words are examined, so when linking names, generally look at the previous word. As an example, King Salman University, the words are classified as the name of organization.(iii)
Sequences (conjunctions) with the letter (عن/an, or و/and) are words that connect sentences or groups of words. For example, (أخبرنا محمد وعلي وصالح/Mohammed and Ali and Saleh tell us) if the first word belongs to the NE, then all words between the conjunctions are classified as NE.(iv)
If the word occurs next to the letter و/and, it was classified as a NE. For example, in the sentence عبد الجبار وأحمد ومنير ذهبوا إلى المدرسة, which is translated as Abdul Jabbar, Ahmad, and Munir went to school, the names between و/and were classified as the name of a person.(2) Allah Rules. Allah has 99 names. The 99 names of Allah fall into two categories. The first category contains names that are only used to describe Allah and no one else. If these names are found in a text, they are directly linked to the Allah NE. Names that fall into this category include Allah الله, Ar-Rahman الرحمن, As-Samad الصمد, and Dhu-al-Jalal wa-al-Ikram ذو الجلال و الإكرام. The second category contains names that are not specific to Allah, and that can be used to describe others. Al-Ghani الغنى and “The Rich One” are examples of this kind of name. These names are identified by the following:(i)
The name should not include any of the tokens associated with specific names for Allah as discussed above.(ii)
The name should not come after the token Abd, عبد.(iii)
The name should not be preceded by the word “said.”(iv)
The name should not come after a token one of the following descriptions سبحانه “subhanah,” جلا “Gla,” or تعالى“taealaa“- Almighty.(3) Prophets. A NE is labeled as a “Prophet Type” if the names comes before or after one of the following descriptions: “alnnabaya/النبي,” “alrrasula/الرسول,” “slaa alllah ealayh wasalama/صلى الله عليه وسلم,” “elih alssalam/عليه السلام,” “sydna/سيدنا,” “khatm alnnabyn/خاتم النبيين,” “syd almrsalin/سيد المرسلين,” “rssul allh/رسول الله,” or “syd alrrusul/سيد الرسل.”(4) Person. The entities associated with the names of people are categorized as follows. All words that are found before or after bin/بن or bint/بنت are classified as names of people. Many of the NEs in Classic Arabic are words related to people such as the word for son/بن and daughter/بنت. It is rare to use these words without using a name, for example, Mohammed bin Abdullah and Fatima bint Mohammed. If the word begins with ال/al and ends with ي/ya and is preceded by a Person Name, then ال/al and ي/ya will also be categorized as a person name. For example, رمزي السماوي/Ramzi Alssamawi contains Ramzi/رمزي, which is the name of a person. This name starts with ال/al and ends with ي/ya السماوي/alssamawi, both of which will now be classified as the name of a person.(5) Number. A list of numbers recorded as words rather than numbers was added. This is typical in classic Arabic, for example, the 10th of Dhul-Hijjah is recorded as العاشر من ذي الحجة.(6) Time. Time in classic Arabic is only defined as either night or day or as a time for prayer. If the word أول/first or the word آخر/last is found preceding a word that begins with ال/ala such as the أول الليل/first night or آخر النهار/the last day, then all these words are classified as a time NE. Prayer times were seen as falling into the time NE category, for example, بعد صلاة العصر/after Asr Prayer, which refers to the moment before sunset. The token was also categorized as a time NE if it was قبل/before, بعد/after, or في/in and the next word was one of the following: الضحى/dhaa, ضحوة/dihwtu, صبح/sibha, صباح/sibah, الظهر/alzhr, الظهيرة/alzzahirti, غداة/ghidati, العصر/aliesri, النهار/alnnahar, 'أول النهار/uwl alnnahar, نصف النهار/nisf alnnuhar, آخر النهار/akhur alnnahar, المغرب/almaghrib, مغرب/mighrab, العشاء/alesha', المساء/almasa', الليل/alllila, 'أول الليل/awl allili, آخر الليل/akhar allyl, الزوال/alzwal, الغروب/alghrwb, هاجرة/hajr.


## 4.3.5. Blacklist

Blacklist contains all words that were not related to a NE. In the proposed rule-based system, if any words come as NE and it is one of the blacklist, it will change the rule from NE to others. In the example قال الإمام محمد, Imam Mohammed Said, قال is a trigger word, and according to the rules, the next word should be a person’s name. However, in this case, the next word is الإمام/Imam, which is on the blacklist, and thus this this token was not categorized as a NE.


## 4.3.6. Integrating Linguistic Resources in the Rule-Based System

In earlier studies, the steps in rule-based methods were separate as some methods relied only on trigger words or grammatical rules. In this study, a rule-based method was devised that would use every available resource before comparing the results (see Figure5).Figure 5
Operational stage for the proposed system.Three cases are displayed in Figure5. If all the features extracted from a token using different resources are false, then the token is not related to any NE. If only one of the features extracted from a token is found on a blacklist, then the token is not related to any type of NE. If the features extracted from a token are found on a blacklist is false and there is more than one feature, the token is related to more than one type of NE.


## 4.3.7. Annotation Coding

Encoding schemes are required to represent the annotated NEs internally. Encoding scheme tag each token in a text. The most straightforward encoding scheme is IO encoding, which tags each token as either a NE (“I”) or not a NE (“O”). IO encoding does not represent two NEs found next to each other. Another encoding scheme is BIO encoding. BIO encoding is frequently used as it solves the boundary issues found in TO encoding schemes. In BIO encoding, tokens related to NE can be tagged with a “B” indicating that it is the first token or the beginning of the name of a NE or an “I” indicating that this token is also related to a NE. A tag of “O” indicates that the token is not related to a NE.


## 5. Experimental Results

The attributes of type and span are used to define each NE. Both attributes are essential, but it is more important to use the correct type as the span of a NE can be challenging to determine. The proposed method relied on triggers words, patterns, gazetteers, rules, and blacklists. The first experiment was conducted to determine how using trigger words affected the identification of NEs. The results of not using trigger words are shown in Table11 and Figure 6.Table 11
Results of not using trigger words.
NECountTPFPFNPrecisionRecallF-measureBook183103121130.8956520.5628420.691275Prophet650259329052970.8676320.9123350.889422Allah781168362477960.9651270.8751760.917953Pers391592746124876210.9169560.7012690.794739Org9900111Number13707131872484440.9815410.9620630.971704Date59643721060.9954440.7332210.844444Meas1478623560.7889910.5850340.671875Rlig1841341240.9925930.7282610.840125Sect1713420.7647060.7647060.764706Loc13498971212870.8811390.6649370.757921NatOb670409612310.8702130.6104480.717544Month7763570.9264710.8181820.868966Crime21214171720.6650940.6650940.665094Time1027551270.5952380.7352940.657895Clan674479261090.9485150.7106820.812553Hell24522128220.887550.9020410.894737Para29423720380.9221790.8061220.860254Day3124410.8571430.7741940.813559Mon1391211440.8962960.8705040.883212Figure 6
Results of not using trigger words.The gazetteers contained the NEs, and they played an essential role in the identification of NEs in Arabic texts using the proposed rule-based method. Most Arabic NEs were found in the gazetteers, and they were easily recognized in texts. The second experiment conducted in this study examined the effect of not using the gazetteers. The results can be seen in Table12 and Figure 7.Table 12
Results of not using gazetteers.
KeyCountTPFPFNPrecisionRecallF-measureBook183134201130.870130.732240.795252Prophet650260397841860.8850950.9287910.906417Allah78116719737860.9892520.8601970.920222Pers391593158117016210.9488910.8064810.87191Org9000000Number13707130541454440.9890140.952360.970341Date59643721060.9954440.7332210.844444Meas1477423560.7628870.5034010.606557Rlig184872240.9775280.4728260.637363Sect1715420.7894740.8823530.833333Loc1349970842870.9203040.7190510.807324NatOb670601692310.8970150.8970150.897015Month7756770.8888890.7272730.8Crime21216739720.810680.7877360.799043Time1025924270.7108430.5784310.637838Clan674398271090.9364710.5905040.724295Hell24515732220.8306880.6408160.723502Para29420624380.8956520.700680.78626Day3124910.7272730.7741940.75Mon1391011740.8559320.7266190.785992Figure 7
Results of not using gazetteers.The third experiment was conducted to investigate how patterns affected the results of the proposed method. Patterns are used to identify NEs by recognizing dates and times in the texts. Table13 and Figure 8 show the results of not using patterns.Table 13
Results of not using patterns.
KeyCountTPFPFNPrecisionRecallF-measureBook183161201130.8895030.8797810.884615Prophet6502603914831860.8028450.9287910.861238Allah781170113857860.9479450.897580.922075Pers391593814940546210.903940.9742080.93776Org9900111Number13707404248131970.6196320.0294740.056271Date59643721060.9954440.7332210.844444Meas14711823560.8368790.8027210.819444Rlig1841532240.9870970.8315220.902655Sect1715420.7894740.8823530.833333Loc13491090842870.928450.8080060.864051NatOb670601692310.8970150.8970150.897015Month7772770.9113920.9350650.923077Crime21218139720.8227270.8537740.837963Time1029324270.7948720.9117650.849315Clan674578271090.9553720.8575670.903831Hell24522232220.8740160.9061220.88978Para29425624380.9142860.8707480.891986Day3130910.7692310.9677420.857143Mon1391311740.8851350.9424460.912892Figure 8
Results of not using patterns.Our proposed method used heuristic rules derived from the Arabic grammatical rules to identify NEs in Arabic texts. The heuristic rules were used to recognize the NEs in new texts. The next experiment was conducted to determine the effect of not using these grammatical rules. The results are shown in Table14 and Figure 9.Table 14
Results of not using grammar rules.
KeyCountTPFPFNPrecisionRecallF-measureBook183161201130.8895030.8797810.884615Prophet650257816751860.8954460.8891110.892267Allah781165473857860.944460.8381770.88815Pers391593674554766210.8703020.9383540.903047Org9900111Number13707131872484440.9815410.9620630.971704Date59643721060.9954440.7332210.844444Meas14711823560.8368790.8027210.819444Rlig1841532240.9870970.8315220.902655Sect1712320.80.7058820.75Loc13491090842870.928450.8080060.864051NatOb670601692310.8970150.8970150.897015Month7772770.9113920.9350650.923077Crime21218139720.8227270.8537740.837963Time1029324270.7948720.9117650.849315Clan674578271090.9553720.8575670.903831Hell24522232220.8740160.9061220.88978Para29425624380.9142860.8707480.891986Day3130910.7692310.9677420.857143Mon1391311740.8851350.9424460.912892Figure 9
Results of not using grammar rules.The blacklists were an important resource for determining the correct type of NE. The results of not using the blacklists to identify NE are shown in Table15 and Figure 10.Table 15
Results of not using blacklist.
KeyCountTPFPFNPrecisionRecallF-measureBook183161201130.8895030.8797810.884615Prophet6502603914751860.80370.9287910.861729Allah781170118617860.8906250.897580.894089Pers3915938149874329040.813550.9742080.88666Org99100.910.94736Number13707131872943940.9781920.9620630.97006Date596437171060.9625550.7332210.832381Meas14711829560.8027210.8027210.802721Rlig18415321240.879310.8315220.854749Sect1715720.6818180.8823530.769231Loc134910901142870.9053160.8080060.853897NatOb6706011312310.8210380.8970150.857347Month77721390.8470590.9350650.888889Crime21218147720.793860.8537740.822727Time1029331270.750.9117650.823009Clan674578431090.9307570.8575670.892664Hell24522249220.8191880.9061220.860465Para29425650380.8366010.8707480.853333Day3127940.750.8709680.80597Mon1391313640.7844310.9424460.856209Figure 10
Results of not using blacklist.The overall results generated by the Arabic NER proposed in this study for NEs are shown in Table16. Figure 11 visually represents the results for the five main components: trigger words, patterns, grammar rules, blacklist, and gazetteers.Table 16
Overall results for NEs.
KeyCountTPFPFNPrecisionRecallF-measureBook183161171130.9044940.8797810.891967Prophet650260392451860.9610120.9287910.944627Allah781170113857860.9479450.897580.922075Pers391593784648766210.8858670.966470.924415Org9900111Number13707131872484440.9815410.9620630.971704Date59643721060.9954440.7332210.844444Meas14711823560.8368790.8027210.819444Rlig1841532240.9870970.8315220.902655Sect1715420.7894740.8823530.833333Loc13491090842870.928450.8080060.864051NatOb670601692310.8970150.8970150.897015Month7772770.9113920.9350650.923077Crime21218139720.8227270.8537740.837963Time1029324270.7948720.9117650.849315Clan674578271090.9553720.8575670.903831Hell24522731220.8798450.9265310.902584Para29425624380.9142860.8707480.891986Day3130910.7692310.9677420.857143Mon1391311740.8851350.9424460.912892Figure 11
The overall results.Table17 shows the overall results of the integration. A comparison of the results of the method is presented in Figure 12.Table 17
The overall results of integration.
MethodPrecisionRecallF-measureRule-based method0.9020.8930.895Without trigger words0.8810.7690.816Without patterns0.8760.8450.844Without grammars0.8980.8770.884Without gazetteers0.8340.7010.755Figure 12
Comparison of versions of the rule-based method.When examining Arabic texts, the NEs can be categorized as belonging to either the general domain or the Islamic domain. This study focused on classic Arabic texts, and thus NEs found in the Islamic domain, such as Book, Prophet, Allah, Rlig, Sect, Crime, Clan, Hell, and Para, were considered. Figure13 describes the performance of the proposed system regarding these NEs.Figure 13
Comparison of features on CA NEs.


### 5.1. Comparison between Baseline and Rule-Based Approach

Since the corpus that is used during this thesis is a new experimental dataset, 10% of this corpus has been evaluated using the existing tools (GATE and the language computer). The results obtained from these tools are baseline results. Therefore, this section introduces a comparison between the baseline results and the results obtained from the rule-based method. In the same dataset that has been used in the baseline results, the proposed rule-based method has been evaluated using the same evaluation measures. Table18 presents the comparison between the baseline results and the proposed method results.Table 18
Evaluation of rule-based method.
NECountTPFPFNRecallPrecisionF-measurePerson1129107485410.9630.9270.945Location1921747130.9300.9610.946Organization88101.0000.8890.941Date4537530.9250.8810.902Money3325230.8930.9260.909Book1211120.8460.9170.880Measurements1914040.7781.0000.875Table19 presents the comparison between the baseline results and the results of proposed method.Table 19
Comparison between baseline analysis and rule-based methods.
NEGATELanguage computerRule-based methodPerson0.48550.57670.945Location0.24180.20.946Organization0.444400.941Date/time0.739900.902Money0.266500.909Book000.88Measurements000.875As shown in Table19 and Figure 14, the GATE and language computer got low results and some of that biased with the 0- values. This is because the language computer could not recognize five NEs and GATE failed to recognize two. Thus, the proposed rule-based method performed better than the GATE and Language computer systems in terms of F-measure.Figure 14
Comparison between baseline analysis and rule-based methods.


## 5.1. Comparison between Baseline and Rule-Based Approach

Since the corpus that is used during this thesis is a new experimental dataset, 10% of this corpus has been evaluated using the existing tools (GATE and the language computer). The results obtained from these tools are baseline results. Therefore, this section introduces a comparison between the baseline results and the results obtained from the rule-based method. In the same dataset that has been used in the baseline results, the proposed rule-based method has been evaluated using the same evaluation measures. Table18 presents the comparison between the baseline results and the proposed method results.Table 18
Evaluation of rule-based method.
NECountTPFPFNRecallPrecisionF-measurePerson1129107485410.9630.9270.945Location1921747130.9300.9610.946Organization88101.0000.8890.941Date4537530.9250.8810.902Money3325230.8930.9260.909Book1211120.8460.9170.880Measurements1914040.7781.0000.875Table19 presents the comparison between the baseline results and the results of proposed method.Table 19
Comparison between baseline analysis and rule-based methods.
NEGATELanguage computerRule-based methodPerson0.48550.57670.945Location0.24180.20.946Organization0.444400.941Date/time0.739900.902Money0.266500.909Book000.88Measurements000.875As shown in Table19 and Figure 14, the GATE and language computer got low results and some of that biased with the 0- values. This is because the language computer could not recognize five NEs and GATE failed to recognize two. Thus, the proposed rule-based method performed better than the GATE and Language computer systems in terms of F-measure.Figure 14
Comparison between baseline analysis and rule-based methods.


## 6. Conclusion

In this paper, a new rule-based approach was proposed. A description of the linguistic resources used by the new approach was provided before the new approach was explained. Then, the operational contents (read operation file, read linguistic resource, create regex, and rules) were discussed with the preprocessing and processing stages. The new approach proposed by this study used trigger words, gazetteers, regular expressions, grammatical rules, and blacklists, and the methodology was explained in this section. Finally, the rule-based approach was evaluated. The results indicated that this approach achieved a 90.2% rate of precision and an 89.3% level of recall and had an F-measure of 89.5.NER is a way to extract information, and it is used in several NLP operations, including machine translation and information retrieval. Arabic NER is attracting increasing attention, but the unique nature of Arabic means that using NER can be difficult. The contributions made by this study are essential steps in finding solutions for these issues.



---

*Source: 7164254-2022-01-21.xml*