S[] findMeaningfulWordSplit(S)(S word, HLang[] langs = []) if (isSomeString!S) { S second = word; for (size_t i = 1; i + 1 < word.length; i++) { second = second.dropExactly(i).to!string; const first = word[0..$-second.length]; if (this.canMeanSomething(first, langs) && this.canMeanSomething(second, langs)) { return [first, second]; } } return typeof(return).init; }
Re: Find Semantically Correct Word Splits in UTF-8 Strings
Kagamin via Digitalmars-d-learn Wed, 01 Oct 2014 07:16:29 -0700
- Find Semantically Correct Word Split... Nordlöw
- Re: Find Semantically Correct W... Nordlöw
- Re: Find Semantically Corre... Nordlöw
- Re: Find Semantically Corre... Kagamin via Digitalmars-d-learn
- Re: Find Semantically Corre... monarch_dodra via Digitalmars-d-learn
- Re: Find Semantically Corre... monarch_dodra via Digitalmars-d-learn
- Re: Find Semantically C... Nordlöw
- Re: Find Semantical... monarch_dodra via Digitalmars-d-learn
- Re: Find Seman... Nordlöw
- Re: Find Semantically Correct W... monarch_dodra via Digitalmars-d-learn
- Re: Find Semantically Corre... Nordlöw