Search code examples
twittertweepytweets

How to find the language of a Tweet using Tweepy?


I gave a stream of Tweets that I filter based on certain criteria. I do not wish to use the language criteria during streaming itself. Rather, I wish to know the language of such filtered tweets.

I'm using Tweepy for streaming. Kindly suggest to me a solution for this.


Solution

  • Status/Tweet objects have a lang attribute. Note though, that it is nullable, meaning it could be None:

    When present, indicates a BCP 47 language identifier corresponding to the machine-detected language of the Tweet text, or und if no language could be detected.