On Wednesday, 1 October 2014 at 11:06:24 UTC, Nordlöw wrote:
I'm looking for a way to make my algorithm


Update:

    S[] findMeaningfulWordSplit(S)(S word,
HLang[] langs = []) if (isSomeString!S)
    {
        for (size_t i = 1; i + 1 < word.length; i++)
        {
            const first = word.takeExactly(i).to!string;
            const second = word.dropExactly(i).to!string;
            if (this.canMeanSomething(first, langs) &&
                this.canMeanSomething(second, langs))
            {
                return [first,
                        second];
            }
        }
        return typeof(return).init;
    }

works but has unfortunately O(word.length^^2) time-complexity.

Do we need a new InputRange algorithm for this?

Reply via email to