This Python script performs sentiment analysis on three different books that won the International Arabic Fiction Award, and extracts extended contexts for specific keywords in the text. It utilizes the Natural Language Toolkit (NLTK) library for text processing and the VADER sentiment analysis tool to provide insights into the emotional tone of the text. This code can be used for any book, just make sure you change the name of the book in the code.
Before running the script, ensure that you have the necessary libraries installed. You can install them via pip:
pip install nltk vaderSentiment
Additionally, make sure you have the book text files available in the same directory as the script and correctly named.
- Place the script in the same directory as the book text files.
- Install the required libraries, as mentioned in the Prerequisites section.
- Execute the script using Python
python script.py
Upon execution, the script will display the sentiment analysis results for each book. Furthermore, it will provide the extracted contexts surrounding the specified keywords for in-depth analysis.