It’s using Apple’s Natural Language API language recognizer to make a prediction. It’ll take the top predicted language if Apple tells us the confidence is at least 50% or higher. Sometimes it gets it wrong. I’ve done a bunch of tweaking and this was the best I could do with their API, but maybe there’s more to be done that I’m not realizing.