# Path: pycryptics/utils/synonyms.py
# SYNONYMS = msgpack.load(f, use_list=False)
# 
# Path: pycryptics/utils/ngrams.py
# NGRAMS = msgpack.load(f, use_list=False)
# 
# Path: pycryptics/utils/transforms.py
# def split_words(ans, lengths):
#     j = 0
#     words = []
#     stop = 0
#     for l in lengths:
#         stop = j + l
#         if j >= len(ans):
#             return words
#         elif stop >= len(ans):
#             stop = len(ans)
#         words.append(ans[j:stop])
#         j += l
#     return words


from pycryptics.utils.synonyms import SYNONYMS
from pycryptics.utils.ngrams import NGRAMS
from pycryptics.utils.transforms import split_words
    from pycryptics.parse_and_solve import constraints
            if s in SYNONYMS:
                subs.add(s)
    if len(word) > 2:
        subs.add(word[:1] + word[-1:])
        if len(word) % 2 == 0:
            subs.add(word[len(word)//2-1:len(word)//2+1])
            subs.add(word[:len(word)//2-1] + word[len(word)//2+1:])
        else:
            subs.add(word[len(word)//2:len(word)//2+1])
            subs.add(word[:len(word)//2] + word[len(word)//2+1:])
        subs.add(word[1:-1])
    return bigram_filter(subs, constraints)


def all_insertions(words, constraints):
    assert len(words) == 2
    word1, word2 = [w.lower().replace('_', "") for w in words]
    results = set([])
    if len(word1) + len(word2) > sum(constraints.lengths):
        return None
    for j in range(1, len(word2)):
        results.add(word2[:j] + word1 + word2[j:])
    word2, word1 = word1, word2
    for j in range(len(word2)):
        results.add(word2[:j] + word1 + word2[j:])
    return bigram_filter(results, constraints)


def anagrams(words, constraints):
    assert len(words) == 1

# Path: pycryptics/utils/synonyms.py
# SYNONYMS = msgpack.load(f, use_list=False)
# 
# Path: pycryptics/utils/ngrams.py
# NGRAMS = msgpack.load(f, use_list=False)
# 
# Path: pycryptics/utils/transforms.py
# def split_words(ans, lengths):
#     j = 0
#     words = []
#     stop = 0
#     for l in lengths:
#         stop = j + l
#         if j >= len(ans):
#             return words
#         elif stop >= len(ans):
#             stop = len(ans)
#         words.append(ans[j:stop])
#         j += l
#     return words


# Path: pycryptics/utils/clue_funcs.py
from pycryptics.utils.synonyms import SYNONYMS
from pycryptics.utils.ngrams import NGRAMS
from pycryptics.utils.transforms import split_words
    from pycryptics.parse_and_solve import constraints

            if s in SYNONYMS:
                subs.add(s)
    if len(word) > 2:
        subs.add(word[:1] + word[-1:])
        if len(word) % 2 == 0:
            subs.add(word[len(word)//2-1:len(word)//2+1])
            subs.add(word[:len(word)//2-1] + word[len(word)//2+1:])
        else:
            subs.add(word[len(word)//2:len(word)//2+1])
            subs.add(word[:len(word)//2] + word[len(word)//2+1:])
        subs.add(word[1:-1])
    return bigram_filter(subs, constraints)


def all_insertions(words, constraints):
    assert len(words) == 2
    word1, word2 = [w.lower().replace('_', "") for w in words]
    results = set([])
    if len(word1) + len(word2) > sum(constraints.lengths):
        return None
    for j in range(1, len(word2)):
        results.add(word2[:j] + word1 + word2[j:])
    word2, word1 = word1, word2
    for j in range(len(word2)):
        results.add(word2[:j] + word1 + word2[j:])
    return bigram_filter(results, constraints)


def anagrams(words, constraints):
    assert len(words) == 1

    word = words[0].lower().replace('_', '')