In this project we analyzes tweets from a CSV file and provides insights about a specific hashtag. It identifies the most common words used in tweets containing the hashtag and also retrieves a list of accounts that have used the hashtag. The code utilizes the Natural Language Toolkit (NLTK) library for text processing and analysis.
- Python 3.x
- NLTK library
To use this script, please follow these steps:
- Clone this repository to your local machine:
git clone https://github.com/Amirrezahmi/Zozo-Assistant.git
- Install the NLTK library by running the following command:
pip install nltk
- Download the required NLTK resources by executing the following code snippet:
import nltk
nltk.download('stopwords')
nltk.download('averaged_perceptron_tagger')
- Ensure that you have a CSV file containing the tweets you want to analyze.
- Open the script
hashtag_analyzer.py
in your preferred Python IDE or text editor. - Modify the following line of code to specify the path to your CSV file:
with open('teet.csv', 'r', encoding='latin-1') as f:
- Run the script.
- When prompted, enter the hashtag you want to analyze (without the '#').
- The script will perform the following tasks:
- Extract all the words from the tweets that contain the specified hashtag.
- Remove stop words and numbers from the list of words.
- Classify each word as an adjective, verb, or other type of word.
- Count the frequency of each word.
- Return the top three most common words and their counts.
- Find the accounts that use the specified hashtag.
- The script will display the results in the console:
Three most repeated words:
<word1>: <count1>
<word2>: <count2>
<word3>: <count3>
List of accounts:
<account1>
<account2>
<account3>
...
Here's an secreenshot of a sample example:
Contributions are welcome! If you'd like to contribute to this project, please follow these steps:
- Fork the repository.
- Create a new branch: git checkout -b my-new-branch.
- Make your changes and commit them: git commit -m 'Add some feature'.
- Push to the branch: git push origin my-new-branch.
- Submit a pull request.
This project is licensed under the MIT License.
For any questions or inquiries, please contact amirrezahmi2002@gmail.com