Releases: strangetom/ingredient-parser
1.1.2
Require NLTK >= 3.9.1, due to change in their resources format.
1.1.1
Revert upgrade to NLTK 3.8.2 after 3.8.2 removed to PyPI.
1.1.0
General
Require NLTK >= 3.8.2 due to change in POS tagger weights format.
Model
- Include new tokens features, which help improve performance:
- Word shape (e.g. cheese -> xxxxxx; Cheese -> Xxxxxx)
- N-gram (n=3, 4, 5) prefixes and suffixes of tokens
- Add 15,000 new sentences to training data from AllRecipes. This dataset includes lots of branded ingredients, which the existing datasets were quite light on.
- Tweaks to the model hyperparameters have yielded a model that is ~25% small, but with better performance than the previous model.
Processing
- Change processing of numbers written as words (e.g. 'one', 'two' ). If the token is labelled as QTY, then the number will converted to a digit (i.e. 'one' -> 1) or collapsed into a range (i.e. 'one or two' -> 1-2), otherwise the token is left unchanged.
1.0.1
Warning
This version requires NLTK >=3.8.2
NLTK 3.8.2 changes the file format (from pickle to json) of the weights used by the part of speech tagger used in this project, to address some security concerns. This patch updates the NLTK resource checks performed when ingredient-parser is imported to check for the new json files, and downloads them if they are not present.
This version requires NLTK>=3.8.2.
1.0.0
1.0
General
- Improve performance when tagging multiple sentences. For large numbers of sentences (>1000), the performance improvement is ~100x.
Processing
- Extend support for composite amounts that have the form e.g.
1 cup plus 1 tablespoonor1 cup minus 1 tablespoon. Previously the phraseplus/minus 1 tablespoonwould be returned in the comment. Now the whole phrase is captured as aCompositeAmountobject. - Fix cases where the incorrect
pint.Unitwould be returned, caused by pint interpreting the unit as something else e.g. "pinch" -> "pico-inch".
0.1.0-beta11
General
-
Refactor package structure to make it more suitable for expansion to over languages.
Note: There aren't any plans to support other languages yet.
Model
- Reduce duplication in training data
- Introduce PURPOSE label for tokens that describe the purpose of the ingredient, such as
for the dressingandfor garnish. - Replace quantities with "!num" when determining the features for tokens so that the model doesn't need to learn all possible values quantities can take. This results in a small reduction in model size.
Processing
- Various bug fixes to post-processing of tokens with labels NAME, COMMENT, PREP, PURPOSE, SIZE to correct punctuation and confidence calculations.
- Modification of tokeniser to split full stops from the end of tokens. This helps to model avoid treating "
token." and "token" as different cases to learn. - Add fallback functionality to
parse_ingredientfor cases where none of the tokens are labelled as NAME. This will select name as the token with the highest confidence of being labelled NAME, even though a different label has a high confidence for that token. This can be disabled by settingexpect_name_in_output=Falseinparse_ingredient.
0.1.0-beta10
Bugfix
Fix incorrect python version specifier in package which was preventing pip in Python 3.12 downloading the latest version.
0.1.0-beta9
General
Model
- Add additional model performance metrics.
- Add model hyper-parameter tuning functionality with
python train.py gridsearchto iterate over specified training algorithms and hyper-parameters. - Add
--detailedargument to output detailed information about model performance on test data. (#9, @boxydog) - Change model labels to treat label all punctuation as PUNC - this resolves some of the ambiguity in token labeling
- Introduce SIZE label for tokens that modify the size of the ingredient. Note that his only applies to size modifiers of the ingredient. Size modifiers of the unit will remain part of the unit e.g. large clove.
Processing
-
Integration of
pintlibrary for units-
By default, units in
IngredientAmountobject will be returned aspint.Unitobjects (where possible). This enables the easy conversion of amounts between different units. This can be disabled by settingstring_units=Truein theparse_ingredientfunction calls. -
For units that have US customary and Imperial version with the same name (e.g, cup), setting
imperial_units=Truein theparse_ingredientfunction calls will return the imperial version. The default is US customary. -
This only applies to units in
pint's unit registry (basically all common, standardised units). If the unit can't be found, then the string is returned as previously.
-
-
Additions to
IngredientAmountobject:- New
quantity_maxfield for handling upper limit of ranges. If the quantity is not a range, this will default to same as thequantityfield. - Flags for RANGE and MULTIPLIER
- RANGE is set to True for quantity ranges e.g.
1-2 - MULTIPLIER is set to True for quantities like
1x
- RANGE is set to True for quantity ranges e.g.
- Conversion of quantity field to
floatwhere possible
- New
-
PreProcessor improvements
- Be less aggressive about replacing written numbers (e.g. one) with the digit version. For example, in sentences like
1 tsp Chinese five-spice,five-spiceis now kept as written instead of being replaced by two tokens:5 spice. - Improve handling of ranges that duplicate the units e.g.
1 pound to 2 poundis now returned as1-2 pound
- Be less aggressive about replacing written numbers (e.g. one) with the digit version. For example, in sentences like
0.1.0-beta8
General
- Support Python 3.12
Model
- Include more training data, expanding the Cookstr and BBC data by 5,000 additional sentences each
- Change how the training data is stored. An SQLite database is now used to store the sentences and their tokens and labels. This fixes a long standing bug where tokens in the training data would be assigned the wrong label. csv exports are still available.
- Discard any sentences containing OTHER label prior to training model, so a parsed ingredient sentence can never contain anything labelled OTHER.
Processing
- Remove
otherfield fromParsedIngredientreturn fromparse_ingredientfunction. - Added
textfield toIngredientAmount. This is auto-generated on when the object is created and proves a human readable string for the amount e.g. "100 g" - Allow SINGULAR flag to be set if the amount it's being applied to is in brackets
- Where a sentence has multiple related amounts e.g.
14 ounce (400 g), any flags set for one of the related amounts are applied to all the related amounts - Rewrite the tokeniser so it doesn't require all handled characters to be explicitly stated
- Add an option to
parse_ingredientto discard isolated stop words that appear in the name, comment and preparation fields. IngredientAmount.amountelements are now ordered to match the order in which they appear in the sentence.- Initial support for composite ingredient amounts e.g.
1 lb 2 ozis now consider to be a singleCompositeIngredientAmountinstead of two separateIngredientAmount.- Further work required to handle other cases such
1 tablespoon plus 1 teaspoon. - This solution may change as it develops
- Further work required to handle other cases such
0.1.0-beta7
- Automatically download required NLTK resources if they're not found when importing
- Require python version <3.12 because python-crfsuite does not yet support 3.12
- Various minor tweaks and fixes.