ID EN
Text Wrapping

fix_sentence_endings

Python 3.11

(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 algorithm is that it is unable to detect the difference between “Dr.” in

Syntax

PYTHON
fix_sentence_endings

Examples

Example 1
PYTHON
[...] Dr. Frankenstein's monster [...]
Example 2
PYTHON
[...] See Spot. See Spot run [...]

See Also

TextWrapper fix_sentence_endings