There are straightforward ways to convert English words to phonemes via a dictionary that contains such information. However, is there a way to automatically convert English text into syllables? I.e., to split the word "doctor" into the two syllables "doc_tor"? I'd like to do this for a large text and thus an automated procedure would be essential.
I looked at the SO discussion (and admit that I can't compute the consequences of all of the code). Those guys even admit that hyphenation solutions can't handle quasi-novel data (such as names of Welsh origin). Linguists can contribute linguistic clarity to the discussion.
I maintain that the SO answers do not yield correct syllabification, since syllabification and hyphenation are not the same thing. For example, in the SO OP's question, s/he gives the example in-vi-sib-le, where the penult is closed with /b/ and the final syllable is "le", whatever that means. The standard understanding over the past almost 40 years is that this word is syllabified [ɪn.vɪ.zə.bl̩] or [ɪn.vɪ.zə<.>b<.>l̩], where "<.>b<.>l̩" is a clunky way of writing ambisyllabic b.
The major premise is that the procedure would map (spelled) words from text to ?transcribed strings with syllable boundaries, and a minor premise (which I think we should assume the OP had in mind) is that the procedure would do so just on the basis of the letters -- rather than e.g. calling up a hyphenated dictionary and inserting syllable boundaries where there are hyphens (a fairly obvious kludge). English syllabification is partly sensitive to stress, especially to get the correct intervocalic syllabification of consonants. Just based on spelling, you can't automatically compute the stress difference between "latest" and "latex", or "tigress" and "progress".
I argue that the answer is, "no, it cannot be done", assuming a self-contained linguistic approach to the problem. (That is, without linking the procedure to an external phonetically-transcribed dictionary or similar object; and without hard-coding a long list of words where the algorithm fails). The primary reason why it would fail in principle is that syllabification isn't based on spelling. The secondary reason why it would fail is because it isn't even clear to linguists what the answer should be. For instance, in many dialects of American English, it's impossible to determine how many syllables there are in towel, foul -- could be 1, could be two. There is much debate over how intervocalic consonants are to be syllabified (is the first syllable of "hammer" closed? does the second syllable have an onset consonant?).