[AB-xxx] adding character replacement to amongus text for ß

This commit is contained in:
Sheldan
2024-02-24 10:41:03 +01:00
parent 518355a68a
commit c11ddd84ab

View File

@@ -29,7 +29,7 @@ def generate_amongus_text():
if len(text) > max_chars:
return f'too long text, max {max_chars}', 400
text = text.lower()
text = text.replace('ö', 'oe').replace('ä', 'ae').replace('ü', 'ue') # "fixing" umlauts
text = text.replace('ö', 'oe').replace('ä', 'ae').replace('ü', 'ue').replace('ß', 'ss') # "fixing" umlauts and other replaceable characters
text = re.sub(r'[^a-z!? ]', "", text)
if len(text) == 0:
return 'No valid characters found.', 400