Skip to content
This repository has been archived by the owner on Jul 1, 2023. It is now read-only.

Contains two Python codes, CoxJames_CategoryAnalysis.py and CoxJames_FeedbackCategorisation+SentimentAnalysis.py, designed for analysing and categorising feedback data.

License

Notifications You must be signed in to change notification settings

JamesWC-Work/Feedback-Analyser

Repository files navigation

CoxJames - Feedback Categorisation and Sentiment Analysis

Overview:

The project consists of two Python codes: CoxJames_CategoryAnalysis.py and CoxJames_FeedbackCategorisation+SentimentAnalysis.py. These codes are designed to perform category analysis and sentiment analysis on feedback data stored in Excel files.

By combining these two codes, users can analyse feedback data, extract relevant keywords, categorise feedback, and perform sentiment analysis, allowing them to gain valuable insights into the feedback received and understand the sentiment associated with different categories. These insights can be utilised for various purposes, such as improving products or services, identifying areas of improvement, and making data-driven decisions based on customer feedback.

Description of CoxJames_CategoryAnalysis_NgramGeneration:

The main purpose of CoxJames_CategoryAnalysis.py is to analyse feedback data and extract relevant keywords for predefined category. The code reads an Excel file containing feedback and category information. It tokenises the feedback, removes stopwords, creates n-grams, and tags the tokens with part-of-speech tags. It then extracts keywords based on the assigned categories and writes them to the "Dictionary" sheet of another Excel file. This code helps in identifying significant keywords associated with each feedback category.

Usage:

  1. Install the required libraries:

    pip install openpyxl nltk
  2. Place the Python script (CoxJames_CategoryAnalysis.py) in a directory along with the following files:

    • The input Excel file containing feedback and categories.
    • The Stopwords List Expanded.txt file.
  3. Open the Python script in a text editor.

  4. Replace 'INSERT EXCEL FILE NAME' with the actual filename of the input Excel file. The line to modify is:

    wb = openpyxl.load_workbook(os.path.join(dir_path, 'INSERT EXCEL FILE NAME'))
  5. Save the changes to the Python script.

  6. Open a terminal or command prompt and navigate to the directory where the Python script is located.

  7. Run the Python script:

    python CoxJames_CategoryAnalysis.py

    The script will execute and perform the category analysis on the feedback data.

  8. After the execution completes, a new Excel file named Dictionary_Output.xlsx will be generated in the same directory. This file will contain the extracted keywords categorized by the original feedback categories.

  9. You can open the Dictionary_Output.xlsx file in a spreadsheet application (e.g., Microsoft Excel, Google Sheets) to view and analyze the extracted keywords.

  10. The category analysis process is complete. You can use the extracted keywords for further analysis or any other relevant tasks.

Note: Make sure you have appropriate permissions to read and write files in the specified directory.

Description of CoxJames_FeedbackCategorisation+SentimentAnalysis:

The main purpose of CoxJames_FeedbackCategorisation+SentimentAnalysis.py is to categorise feedback based on custom categories and perform sentiment analysis. It reads an Excel file containing feedback data and utilises the previously generated "Dictionary" sheet to categorise the feedback based on the extracted keywords. Additionally, the code performs sentiment analysis using the SentimentIntensityAnalyzer from the NLTK library. The results, including the assigned categories and sentiment scores, are saved in separate sheets of a new Excel file. This code enables the categorisation and sentiment analysis of feedback data, providing valuable insights into customer sentiment and feedback trends.

Usage:

  1. Install the required libraries:

    pip install openpyxl nltk matplotlib pandas numpy
  2. Place the Python script (CoxJames_FeedbackCategorisation+SentimentAnalysis.py) in a directory along with the following files:

    • The input Excel file containing feedback.
    • The Dictionary_Output.xlsx file generated by the previous Python code (CoxJames_CategoryAnalysis.py).
  3. Open the Python script in a text editor.

  4. Replace 'INSERT EXCEL FILE NAME' with the actual filename of the input Excel file. The line to modify is:

    df = pd.read_excel(os.path.join(dir_path, 'INSERT EXCEL FILE NAME'), sheet_name='Raw')
  5. Save the changes to the Python script.

  6. Open a terminal or command prompt and navigate to the directory where the Python script is located.

  7. Run the Python script:

    python CoxJames_FeedbackCategorisation+SentimentAnalysis.py

    The script will execute and perform the feedback categorisation and sentiment analysis.

  8. After the execution completes, a new Excel file named Category_Analysis_Output.xlsx will be generated in the same directory. This file will contain two sheets:

    • summary: Contains a summary of the data, including the count and mean sentiment for each category.
    • raw: Contains the original feedback data with the assigned categories and sentiment scores.
  9. You can open the Category_Analysis_Output.xlsx file in a spreadsheet application (e.g., Microsoft Excel, Google Sheets) to view and analyse the categorised feedback and sentiment analysis results.

  10. The feedback categorisation and sentiment analysis process is complete. You can use the output file for further analysis or any other relevant tasks.

Note: Make sure you have appropriate permissions to read and write files in the specified directory.

About

Contains two Python codes, CoxJames_CategoryAnalysis.py and CoxJames_FeedbackCategorisation+SentimentAnalysis.py, designed for analysing and categorising feedback data.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages