syntactic.sentence_case

syntactic.sentence_case(obj: str | list[str], strict: bool = False) list[str]

Convert strings to sentence case.

Capitalizes the first letter of the first word. Subsequent words are lowercased unless they appear to be acronyms (all-caps, mixed case with multiple uppercase letters, etc.).

Parameters:
  • obj (str or list of str) – String(s) to convert.

  • strict (bool) – Force ALL words (including the first) to title/lowercase, ignoring acronym detection.

Returns:

Sentence-cased string(s).

Return type:

list of str

Examples

>>> sentence_case(["hello world", "FOO BAR"])
['Hello world', 'FOO BAR']
>>> sentence_case(["hello world", "FOO BAR"], strict=True)
['Hello world', 'Foo bar']