An in-browser computational linguistic environment providing client-side optical character recognition, n-gram lexical classification, LLM translation dispatch, and dual-column AST-aligned parallel text visualization.
Explore Live System • Architecture • Linguistic Engine • Deployment
Bilex addresses the fundamental challenge of asymmetric cross-lingual document comprehension. Traditional translation workflows sever structural correspondence, discarding layout telemetry and paragraph cohesion.
Bilex implements an end-to-end, browser-orchestrated pipeline where ingested documents—ranging from clean native vector PDFs to degraded multi-page raster scans—undergo optical rasterization, client-side WebAssembly character recognition, language inference, token chunking, and dual-pane parallel synchronization.
┌────────────────────────────────────────────────────────────────────────┐
│ DOCUMENT INGESTION & PARSING │
│ [Vector PDF] ──────────► [pdfjs-dist TextStream] │
│ [Scanned Image/Photos] ─► [HTML5 Canvas Rasterizer] ─► [Tesseract WASM]│
└──────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ STATISTICAL INFERENCE & CHUNK DISPATCH │
│ • n-gram frequency classification via `franc-min` │
│ • Paragraph segmentation & token boundary indexing │
│ • Rate-limited LLM API batching (Gemini, Groq, DeepL, OpenAI) │
└──────────────────────────────────┬─────────────────────────────────────┘
│
▼
┌────────────────────────────────────────────────────────────────────────┐
│ PARALLEL READ INTERFACE & VECTOR EXPORT │
│ Dual-pane synchronized scroll │ In-situ AST mutation │ B-Tree search │
│ Export to dual-column A4 PDF (`jspdf-autotable`), Markdown, or JSON │
└────────────────────────────────────────────────────────────────────────┘
For scanned inputs and multi-image raster uploads (PNG, JPEG, WebP), Bilex executes a zero-server-hop extraction pipeline:
- Off-Screen Canvas Rasterization: Images are normalized into strict DIN A4 aspect ratios without geometric distortion.
- Tesseract WebAssembly Runtime: Multithreaded neural network OCR executes entirely within browser workers, eliminating confidential document transit over public networks.
Prior to translation dispatch, source text fragments undergo classification via trigram frequency profiling:
To adhere to LLM context-window limits and rate allocations, large documents are partitioned using deterministic paragraph-boundary chunking:
- Serverless Relay (
/api/translate): Eliminates CORS vulnerability and masks upstream credentials. - Pluggable Translation Adapters:
- Google Gemini API (
gemini-2.0-flash,gemini-1.5-flash) - Groq Llama Inference Engine (
llama-3.3-70b-versatile) - DeepL Neural Engine
- OpenAI Platform (
gpt-4o-mini,gpt-4o) - Anthropic Claude Engine (
claude-3-5-sonnet) - Deterministic Mock Runtime (offline academic testing without external egress)
- Google Gemini API (
The presentation layer enforces isomorphic structural parity between source and target text:
-
1-to-1 Index Correlation: Paragraph tokens maintain strict index preservation (
$\text{Src}_i \iff \text{Dst}_i$ ). - Bidirectional Event Highlighting: Hover and focus states synchronize bounding viewports, maintaining contextual visual grounding across languages.
-
In-Situ Mutation: Immediate client-side re-editing with visual state demarcation (
Editedaudit tag). - Sub-Linear Search Filtering: Real-time token search with instant occurrence counters across parallel panes.
Synthesized bilingual corpora can be serialized into four academic and archival formats:
| Format | Engine | Structural Specification |
|---|---|---|
| Bilingual Dual-Column PDF | jspdf + jspdf-autotable |
Formal A4 pagination with dual-column juxtaposed grid |
| Normalized Unified PDF | Native Canvas / PDF compilation | Reordered, non-distorted image compilation |
Comparative Markdown (.md) |
AST Table Serializer | Ready for knowledge graphs (Obsidian, Notion, GitHub) |
Interleaved Plaintext (.txt) |
Dynamic Streamer | Raw translation or alternating bilingual blocks |
State Snapshot (.json) |
JSON Serialization | Full project state persistence for zero-cost resumption |
-
Node.js:
$\ge 20.x$ -
Vite Runtime Engine:
$\ge 8.x$
# Clone the repository
git clone https://github.com/ExeDevCentral/Bilex.git
cd Bilex
# Install dependencies deterministically
npm install
# Launch development environment
npm run devWhen orchestrating deployment via Vercel, inject designated environment variables according to provider selection:
GEMINI_API_KEY="AIzaSy..."
GROQ_API_KEY="gsk_..."
DEEPL_API_KEY="..."
OPENAI_API_KEY="sk-..."
ANTHROPIC_API_KEY="sk-ant-..."The codebase enforces strict static type safety under TypeScript strict mode, automated code analysis with Oxlint, and unit tests via Node's native test runner:
# Execute unit test suite (parser, language detector, export formatters)
npm test
# Execute static type validation
npx tsc -b
# Run static AST linting
npm run lint
# Build production bundle
npm run build- Minimalist Mobile Bottom Dock: Keeps the mobile top header focused solely on brand and language selection while delegating core actions to a 5-button thumb-zone dock (
Documento,Idiomas,Exportar / Motor IA,Día / Noche,Ajustes) with zero overlap over bilingual text pairs.
Distributed under the MIT License. Engineered for privacy-preserving document comprehension.