Chat Analyzer

class components.chat.ChatAnalyzer(fp='', data=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)

Get figure for plot

get_time_series_hour_plot(text_df)

Get figure for plot

get_word_cloud(text_df[, max_words, plotly])

Get figure for plot

process_chat()

Process chat to get statistics and intermediate message data

static get_distribution_of_messages_by_day(text_df)

Get distribution of messages by day

Parameters

text_df (pd.DataFrame) – text message data

Returns

data with columns (sender, day, counts)

Return type

(pd.DataFrame)

static get_distribution_of_messages_by_hour(text_df)

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

Parameters

text_df (pd.DataFrame) – text message data

Returns

data with columns (sender, hour, counts)

Return type

(pd.DataFrame)

get_time_series_day_plot(text_df)

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

Parameters

text_df (pd.DataFrame) – text message data

Returns

(dict)

get_time_series_hour_plot(text_df)

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

Parameters

text_df (pd.DataFrame) – all chat data where type is message

Returns

(dict)

static get_word_cloud(text_df, max_words=100, plotly=True)

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

Parameters
  • text_df (pd.DataFrame) – text message data

  • max_words (int) – maximum words to consider in word cloud

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

Returns

(html.Img)

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