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

"only" parameter returns always score = 1 #96

Closed
dbuchet opened this issue Mar 10, 2021 · 3 comments
Closed

"only" parameter returns always score = 1 #96

dbuchet opened this issue Mar 10, 2021 · 3 comments

Comments

@dbuchet
Copy link

dbuchet commented Mar 10, 2021

Using parameter only with franc.all returns all languages defined with score = 1

franc.all('This is a text written in English')); // => Expected result with ['fra', 0.5710206995003568] in array
franc.all('This is a text written in English', {only: ['fra']}); // => ['fra', 1]

https://stackblitz.com/edit/react-esuzot?file=src/App.js

Thanks :)

@dbuchet dbuchet changed the title Only parameter returns always 1 "only" parameter returns always score = 1 Mar 10, 2021
@wooorm
Copy link
Owner

wooorm commented Mar 10, 2021

What do you expect to happen? By saying the result can only be French, well, the result wil be 100% French.

@dbuchet
Copy link
Author

dbuchet commented Mar 10, 2021

Oh make sense when you explained it like this, but I was expected ['fra', 0.5710206995003568] In fact using only I was thinking I will only have the scoring for the provided languages.

So yes, basically, it's just an integrated filter (so my expectation is quite easy to implement on my side)
Thanks for your answer!

@wooorm
Copy link
Owner

wooorm commented Mar 10, 2021

👍

This might touch upon #89.

But otherwise, I think the current output makes sense!

@wooorm wooorm closed this as completed Mar 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants