Documentation
¶
Overview ¶
Package sentence decides what prose a reference binds to (docs/SPEC.md §18).
A reference in running text binds to its enclosing sentence. `.`, `!`, or `?` ends a sentence only when whitespace follows and then an uppercase letter, a digit, a quote or backtick, or an opening bracket — or the text ends. So "v1.2 and", "Fig. 3" and "e.g. this" do not split, and a short fixed list of abbreviations (Abbreviations) and a run of three or more dots never end one either. Inside a list item or a table cell it binds to the whole item or cell. The markdown extractor hands Bind a whole paragraph, joined, so a sentence wrapped across lines is one sentence.
Two references in one sentence share one ack because they share one sentence hash. This is the unit a reviewer approves, so the rule has to be boring and stable: an ack must survive a paragraph moving, re-wrapping, or re-spacing, and must be invalidated when the sentence is rewritten. Runs of whitespace in the result are collapsed to one space for that reason.
Index ¶
Constants ¶
const Terminators = ".!?"
Terminators end a sentence when followed by whitespace or end of text.
Variables ¶
var Abbreviations = map[string]bool{ "e.g.": true, "i.e.": true, "etc.": true, "vs.": true, "cf.": true, "viz.": true, "fig.": true, "no.": true, "dr.": true, "mr.": true, "mrs.": true, "ms.": true, "st.": true, "u.s.": true, "u.k.": true, }
Abbreviations never end a sentence. The list is short, English, and fixed on purpose: it covers what technical prose uses, and a term not on it splits as before, so the list can only remove false splits. Compared lowercased.
Functions ¶
Types ¶
This section is empty.