<rss xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" version="2.0">
  <channel>
    <title>MaplePrimes - answers and comments on Question, StringTools[SyllableLength]  missing rules</title>
    <link>http://www.mapleprimes.com/questions/141434-StringToolsSyllableLength--Missing-Rules</link>
    <language>en-us</language>
    <copyright>2026 Maplesoft, A Division of Waterloo Maple Inc.</copyright>
    <generator>Maplesoft Document System</generator>
    <lastBuildDate>Tue, 09 Jun 2026 10:19:48 GMT</lastBuildDate>
    <pubDate>Tue, 09 Jun 2026 10:19:48 GMT</pubDate>
    <itunes:subtitle />
    <itunes:summary />
    <description>The latest answers and comments added to the Question, StringTools[SyllableLength]  missing rules</description>
    <image>
      <url>http://www.mapleprimes.com/images/mapleprimeswhite.jpg</url>
      <title>MaplePrimes - answers and comments on Question, StringTools[SyllableLength]  missing rules</title>
      <link>http://www.mapleprimes.com/questions/141434-StringToolsSyllableLength--Missing-Rules</link>
    </image>
    <item>
      <title>StringTools</title>
      <link>http://www.mapleprimes.com/questions/141434-StringToolsSyllableLength--Missing-Rules?ref=Feed:MaplePrimes:StringTools[SyllableLength]  missing rules:Comments#comment242666</link>
      <itunes:summary>&lt;p&gt;Any thoughts as to why StringTools(SyllableLength) has not been fixed in Maple yet?&lt;/p&gt;
</itunes:summary>
      <description>&lt;p&gt;Any thoughts as to why StringTools(SyllableLength) has not been fixed in Maple yet?&lt;/p&gt;
</description>
      <guid>242666</guid>
      <pubDate>Sat, 21 Oct 2017 23:28:17 Z</pubDate>
      <itunes:author>Christopher2222</itunes:author>
      <author>Christopher2222</author>
    </item>
    <item>
      <title>Well this is a can of worms!</title>
      <link>http://www.mapleprimes.com/questions/141434-StringToolsSyllableLength--Missing-Rules?ref=Feed:MaplePrimes:StringTools[SyllableLength]  missing rules:Comments#comment242701</link>
      <itunes:summary>&lt;p&gt;The conclusion I have come to is that &lt;strong&gt;accurate&lt;/strong&gt; syllable counting &lt;strong&gt;cannot be achieved&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I think that Maple&amp;#39;s &amp;quot;get-out&amp;quot; on this one, is (from the help page)&lt;/p&gt;

&lt;p style="margin-left: 40px;"&gt;The&lt;strong&gt; morphological&lt;/strong&gt; syllable length is defined to be the &lt;strong&gt;number of vowel-consonant &lt;/strong&gt;changes in word. (Note that this &lt;strong&gt;may not agree with the lexical syllable length&lt;/strong&gt; found in dictionaries.)&lt;/p&gt;

&lt;p&gt;Before I came to the conclusion above I thought it might be fun to try and work out what &amp;quot;rules&amp;quot; are actually being applied by Maple&amp;#39;s&amp;nbsp; SyllableLength()&amp;nbsp; command, and whether ti might be possible to do better&lt;/p&gt;

&lt;p&gt;A moment&amp;#39;s thought will convinece you that a reasonable stab at the basic algorithm would be to &amp;quot;telescope&amp;quot; all adjacent consonants to a single consonant, and all adjacent vowels to a single vowel. With &amp;#39;V&amp;#39; representing a vowel and &amp;#39;C&amp;#39; representing a consonant, this would result in a string of alternating &amp;quot;V&amp;quot;, &amp;quot;C&amp;quot; characters - for example the word &amp;quot;straight&amp;quot; would be transformed to &amp;quot;CCCVVCCC&amp;quot;, which would then be &amp;quot;telescoped&amp;quot; to &amp;quot;CVC&amp;quot;. Then just count the number of occurrences of the &amp;quot;V&amp;quot; character in the resulting string. So I wrote a little procedure to do this -it&amp;#39;s pretty trivial. (I apologise for parts of this - it&amp;#39;s a long time since I used any regexp stuff, and I was never that great with &amp;#39;regexps&amp;#39; anyway)&lt;/p&gt;

