import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from wordcloud import WordCloud # Load the dataset internally within the EDA module df = pd.read_csv('Danamon Mobile Banking Reviews(D-Bank Pro).csv') def visualize_wordcloud(): """Generate a word cloud for the 'content' column.""" wordcloud = WordCloud(width=800, height=400, background_color='white').generate(' '.join(df['content'])) plt.figure(figsize=(10, 7)) plt.imshow(wordcloud, interpolation='bilinear') plt.axis('off') plt.title('Word Cloud for Reviews') return plt.gcf() # Return the current figure def plot_review_lengths(): """Plot the distribution of review lengths.""" review_lengths = df['content'].str.len() plt.figure(figsize=(12, 6)) sns.histplot(review_lengths, bins=50, kde=True) plt.title('Distribution of Review Lengths') plt.xlabel('Review Length (characters)') plt.ylabel('Number of Reviews') return plt.gcf() # Return the current figure def rating_distribution(): """Plot the distribution of ratings.""" ratings = df['score'].value_counts() plt.figure(figsize=(10, 6)) sns.barplot(x=ratings.index, y=ratings.values, palette="viridis") plt.title('Rating Distribution') plt.xlabel('Rating') plt.ylabel('Number of Reviews') return plt.gcf() # Return the current figure