Edit Distance Algorithm for Mobile Text Input
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing systems face challenges in efficiently suggesting candidate words for correcting mistyped or misremembered input strings, particularly on mobile devices, due to high computational complexity and memory constraints, as they need to handle a vast number of possible combinations and compare inputs to a large dictionary in real-time.
Innovation Solution
A method using an edit distance algorithm, specifically the Wagner-Fischer algorithm, is implemented with optimizations such as caching edit distance values and reusing arrays to reduce memory allocation and computation, allowing for efficient suggestion of candidate words by leveraging cache memory and minimizing cache misses.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If a predictive text system is used to correct or suggest corrections, then text input accuracy is improved, but the system becomes irrelevant or ineffective when users input non-text data or additional data types
Solution Approach 1:
The system generalizes the correction mechanism from text-specific predictive text to a universal input correction system that handles multiple data types including text, coordinates, and location identifiers. The edit distance algorithm and candidate generation framework are type-agnostic, making the system adaptable to various input formats while maintaining correction accuracy.
2Measurement precision
If all possible word combinations are scanned to find corrections, then candidate word accuracy is improved, but the processing time becomes infeasible even on modern computers
Solution Approach 1:
The system segments the search space by dividing the 57 trillion possible three-word combinations into manageable subsets based on edit distance from the input. Instead of scanning all combinations, it generates candidates by applying edit operations (insertion, deletion, substitution) to the input words, then filters results based on a threshold, reducing the search space to only plausible candidates.
Solution Approach 2:
The system performs partial action by generating candidates within a limited edit distance threshold rather than exhaustively checking all possible combinations. This threshold-based approach generates sufficient candidates for practical correction needs without the computational burden of complete enumeration, achieving acceptable accuracy with feasible processing time.
3Measurement precision
If a large dictionary is used for comparison to improve correction accuracy, then candidate word quality is improved, but memory usage increases beyond available resources on mobile devices
Solution Approach 1:
The system segments the dictionary into word-level units and processes them in batches or streams rather than loading the entire dictionary into memory simultaneously. The candidate generation focuses on words within edit distance threshold of the input, allowing the system to work with a subset of the dictionary at any given time, reducing peak memory requirements while maintaining access to the full dictionary vocabulary.
Solution Approach 2:
The system uses partial action by comparing the input against only those dictionary words that fall within the edit distance threshold, rather than comparing against the entire dictionary. This selective comparison approach maintains correction accuracy for plausible candidates while avoiding the memory overhead of holding and processing the complete dictionary in memory.
4Measurement precision
If edit distance calculations are performed for every word in the dictionary, then candidate word precision is improved, but computational complexity becomes infeasible for real-time operation on mobile devices
Solution Approach 1:
The system performs preliminary action by generating candidate words through edit operations on the input before performing full edit distance calculations against the dictionary. This pre-filtering step creates a small set of plausible candidates that are then validated against the dictionary, avoiding the need to compute edit distances for all dictionary words and significantly reducing computational complexity.
Solution Approach 2:
The system applies partial action by performing complete edit distance calculations only on the subset of candidates generated through edit operations, rather than calculating edit distances for every word in the dictionary. This selective computation maintains precision for relevant candidates while reducing the overall computational burden to feasible levels for mobile devices.
Data Source
AI summary
Provided is a computer implemented method for suggesting one or more candidate words from a list of words based on an input string received at an electronic device. Preferably, the list of words comprises an ordered list of words. The method comprises a first step of providing an array in memory for receiving edit distance values between initial substrings of the input string and initial substrings of each word in a set of some or all of the words in the list of words. The method includes applying an edit distance algorithm comparing a selected word to a received input string in order to obtain the aforementioned edit distance values. The selected word may comprise an empty string of no characters. The method includes determining for one or more words of the set of words a number of characters K by which it overlaps with a prefix of a previously considered word and retaining edit distance values in said memory array for said word being considered using some or all of the edit distance values for the K prefix characters of the previously considered word. From the edit distance values, it is possible to identify one or more candidate words from the word list as a replacement for the received input string in a fast and efficient manner.


