String matching compares character sequences to find exact or approximate correspondences. It supports useful NLP behavior even when no machine learning, tokenization, or feature generation is involved. section 1.4.2 section 1.9
Regular expressions provide a compact rule language for matching patterns. Their regular-language foundation is efficiently parsable, while finite-state machines clarify the kinds of patterns these rules can recognize. section 1.4.2
Common matching strategies include:
- Use regular-expression rules to recognize input patterns for question answering and task-execution assistants. section 1.9
- Use edit distance to rank stored statements by similarity, then reuse the response paired with the closest match. section 1.9
A minimal chatbot pipeline
ChatterBot computes the Levenshtein distance between an input statement and stored statements, then uses brute-force search to select a corresponding reply. Will takes a different approach, matching programmed regular expressions for a data-light assistant. section 1.9
Figure 1.4 Kinds of automata
Use the automata diagram to relate regular expressions and finite-state machines to progressively more expressive computational models. section 1.4.2
Figure 1.8 Example layers for an NLP pipeline
Use the NLP-layer diagram to place string matching near the text-processing surface of chatbot and language-processing pipelines. section 1.9
