forked from nsafai/recipe-parser
-
Notifications
You must be signed in to change notification settings - Fork 14
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
possible quanto basta solution #5
Open
scolobey
wants to merge
11
commits into
suprmat95:master
Choose a base branch
from
scolobey:quanto-basta
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
At least for English, the units list contains both caps and lowercase options. This becomes important because 't' designates teaspoon and 'T' designates Tablespoon. In addition to accurately identifying these edge cases 't' and 'T', the matched text is returned and used as the 'originalUnit' later to remove the unit from the ingredient string. This was causing the following commented English test to fail. "25 lb beef stew chunks (or buy a roast and chop into small cubes)" Because 'lb' was matching for both 'lb' and 'Lb' in the units list, and 'Lb' comes second, the final match being returned was for 'Lb' so when the unit is later removed via a replace() it tries to remove 'Lb' and finds nothing, so the ingredient text ends up being 'lb beef stew chunks' instead of 'beef stew chunks'
Remove 'case insensitive' designator on singular unit match regex.
* Added Prettier * Added missing dev dependencies * Formatted all files * Split out test files * Fixed failing tests related to english language * Fixed combination and prettyprint logic * Added CI tests * Removed unnecessary capitalised duplicates * Removed logs * Refactored nested ifs * Corrected typescript error * Removed prettier config lines * Type fixes * Accounted for words like "butter" when looking for "to taste" regex (i.e. "tt") * Refactored into multiple language files * Added German Language * Updated README and removed duplicate locks * Added support for multiple joiners and numbers like 1,200.30 * Added support for commas instead of periods for decimals * Modified regex detector to allow for Umlaut characters that are word breaking * Fixed unicode fractions * Added "Bund" german term * Corrected order of English items * Fixes some German translations and adds KL * Added linting workflow Co-authored-by: Sebastian Weggesser <[email protected]>
# Conflicts: # package-lock.json # src/index.ts # src/numbers.ts # src/units.ts # test/index.test.ts
benjackwhite
approved these changes
Jun 14, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added the key baseUnits to LanguageConfig.
If there is no identified quantity or unit in parse, and there is a specified baseUnits that is > 0 characters in length, the unit is identified as baseUnit.