Alpha Words

Excerpt from “Explorations with Words”

The following is an excerpt from a moderately cleaned up and later annotated version of a conversation I led with the CT@TP students during a free form, work time style meeting of our club on 01/18/18 that I later titled “Explorations with Words.”

An Alphabet of Words

I was reminded of a thought exercise I find myself doing from time to time.

“How many letters of the alphabet have a corresponding word that sounds like the name of the letter?”

Of course I think of “see” and “sea” and “eye.” I think of how when I visited Australia as a child, I thought it was funny that people stood in a “queue” rather than in a line. Now it occurs to me to use the Wolfram Language to answer my question and I shared this puzzle with the students.

I knew there was WordData and I figured there would be a way to get pronunciation.

WordData["Properties"]

Let’s try “PhoneticForm.”

WordData["see","PhoneticForm"]

WordData["c","PhoneticForm"]

It’s a match! What does the alphabet look like?

Map[WordData[#,"PhoneticForm"]&,Alphabet[]]

We spent a little time just looking at this result. Students immediately asked questions such as “Is that ‘w’?” and “Why is there an integral in ‘h’?”

I organized it a little differently to make it more useful.

alphaphon=Map[{#,WordData[#,"PhoneticForm"]}&,Alphabet[]]

Aside: In my classroom it appeared that it would take too long to find the PhoneticForm of each word in WordList, so I created a short, alternate word list to work with as we built the code. This worked well, but later when I revisited this at home, the whole WordList was reasonable to work with. Hopefully it will work okay at school too. Internet-based information sometimes causes hiccups in production.

wl={"house","sea","car","jay","oh"};
plist=Map[{#,WordData[#,"PhoneticForm"]}&,wl]

Now, let’s get the whole WordList in PhoneticForm, but listed as pairs with the actual word, like we did the alphabet. (This calculation may take some time.)

phoneticlist=Map[{#,WordData[#,"PhoneticForm"]}&,WordList[]];

We looked again at WordData[“Properties”] to see if there was some way to go back from PhoneticForm. However, nothing seemed to fit, so we continued along.

I needed to do a little explanation of how Part (and the Part shortcut) works.

{"o","ˈoʊ"}[[2]]

phoneticlist[[31415]]

phoneticlist[[31415,2]]

Generally, we use the same list building algorithm that we used earlier for q-words and for vowel-words. Let’s try getting this to work for one letter. We know that “c” has two answers.

letterlist={};
Map[If[{"c","sˈi"}[[2]]===#[[2]],letterlist=Append[letterlist,#],letterlist=letterlist]&,phoneticlist];
letterlist

To get our whole answer, Table this across the whole alphabet. Replace {“c”,”sˈi”} with the phonetic alphabet list (where n represents each letter number). Each letter is checked against the entire WordList for matches with PhoneticForm. Results are gathered into one large list.

alphaanswer=Table[
letterlist={};
Map[If[alphaphon[[n]][[2]]===#[[2]],letterlist=Append[letterlist,#],letterlist=letterlist]&,phoneticlist];
letterlist,{n,1,26}]

Pairing these values with the original alphabet allows us to display our result a little more clearly.

Grid@Partition[Riffle[Alphabet[],alphaanswer],2]

How fun!

Interesting that “a” was matched with itself, but not “I.”

Eye hope ewe had fun 2 . . . Owe! Should we do numbers next?

IntegerName[Range[0,9]]

Numbers

I did try the numbers and it worked really well adapting the code. Yet, I noticed that “eight” did not match with “ate” even though they have the same phonetic form.

WordData["eight","PhoneticForm"]

WordData["ate","PhoneticForm"]

WordData["eight","PhoneticForm"]==WordData["ate","PhoneticForm"]

With a little digging, I found that “ate” is not in the WordList. That the list excludes unusual q-words isn’t too much of a surprise, but I expected to see “ate.”

Take[WordList[],{2120,2140}]

MemberQ[WordList[],"ate"]

Update: IncludeInflections

While working on another project, I learned that WordList has an option called IncludeInflections. This will have the list include various verb forms.

Length[WordList[]]

Length[WordList[IncludeInflections->True]]

MemberQ[WordList[IncludeInflections->True],"ate"]

The code below will take some time to evaluate because it finds the phonetic form of the longer WordList.

phoneticlist=Map[{#,WordData[#,"PhoneticForm"]}&,WordList[IncludeInflections->True]];
numberphon=Map[{#,WordData[#,"PhoneticForm"]}&,IntegerName[Range[0,9]]];
numberanswer=Table[
numberlist={};
Map[If[numberphon[[n]][[2]]===#[[2]],numberlist=Append[numberlist,#],numberlist=numberlist]&,phoneticlist];
numberlist,{n,1,10}];
Grid@Partition[Riffle[IntegerName[Range[0,9]],numberanswer],2]

Update: One-Liner Competition 2018

In October 2018, I attended the annual Wolfram Technology Conference in Champaign, Illinois. Each year as part of the conference, attendees are invited to participate in the annual One-Liner Competition by submitting “the most stupendous, entertaining, amazing, surprising, astounding effects you can achieve in 128 characters or fewer of tweetable Wolfram Language code.”

I used this Alpha Words computational thinking conversation as inspiration and was able to condense finding an alphabet of words into exactly 128 characters, even with a little formatting. For a while I was stuck on 129 characters, but changing the organization of a word with its phonetic form from a list to a rule made the difference.

I’m proud to share that “Alphabet of Words” won Third Prize in the competition!

w=#->WordData[#,"PhoneticForm"]&;a=w/@Alphabet[];p=w/@WordList[];Grid@Table[{a[[n]],If[a[[n,2]]===#[[2]],#,Nothing]&/@p},{n,26}]

To see more from the 2018 One-Liner Competition, read the article by Chris Carlson linked below.
http://blog.wolfram.com/2018/10/25/the-winners-of-the-2018-one-liner-competition

Abby Brown
www.abbymath.com
CT@TP: Computational Thinking at Torrey Pines High School
January 2018 (Updated November 2018)