Parchi: Multilingual Order Processing for Wholesalers
Inspiration
Small retailers order from wholesalers the way they talk—not through a portal or an order form, but in a chat message:
"Hola, necesito 2 cajas de grapadoras 24/6, 5 docenas de papel de regalo rojo, 10 paquetes de grapas 24/6 y 6 rollos de cinta de embalaje. Para mañana por favor."
Others send voice notes, Arabic text with Arabic numerals ("عايز ٢ كرتونة لمبة ليد 9W"), French messages with abbreviated words, or photos of handwritten order slips.
At the wholesaler's end, someone must read every message, determine which of four staplers grapadora refers to, check stock, and retype the entire order into billing software. QuickBooks, Xero, and Zoho make good invoices, but they all assume a person has already completed that retyping.
This process is slow, error-prone, and repeated in every market, from Mexico City to Cairo to Jakarta. We wanted to build the first version of a company that eliminates this repetitive work.
What It Does
Parchi (a word for the paper slip on which an order is written) is an order desk for wholesalers:
- Multilingual order processing: Reads orders in seven languages—English, Spanish, Portuguese, French, Arabic, Indonesian, and Hindi—as they are naturally written. It understands number words (docena, dúzia, douzaine, عشرة, lusin), trade units (caja, caixa, carton, كرتونة, kotak), different scripts and digits (٢, ५), and spelling mistakes such as "sciccors", "notbook", and "padlok".
- Transparent extraction: Highlights every quantity, item, and size in the original message. Hovering over an invoice line highlights the exact words from which it was derived.
- Intelligent product matching: Matches each order line to a product using confidence scores and product specifications, distinguishing variants such as 24/6 versus No.10 staples, 9 W versus 12 W bulbs, and 6×8 versus 8×10 frames.
- Customer-aware matching: Uses a customer's purchase history to resolve ambiguous variants, prioritising previously ordered products when appropriate.
- Uncertainty handling: Flags unclear lines for one-click confirmation or sends them to Claude in a single batched request. Handwritten order slips are transcribed using Claude.
- Stock management: Checks inventory and allows available items to be invoiced while the remaining items are backordered.
- Automated invoicing: Calculates item-level taxes, supports zero-rated export sales, generates tax summaries and amounts in words, and assigns yearly invoice numbers (e.g.,
INV-2026-0143). Currency and tax rates are configurable for different markets. - WhatsApp communication: Replies to customers in their preferred language.
- Business operations dashboard: Manages invoices and collections, tracks live inventory, generates supplier reorder lists, and provides weekly summaries of order values, channels, and languages.
How We Built It
Rules first, AI only when needed. The core is a dependency-free order-processing engine written in pure TypeScript. It runs identically in the browser, in tests, and in a Deno edge function.
1. Tokenizer
Preserves product specifications such as 24/6, No.10, 6x8, and USB-C; converts Arabic-Indic and other numeral systems; normalises Arabic letter variants; removes French elisions (d'ampoules → ampoules); and splits order lines using commas, and, y, e, et, dan, and the Arabic comma.
2. Extractor
Uses a state machine and language-specific lexicons, called language packs. Each pack contains number words, trade units, colours, sizes, filler words, and deadline expressions such as mañana, amanhã, demain, بكرة, and besok.
Adding support for another market requires a new language pack rather than rewriting the core engine.
3. Product Matcher
Each product receives an IDF-weighted fuzzy token score (s_{\text{tok}}) and a character-trigram score (s_{\text{tri}}), calculated against hundreds of trade names across the supported languages.
The scores are blended, and structured agreement is added:
$$s = 0.8 \times (0.6 \times s_{\text{tok}} + 0.4 \times s_{\text{tri}}) + \Delta_{\text{spec}} + \Delta_{\text{colour}} + \Delta_{\text{size}}$$
Text similarity is deliberately capped at 0.8. A term such as stapler, grapadora, or دباسة may match multiple products equally well, so agreement on specifications such as 24/6 must determine the better match.
Contradictions, such as requesting a 9 W bulb when the candidate is 12 W, incur a greater penalty than a matching attribute earns.
The final confidence score combines the top candidate's score with its lead over the runner-up:
$$c = 0.82 \times \min(1, s_1) + 0.6 \times \min(s_1 - s_2,\ 0.3)$$
- Auto-confirmed: Lines with (c \ge 0.66).
- Manual confirmation: Lines with (0.40 \le c < 0.66) are queued for one-click confirmation.
- Unmatched: Lines with (c < 0.40) are marked as unmatched.
4. AI-Assisted Uncertainty Resolution
Uncertain order lines are sent to Claude in a single JSON request per order. The request includes the candidate products, and the response is validated against that list to ensure the model can select only an existing product.
Handwritten slips are processed using Claude's vision capabilities for transcription before passing through the same deterministic rules-based engine.
5. Invoicing
The invoicing module supports item-level tax calculations, zero-rating for cross-border sales, tax summaries grouped by rate, merging repeated items, and converting totals into words.
Technology Stack
- Frontend: React 18 and TypeScript, built with Vite into a self-contained page.
- Design: Custom-built design system with right-to-left layout support for Arabic.
- AI: Claude for handwritten-order transcription and uncertain product matching.
- Backend: Supabase Postgres with row-level security,
pg_trgm,pgvector, andpgmq. - Serverless processing: Deno edge functions for order parsing and the WhatsApp Cloud API webhook.
- Testing: 31 Vitest tests covering tokenisation, extraction across supported languages, product matching, units, invoicing, and stock management.
Challenges We Ran Into
- Words that collide across languages: Dos means two in Spanish, while do means two in Hindi but can also mean “give” in the phrase bhej do. Similarly, par can mean “pair” in one language and “on” in another. Language packs are designed to avoid introducing cross-language conflicts, with tests covering every supported language.
- Product variants with similar names: Early versions selected the first matching stapler. Capping text similarity and prioritising specifications, colours, and sizes resolved this issue and made confidence scores more reliable. Genuine ties now trigger user confirmation.
- Different scripts and spelling conventions: Arabic uses multiple letter forms, French attaches articles to nouns, and Spanish and Portuguese use plural forms such as médias and pequeños. These variations are normalised before matching.
- Implicit trade units: Two cartons of bulbs may contain 100 pieces, five containers (علب) of batteries may contain 50 packs, and two lusin of scissors may mean 24 pieces. Every unit conversion is displayed so users can verify the assumed pack size.
Accomplishments That We're Proud Of
- Spanish chat orders and Arabic orders containing Arabic numerals can be converted into complete invoices within milliseconds, with every decision explained on screen.
- New languages can be added through language packs without rewriting the core engine. Five languages were added in a single sprint.
- The same order-processing engine runs in the browser, test environment, and server without modification.
What We Learned
AI should be the last resort, not the first.
Explicitly communicating uncertainty through confidence scores, explanations, and one-click corrections builds more trust than relying on a model that is usually right but silent when it makes mistakes.
We also learned that trade language is highly local. The hardest terms to interpret were often not product names but units of measurement and filler words.
What's Next for Parchi?
- Pilot deployments with a small number of wholesale distributors.
- Integration with the WhatsApp Business inbox so orders reach Parchi without manual copying and pasting.
- Speech-to-text processing for voice notes across supported languages.
- Customer-specific price lists.
- Additional language packs and local tax presets.
- Export integrations with QuickBooks, Xero, and Zoho Books.
The demo runs on sample data featuring a fictional distributor, fictional customer shops, and sample inventory.
Log in or sign up for Devpost to join the conversation.