langid.py
langid.py copied to clipboard
Are accents supported at all?
The text "Bestias desagradables. No sé por qué acepté apostar" should be classified as Spanish, but it is instead classified as Portuguese with high confidence. If you remove the accents, the phrase is correctly classified as Spanish with high confidence.
By the way, the translation in Portuguese is "Bestas desagradáveis. Não sei por que concordei em apostar". Both languages have words in common, but I think the issue here is that the underlying model wasn't trained with text that contained accents (or maybe accents were removed during training pre-processing, but the same pre-processing pipeline is not running during inference?)
>>> identifier.classify("Bestias desagradables. No sé por qué acepté apostar")
('pt', 0.9686061146305236)
>>> identifier.classify("Bestias desagradables. No se por que acepte apostar")
('es', 0.9599256901062293)