2 ms·
I've done this before. You're right. The CPU intensive part is the word search itself. Building the combinations and finding adjacent words, which you've alread
by Todd 13y ago
I've done this before. You're right. The CPU intensive part is the word search itself. Building the combinations and finding adjacent words, which you've already done. The ngram piece is straightforward by comparison. Just compare the domain (with any hyphens removed) against a dictionary of concatenated ngrams. You'll have to veryify that any hyphens occur on word breaks afterwards, but it's a small price to pay for the simplicity of a string compare (or key lookup). You will probably want to load all of your ngram dictionaries into memory, though, or the search will be horribly slow.