improve parsing 3
This commit is contained in:
@@ -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+'), ' ');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user