Abstract
Digital Ink Spelling Correction (DISC) presents a unique challenge: correcting textual errors while preserving the writer's idiosyncratic handwriting style. Traditional methods often require complex character-level segmentation or extensive per-user data. We present Inkorrect, a segmentation-free framework that utilizes a style encoder and a generative decoder with feature masking to produce legible, stylistically consistent corrections. Our approach introduces the Chamfer Distance Edit-Aware (CDE) metric, which better aligns with human perception of handwriting quality.
Introduction
Correcting a typo in digital ink—the sequence of strokes captured on tablets or styluses—is significantly more complex than correcting standard text. While a text editor simply swaps characters, a digital ink system must ensure the corrected word matches the original writer's specific slant, pressure, and "prosody" (the unique way they connect letters).
Existing approaches typically rely on style transfer techniques that require either multiple samples from a single writer or precise character-level segmentation. These requirements make data collection expensive and deployment error-prone. Furthermore, DISC involves a fundamental tension: if a correction is too similar to a messy original, it remains unreadable; if it is too generic, it loses the user's personal touch.
Methodology
Inkorrect addresses these challenges through a two-part architecture designed to decouple style from content without requiring explicit segmentation.
Architecture Overview
- The Style Encoder: A two-layer Long Short-Term Memory (LSTM) network processes the entire original (misspelled) ink sequence into a fixed-dimension latent vector. This vector captures both global style (e.g., overall size and angle) and local features (e.g., specific letter formations).
- The Generative Decoder: Based on the architecture by Graves (2013), this multi-layer LSTM uses monotonic attention to take the target (corrected) text label and the style vector to synthesize the new ink strokes.
Feature Masking and the Similarity Dial
To prevent the model from simply memorizing and redrawing the misspelled input, we introduced a feature masking layer. During training, parts of the style vector are randomly hidden, forcing the model to learn the essence of a style rather than just copying coordinates. At inference, a "similarity" (sim) parameter acts as a dial: increasing it allows more style information through for higher similarity, while decreasing it prioritizes the legibility of the corrected word.
Evaluation and Metrics
Standard distance metrics often fail when a word's length changes during correction (e.g., "thier" to "their"). To solve this, we propose Chamfer Distance Edit-Aware (CDE). CDE uses dynamic programming to align segments of the ink, providing a similarity score that correlates more closely with human judgment.
Our model was evaluated on two major datasets:
- HANDS-VNOnDB: 66,000 single Vietnamese words featuring cursive samples and complex diacritics.
- DeepWriting (DW): An English dataset containing approximately 33,000 training samples.
Since natural typo-correction pairs are rare, we augmented these datasets with synthetic misspelled labels generated using Levenshtein distances of 1 or 2.
Key Results
- Human Preference: In side-by-side blind tests, human evaluators preferred Inkorrect’s corrections over the previous state-of-the-art (DeepWriting) in 66% of cases.
- Metric Reliability: The proposed CDE metric showed an 85% agreement with human preference, significantly outperforming older metrics like CDO (66%).
- Pareto Dominance: Inkorrect demonstrated a superior "Pareto frontier," meaning it consistently achieved better recognizability for any given level of stylistic similarity compared to prior work.
Conclusion and Future Work
Inkorrect demonstrates that global style capturing is often more vital for a natural look than replicating individual character shapes. By avoiding the "cascading error" problem inherent in segmentation-based models, Inkorrect offers a more robust path for real-world digital ink applications. Future research will explore variable-length style representations to better handle long sentences and the integration of "reflowing" logic to adjust surrounding text when a corrected word changes in length.
Summary updated