def split_text(text, word_frequencies, cache):
    if text in cache:
        return cache[text]
if not text:
    return 1, []
best_freq, best_split = 0, []
for i in range(1, len(text) + 1):
    word, remainder = text[:i], text[i:]
Detect most likely words from text without spaces / combined words