Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
chars = zalgo_position_dict[position]
count = intensities[position]
res_ = random.sample(chars, count)
random.shuffle(res_)
result__ += ''.join(res_)
result = result__
return result
else:
#Prettify
#Just assume that the following lines work, with a few bugs.
#It will make life easier.
text = [i for i in args.f]
for i in range(len(text)):
if text[i] in emoji.UNICODE_EMOJI:
if text[i] == emoji.emojize(':b:',use_aliases=True):
text[i] = 'B'
else:
text[i] = ' '
for lists in letter_list:
if text[i] in lists:
text[i] = chr(lists.index(text[i]) + 65)
for lenny in lenny_list:
temp_lenny = [c for c in lenny]
i = 0
while i< len(text) - len(temp_lenny):
if text[i] == temp_lenny[0] and text[i:i+len(temp_lenny)] == temp_lenny:
del text[i:i+len(temp_lenny)]
else:
i += 1
def is_emoji(letter):
return letter in UNICODE_EMOJI
"""
Common emoji code.
"""
import emoji
EMOJIS = set(emoji.emojize(emoji_code) for emoji_code in emoji.UNICODE_EMOJI.values())
def is_emoji(c):
return c in EMOJIS
async def emote(self, ctx):
'''Random emote/emoji'''
await ctx.embed_reply(random.choice(list(emoji.UNICODE_EMOJI)))
def normalize(word):
word = word.lower().strip(string.punctuation).replace("’", "\'")
# remove all emojis :(
for c in word:
if c in emoji.UNICODE_EMOJI:
return None
return word
def is_only_emoji(text):
"""
Test if an incoming text is only composed of emojis.
"""
result = True
for c in text:
if c not in UNICODE_EMOJI:
result = False
break
return result
def remove_emojis(sentence):
import emoji
allchars = [str for str in sentence]
l = [c for c in allchars if c not in emoji.UNICODE_EMOJI]
return ''.join(l)
def read_english(path="english_words.txt", add_emojis=True):
# read english words for filtering (includes emojis as part of set)
english = set()
with codecs.open(path, "r", "utf-8") as f:
for line in f:
line = line.strip().lower().replace('\n', '')
if len(line):
english.add(line)
if add_emojis:
for e in UNICODE_EMOJI:
english.add(e)
return english