Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Franc is providing wrong language #519

Open
Zodiac1978 opened this issue Aug 4, 2023 · 8 comments
Open

Franc is providing wrong language #519

Zodiac1978 opened this issue Aug 4, 2023 · 8 comments
Labels

Comments

@Zodiac1978
Copy link
Member

Describe the bug
If I use the content from Line 962/F provided via our report form I get not English but sco (Scots) reported and not English.

Therefore the lang check is marking the comment as spam. (Needs reproducing.)

Maybe we need to narrow the languages down.
See: https://github.com/wooorm/franc#options

First reported in the forums: https://wordpress.org/support/topic/what-to-do-about-false-positives/

@Zodiac1978 Zodiac1978 added the bug label Aug 4, 2023
@Zodiac1978
Copy link
Member Author

Maybe we should add a checkbox to our form if the report is for a false positive and if yes, what spam reason was set. This would help us to find the method which is the culprit.

@Zodiac1978
Copy link
Member Author

Maybe we should add a checkbox to our form if the report is for a false positive and if yes, what spam reason was set. This would help us to find the method which is the culprit.

This was added by me in the meantime:
https://docs.google.com/forms/d/e/1FAIpQLSeQlKVZZYsF1qkKz7U78B2wy_6s6I7aNSdQc-DGpjeqWx70-A/viewform?c=0&w=1

About narrowing down the languages, maybe @MatzeKitt can chime in here and help with the API side.

@MatzeKitt
Copy link
Member

Since franc by default returns a list of potentially matching languages, the easiest way would be to just return a list of potential languages instead of a single language. That way we can determine on ASB side if the language is met (we also receive the percentage the string meets the language and can work with a threshold in ASB).

@MatzeKitt
Copy link
Member

Would look like this:

franc -a "Das ist ein Test"
src 1
deu 0.9825403753819293
est 0.8485377564382366
glg 0.7952859013531209
fin 0.7206460061108686
tzm 0.6983849847228285
nld 0.6975120034919249
por 0.6900916630292449
nds 0.6700130947184635
ind 0.624181580096028
…

@Zodiac1978
Copy link
Member Author

Hey @MatzeKitt

as this is a different approach to narrowing down the languages on the API side, configured through the allowed languages in WP/ASB - why are you suggesting this approach? What is the advantage to the other approach?

And how complicated would it be to implement one of them?

@MatzeKitt
Copy link
Member

MatzeKitt commented Feb 13, 2024

It is more flexible since you don’t need to manage a list of languages and test only against them but you simply need to set a threshold. This would also make the code less complex.

The complexity of my solution is not high:

  1. Define a threshold
  2. Adjust the API to allow returning multiple languages
  3. Filter the languages by the defined threshold

Your proposed solution:

  1. Define languages to check (editable? then we need an option for that)
  2. Adjust the API to allow limiting languages
  3. Send the additional settings to the API

Especially the first point can be more complex, since you need to either define it for all available languages or have an additional option for that, which is harder to tell the user what to do (especially since there already is an option with languages).

@Zodiac1978
Copy link
Member Author

Define languages to check (editable? then we need an option for that)

Isn't this already there?
https://antispambee.pluginkollektiv.org/documentation/#allow-comments-only-in-certain-language

(especially since there already is an option with languages)

Why do you think this need to be an additional setting?

Adjust the API to allow limiting languages

There is an only option available:
https://github.com/wooorm/franc#options

@MatzeKitt
Copy link
Member

A list of languages you want is completely different from languages franc should be able to detect. At least in my point of view. I don't know how franc behaves if you e.g. define only English and German but submit a French text. Since you would only allow English or German, I assume that franc would only output these two languages – both with a relatively low score. That wouldn’t help anything, thus you would need to define similar languages (e.g. Scottish should behave the same as English, etc.)

From my point of view, limiting franc in its detection would not help us here at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants