assert np.size(words) > 0, EMPTY_NP_ARRAY_MESSAGE
// initialize the value to return
all_results = {}
// find the total word count of each group
group_lists = [np.sum(value, axis=0)
for _, value in enumerate(group_values)]
// find number of groups
num_group = len(group_lists)
// comparison map, in here is a list of tuple.
// There are two elements in the tuple, each one is a index of groups
// (for example the first group will have index 0)
// Two groups index cannot be equal.
comp_map = itertools.product(list(range(num_group)),
list(range(num_group)))
comp_map = [(i_index, j_index)
for (i_index, j_index) in comp_map if i_index != j_index]
// compare each paragraph in group_comp to group_base
for group_comp_index, group_base_index in comp_map:
// gives all the paragraphs in the group in a array
group_comp_paras = group_values[group_comp_index]
// the word list of base group
group_base_list = group_lists[group_base_index]
// enumerate through all the paragraphs in group_comp_paras
for para_index, paras in enumerate(group_comp_paras):
word_z_score_dict = _z_test_word_list_(
count_list_i=paras,
count_list_j=group_base_list,
words=words)
// sort the dictionary
// pack the sorted result in sorted list
all_results.update(
{(group_comp_index, para_index, group_base_index):
word_z_score_dict})
return all_results