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

Demo considers 'MECHANICALLY SEPARATED CHICKEN' as vegan #9

Open
fluxsauce opened this issue Feb 6, 2018 · 8 comments
Open

Demo considers 'MECHANICALLY SEPARATED CHICKEN' as vegan #9

fluxsauce opened this issue Feb 6, 2018 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@fluxsauce
Copy link

https://github.com/hmontazeri/is-vegan/blame/25e87fef5b88f92319f001c6af96ff658fddcbf2/README.md#L152

isVegan.containsNonVeganIngredients([
...
  'MECHANICALLY SEPARATED CHICKEN',
...
]); // returns ['PASTEURIZED MILK', 'PORK', 'BEEF', 'WHEY']

Consider using fuzzy matching with a degree of confidence instead of string matching.

@fluxsauce fluxsauce changed the title Demo does not consider 'MECHANICALLY SEPARATED CHICKEN' as non-vegan Demo considers 'MECHANICALLY SEPARATED CHICKEN' as vegan Feb 6, 2018
@hmontazeri
Copy link
Owner

Good point! will be added. Thx!

@hmontazeri
Copy link
Owner

Fixed!

@fluxsauce
Copy link
Author

I disagree, the fundamental problem is still there. Yes, mechanically separated chicken is technically on the list, but what about separated chicken? chicken parts?

At the very least, search the entire string, don't just match the exact string.

@hmontazeri
Copy link
Owner

I understand what you mean, a wildcard search is not the answer as well... It could match parts which could make it worse than matching an exact string...

@hmontazeri
Copy link
Owner

@fluxsauce how about adding a regex search for obvious meat / fish species?

@hmontazeri hmontazeri reopened this Feb 6, 2018
@hmontazeri hmontazeri added the enhancement New feature or request label Feb 6, 2018
@fluxsauce
Copy link
Author

That would work; I'd call it a component match and fill it with terms that shouldn't false positive, such as:

pig, pork, lard, beef, ribs, fillet, poultry, chicken, turkey, eggs, sheep, mutton, lamb, goat, rabbit, caviar, roe, honey, venison, steak

it'd be a shorter list than whole ingredients.

@drusepth
Copy link

drusepth commented Feb 6, 2018

I'd be wary of searching for particular substrings like "chicken", because you can easily also end up needing to add prefixes and such to avoid false negatives on things like "vegan chicken" or "chicken alternative", or "chicken tofu", etc.

Seems like there's a different (better) solution out there, but I'm not sure what it is. The above solution(s) work somewhat if you prefer false negatives over false positives, though.

@fluxsauce
Copy link
Author

fluxsauce commented Feb 6, 2018

The above solution(s) work somewhat if you prefer false negatives over false positives, though.

It could be mitigated with a blacklist of known false positives like "chicken alternative".

There's a reason why I personally avoid signature-based scanners, it's a constant "two steps forward and one step back" of exceptions.

Try valid US street address parsing as an example, seems simple until it isn't :-)

@hmontazeri hmontazeri added the help wanted Extra attention is needed label Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants