Syllables & Regular Expressions

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Syllables & Regular Expressions

Post by ChrisGreaves »

I read Steven Pinker, so of course I can't resist playing around with syllables.
So this thread is a hobby/pastime thread.
The attached ZIP file contains a Word2003 template whose Test macro populates columns 2 and 3 of a table with the number of syllables in the word in column 1, (columns 2 & 3 because I have two methods).
In column 4 is the number of syllables *I* think it should be based on my understanding of the English (UK, Australia, Canada) language.

I'm not immediately interested in "fixing" the RegExp but am curious - before we start - whether language students agree with me on those words which I think are nor properly analyzed by one or both of the regexps.

In other words, before I criticize the RegExp, is my understanding of the English language up to scratch?
Here's where I disagree with the results of the RegExps.
The number to the right is the number of syllables *I* think the word has.
torontonians 5
fashionable 4
remarkable 4
annoying 3
unable 3
mckenzie 3
patios 3
sarcasm 3
supplier 3
toastier 3
usual 3
cancelled 2
depressed 2
forecast 2
likely 2
shuttered 2
being 2
crying 2
drizzle 2
little 2
single 2
isn’t 2
it’d 2
closed 1
dimes 1
games 1
lines 1
moved 1
ones 1
passed 1
rained 1
sales 1
stacked 1
states 1
royal 1
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace

William
StarLounger
Posts: 79
Joined: 08 Feb 2010, 21:48
Location: Wellington, New Zealand

Re: Syllables & Regular Expressions

Post by William »

Chris

Interesting hobby!

The following are websites that count syllables:

http://www.wordcalc.com/
http://www.syllablecount.com/
http://www.howmanysyllables.com/
I tested some of the words in your list using these. According to them, some of the time your understanding is correct and some of the time it's not. :scratch:

By the way, is "torontonians" a real word, or did you just make that up? It doesn't really roll off the tongue - or not with a New Zealand accent anyway.

William

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Syllables & Regular Expressions

Post by ChrisGreaves »

William wrote:Chris, Interesting hobby!
Hi William,
Don't blame me; blame Steven Pinker!
By the way, is "torontonians" a real word, or did you just make that up?
I got it from The Toronto Star this afternoon.
Yes, we Torontonians often describe ourselves as Torontonians.

I believe that "5" is correct, as in To-ron-ton-i-ans.
I'd split Thes-pi-ans the same way.
Vowels are those sounds that give the muscles of the mouth etc time to adopt their new position, spacers in time, if you will, so the penultimate i is really pronounced ee, and the a is more like a ya, using the y as an almost-consonant.

Pinker explains it way better than can I.

P.S. What do New Zealanders call Wel-ling-ton-i-ans?
An expensive day out: Wallet and Grimace

User avatar
macropod
4StarLounger
Posts: 508
Joined: 17 Dec 2010, 03:14

Re: Syllables & Regular Expressions

Post by macropod »

ChrisGreaves wrote:What do New Zealanders call Wel-ling-ton-i-ans?
All sorts of things - some of which don't bear repetition. :evilgrin:
Paul Edstein
[Fmr MS MVP - Word]

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Syllables & Regular Expressions

Post by ChrisGreaves »

macropod wrote:some of which don't bear repetition. :evilgrin:
:rofl:
An expensive day out: Wallet and Grimace

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Syllables & Regular Expressions

Post by ChrisGreaves »

ChrisGreaves wrote:I read Steven Pinker,
Here's another part of the problem for students of syllables, carefully calculated to trip up some Regular Expressions:
Scan10004.JPG
You do not have the required permissions to view the files attached to this post.
An expensive day out: Wallet and Grimace

William
StarLounger
Posts: 79
Joined: 08 Feb 2010, 21:48
Location: Wellington, New Zealand

Re: Syllables & Regular Expressions

Post by William »

Hmmm. I suspect that we won't see a movie based on a Steven Pinker book anytime soon.

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Syllables & Regular Expressions

Post by ChrisGreaves »

William wrote:Hmmm. I suspect that we won't see a movie based on a Steven Pinker book anytime soon.
Ha! William, you're right.
An expensive day out: Wallet and Grimace

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15498
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Re: Syllables & Regular Expressions

Post by ChrisGreaves »

William wrote:Hmmm. I suspect that we won't see a movie based on a Steven Pinker book anytime soon.
While you're waiting, would you settle for a Word VBA macro?

Code: Select all

''' Code based on page 196 of "The language Instinct" by Steven Pinker ISBN 0-06-095833-2
Public Const sngcPP As Single = 0.3
Public Const sngcDET As Single = 0.3

Sub TESTS()
    MsgBox S
End Sub
Function S() As String
    S = NP & VP
End Function
Function NP() As String
    NP = det & N & PP
End Function
Function VP() As String
    VP = V & NP & PP
End Function
Function PP() As String
    If Rnd() < sngcPP Then
        PP = P & NP
    Else
    End If
End Function
Function N() As String
    N = strRand(",boy,girl,dog,cat,ice cream,candy,hotdogs")
End Function
Function V() As String
    V = strRand(",eats,likes,bites")
End Function
Function P() As String
    P = strRand(",with,in,near")
End Function
Function det() As String
    If Rnd() < sngcDET Then
        det = strRand(",a,the,one")
    Else
    End If
End Function
Function strRand(ByVal strDictionary) As String
    ''' Return a random string from the dictionary
    Dim strDelimiter
    strDelimiter = Left(strDictionary, 1)
    strDictionary = Right(strDictionary, Len(strDictionary) - 1)
    Dim lngWords As Long
    lngWords = Len(strDictionary) - Len(Replace(strDictionary, strDelimiter, ""))
    lngWords = Rnd() * lngWords
    strRand = " " & Split(strDictionary, strDelimiter)(lngWords)
'Sub TESTstrRand()
'    Debug.Print strRand(",with,in,near")
'End Sub
End Function
An expensive day out: Wallet and Grimace