1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Feature Engineering for NLP in Python

Connected

Bài tập

Hashtags and mentions in Russian tweets

Let's revisit the tweets dataframe containing the Russian tweets. In this exercise, you will compute the number of hashtags and mentions in each tweet by defining two functions count_hashtags() and count_mentions() respectively and applying them to the content feature of tweets.

In case you don't recall, the tweets are contained in the content feature of tweets.

Hướng dẫn 1/2

undefined XP
  • 1

    In the list comprehension, use startswith() to check if a particular word starts with '#'.

  • 2

    In the list comprehension, use startswith() to check if a particular word starts with '@'.