Preparing search index...

    Function parseIngredientsNoHeader

    • Parses ingredients from OCR text when no clear header structure is detected

      Fallback parsing method that assumes ingredients are organized in two sections: the first half contains ingredient names, the second half contains quantities with units. This handles cases where ingredient tables don't have clear headers or person markers.

      On iOS, ML Kit may return quantity blocks before name blocks (opposite of Android). This is detected by checking if the first "name" line starts with a digit, in which case the two halves are swapped before pairing.

      Parameters

      • lines: string[]

        Array of text lines from ingredient OCR

      Returns ingredientObject[]

      Array of ingredient objects with names, quantities, and units

      // Input lines: ["Flour", "Sugar", "Salt", "2 cups", "1 tsp", "1 pinch"]
      // Returns: [
      // { name: "Flour", unit: "cups", quantityPerPersons: [{ persons: -1, quantity: "2" }] },
      // { name: "Sugar", unit: "tsp", quantityPerPersons: [{ persons: -1, quantity: "1" }] }
      // ]