ADFA-3755 | Fix Spinner entries OCR parsing and validation#1234
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 6 minutes and 50 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA new Changes
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested Reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Update SpinnerGrammar to use tools namespace and parse array entries correctly.
66907db to
a255ec2
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/grammar/AttributeValidator.kt`:
- Around line 63-97: The code fails to normalize OCR digits when the overall
attribute is a numeric list (e.g., "[0, l, 2]") because isOcrGarbledNumber
requires each item to already contain a real digit and cleanNumberArtifacts only
strips literal spaces; fix by detecting array-level numeric intent before
per-item processing and by normalizing whitespace removal: compute isNumericList
from content.split(",") (e.g., check tokens for any real digits or
OCR-digit-only tokens) and pass that flag into processItem (or map with
processItem(item, isNumericList)) so items like "l" are normalized; update
isOcrGarbledNumber to allow OCR-digit-only tokens when invoked in numeric-list
mode (or use the isNumericList flag instead of hasDigit), and change
cleanNumberArtifacts to remove all whitespace using Regex("\\s+") rather than
replacing only " ".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 420d9264-3878-4325-a4e2-464645ae3dd5
📒 Files selected for processing (2)
cv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/grammar/AttributeValidator.ktcv-image-to-xml/src/main/java/org/appdevforall/codeonthego/computervision/domain/grammar/WidgetGrammar.kt
Description
This PR fixes an issue where dropdown
entrieswere being omitted from the generated XML and corrupted by OCR noise.EntriesValidatorand updatedSpinnerGrammar.SpinnerGrammarnow correctly maps totools:entriesinstead ofandroid:entriesto prevent build errors with raw arrays. The newEntriesValidatorprocesses the array elements individually, distinguishing between likely numbers and text. It cleans common OCR artifacts (like mistaking 'o' for '0' or 'l' for '1') in numeric data while safely preserving standard text strings and Android resource references (e.g.,@array/items).Details
Logic update: Implemented regex-based sanitization for common OCR artifacts specifically targeted at numeric arrays, while preserving standard text words.
document_5136636871467599640.mp4
Ticket
ADFA-3755
Also fixes:
ADFA-3759