test
This commit is contained in:
parent
e3f6c6e369
commit
e6c22da6c5
@ -46,19 +46,21 @@ def leet_convert(message):
|
|||||||
"y": ["j", "`/", "\\|/", "\\//"],
|
"y": ["j", "`/", "\\|/", "\\//"],
|
||||||
"z": ["2", "7_", "-/_", "%", ">_", "~/_", "-\_", "-|_"],
|
"z": ["2", "7_", "-/_", "%", ">_", "~/_", "-\_", "-|_"],
|
||||||
}
|
}
|
||||||
leetspeak = ""
|
leetspeak = []
|
||||||
|
|
||||||
for word in message.split(" "):
|
for word in message.split(" "):
|
||||||
if word.lower() in [old for old, new in replacements]:
|
if word.lower() in [old for old, new in replacements]:
|
||||||
leet_word = word.replace([old for old, new in replacements][0], [new for old, new in replacements][0])
|
leet_word = word.replace([old for old, new in replacements][0], [new for old, new in replacements][0])
|
||||||
leetspeak = leetspeak + leet_word
|
leetspeak.append(leet_word)
|
||||||
else:
|
else:
|
||||||
|
word_chars = []
|
||||||
for char in word:
|
for char in word:
|
||||||
if char.lower() in char_map and random.random() <= 0.70: # 70% convert
|
if char.lower() in char_map and random.random() <= 0.70: # 70% convert
|
||||||
possible_replacements = char_map[char.lower()]
|
possible_replacements = char_map[char.lower()]
|
||||||
leet_replacement = random.choice(possible_replacements)
|
leet_replacement = random.choice(possible_replacements)
|
||||||
leetspeak = leetspeak + leet_replacement
|
word_chars.append(leet_replacement)
|
||||||
else:
|
else:
|
||||||
leetspeak = leetspeak + char
|
word_chars.append(char)
|
||||||
|
leetspeak.append("".join(word_chars))
|
||||||
|
|
||||||
return leetspeak
|
return " ".join(leetspeak)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user