# On Hierarchical Text Language-Identification Algorithms
## 5 Results and Discussion
### Two-Stage LI  
The languages in our corpus belong to 25 different scripts. Among them, 20 scripts only have one member. Thus, the language can be identified during the SI process. The other five scripts have many members. After script identification, their members are identified within the same script languages. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**ID** & **In All 97 Languages** & **In Latin Script** & **In Germanic LG** & **In Nor-Nob SLG** \\ \hline
2-gram & 256,629 & 7389 & 3203 & 1706 \\
3-gram & 973,319 & 78,320 & 31,516 & 13,781 \\
4-gram & 2,342,861 & 438,945 & 164,640 & 57,012 \\
5-gram & 4,174,524 & 1,391,955 & 445,814 & 114,227 \\ \hline \hline \end{tabular}
\end{table} 
Table 10: Different N-gram numbers in different LI corpora. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**FS** & **1000** & **3000** & **5000** & **10,000** & **15,000** & **20,000** & **25,000** & **30,000** \\ \hline NB-2 & 0.440 & 0.870 & 0.920 & 0.942 & 0.952 & 0.952 & 0.952 & 0.957 \\ SVM-2 & 0.423 & 0.879 & 0.933 & 0.955 & 0.964 & 0.964 & 0.964 & 0.964 \\ NB-3 & 0.590 & 0.763 & 0.874 & 0.916 & 0.932 & 0.935 & 0.936 & 0.950 \\ SVM-3 & 0.588 & 0.768 & 0.886 & 0.932 & 0.949 & 0.952 & 0.952 & 0.963 \\ NB-4 & 0.446 & 0.667 & 0.776 & 0.864 & 0.878 & 0.899 & 0.905 & 0.914 \\ SVM-4 & 0.448 & 0.672 & 0.781 & 0.878 & 0.892 & 0.913 & 0.919 & 0.928 \\ NB-5 & 0.334 & 0.560 & 0.670 & 0.775 & 0.800 & 0.822 & 0.840 & 0.851 \\ SVM-5 & 0.339 & 0.566 & 0.676 & 0.786 & 0.813 & 0.836 & 0.855 & 0.866 \\ NB-30 & 0.690 & 0.834 & 0.920 & 0.945 & 0.950 & 0.952 & 0.952 & 0.963 \\ SVM-30 & 0.697 & 0.845 & 0.937 & 0.953 & 0.968 & 0.970 & 0.970 & 0.970 \\ NB-40 & 0.692 & 0.815 & 0.899 & 0.937 & 0.947 & 0.949 & 0.949 & 0.961 \\ SVM-40 & 0.698 & 0.829 & 0.918 & 0.957 & 0.966 & 0.968 & 0.968 & 0.969 \\ \hline \hline \end{tabular}
\end{table} 
Table 11: Results of LI in one-stage LI. FS, feature size. \begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**ID** & **Bos** & **Hrv** & **ID** & **Ind** & **Msa** & **ID** & **Nob** & **Nor** \\ \hline bos & 768 & 207 & ind & 714 & 262 & nob & 555 & 322 \\ hrv & 205 & 710 & msa & 229 & 756 & nor & 407 & 428 \\ F1-score & 0.771 & 0.735 & & 0.772 & 0.744 & & 0.544 & 0.468 \\ \hline \hline \end{tabular}
\end{table} 
Table 12: Confusion matrix and F1-scores related to similar languages in one-stage LI. The pseudocode is shown in Figure 1. The classification results for LI in the same script languages are shown in Figures 5-10 and Table 13. After examining the results in the figures, we found that the shorter character N-gram requires fewer features to reach its optimal value than longer character N-grams, and combinations of different types of N-grams are more efficient than single-length N-grams. Two types of mixed N-grams exist in our tests: a mixture of three-grams and two-grams and a mixture of two-grams, three-grams and four-grams. The two types have nearly the same efficiency, which is better than that of the other single-type N-grams in some LI tasks. This is because when using a hybrid N-gram model, we can use different lengths of prefixes, suffixes and roots to create the basic unit of words. The above situation also occurs with the other LI tasks. For longer feature types, such as four-gram and five-gram, accuracy continued to increase, as shown in Figures 5-10 and Table 11. This reveals that if longer feature types are selected for LI, more features are needed to reach optimal accuracy than for shorter N-gram feature types. This is because when longer N-gram feature types are selected, a larger number of different N-gram numbers exist than in shorter feature types. Thus, longer N-gram feature types require longer feature sizes to cover enough distinct features. The above situation also occurred in the other LI tasks.