word-break-trie
v1.0.1
Published
word-break util using trie-search dictionary
Downloads
20
Maintainers
Readme
word-break-trie
word-break util using a trie dictionary
TypeScript
import wordBreak from "word-break-trie";
import trie from "trie-prefix-tree";
test("wordBreak", () => {
const input = "ilikesamsung";
const dict = trie(["samsung", "like", "i"]);
const list = wordBreak(input, dict.hasWord);
expect(list.join("|")).toBe("i|like|samsung");
});