Skip to main content

Process reviews data, apply text preprocessing, and generate a chord plot visualization showing word co-occurrence patterns and sentiment analysis.

Project description

ChordReviewsVis Package

Overview

ChordReviewsVis is a Python package designed to process and visualize review data by generating chord plots. These visualizations illustrate word co-occurrence patterns and sentiment analysis, providing insights into the textual data.

This package was developed by Félix José Funes as part of his master's dissertation at Universidade Nova de Lisboa, which was supervised by Prof. Nuno António, PhD.

Installation

To install ChordReviewsVis, use pip:

pip install ChordReviewsVis

Usage

First, import the necessary libraries and the ChordReviews function:

import pandas as pd
from ChordReviewsVis import ChordReviews

Prepare your DataFrame with a text column containing review data. Then call the ChordReviews function:

# Example DataFrame
df = pd.read_csv("filepath")

# Generate chord plot
ChordReviews(df, 'review')

Some datasets that can be used for this purpose are:

Function Parameters

  • df (pandas.DataFrame): DataFrame containing review data.
  • text_column (str): Name of the column containing the text data.
  • size (int, optional): Size of the output chord plot. Default is 300.
  • stopwords_to_add (list, optional): Additional stopwords to include in the stop words set. Default is an empty list.
  • stemming (bool, optional): Whether to apply stemming to words. Default is False.
  • lemmatization (bool, optional): Whether to apply lemmatization to words. Default is True.
  • words_to_replace (dict, optional): A dictionary where keys are words to be replaced and values are the replacements. Default is an empty dictionary.
  • label_text_font_size (int, optional): Font size for the labels in the chord plot. Default is 12.

Returns

  • hv.Chord: A chord plot visualization of word co-occurrence patterns and sentiment analysis.

Example

import pandas as pd
from ChordReviewsVis import ChordReviews

# Example DataFrame
df = pd.read_csv("https://github.com/felix-funes/ChordReviewsVis/raw/main/Test%20Dataset%20-%20IMDB%20Movie%20Reviews.csv")

# Generate chord plot
chord_plot = ChordReviews(df, 'review')

# Display the plot
chord_plot.show()

[chord plot example]

Dependencies

Ensure you have the following libraries installed:

  • pandas
  • numpy
  • nltk
  • BeautifulSoup
  • re
  • holoviews

These can be installed via pip:

pip install pandas numpy nltk beautifulsoup4 re holoviews

License

This project is licensed under the MIT License.

Contact

For any issues or inquiries, please contact the package maintainer at felixfunes96 [at] gmail [dot] com.


By using this package, you agree to the terms outlined in the LICENSE file included in the repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chordreviewsvis-0.2.7.tar.gz (6.9 kB view hashes)

Uploaded Source

Built Distribution

ChordReviewsVis-0.2.7-py3-none-any.whl (7.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page