summaryrefslogtreecommitdiff
path: root/util.py
diff options
context:
space:
mode:
authorrusinthread <rusinthread@cock.li>2017-02-14 17:20:31 +0300
committerrusinthread <rusinthread@cock.li>2017-02-14 17:20:31 +0300
commit2cd3036adc3568650d910e7ee430c0bce85873ac (patch)
tree267e026970f87387933668a79e0b0d3db87c7ded /util.py
parent2bf675631511bec3cd7e41dd347523ef59715e0c (diff)
fix some bugs in util functions
Diffstat (limited to 'util.py')
-rw-r--r--util.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/util.py b/util.py
index 8bb449a..4add30c 100644
--- a/util.py
+++ b/util.py
@@ -75,14 +75,14 @@ for k, v in ENG_FREQ.items():
ENG_FREQ[k] = v/100
-BF_NAMES = (
+BF_NAMES = [
'марширующе',
'марширующий',
'свободин',
'мовсаев',
'щиголев',
'щиголёв',
-)
+]
def plural(n, words):
words = words.split(' ')
@@ -214,7 +214,7 @@ def print_hl(s, tohl, end="\n"):
i = 0
indexes = []
for c in s:
- if c != tohl:
+ if c.lower() != tohl.lower():
print(c, end='')
else:
indexes.append(i)
@@ -231,10 +231,10 @@ def rot_en(s):
s = s.upper()
for i in range(0, 26):
for letter in s:
- if re.match('[\d\.,\_\- ]', letter):
+ if letter not in alphabet:
print(letter, end='')
continue
-
+
letter_index = alphabet.index(letter)
new_index = (letter_index + i) % 26
new_letter = alphabet[new_index]
@@ -248,10 +248,10 @@ def rot_ru(s):
s = s.upper()
for i in range(0, 33):
for letter in s:
- if re.match('[\d\.,\_\- ]', letter):
+ if letter not in alphabet:
print(letter, end='')
continue
-
+
letter_index = alphabet.index(letter)
new_index = (letter_index + i) % 33
new_letter = alphabet[new_index]