aoptk.text_utils

Functions

ends(→ bool)

Check if text ends with sentence-ending punctuation.

endswith_digit(→ bool)

Check if text ends with a digit.

end_of_span(→ bool)

Check text whether it is the end of a span.

contains_any(→ bool)

Check if text looks like formatting artifacts.

Module Contents

aoptk.text_utils.ends(text: str) bool[source]

Check if text ends with sentence-ending punctuation.

Parameters:
  • text (str) – The text to check.

  • sentence_terminators (list[str] | None) – List of sentence terminators.

aoptk.text_utils.endswith_digit(text: str) bool[source]

Check if text ends with a digit.

Parameters:

text (str) – The text to check.

aoptk.text_utils.end_of_span(text: str) bool[source]

Check text whether it is the end of a span.

Parameters:

text (str) – Text to check

Returns:

True if text has common delimiter or ends with a digit.

Return type:

bool

aoptk.text_utils.contains_any(text: str, substrs: list[str]) bool[source]

Check if text looks like formatting artifacts.

Parameters:
  • text (str) – The text to check.

  • substrs (list[str] | None) – substrings to match.