From 2cd3036adc3568650d910e7ee430c0bce85873ac Mon Sep 17 00:00:00 2001 From: rusinthread Date: Tue, 14 Feb 2017 17:20:31 +0300 Subject: fix some bugs in util functions --- util.py | 14 +++++++------- 1 file 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] -- cgit v1.2.3