Preparing search index...

    Module OCRMeasurements

    OCRMeasurements - Serving counts and cooking times read from a recipe card

    Recipe cards print a small matrix pairing a serving count with the cooking time it applies to. Recognizers disagree on how that matrix comes back: some return one line per column ("2 pers." … then "25 min" …), others merge a whole row into a single line ("2 pers. 25 min"). This module reads both shapes from the same input by binding each vocabulary term to the number it sits next to, then regrouping the results into rows.

    The vocabulary is supplied entirely by the caller (from i18n) — this module carries zero natural-language terms of its own, so adding a language is a translation-file change, never a parsing-code change.

    const measurements = extractMeasurements(
    ['2 pers. 25 min'],
    { personsTerms: ['pers.'], timeTerms: ['min'] }
    );
    const rows = pairMeasurementsIntoRows(measurements); // [{ person: 2, time: 25 }]
    MeasurementKind
    Measurement
    PersonsTimeRow
    MeasurementVocabulary
    extractMeasurements
    pairMeasurementsIntoRows