Chat Analyzer

class main.components.chat.ChatAnalyzer(fp: str = '', data: str | None = None)

The ChatAnalyzer object contains functions used for Chat Analyzer tab

Methods:

get_distribution_of_messages_by_day(text_df)

Get distribution of messages by day

get_distribution_of_messages_by_hour(text_df)

Get distribution of messages by time sent (grouped on daily level)

get_time_series_day_plot(text_df, template)

Get figure for plot Adds plotly.graph_objects charts for line plot

get_time_series_hour_plot(text_df, template)

Get figure for plot Adds plotly.graph_objects charts for line plot

get_word_cloud(text_df[, max_words, plotly])

Get figure for plot Adds plotly.graph_objects charts for word cloud plot

process_chat()

Process chat to get statistics and intermediate message data

static get_distribution_of_messages_by_day(text_df: DataFrame) DataFrame

Get distribution of messages by day

Parameters:

text_df – text message data

Returns:

data with columns (sender, day, counts)

static get_distribution_of_messages_by_hour(text_df: DataFrame) DataFrame

Get distribution of messages by time sent (grouped on daily level)

Parameters:

text_df – text message data

Returns:

data with columns (sender, hour, counts)

Return type:

(pd.DataFrame)

get_time_series_day_plot(text_df: DataFrame, template: str) Figure

Get figure for plot Adds plotly.graph_objects charts for line plot

Parameters:
  • text_df – text message data

  • template – template of plot

Returns:

Message count by date plot

get_time_series_hour_plot(text_df: DataFrame, template: str) Figure

Get figure for plot Adds plotly.graph_objects charts for line plot

Parameters:
  • text_df – all chat data where type is message

  • template – template of plot

Returns:

Message count by hour plot

static get_word_cloud(text_df: DataFrame, max_words: int = 100, plotly: bool = True) Img

Get figure for plot Adds plotly.graph_objects charts for word cloud plot

Parameters:
  • text_df – text message data

  • max_words – maximum words to consider in word cloud

  • plotly – whether image should be returned to console, defaults to True (hidden from console)

Returns:

Word cloud image

process_chat()

Process chat to get statistics and intermediate message data

Returns: 2-element tuple

  • process_text (pd.DataFrame): statistics of chat

  • text_df (pd.DataFrame): text message data