> Most libraries only use n-grams of size 3 (trigrams) which is satisfactory for detecting the language of longer text fragments consisting of multiple sentences. For short phrases or single words, however, trigrams are not enough. I only dabbled in language detection at a workshop at a conference years ago, but I was very impressed how well such models work on short text with only bigrams. Maybe once you expand to o…
We're using libraries like this to try to guess the language of a book based on title alone (in case no other information is readily available), and trigram-based algorithms get it wrong often enough for it to be noticeable. I will look into replacing our current library with this one, it seems better suited for the task at hand.
Lingua-Go, the most accurate language detection for Go
11–20 of 26 posts
Re: Lingua-Go, the most accurate language detection for Go
#12What's a good way to detect languages in mixed-language passages? What's the state of art here? For example, given "'I think, therefore I am' is the first principle of René Descartes's philosophy that was originally published in French as je pense, donc je suis." , is there a library that would tell me the main passage is in English, but contains fragments in French?
Re: Lingua-Go, the most accurate language detection for Go
#13I see Dutch performs badly. I wouldn't be surprised if that's because of bad/noisy training data. Dutch web content contains an awful amount of English, which pollutes recognition. Cross-check the Dutch tokens with an English dictionary to be sure (although there is quite some overlap for frequent words, e.g. "is", "we", "are", "have", "bent", "had", "brief", etc., and rare ones like "keeshond"). BTW, the test statis…
Re: Lingua-Go, the most accurate language detection for Go
#14What's a good way to detect languages in mixed-language passages? What's the state of art here? For example, given "'I think, therefore I am' is the first principle of René Descartes's philosophy that was originally published in French as je pense, donc je suis." , is there a library that would tell me the main passage is in English, but contains fragments in French?
Re: Lingua-Go, the most accurate language detection for Go
#15> This engine first determines the alphabet of the input text and searches for characters which are unique in one or more languages. If exactly one language can be reliably chosen this way, the statistical model is not necessary anymore. Can this be a problem? If a text in Language_A includes names/words of Language_B, only relying on special characters would wrongly classify the entire text as Language_B.
Re: Lingua-Go, the most accurate language detection for Go
#16Re: Lingua-Go, the most accurate language detection for Go
#17I see Dutch performs badly. I wouldn't be surprised if that's because of bad/noisy training data. Dutch web content contains an awful amount of English, which pollutes recognition. Cross-check the Dutch tokens with an English dictionary to be sure (although there is quite some overlap for frequent words, e.g. "is", "we", "are", "have", "bent", "had", "brief", etc., and rare ones like "keeshond"). BTW, the test statis…
My guess is that it has trouble distinguishing between Afrikaans and Dutch, Indonesian and Malay, and other similar pairs.
Indonesian and Malay insert vowels in consonant clusters and replace quite a few consonants, so they should be easily distinguishable from Dutch, even on Dutch loan words (which are not that frequent anyway).
Dutch has a much larger overlap with German (probably the largest), but even those can be distinguished (by a human) with just a few words of a meaningful sentence. I find it difficult to come up with three words that could be a grammatical fragment in both languages, but even then I expect the n-gram frequencies to be quite diverging.
Re: Lingua-Go, the most accurate language detection for Go
#18Earlier quoted context omitted.
My guess is that it has trouble distinguishing between Afrikaans and Dutch, Indonesian and Malay, and other similar pairs.
Overlap with those is not particularly large. n-grams are particularly sensitive to spelling, and e.g. Afrikaans writes "Hy het skool toe gegaan", whereas it would be "Hij is naar school gegaan" in Dutch. Indonesian and Malay insert vowels in consonant clusters and replace quite a few consonants, so they should be easily distinguishable from Dutch, even on Dutch loan words (which are not that frequent anyway). Dutch…
I meant that Indonesian and Malay would be difficult to distinguishing from each other.
Re: Lingua-Go, the most accurate language detection for Go
#19I see https://github.com/google/cld3, but how does this compare with https://github.com/CLD2Owners/cld2 which is used by the large https://commoncrawl.org project to classify billions of samples from the whole internet?
Re: Lingua-Go, the most accurate language detection for Go
#20> Most libraries only use n-grams of size 3 (trigrams) which is satisfactory for detecting the language of longer text fragments consisting of multiple sentences. For short phrases or single words, however, trigrams are not enough. I only dabbled in language detection at a workshop at a conference years ago, but I was very impressed how well such models work on short text with only bigrams. Maybe once you expand to o…
By "real", I mean texts in a mix of multiple languages (super common on the web); short texts; texts in a different (unknown) language where ngrams don't know how to say "I don't know" and return rubbish instead; texts in close languages; etc.
Going "deep learning" is not the only alternative. Even simpler methods can work significantly better, while being fully interpretable:
https://link.springer.com/chapter/10.1007/978-3-642-00382-0_...