Skip to main content

Module suggest

Module suggest 

Source
Expand description

Conservative nearest-match selection for “did you mean” diagnostics.

Several passes answer the same question: the user wrote an identifier that matches nothing — is one known name a plausible near-miss worth offering as a fix? This module owns the shared edit-distance metric, the selection rule, and the MOS0015 unknown-key diagnostic builder; callers supply their own candidate sets (reference labels, citation keys, #set targets, directive keyword arguments).

Functions§

edit_distance 🔒
Byte-level edit distance counting an adjacent transposition as one edit (optimal string alignment, the restricted Damerau-Levenshtein variant).
nearest_match 🔒
The single candidate that is a reasonable near-miss for unknown, if any.
unknown_key_diagnostic 🔒
Build the MOS0015 unknown-keyword-argument diagnostic shared by #set, #image, #figure, and #bibliography, attaching a fix replacing exactly the key token when one known key is a conservative near-miss.