Function Repository Resource:

 WordPhoneticSyllabify

Source Notebook

Segment an English word and its phonetic form into syllables

Contributed by: Mark Greenberg

ResourceFunction["WordPhoneticSyllabify"][w]

returns a list containing both w and its phonetic form with syllable delimiters.

Details and Options

ResourceFunction["WordPhoneticSyllabify"] places a bullet character • between each syllable.
ResourceFunction["WordPhoneticSyllabify"] takes the following option:
Stress"Phonetic"whether to mark primary and secondary stress ( ˈ and ˌ ) for phonetics, or on and off beats ( ↑ and ↓ ) for poetic meter.
The "Stress" option, when set to "Metric", changes the phonetic part of the output from having primary and secondary stress marks (ˈ and ˌ) common in phonetics, to having marks for stressed and unstressed syllables (↑ and ↓) for the analysis of poetic meter.
ResourceFunction["WordPhoneticSyllabify"] divides syllables first by morphology, as in {dis•arm, dɪs•ˈɑrm},and then by the Maximal Onset Principle, as in {a•larm, ə•lˈɑrm}.
ResourceFunction["WordPhoneticSyllabify"] is case-insensitive and returns results in lower case.
The second item of the output consists of phonetic symbols, some of which can be confused with keyboard characters including ɡ (LatinSmallLetterScriptG), ˈ (ModifierLetterVerticalLine), and ˌ ("ModifierLetterLowVerticalLine").
Phonetic output of ResourceFunction["WordPhoneticSyllabify"][w] is General American English in a style compatible with WordData[w,"PhoneticForm"], even if w is not English or includes characters that are not part of the English alphabet.
ResourceFunction["WordPhoneticSyllabify"] has the attribute Listable.

Examples

Basic Examples (1) 

Find the phonetic syllable breaks in a word:

In[1]:=
ResourceFunction["WordPhoneticSyllabify"]["computational"]
Out[1]=

Scope (2) 

Apply WordPhoneticSyllabify[w] to a list of words:

In[2]:=
ResourceFunction[
 "WordPhoneticSyllabify"][{"Once", "upon", "a", "midnight", "dreary"}]
Out[2]=

Find the phonetic syllable divisions of names (as pronounced in English):

In[3]:=
ResourceFunction["WordPhoneticSyllabify"][{"Galadriel", "Sepulchrave"}]
Out[3]=

Applications (3) 

Determine whether words rhyme by comparing the last syllable:

In[4]:=
words = {"terrain", "remain"};
phons = ResourceFunction["WordPhoneticSyllabify"][words][[All, 2]]
Out[5]=
In[6]:=
lastsyllable = StringCases[#, "ˈ" ~~ __ ~~ EndOfString] & /@ phons
Out[6]=
In[7]:=
SameQ[lastsyllable]
Out[7]=

Count the syllables in a line of poetry ("Sonnet Composed At (Neidpath) Castle" by William Wordsworth):

In[8]:=
verse = "Degenerate Douglas! oh, the unworthy Lord!";
phons = (ResourceFunction["WordPhoneticSyllabify"] /@ TextWords[verse])[[All, 1]]
Out[9]=
In[10]:=
StringCount[StringRiffle[phons], " " | "\[Bullet]"] + 1
Out[10]=

Count the feet in the same line of poetry:

In[11]:=
verse = "Degenerate Douglas! oh, the unworthy Lord!";
phons = (ResourceFunction["WordPhoneticSyllabify"][#, Stress -> "Metric"] & /@ TextWords[verse])[[All, 2]]
Out[12]=
In[13]:=
StringCount[StringRiffle[phons], "\[UpArrow]"]
Out[13]=

Properties and Relations (3) 

WordData can give a word's phonetic form without the syllable breaks:

In[14]:=
words = {"elephant", "cheetah", "hippopotamus"};
<|"WordData" -> <|(# -> WordData[#, "PhoneticForm"] &) /@ words|>,
   "WordPhoneticSyllabify" -> <|(# -> ResourceFunction["WordPhoneticSyllabify"][#][[2]] &) /@ words|>
   |> // Transpose // Dataset
Out[15]=

WordData can also provide the hyphenation breaks of a word, but notice that they are not always the same as phonetic syllable breaks:

In[16]:=
words = {"elephant", "cheetah", "hippopotamus"};
<|"WordData" -> <|(# -> WordData[#, "Hyphenation"] &) /@ words|>,
   "WordPhoneticSyllabify" -> <|(# -> ResourceFunction["WordPhoneticSyllabify"][#][[1]] &) /@ words|>
   |> // Transpose // Dataset
Out[17]=

WordData returns Missing for many inflected forms, proper nouns, poetic words, nonsense words, etc., while WordPhoneticSyllabify uses AI to supply the missing data:

In[18]:=
words = {"transitioned", "Lenore", "surcease", "Jabberwocky"};
<|"WordData" -> <|(# -> WordData[#, "PhoneticForm"] &) /@ words|>,
   "WordPhoneticSyllabify" -> <|(# -> ResourceFunction["WordPhoneticSyllabify"][#] &) /@ words|>
   |> // Transpose // Dataset
Out[19]=

Neat Examples (1) 

Use WordPhoneticSyllabify as the foundation for scansion of a line of poetry (here, Emily Dickinson's 656th poem):

In[20]:=
words = TextWords["I started Early\[Dash]Took my Dog\[Dash]"];
sylData = ResourceFunction["WordPhoneticSyllabify"][#, Stress -> "Metric"] & /@
    words;
{abcSyl, phoSyl} = Table[Flatten[
    StringSplit[#, "\[Bullet]"] & /@ sylData[[All, i]]], {i, 2}];
rawSeq = Prepend[ReplaceAll[#, {a_ /; StringContainsQ[a, "\[UpArrow]"] -> "\[UpArrow]",
        a_ /; StringContainsQ[a, "\[DownArrow]"] -> "\[DownArrow]", _ -> "?"}] & /@ phoSyl, "<"];
seq = FixedPoint[SequenceReplace[#, {
      {"\[UpArrow]", "\[UpArrow]" | "?", "\[UpArrow]"} -> Sequence["\[UpArrow]", "\[DownArrow]", "\[UpArrow]"],
      {"<", "\[UpArrow]" | "?", "\[UpArrow]"} -> Sequence["\[DownArrow]", "\[UpArrow]"]
      }] &,
   rawSeq];
Grid[{seq /. {"\[UpArrow]" -> "/", "\[DownArrow]" -> "\[Cup]"}, abcSyl}]
Out[25]=

Publisher

Mark Greenberg

Requirements

Wolfram Language 14.0 (January 2024) or above

Version History

  • 2.0.0 – 16 October 2026
  • 1.0.2 – 10 December 2025
  • 1.0.1 – 15 July 2024
  • 1.0.0 – 28 February 2024

Source Metadata

Related Resources

Author Notes

When using WordPhoneticSyllabify[w, Stress→"Metric"][[2]] as the basis for scanning a poem, keep in mind that some of the syllables may not have either mark (↑ or ↓). The stress of such unmarked syllables needs to be determined in the context of the surrounding text. The surrounding text can also change the stress of a word. For example, most single-syllable words are stressed when taken alone, but a run of three stressed syllables, in most cases, destresses the middle one. (See the rules applied in the entry in the "Neat Examples" section.)

License Information