&lt;p&gt;My experimentation suggest that this is pretty much what the SyllableLength() command in Maple actually does. However it does apply a few extras: for example the above algorithm will render &amp;quot;bake&amp;quot; as &amp;quot;CVCV&amp;quot; and hence count two syllables. The Maple command appears to &amp;quot;get around&amp;quot; this by ignoring &lt;strong&gt;all&lt;/strong&gt; trailing vowels, so SyllableLength(&amp;quot;bake&amp;quot;) returns 1, but so does SyllableLength(&amp;quot;llama&amp;quot;)&amp;nbsp; or SyllableLength(&amp;quot;guru&amp;quot;)&amp;nbsp; - not good.&lt;/p&gt;

&lt;p&gt;However a trivial piece of regexp magic will reduce the syllable count by one &lt;strong&gt;only&lt;/strong&gt; if the word ends in consonant+&amp;quot;e&amp;quot;+(zero or one)&amp;quot;s&amp;quot;. This works, but has the unfortunate side-effect or reducing words such as &amp;quot;he&amp;quot;, &amp;quot;the&amp;quot;, &amp;quot;due&amp;quot;, etc to zero syllables. Another no-brainer: jonly apply this step if the input syllable length is greater than 1.&lt;/p&gt;

&lt;p&gt;Then I got to your last example - ie &amp;quot;radio&amp;quot;, which the basic algorithm describe above would collapse to&amp;nbsp; &amp;quot;CVCV&amp;quot; and so the syllable count would be off by 1. Again. another little piece of regexp magic will fix this - any word ending in &amp;quot;io&amp;quot; should have the syllable count increased by 1. However what happens if the &amp;quot;io&amp;quot; is not at the end of the word? consonant+&amp;quot;io&amp;quot;+consonant can be one or two syllables depending on whether the leading consonant is &amp;quot;t&amp;quot;, &amp;quot;g&amp;quot;, or &amp;quot;s&amp;quot;. So OK another little piece or regexp.&lt;/p&gt;

&lt;p&gt;Probably because of this last example, I then started thinking about the &amp;quot;ious&amp;quot; problem - think the difference between &amp;quot;specious&amp;quot; and &amp;quot;serious&amp;quot;. It would seem that &amp;quot;ious&amp;quot; is one syllable when preceded by &amp;quot;c&amp;quot;, &amp;quot;g&amp;quot; &amp;quot;t&amp;quot; or &amp;quot;x&amp;quot; (think &amp;quot;specious&amp;quot;, &amp;quot;facetious&amp;quot;, &amp;quot;egregious&amp;quot; or &amp;quot;noxious&amp;quot;) but otherwise is two syllables ( think &amp;quot;serious&amp;quot;, &amp;quot;odious&amp;quot;, &amp;quot;pious&amp;quot;, &amp;quot;harmonious&amp;quot;). Another regexp and this is solved&lt;/p&gt;

&lt;p&gt;At this point, I&amp;#39;m cooking with gas: my routine now seems to be &lt;strong&gt;way&lt;/strong&gt; more &lt;strong&gt;accurate &lt;/strong&gt;than the the inbuilt Maple version, and I&amp;#39;m thinking that there can&amp;#39;t be many(?) more &amp;quot;exceptional&amp;quot; cases to handle - until I thought about the &amp;quot;re+vowel&amp;quot; combination. This was when I &lt;strong&gt;rea&lt;/strong&gt;lly &lt;strong&gt;rea&lt;/strong&gt;lised the magnitude of the problem, &lt;strong&gt;rei&lt;/strong&gt;nforced by contemplating &lt;strong&gt;rei&lt;/strong&gt;ndeer. I simply cannot think of any way to deal with this issue algorithmically (or its relation the &amp;quot;de+vowel&amp;quot; combination,- think &lt;strong&gt;dea&lt;/strong&gt;lmaker and &lt;strong&gt;dea&lt;/strong&gt;ctivate). My conclusion - we&amp;#39;re screwed - as in &lt;strong&gt;there is no algothmic way to count &amp;quot;dictionary&amp;quot; syllables&lt;/strong&gt;:-(&lt;/p&gt;

&lt;p&gt;FWIW, the routine I came up with is attached&lt;/p&gt;

