Skip to content

[BUG] - Ingredient parser percentages are inaccurate #5257

Open
@conectionist

Description

@conectionist

First Check

  • This is not a feature request.
  • I added a very descriptive title to this issue (title field is above this).
  • I used the GitHub search to find a similar issue and didn't find it.
  • I searched the Mealie documentation, with the integrated search.
  • I already read the docs and didn't find an answer.
  • This issue can be replicated on the demo site (https://demo.mealie.io/).

What is the issue you are experiencing?

I just want to be clear from the start, the issue isn't with the ingredient parsing per se, but with the auto-evaluation of the results.
After parsing the ingredients of a recipe, the parser will display the results and some percentages representing how accurate the results are.
Sometimes, these percentages are correct, other times... not so much.

Here's an example:

Image

As we can see from the image, the recipe has 4 ingredient (they're in Romanian, but that shouldn't be a problem in understanding the issue):

  • 100 g orez alb
  • 300 g apa
  • 100g somon
  • 1 ou de gaina

After parsing the ingredients, the results are as follows:
100 gram
100 --> detected successfully
gram --> detected successfully
orez alb --> not detected (I didn't have it my database, so this is expected behavior)
What I expect: You got 2 out of 3, so I would expect 66%.
What the parser says: 55%.
Why are you selling yourself short, parser? You got most of it right.

300 gram apa
300 --> detected successfully
gram --> detected successfully
apa --> detected successfully
What I expect: You got them all right, so I would expect 100%.
What the parser says: 51%.
Why are mean 51%, parser? You got it completely right! If that's not 100% right, I don't know what is.

100 gram somon
100 --> detected successfully
gram --> detected successfully
somon --> detected successfully
What I expect: You got them all right, so I would expect 100%.
What the parser says: 64%.
Again, why are you being so hard on yourself, parser? You got it completely right!

1 ou de gaina
1 --> detected successfully
ou de gaina --> not detected (I didn't have it my database, so this is expected behavior)
What I expect: You got 1 (literally). No unit of measure, so that's 50% at best.
What the parser says: 91%.
Now you're just being overconfident! :))

Steps to Reproduce

  1. Create a recipe with ingredients.
  2. Enable "Ingredient amounts" from Settings
  3. Click on Parse
  4. Notice the percentages (on the right of each detected ingredient).

Expected result:
The percentages should reflect the success of the parsing process.
Examples:
If 2 out of 3 elements of an ingredient were detected, that a 66% success rate.
If 1 out of 4 elements of an ingredient, that a 25% success rate.
If 3 out of 3 elements of an ingredient, that a 100% success rate.

Actual result:
Sometimes, the percentages are somewhat inaccurate.

Please provide relevant logs

When I click on "Parse", this is the only log entry that appears in the logs:

200 OK "POST /api/parser/ingredients HTTP/1.1"

Mealie Version

Build v2.7.1
UI is working.

Deployment

Docker (Linux)

Additional Deployment Details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions