def histogram(source_text):
    word_list = word_frequency.get_words(source_text)

    # count occurrence of strings:
    word_data_struct = Linked_List()
    for each_str in word_list:
        # if each_str in word_dict:
        each_node = word_data_struct.find_node_tuple(each_str)
        if each_node is not None:
            each_node.value = (each_node.value[0], each_node.value[1] + 1)
        else:
            # word_dict[each_str] = 1
            new_value = (each_str, 1)
            new_node = Node(new_value)
            word_data_struct.unshift(new_node)
    return word_data_struct
def histogram_tuples(source_text):
    word_list = word_frequency.get_words(source_text)
    word_list.sort()
    tuple_arr = []
    for idx, each_str in enumerate(word_list):
        # search list for tuples with 0th element == each_str
        existing_idx = None
        for inner_idx, each_tuple in enumerate(tuple_arr):
            if each_tuple[0] == each_str:
                existing_idx = inner_idx
                break
        if existing_idx is not None:
            old_tuple = tuple_arr[existing_idx]
            new_tuple = (old_tuple[0], old_tuple[1] + 1)
            tuple_arr[existing_idx] = new_tuple
        else:
            new_tuple = (each_str, 1)
            tuple_arr.append(new_tuple)
    return tuple_arr
def convert_histogram():  #text
    # text_stuff = text.split()
    # word_counts = word_frequency.histogram(text)
    word_counts = word_frequency.histogram(word_frequency.get_words())
    # print(word_counts)
    return word_counts