improve parsing 3

This commit is contained in:
davmar
2026-09-02 13:38:47 +02:00
parent 98574af903
commit ae42ba8193
10 changed files with 417 additions and 136 deletions
+11
View File
@@ -116,6 +116,17 @@ class ReceiptTextParser {
return _parseSequential(lines, config, rawText);
}
/// True when OCR dumped an entire name column before a price column (Jumbo-style).
static bool looksLikeColumnOcr(String rawText) {
final config = receiptParseConfig;
final lines = rawText
.split('\n')
.map(_preprocess)
.where((line) => line.isNotEmpty)
.toList();
return _looksLikeColumnOcr(lines, config);
}
static String _preprocess(String line) =>
line.trim().replaceAll(RegExp(r'\s+'), ' ');