Build a mobile-first document intelligence workspace that lets users capture paper documents, clean and OCR them reliably, refine text with on-device or cloud LLMs, and export to PDF/DOCX—while keeping data private and usable offline.
- MVVM structure with
ui/,viewmodel/,data/,ocr/,exporter/,utils/modules. - Navigation graph with Home → Scanner → Crop/Preview → OCR → Document.
- Centralized ViewModel factory for injection-ready flows.
- CameraX live preview integrated in Compose.
- Capture button saves image to internal storage.
- Basic rectangular overlay guide for edge alignment.
- Runtime camera permission flow handled.
- Crop and preview screen with adjustable horizontal/vertical bounds.
- OpenCV preprocessing pipeline:
- Denoise (Gaussian blur)
- Grayscale conversion
- Perspective correction (basic contour-based deskew)
- Adaptive thresholding (binarize for OCR)
- Processed image is saved to internal storage and forwarded to OCR.
- ML Kit Text Recognition implemented in
ocr/TextExtractor.kt. - OCR returns structured result:
OCRResult(text, confidence). - OCR screen displays extracted text and confidence.
- User can edit text before saving.
- Room database with
DocumentEntity,DocumentDao, andTextLexiqDatabase. - Repository saves OCR output and exposes recent documents.
- Home screen lists saved documents (basic summary).
- Document view screen loads by ID and displays content.
- Document editing mode implemented with save/discard.
- Metadata fields added (source, engine, language, tags).
-
DocumentDaoand Repository updated for CRUD operations.
- PDF export implemented using iText7.
- DOCX export implemented using Apache POI.
- LaTeX code generation added.
- Export action menu in UI with format selection.
- Advanced OpenCV preprocessing: Deskewing (minAreaRect), Binarization (Adaptive Threshold), Grayscale.
- Text block sorting in
TextExtractorfor reliable reading order. - Skew correction implemented.
-
TokenOptimizer: Whitespace compression and stopword removal. -
SmartModelRouter: Floating access logic (On-Device vs Cloud). -
LLMEnginearchitecture defined.
- Confidence is averaged from blocks. Visual overlays missing.
- Tesseract (tess-two) implementation optional/pending.
- Auto-language detection pending.
- Basic errors surfaced in UI, but no retry strategies or offline recovery.
- Option to switch between ML Kit and Tesseract (tess-two).
- Support multiple languages and auto-language detection.
- Add visual OCR overlays for confidence highlighting.
- Design
LLMEngineinterface (abstraction for On-Device vs Cloud). - Implement
TokenOptimizer(Stopword removal, context compression). - Implement
SmartModelRouter(Floating access: Route based on complexity/cost). - Implement
LlamaCppClient(On-Device Tier). - Implement
CloudLLMClient(Paid Tier). - Integrate LLM features into UI (Summarize, Simplify).
- Implement auto edge detection interface (OpenCV contors logic exists, need UI overlay).
- Auto capture when page is stable inside the guide.
- Manual crop corners (drag handles) instead of slider-only crop.
- Create a unified app state (loading/saving indicators, error toasts/snackbars).
- Add settings screen bindings to actual config/state.
- Add onboarding/permissions screen.
- Unit tests for preprocessing and repository layers.
- Instrumentation tests for CameraX and OCR flows.
- Validate OpenCV initialization on device (not just debug).
- Create
TextLexiq Server(Python) for Daytona/LeanMCP. - Port OpenCV/OCR pipeline to Python (pip package).
- Create
textlexiq-jsclient (npm package). - Deploy MCP Server to LeanMCP.
- Current implementation uses ML Kit for OCR. If you prefer tess-two, a new implementation can be added in
ocr/TextExtractor.ktbehind an interface. - OpenCV initialization is performed in
TextLexiqAppand may need runtime loading for production builds.