Abstract
In many applications, it is necessary to determine string similarity. While the Edit Distance approach is a classic method for determining field similarity, its $O(nm)$ complexity is often prohibitive. This paper introduces a package of substring-based algorithms, including the Moving Contracting Window Pattern Algorithm (MCWPA) and the Expandable Region Match Algorithm (ERMA). These methods achieve higher accuracy and improved time complexity: $O(knm)$ ($k < 0.75$) for the worst case, $O(\beta n)$ where $\beta < 6$ for the average case, and $O(1)$ for the best case. Theoretical analysis and experimental results demonstrate significant improvements over traditional token-based and edit-distance methods.
Introduction: The Limitations of Edit Distance
String comparison is a foundational task in data cleaning, pattern recognition, and computational biology. Historically, researchers relied on Edit Distance, which uses dynamic programming to find the minimum operations to turn one string into another. However, Edit Distance is computationally expensive ($O(nm)$) and often fails to capture semantic similarity in "field" data like names or addresses, where typos and formatting variations are common.
A later "token-based" approach improved performance but introduced new errors: it often over-evaluated similarity if multiple words in one field matched a single word in another, and it struggled to distinguish between strings that contained the same words in different orders. Our approach addresses these "false detections" by focusing on character continuity and adaptive windowing.
Methods: MCWPA and ERMA
The proposed framework centers on two main components designed to prioritize long, continuous matches while maintaining high throughput:
1. Moving Contracting Window Pattern Algorithm (MCWPA)
Instead of comparing whole words, MCWPA uses a sliding window that starts at the maximum possible size and "contracts" (shrinks) with each round. It identifies the longest common substrings first. This ensures that the most significant semantic matches are prioritized and processed before smaller, potentially coincidental matches.
2. Expandable Region Match Algorithm (ERMA)
ERMA serves as the high-performance engine for finding matches. It pre-processes the target string into a "character-region" (using either an array or a tree) to store the positions of every character. This allows the algorithm to "expand" a match character-by-character very quickly once a seed match is found, significantly reducing the search space.
3. The "Inaccessibility" Rule and Squared Similarity
Once a substring match is found, those characters are marked as "inaccessible." This prevents the algorithm from re-counting the same characters, solving the "many-to-one" matching problem found in previous token-based methods.
The similarity formula uses the Sum of the Square of the Number of same Characters (SSNC). By squaring the lengths of continuous matches, the algorithm mathematically rewards continuity. For example, a single 6-character match is weighted more heavily than three disjoint 2-character matches, better reflecting true semantic similarity.
Performance and Results
The algorithm is designed to be "adaptive." If a user sets a high similarity threshold, the algorithm uses Upper-Bound Window Size (UBWS) and Lower-Bound Window Size (LBWS) to skip unnecessary comparisons.
Key results include:
- Speedup: While traditional algorithms sit at $O(nm)$, the proposed method achieves an average-case complexity of $O(\beta n)$ where $\beta < 6$ (essentially linear time). In the best case, it reaches $O(1)$.
- Accuracy: In experiments using the Campus Survey and 1990 US Census datasets, the MCWPA/ERMA approach showed a significantly lower false detection rate than previous state-of-the-art methods. It was particularly effective at correctly identifying that strings with the same words in different orders are not necessarily identical.
- Scalability: The algorithms maintained high performance even when scaled to synthetic datasets with over 200,000 records, demonstrating robustness under heavy load.
Conclusion
By treating the character as the basic unit of comparison and rewarding continuity through squared sums, this package of algorithms significantly improves both the accuracy and time complexity of field similarity calculations. Future work will focus on optimizing the memory usage of the character-region data structures and exploring performance across diverse character sets.
References: * [WF74] R. Wagner and M. Fisher, The String to String Correction Problem, JACM 21, 1974. * [GUS97] D. Gusfield, Algorithms on Strings, Trees and Sequences, 1997. * [LL+99] M. L. Lee et al., Cleansing data for mining and warehousing, DEXA99, 1999.
Summary updated