text_summary_list_utils module

Created on Fri Apr 17 16:19:43 2020

@author: alice

text_summary_list_utils.create_list_of_summaries(data_groups)

Create a list of text summaries from a dataframe groupby object.

Parameters

data_groups (Pandas.GroupBy) – groupby object with data grouped by time

Returns

list of TextSummary objects for each bin

Return type

text_summary_list (list of TextSummary)

text_summary_list_utils.create_list_of_summaries_by_person(data_groups, names)

Same as create_list_of_summaries except divided by person - so one list per person packaged together in a big list.

Parameters
  • data_groups (Pandas.GroupBy) – groupby object with data grouped by time

  • names (list of str) – names of senders

Returns

[list of TextSummary objects for each bin]

Return type

text_summary_list_of_lists (list)

text_summary_list_utils.get_summary_attribute_list(text_summary_list, attribute, key)

Get a list of a dictionary value in an attribute from a list of TextSummaries.

Parameters
  • text_summary_list (list of TextSummary) – list of TextSummary objects

  • attribute (str) – string of the dictionary attribute name

  • key (str) – string of the dictionary key value to get

Returns

list of the values assigned to key in attribute for each TextSummary

Return type

attribute_list (list)

text_summary_list_utils.make_attribute_dict(summary_list)

Return a list of the things to plot given a list of textSummaries. Add new things to plot per bins here!

Parameters

summary_list (list of TextSummary) –

Returns

{key = title of the plot, value = list of the values}

Return type

attribute_dict (dictionary of lists of ints/floats)

text_summary_list_utils.make_occurrence_dict(summary_list, token_list)

Returns a dictionary of the list of occurrence of tokens for each TextSummary in a list of TextSummaries.

Parameters
  • summary_list (list) – list of TextSummaries.

  • token_list (list) – list of tokens, strings, to search for.

Returns

{“token”: [occurrence of token in each textSummary]}

Return type

occurrence_dict (dict)