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


from itertools import (combinations, groupby)
from linguistica.util import NULL
    shorter_word_length = len(b)

    for i in range(shorter_word_length):
        if not a[i] == b[i]:
            return a[:i]
    return a[: shorter_word_length]


def max_common_suffix(a, b):
    return max_common_prefix(a[::-1], b[::-1])[::-1]


def make_stems_to_signatures(sigs_to_stems):
    stems_to_sigs = dict()

    for sig in sigs_to_stems.keys():
        for stem in sigs_to_stems[sig]:
            if stem not in stems_to_sigs:
                stems_to_sigs[stem] = set()
            stems_to_sigs[stem].add(sig)

    return stems_to_sigs


def check_affix(word, affix, suffixing):
    if suffixing:
        is_affix = lambda word_, affix_: word_.endswith(affix_)  # noqa
    else:
        is_affix = lambda word_, affix_: word_.startswith(affix_)  # noqa


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


# Path: linguistica/signature.py
from itertools import (combinations, groupby)
from linguistica.util import NULL

    shorter_word_length = len(b)

    for i in range(shorter_word_length):
        if not a[i] == b[i]:
            return a[:i]
    return a[: shorter_word_length]


def max_common_suffix(a, b):
    return max_common_prefix(a[::-1], b[::-1])[::-1]


def make_stems_to_signatures(sigs_to_stems):
    stems_to_sigs = dict()

    for sig in sigs_to_stems.keys():
        for stem in sigs_to_stems[sig]:
            if stem not in stems_to_sigs:
                stems_to_sigs[stem] = set()
            stems_to_sigs[stem].add(sig)

    return stems_to_sigs


def check_affix(word, affix, suffixing):
    if suffixing:
        is_affix = lambda word_, affix_: word_.endswith(affix_)  # noqa
    else:
        is_affix = lambda word_, affix_: word_.startswith(affix_)  # noqa


    if affix == NULL: