by jodent · 12y ago · 0 comments
ron? snn
fra? cat
swe? nds
ita? und
nld? gax
Source: var franc = require('franc');
console.log('ron?', franc('Cate bere ai baut?'));
console.log('fra?', franc('C\'est quoi le bordel la, putain'));
console.log('swe?', franc('Jag kanner en bot, hon heter Anna'));
console.log('ita?', franc('che guai'));
console.log('nld?', franc('graag gedaan'));https://en.wikipedia.org/wiki/List_of_English_words_of_Frenc...
…do you expect it to return French or English?
Yes you can present edge cases where there is no definite answer, like the one you cite, but this doesn't mean that the task in general is impossible or useless.
Anyway, You’re completely right. Italian is `und` due to LTE 10 characters, the others are slightly off due to short input too, but the demo (http://wooorm.github.io/franc/) shows the correct languages in the second or third place though!
Anyway, yeah, franc is for language detecting, but it’s optimised for many languages and works best at longer text. It’s a trade-off. For less languages and shorter texts, check out https://github.com/shuyo/ldig
Though I'm sure your test wasn't intended to be insidiously misleading.