# Path: linguistica/util.py
# NULL = 'NULL'


from linguistica.util import NULL

        successors[word_being_built].add(NULL)

    return successors


def common_prefix_length(s1, s2):
    # ensure that s1 is not longer than s2
    length = len(s1)
    if length > len(s2):
        return common_prefix_length(s2, s1)

    for i in range(length):
        if s1[i] != s2[i]:
            return i
    return length


# noinspection PyPep8
def reverse_direction(str_to_sequences_of_strings, is_list=False):
    output_dict = dict()
    for s, sequence_of_strings in str_to_sequences_of_strings.items():
        if type(sequence_of_strings) is set:
            new_sequence = set()
            grow = lambda sequence_, new_item: sequence_.add(new_item)  # noqa
        else:  # sequences_of_strings is a list
            new_sequence = list()
            grow = lambda sequence_, new_item: sequence_.append(new_item)  # noqa

        for item in sequence_of_strings:

# Path: linguistica/util.py
# NULL = 'NULL'


# Path: linguistica/trie.py
from linguistica.util import NULL


        successors[word_being_built].add(NULL)

    return successors


def common_prefix_length(s1, s2):
    # ensure that s1 is not longer than s2
    length = len(s1)
    if length > len(s2):
        return common_prefix_length(s2, s1)

    for i in range(length):
        if s1[i] != s2[i]:
            return i
    return length


# noinspection PyPep8
def reverse_direction(str_to_sequences_of_strings, is_list=False):
    output_dict = dict()
    for s, sequence_of_strings in str_to_sequences_of_strings.items():
        if type(sequence_of_strings) is set:
            new_sequence = set()
            grow = lambda sequence_, new_item: sequence_.add(new_item)  # noqa
        else:  # sequences_of_strings is a list
            new_sequence = list()
            grow = lambda sequence_, new_item: sequence_.append(new_item)  # noqa

        for item in sequence_of_strings:

            if item != NULL: