[APP-610] Make the language filter more lenient (#562)
* Tune the language filter to accept posts when a determination cant be made * use j instead of i since i has been declared in upper scope * use j instead of i since i has been declared in upper scope * Pass the j man --------- Co-authored-by: Ansh Nanda <anshnanda10@gmail.com>zio/stable
parent
ddb8ebb412
commit
d225e857b5
|
@ -203,11 +203,25 @@ export class FeedTuner {
|
||||||
typeof item.post.record.text === 'string'
|
typeof item.post.record.text === 'string'
|
||||||
) {
|
) {
|
||||||
const res = lande(item.post.record.text)
|
const res = lande(item.post.record.text)
|
||||||
const contentLangCode3 = res[0][0]
|
|
||||||
if (langsCode3.includes(contentLangCode3)) {
|
// require at least 70% confidence; otherwise, roll with it
|
||||||
|
if (res[0][1] <= 0.7) {
|
||||||
hasPreferredLang = true
|
hasPreferredLang = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if the user's languages are in the top 5 guesses, roll with it
|
||||||
|
for (let j = 0; j < 5 && j < res.length; j++) {
|
||||||
|
hasPreferredLang =
|
||||||
|
hasPreferredLang || langsCode3.includes(res[i][0])
|
||||||
|
}
|
||||||
|
if (hasPreferredLang) {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// no text? roll with it
|
||||||
|
hasPreferredLang = true
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasPreferredLang) {
|
if (!hasPreferredLang) {
|
||||||
|
|
Loading…
Reference in New Issue