fix_sentence_endings
(default: False
) If true, TextWrapper
attempts to detect sentence endings and ensure that sentences are always separated by exactly two spaces. This is generally desired for text in a monospaced font. However, the sentence detection algorithm is imperfect: it assumes that a sentence ending consists of a lowercase letter followed by one of '.'
, '!'
, or '?'
, possibly followed by one of '"'
or "'"
, followed by a space. One problem with this is algorithm is that it is unable to detect the difference between “Dr.” in
[...] Dr. Frankenstein's monster [...]
and “Spot.” in
[...] See Spot. See Spot run [...]
fix_sentence_endings
is false by default.
Since the sentence detection algorithm relies on string.lowercase
for the definition of “lowercase letter,” and a convention of using two spaces after a period to separate sentences on the same line, it is specific to English-language texts.
Please login to continue.