Trying to count the emoji's from text

Viewed 138

I'm trying to count emoji's in textlines. These are tweets. I tried different codes, but they all return empty.

Eg:

emoticons

def split_count(text):
    emoji_counter = 0
    data = regex.findall(r'\X', text)
    for word in data:
        if any(char in emoji.UNICODE_EMOJI_ENGLISH for char in word):
            emoji_counter += 1
    return emoji_counter      

split_count_udf = F.udf(split_count, IntegerType())

kick_twitter_count = kick_twitter.withColumn("num_emoji", adv.emoji_counts["full_text"])

Error I got:

Error: AttributeError: module 'advertools' has no attribute 'emoji_counts'

emoji_dict stays empty as well:

Any ideas? It would help me a lot!

1 Answers
Related