A finite-state machine (FSM) models computation as movement among a finite set of states in response to input symbols. It replaces sprawling bit-by-bit conditionals with explicit transition rules. A deterministic finite automaton always chooses a definite match or nonmatch; a finite-state transducer additionally emits output symbols. section 1.4 section 1.4.2
Regular expressions provide a compact way to specify FSM behavior for matching character sequences. In a tightly controlled chatbot, a recognized pattern can trigger a scripted response or extract information, such as identifying a greeting intent from “Open sesame” or “Hello, Rosa.” section 1.4.2 section 1.5
Sentence segmentation
A regular-expression FSM can scan text character by character and identify sentence boundaries. A pattern such as `re.split(r'[!.?]+[\s$]+', text)` handles ordinary punctuation, while additional rules address abbreviations, decimals, and other exceptions. The matcher halts after a finite number of steps and does not backtrack unless features such as lookaheads or lookbacks are used. section 11.2.2
Figure 1.4 Kinds of automata
Compare FSMs with combinatoric logic, pushdown automata, and Turing machines to place finite-state computation within the hierarchy of formal-language machinery. section 1.4.2








