langid.py icon indicating copy to clipboard operation
langid.py copied to clipboard

Are accents supported at all?

Open zxul767 opened this issue 2 years ago • 0 comments

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)

zxul767 avatar Aug 15 '23 05:08 zxul767