# 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
from __future__ import division


def reverse(s, constraints):
    assert len(s) == 1
    return bigram_filter([''.join(reversed(s[0]))], constraints)

def internal_substrings(words, constraints):
    assert len(words) == 1
    word = words[0].lower().replace('_', "")
    length = sum(constraints.lengths)
    subs = set([])
    if len(word) <= 1:
        return subs
    if len(word) > length:
        for i in range(1, len(word) - length):
            s = word[i:i+length]
            if s in SYNONYMS:
                subs.add(s)

# 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

from __future__ import division


def reverse(s, constraints):
    assert len(s) == 1
    return bigram_filter([''.join(reversed(s[0]))], constraints)

def internal_substrings(words, constraints):
    assert len(words) == 1
    word = words[0].lower().replace('_', "")
    length = sum(constraints.lengths)
    subs = set([])
    if len(word) <= 1:
        return subs
    if len(word) > length:
        for i in range(1, len(word) - length):
            s = word[i:i+length]
            if s in SYNONYMS:
                subs.add(s)

    if len(word) > 2: