Stricter check for inverted text

main
Bob Mottram 2024-04-27 17:28:33 +01:00
parent 5c01707c97
commit c5a60176a9
2 changed files with 8 additions and 1 deletions

View File

@ -8679,6 +8679,13 @@ def _test_uninvert2():
print('uninverted: ' + uninverted_text) print('uninverted: ' + uninverted_text)
assert uninverted_text == 'This is a test.' assert uninverted_text == 'This is a test.'
inverted_text = 'uspol'
uninverted_text = uninvert_text(inverted_text)
if uninverted_text != 'uspol':
print('inverted: ' + inverted_text)
print('uninverted: ' + uninverted_text)
assert uninverted_text == 'uspol'
def _test_check_individual_post_content(): def _test_check_individual_post_content():
print('check_individual_post_content') print('check_individual_post_content')

View File

@ -225,7 +225,7 @@ def uninvert_text(text: str) -> str:
possible_result = ch_result + possible_result possible_result = ch_result + possible_result
result = text result = text
if matches > len(text)/3: if matches > len(text)/2:
result = possible_result result = possible_result
new_result = '' new_result = ''
extra_replace = { extra_replace = {