INNER CODE UNIT · Python
keep
OpenChemistry/avogadrolibs · scripts/copy-default.py:212
keep = match.group(0)[:len(stem) + 1]
return keep + ('S' if z == 'Z' else 's') + suffix
def respell_text(text, locale):
"""Respell a run of plain text (no markup) for the locale."""
text = WORD_RE.sub(common_word, text)
if locale in ISE_LOCALES:
text = ISE_RE.sub(swap_z, text)
text = YSE_RE.sub(swap_z, text)
return text
def respell(text, locale):
"""Respell text for the locale, leaving markup and URLs untouched."""
if locale not in RESPELL_LOCALES or not text:
return text
pieces = MARKUP_RE.split(text)