How to compute number of syllables in a word in javascript?
<p>Is there javascript library for counting number of syllables in a word? How to count?</p>

<p>Thanks</p>

<p><strong>Edit</strong></p>

<p>Thank Sydenam and zozo for useful information and possible answers.</p>

<p>I found code by <a href="http://stackoverflow.com/questions/1271918/ruby-count-syllables">Pesto at this forum</a> , but it is in Ruby. One of its concise versions is below: </p>

<pre><code>def new_count(word)
  word.downcase!
  return 1 if word.length &lt;= 3
  word.sub!(/(?:[^laeiouy]es|ed|[^laeiouy]e)$/, '')
  word.sub!(/^y/, '')
  word.scan(/[aeiouy]{1,2}/).size
end 
</code></pre>

<p>This seems short but complicated. Can you translate this function into javascript?
Thank you again.</p>
