twitter-text-python is a Tweet parser and formatter for Python. Amongst many things, the tasks that can be performed by this module are :
- reply : The username of the handle to which the tweet is bieng replied to.
- users : All the usernames mentioned in the tweet.
- tags : All the hashtags mentioned in the tweet.
- urls : All the URLs mentioned in the tweet.
- html : Adds hyperlinks to the fields mentioned above.
Example 1 :
The username being replied to is : twitter
All the usernames mentioned are : [‘twitter’, ‘TwitterIndia’]
All the hashtags mentioned are : [‘gfg’, ‘tweeple’]
All the URLs mentioned are : [‘https://twitter.com’]
Example 2 : We can also find the position of string (POS) by doing
include_spans = True.
All the usernames mentioned are : [(‘twitter’, (0, 8)), (‘TwitterIndia’, (130, 143))]
All the hashtags mentioned are : [(‘gfg’, (96, 100)), (‘tweeple’, (101, 109))]
All the URLs mentioned are : [(‘https://twitter.com’, (76, 95))]
- pwd module in Python
- grp module in Python
- MySQL-Connector-Python module in Python
- Arrow module in Python
- Import module in Python
- spwd module in Python
- Zulu module in Python
- Keyboard module in Python
- Pylint module in Python
- FreeGames module in Python
- Keyword Module in Python
- PyInputPlus module in Python
- Python - RemoveAccents Module
- Getopt module in Python
- Binarytree Module in Python
- StringIO Module in Python
- Pathlib module in Python
- Cmdparse module in Python
- Touch module in Python
- struct module in Python
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.