-1

I am trying to convert a word to syllable using regular expression. What is the regular expression for converting. I found it for Indonesian language:

[^aeiou]?[aeiou]((ng|[^aeiou])(?![aeiou]))?
stema
  • 80,307
  • 18
  • 92
  • 121
Natto
  • 201
  • 1
  • 4
  • 16
  • 1
    I doubt very much that you will be able to acheive this using a regular expression - it's a very hard problem! Please see this post: http://stackoverflow.com/questions/405161/detecting-syllables-in-a-word – RB. Aug 08 '12 at 12:09

1 Answers1

0

English is famously irregular - you simply cannot discern the pronunciation of a word from its spelling. Certainly no regex will come close to doing what you want.

(If you were to have a reasonable crack at this you'd need to have a set of rules of how to tokenise a word into syllables, as well as a (large) list of exceptions and special cases. This is definitely not possible with a regular language, and would be very challenging to do as a full-blown program.)

Andrzej Doyle
  • 97,637
  • 30
  • 185
  • 225
  • How about using the syllable counter program to seperate the syllables,like each time the syllable get counted we can retreive the starting index and final index before counting so that we can retreive the array values and store it in a seperate array and display it. – Natto Aug 08 '12 at 12:33
  • @Natto - how about using **which** syllable counter program? If you have such a program/library available, by all means use it. – Andrzej Doyle Aug 09 '12 at 08:57