# On Hierarchical Text Language-Identification Algorithms
## 6 Conclusions  
Languages are written using different scripts and belong to different language groups. Languages in the same language group are similar in terms of vocabulary and structure, and the majority of errors occur between similar languages in LI. Considering these facts, we presented three different hierarchical LI algorithms in this paper. To evaluate the proposed algorithms, we performed comparative tests on different levels of hierarchical LI algorithms and the open source LI tool, langid.py. The experimental results verified that, after SI, LGI and SLGI, the accuracy improved with each stage. This proves that narrowing the LI range can improve accuracy, especially between similar languages. Our proposed method's efficiency is superior to the open source LI tool langid.py. We used different-length N-gram feature types to perform comparative LI tests. The experimental results verified that if there are fewer languages or no similar language groups, using only a shorter N-gram feature type and a relatively small feature size can result in optimal LI accuracy. When mixing the different N-gram feature types to select a feature, the accuracy was superior to that of single N-gram feature types for most of the LI tasks. Further research is required to determine how to extract different length character sequences that can represent prefixes, suffixes, roots and stems in a language and how to apply them to the field of LI. In our experiments, we selected NB and SVM classifiers to perform the LI tasks. From the experimental results, we concluded that for the SLI in SLG task, SVM's classification accuracy was higher than NB. We also used the four feature-selection methods, _CHI_, _NDM_, _DFS_ and OR, to perform comparative tests. From the experimental results, we concluded that _DFS_ and _NDM_'s efficiencies are better than the other two feature selection methods. The experimental results verified that the feature-selection and feature-weighting methods used are suitable for short-text language identification. LGI and SLGI are beneficial for narrowing the LI range and increasing LI's accuracy. However, LGI and SLGI data are highly imbalanced data, which negatively impact feature selection. Thus, LGI and SLGI efficiency can still be improved. If we improve the LGI and SLGI efficiency, we can select relatively small features for discriminating different LG or SLG when there are more languages in the same script, which can further improve LI efficiency. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Length Unit** & **Max** & **Min** & **Average** \\ \hline Character & 260 & 19 & 112.14 \\ Word & 61 & 2 & 15.78 \\ \hline \hline \end{tabular}
\end{table} 
Table 26: Xhosa corpora statistics. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline  & \multicolumn{4}{c}{**Including Xhosa**} & \multicolumn{4}{c}{**Not Including Xhosa**} \\ \hline  & afr & kin & swa & xho & zul & & afr & kin & swa & zul \\ afr & 948 & & 47 & & afr & 996 & & \\ kin & & 996 & & 2 & kin & & 998 & \\ swa & & & 996 & & swa & & 998 & \\ xho & 90 & & 839 & 25 & zul & & & 1000 \\ zul & & & 16 & 984 & & & \\ Macro-F1 & 0.927 & 0.997 & 0.996 & 0.861 & 0.977 & 0.995 & 0.998 & 0.998 & 0.999 \\ \hline \hline \end{tabular}
\end{table} 
Table 28: Confusion matrix related to Xhosa. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline
**Test Type** & **One-Stage** & **Two-Stage** & **Three-Stage 1** & **Three-Stage 2** & **Four-Stage** & **Langid.py** \\ \hline Macro-F1 & 0.9620 & 0.9726 & 0.9748 & 0.9753 & 0.9754 & 0.8736 \\ Time & 0.00:45.167 & 0.00:44.537 & 0.00:44.376 & 0.01:19.102 & 0.01:20.765 & 0.01:20.960 \\ \hline \hline \end{tabular}
\end{table} 
Table 27: Comparative results of the effect of noisy content on LI. We also investigated how foreign language content in a particular language corpus affects the LI. The experimental results showed that accuracy was reduced. A method for automatically removing foreign language content from the LI corpora requires further investigation.