summaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'util.py')
-rw-r--r--util.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/util.py b/util.py
index 1ece867..0b68a6c 100644
--- a/util.py
+++ b/util.py
@@ -210,7 +210,7 @@ def split_sen(s, smart=True):
words = re.split(r'\s+', line)
buf = []
for w in words:
- if not re.sub(r'[\.\!\?]', '', w).isdigit():
+ if not re.sub(r'[\.\!\?\\/]', '', w).isdigit():
buf.append(w)
else:
if len(buf):
@@ -362,22 +362,31 @@ def rot_en(s):
print()
-def rot_ru(s):
+def rot_ru(s, return_list=False):
alphabet = RU_ALPHABET.upper()
+ result = []
s = s.upper()
for i in range(0, 33):
+ buf = ''
for letter in s:
if letter not in alphabet:
- print(letter, end='')
+ buf += letter
continue
letter_index = alphabet.index(letter)
new_index = (letter_index + i) % 33
new_letter = alphabet[new_index]
- print(new_letter, end='')
- print()
+ buf += new_letter
+
+ if not return_list:
+ print(buf)
+ else:
+ result.append(buf)
+
+ if return_list:
+ return result
def bf_all(table):
return list(itertools.product(*table))