Edit distance measures how many single-character insertions, deletions, and substitutions are needed to transform one string into another. Also called Levenshtein distance, it provides a practical way to compare character sequences when exact matching is too brittle. section 1.9 section 1.6
The metric is useful when language is represented directly as characters rather than tokens or semantic vectors. It can support approximate matching without tokenization or feature generation, although it compares surface form rather than meaning. section 1.6 section 1.9
Approximate chatbot matching
A chatbot can compare a user's statement with stored statements, select the closest match by edit distance, and reuse the associated response. ChatterBot uses this approach in a brute-force search pipeline, showing how a simple character-level metric can produce useful conversational behavior. section 1.9
Figure 1.8 Example layers for an NLP pipeline
Use the NLP pipeline layers to place edit distance at the direct character-sequence matching stage, before tokenization, feature generation, or semantic representations. section 1.9





