summaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorrusinthread <rusinthread@cock.li>2017-05-13 13:45:46 +0300
committerrusinthread <rusinthread@cock.li>2017-05-13 13:45:46 +0300
commitab4328bf40b85e732323381a6bd7a473b6b384a5 (patch)
tree445d156cfa9ac0cafa6dacd51995cbea38a6af10 /util.py
parentaea6211b1665e78db13a3c6e8bf36759daa066bd (diff)
decrypted most posts
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))