&lt;p&gt;&lt;a href="/view.aspx?sf=242701_Answer/getSyll.mw"&gt;getSyll.mw&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;ol&gt;
&lt;/ol&gt;
</itunes:summary>
      <description>&lt;p&gt;The conclusion I have come to is that &lt;strong&gt;accurate&lt;/strong&gt; syllable counting &lt;strong&gt;cannot be achieved&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I think that Maple&amp;#39;s &amp;quot;get-out&amp;quot; on this one, is (from the help page)&lt;/p&gt;

&lt;p style="margin-left: 40px;"&gt;The&lt;strong&gt; morphological&lt;/strong&gt; syllable length is defined to be the &lt;strong&gt;number of vowel-consonant &lt;/strong&gt;changes in word. (Note that this &lt;strong&gt;may not agree with the lexical syllable length&lt;/strong&gt; found in dictionaries.)&lt;/p&gt;

&lt;p&gt;Before I came to the conclusion above I thought it might be fun to try and work out what &amp;quot;rules&amp;quot; are actually being applied by Maple&amp;#39;s&amp;nbsp; SyllableLength()&amp;nbsp; command, and whether ti might be possible to do better&lt;/p&gt;

&lt;p&gt;A moment&amp;#39;s thought will convinece you that a reasonable stab at the basic algorithm would be to &amp;quot;telescope&amp;quot; all adjacent consonants to a single consonant, and all adjacent vowels to a single vowel. With &amp;#39;V&amp;#39; representing a vowel and &amp;#39;C&amp;#39; representing a consonant, this would result in a string of alternating &amp;quot;V&amp;quot;, &amp;quot;C&amp;quot; characters - for example the word &amp;quot;straight&amp;quot; would be transformed to &amp;quot;CCCVVCCC&amp;quot;, which would then be &amp;quot;telescoped&amp;quot; to &amp;quot;CVC&amp;quot;. Then just count the number of occurrences of the &amp;quot;V&amp;quot; character in the resulting string. So I wrote a little procedure to do this -it&amp;#39;s pretty trivial. (I apologise for parts of this - it&amp;#39;s a long time since I used any regexp stuff, and I was never that great with &amp;#39;regexps&amp;#39; anyway)&lt;/p&gt;

&lt;p&gt;My experimentation suggest that this is pretty much what the SyllableLength() command in Maple actually does. However it does apply a few extras: for example the above algorithm will render &amp;quot;bake&amp;quot; as &amp;quot;CVCV&amp;quot; and hence count two syllables. The Maple command appears to &amp;quot;get around&amp;quot; this by ignoring &lt;strong&gt;all&lt;/strong&gt; trailing vowels, so SyllableLength(&amp;quot;bake&amp;quot;) returns 1, but so does SyllableLength(&amp;quot;llama&amp;quot;)&amp;nbsp; or SyllableLength(&amp;quot;guru&amp;quot;)&amp;nbsp; - not good.&lt;/p&gt;

&lt;p&gt;However a trivial piece of regexp magic will reduce the syllable count by one &lt;strong&gt;only&lt;/strong&gt; if the word ends in consonant+&amp;quot;e&amp;quot;+(zero or one)&amp;quot;s&amp;quot;. This works, but has the unfortunate side-effect or reducing words such as &amp;quot;he&amp;quot;, &amp;quot;the&amp;quot;, &amp;quot;due&amp;quot;, etc to zero syllables. Another no-brainer: jonly apply this step if the input syllable length is greater than 1.&lt;/p&gt;

&lt;p&gt;Then I got to your last example - ie &amp;quot;radio&amp;quot;, which the basic algorithm describe above would collapse to&amp;nbsp; &amp;quot;CVCV&amp;quot; and so the syllable count would be off by 1. Again. another little piece of regexp magic will fix this - any word ending in &amp;quot;io&amp;quot; should have the syllable count increased by 1. However what happens if the &amp;quot;io&amp;quot; is not at the end of the word? consonant+&amp;quot;io&amp;quot;+consonant can be one or two syllables depending on whether the leading consonant is &amp;quot;t&amp;quot;, &amp;quot;g&amp;quot;, or &amp;quot;s&amp;quot;. So OK another little piece or regexp.&lt;/p&gt;

