medkit.text.utils.decoding

medkit.text.utils.decoding#

Functions#

get_ascii_from_unicode(β†’Β str)

Return the (closest) ascii text when possible.

Module Contents#

medkit.text.utils.decoding.get_ascii_from_unicode(text: str, keep_length: bool = True, logger=None) str#

Return the (closest) ascii text when possible.

Parameters:
text:

The unicode text to decode to ascii

keep_length

If True, special characters which change the length are kept in returned string

logger

Logger to pass if one wants to keep caller information

Returns:
str

The closest ascii text