Counting user interventions

Counting the user interventions can give relevant insights on which users “dominate” the conversation, even more in a group chat. To this end, object FigureBuilder has the method user_interventions_count_linechart, which generates a plotly figure with the count of user interventions.

First of all, we load a chat and create an instance of FigureBuilder.

>>> from whatstk import WhatsAppChat, FigureBuilder
>>> from whatstk.graph import plot
>>> from whatstk.data import whatsapp_urls
>>> chat = WhatsAppChat.from_source(filepath=whatsapp_urls.LOREM_2000)
>>> fb = FigureBuilder(chat=chat)

Count of user interventions

Default call of the aforementioned method displays the number of interventions sent by each user per day.

>>> fig = fb.user_interventions_count_linechart()
>>> plot(fig)

As seen in previous plot, the number of messages sent per user in a day tends to oscilate quite a lot from day to day, which might difficult a good visualisation of the data. Hence, we can use cumulative=True to illustrate the cumulative count of interventions instead.

>>> fig = fb.user_interventions_count_linechart(cumulative=True, title='User inteventions count (cumulative)')
>>> plot(fig)