&lt;p&gt;Probably because of this last example, I then started thinking about the &amp;quot;ious&amp;quot; problem - think the difference between &amp;quot;specious&amp;quot; and &amp;quot;serious&amp;quot;. It would seem that &amp;quot;ious&amp;quot; is one syllable when preceded by &amp;quot;c&amp;quot;, &amp;quot;g&amp;quot; &amp;quot;t&amp;quot; or &amp;quot;x&amp;quot; (think &amp;quot;specious&amp;quot;, &amp;quot;facetious&amp;quot;, &amp;quot;egregious&amp;quot; or &amp;quot;noxious&amp;quot;) but otherwise is two syllables ( think &amp;quot;serious&amp;quot;, &amp;quot;odious&amp;quot;, &amp;quot;pious&amp;quot;, &amp;quot;harmonious&amp;quot;). Another regexp and this is solved&lt;/p&gt;

&lt;p&gt;At this point, I&amp;#39;m cooking with gas: my routine now seems to be &lt;strong&gt;way&lt;/strong&gt; more &lt;strong&gt;accurate &lt;/strong&gt;than the the inbuilt Maple version, and I&amp;#39;m thinking that there can&amp;#39;t be many(?) more &amp;quot;exceptional&amp;quot; cases to handle - until I thought about the &amp;quot;re+vowel&amp;quot; combination. This was when I &lt;strong&gt;rea&lt;/strong&gt;lly &lt;strong&gt;rea&lt;/strong&gt;lised the magnitude of the problem, &lt;strong&gt;rei&lt;/strong&gt;nforced by contemplating &lt;strong&gt;rei&lt;/strong&gt;ndeer. I simply cannot think of any way to deal with this issue algorithmically (or its relation the &amp;quot;de+vowel&amp;quot; combination,- think &lt;strong&gt;dea&lt;/strong&gt;lmaker and &lt;strong&gt;dea&lt;/strong&gt;ctivate). My conclusion - we&amp;#39;re screwed - as in &lt;strong&gt;there is no algothmic way to count &amp;quot;dictionary&amp;quot; syllables&lt;/strong&gt;:-(&lt;/p&gt;

&lt;p&gt;FWIW, the routine I came up with is attached&lt;/p&gt;

&lt;p&gt;&lt;a href="/view.aspx?sf=242701_Answer/getSyll.mw"&gt;getSyll.mw&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;ol&gt;
&lt;/ol&gt;
</description>
      <guid>242701</guid>
      <pubDate>Mon, 23 Oct 2017 01:51:18 Z</pubDate>
      <itunes:author>tomleslie</itunes:author>
      <author>tomleslie</author>
    </item>
    <item>
      <title>tough one</title>
      <link>http://www.mapleprimes.com/questions/141434-StringToolsSyllableLength--Missing-Rules?ref=Feed:MaplePrimes:StringTools[SyllableLength]  missing rules:Comments#comment242716</link>
      <itunes:summary>&lt;p&gt;&lt;a href="/questions/141434-StringToolsSyllableLength--Missing-Rules#comment242701"&gt;@tomleslie&lt;/a&gt; thanks.&amp;nbsp; I appreciate your work on the subject.&amp;nbsp; Another tough word is &amp;quot;doable&amp;quot;.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Your example of dealmaker and deactivate are examples of two different types of words, one is a combination of two words &amp;quot;deal-maker&amp;quot; while the other is a word with a prefix &amp;quot;de-activate&amp;quot;.&lt;/p&gt;

&lt;p&gt;I think if we create enough rules we can crack the syllable code, but perhaps there are too many one off rules that make the code impossible to complete?&lt;/p&gt;
</itunes:summary>
      <description>&lt;p&gt;&lt;a href="/questions/141434-StringToolsSyllableLength--Missing-Rules#comment242701"&gt;@tomleslie&lt;/a&gt; thanks.&amp;nbsp; I appreciate your work on the subject.&amp;nbsp; Another tough word is &amp;quot;doable&amp;quot;.&amp;nbsp;&lt;/p&gt;

&lt;p&gt;Your example of dealmaker and deactivate are examples of two different types of words, one is a combination of two words &amp;quot;deal-maker&amp;quot; while the other is a word with a prefix &amp;quot;de-activate&amp;quot;.&lt;/p&gt;

&lt;p&gt;I think if we create enough rules we can crack the syllable code, but perhaps there are too many one off rules that make the code impossible to complete?&lt;/p&gt;
</description>
      <guid>242716</guid>
      <pubDate>Mon, 23 Oct 2017 14:13:43 Z</pubDate>
      <itunes:author>Christopher2222</itunes:author>
      <author>Christopher2222</author>
    </item>
  </channel>
</rss>