Reads every serving count and duration printed on the given OCR lines.
Each line is split into number and word tokens. A word whose letters match a
vocabulary term — punctuation and case are stripped from both sides, so
pers., Pers and pers, all match pers — takes the nearest free number
on its own line, preferring the one before it (4 pers) and falling back to
the one after it (Serves 4). A number is claimed by at most one term, so a
merged line such as "5 pers. > 30 min" yields both its serving count and
its time, and stray tokens between them are ignored.
Parameters
lines: string[]
OCR line texts to read, in the order they should be reported
Reads every serving count and duration printed on the given OCR lines.
Each line is split into number and word tokens. A word whose letters match a vocabulary term — punctuation and case are stripped from both sides, so
pers.,Persandpers,all matchpers— takes the nearest free number on its own line, preferring the one before it (4 pers) and falling back to the one after it (Serves 4). A number is claimed by at most one term, so a merged line such as"5 pers. > 30 min"yields both its serving count and its time, and stray tokens between them are ignored.