14
I'm attempting to create an algorithm that will suggest Mad Gab style phrases.
The input is a set of phrases. I also have a set of keywords that I'd like to use when possible. Currently, my solution is simply brute force:
- loop over phrases (character by character)
- if keyword is found
- store keyword and branch (recursion)
- increment character count
- if keyword is found
However, the problems I am running into are:
- Account for compound keywords, e.g. "catches" can be "catches", "cat" + "cheeses"
- Allow literal terms - "the", "and", "one", "two", "three".
- How to suggest terms that are not keywords. i.e. fall back on something like the system dictionary when keywords or literals can not be found.
- Skip phrase segments. Right now it just does one pass through. But consider the case where the phrase starts with something unmatched but a few characters later contains matches.
I am most familiar with PHP and MySQL. However, I am open to another technology if it provides a better solution.
I am also interested in any additional suggestions. Particularly ways to use the second parameter of metaphone() to make harder suggestions.