I’m trying to is generate all possible syllable combinations for a given word. The process for identifying what’s a syllable isn’t relevant here, but it’s the generating of all combinations that’s giving me a problem. I think this is probably possible to do recursively in a few lines I think (though any other way is fine), but I’m having trouble getting it working. Can anyone help ?
// how to test a syllable, just for the purpose of this example
bool IsSyllable(string possibleSyllable)
{
return Regex.IsMatch(possibleSyllable, "^(mis|und|un|der|er|stand)$");
}
List<string> BreakIntoSyllables(string word)
{
// the code here is what I'm trying to write
// if 'word' is "misunderstand" , I'd like this to return
// => {"mis","und","er","stand"},{ "mis","un","der","stand"}
// and for any other combinations to be not included
}
Try starting with this:
This returns:
Does that help to begin with at least?
EDIT: I thought a bit further about this problem an came up with this couple of queries:
Now
queryreturn this:Let me know if that’s nailed it now.