# On Hierarchical Text Language-Identification Algorithms
## 5 Results and Discussion
### Three-Stage Li-2  
Three-stage LI-2 includes three sub-tasks: SI, LGI in using same script languages and LI in LG; the pseudocode is shown in Figure 3. In the LGI process, the language group to which the text's language belongs is determined using the same script languages. In the third stage, the language within the language group is identified. In our experiments, Arabic-, Cyrillic- and Latin-script languages were divided into several language groups, as shown in Tables 2-4. The Devanagari and Nagari scripts also have many members (Table 5), but their respective members only belong to one language group. Identifying their members after SI is equivalent to the LGI process; the results are shown in Table 13, and their selected OCM is shown in Table 14.  
The results of LGI on Arabic, Cyrillic and Latin scripts are shown in Figure 15 and Table 18. From the results, we found that if there are fewer members in the script groups, using only two-gram features is sufficient to reach the optimal LGI score. If more languages are used in the scripts, three-gram or mixtures of N-grams are more suitable for LGI. LGI's accuracy is very high, revealing that we can discriminate between different LG in the same script languages. The results for LI in LG are shown in Figures 16-19 and Table 19. Comparing the LI in LG results to the LI in script results, we concluded that the majority of the LI in LG's feature size, which reached optimal accuracy, is lower than the LI in script's feature size. It also revealed that narrowing the identification range is beneficial to language identification. From the results in Table 19, we also concluded that if there are fewer members or no similar language group in LG, using only two-gram features is sufficient to reach the optimal LI score. The boldface or underscore numbers in Table 19 highlights the LG that includes similar languages or has more members. Therefore, during identification, their members need more features and longer feature types than other LGs.  
Figure 14: LI in SLG consisting of nob and nor.  
Figure 16: LI in Indo-European/Germanic in Latin script languages.  
Figure 17: LI in Indo-European/Italic in Latin script languages.  
\begin{table}
\begin{tabular}{l c c c c c c c c} \hline \hline
**FS** & **300** & **500** & **700** & **1000** & **2000** & **3000** & **5000** & **7000** \\ \hline Arabic & 0.999 & 0.999 & 0.999 & 0.999 & 0.999 & 0.999 & & \\ Cyrillic & 0.998 & 0.999 & 0.999 & 0.999 & 0.999 & & \\ Latin & 0.960 & 0.980 & 0.986 & 0.989 & 0.991 & 0.992 & 0.992 & 0.992 \\ \hline \hline \end{tabular}
\end{table}
Table 18: LGI in different script languages when using _DFS_ and two-gram.  
Figure 15: LGI in Latin script languages.  
The selected OCM for LGI is given in Table 20. The three-stage LI-2 result is shown in Table 24, and from the results, we concluded that the three-stage LI-2's macro F1-score is higher than the of two-stage LI. The reason for this result is that we accurately identified language groups by using similar script languages and identification language within a language group. Narrowing the identification range is beneficial to LI, improving the LI's accuracy. The confusion matrix related to similar languages is shown in Table 21. Comparing the results in Tables 15 and 21, similar language identification accuracy in three-stage LI-2 is higher than that of two-stage LI. The reason for this finding is that, after LGI narrowing of the identification range, there are more than enough features to discriminate similar languages.  
Although the accuracy of three-stage LI-2's is higher than that of two-stage LI, the majority of confusion errors still occur between similar languages. The prediction time was slower than two-stage LI's because the LGI process also consumes time.  
Figure 19: LI in Indo-European/Balto-Slavic in Latin script languages.  
Figure 18: LI in Austronesian/Malayo-Polynesian (MP) in Latin script languages.