Version
@cooklang/cooklang 0.18.7 through the TypeScript/WASM binding.
Reproduction
import { CooklangParser, quantity_display } from '@cooklang/cooklang';
const parser = new CooklangParser();
const [recipe] = parser.parse(
'Position an #oven rack{} in the center and preheat the #oven{} to 230°C, or 200°C with convection.'
);
console.log(recipe.inlineQuantities.map(quantity_display));
console.log(recipe.sections[0].content[0]);
The result contains only:
The relevant step items leave 230°C, inside a text item, while 200°C becomes an inlineQuantity.
Removing the comma makes both temperatures parse:
Position an #oven rack{} in the center and preheat the #oven{} to 230°C or 200°C with convection.
Expected behavior
Both 230°C and 200°C should be recognized as inline quantities regardless of adjacent sentence punctuation, and the recognized unit should preserve its degree symbol.
Additional context
In v0.18.7, find_inline_quantity reads a whitespace-delimited candidate, so the first unit is looked up as °C, and rejected.
PR #99 is related and handles punctuation by trimming non-alphabetic characters from both ends of the unit. That appears to also trim the leading ° from °C, leaving C. It may be safer to remove only trailing punctuation or otherwise retain the original matched unit symbol.
This produces inconsistent structured output and downstream rendering for two temperatures in the same instruction.
Related: #99
Version
@cooklang/cooklang0.18.7 through the TypeScript/WASM binding.Reproduction
The result contains only:
The relevant step items leave
230°C,inside a text item, while200°Cbecomes aninlineQuantity.Removing the comma makes both temperatures parse:
Expected behavior
Both
230°Cand200°Cshould be recognized as inline quantities regardless of adjacent sentence punctuation, and the recognized unit should preserve its degree symbol.Additional context
In v0.18.7,
find_inline_quantityreads a whitespace-delimited candidate, so the first unit is looked up as°C,and rejected.PR #99 is related and handles punctuation by trimming non-alphabetic characters from both ends of the unit. That appears to also trim the leading
°from°C, leavingC. It may be safer to remove only trailing punctuation or otherwise retain the original matched unit symbol.This produces inconsistent structured output and downstream rendering for two temperatures in the same instruction.
Related: #99