CITE THIS NOTEBOOK: Palindromes, reduplication, and more by Chase Marangu. Wolfram Community, SEP 30 2022.
I've always been fascinated by words whose written forms had amusing properties, such as palindromes and words which were anagrams of each other. When I first started learning the Wolfram language, I was excited to discover all the ways that I could now search WordList for words with these amusing properties, and I was also excited about the simplicity of the WordCloud function! This post will show some types of words with amusing properties, alongside the Wolfram language code used to search for words with said amusing properties.
Palindromes
Palindromes
Palindromes are relatively easy to search for in the Wolfram Language, using the StringReverse function.
In[]:=
words = Select[WordList[], # == StringReverse[#] &]WordCloud[words, WordOrientation -> "Random"]
Out[]=
{a,aha,bib,bob,civic,dad,deed,did,dud,ere,eve,ewe,eye,gag,gig,huh,I,kayak,kook,level,ma'am,madam,minim,mom,mum,nan,non,noon,nun,oho,pap,peep,pep,pip,pop,pup,radar,refer,rotor,sis,tat,tenet,TNT,toot,tot,tut,wow}
Out[]=
Other Reversible Words
Other Reversible Words
We can also search for words which, when reversed, are not equal to themselves, but are still equal to some other word.
Note: I have been using WordList up to this point, however it is much faster to use DictionaryWordQ (which uses a different data set than the default for WordList) than to do a linear search of WordList in order to find.
In[]:=
notPalindromes=Select[WordList[],#!=StringReverse[#]&];wordPairs={#,StringReverse[#]}&/@Select[notPalindromes,DictionaryWordQ[StringReverse[#],IgnoreCaseFalse]&]
Out[]=
I had a lot of fun quizzing my friends at the Wolfram Summer School to see how quickly they could figure out what valid word was created by reversing the letters of one in WordList
Reduplication
Reduplication
Reduplication is another interesting property held by some words. It is when a word consists of repeated similar chunks. It is best illustrated by example.
In[]:=
notPalindromes=Select[WordList[],#!=StringReverse[#]&];firstHalf[w_String] := StringTake[w,{1,Floor[StringLength[w]/2.0]}]lastHalf[w_String]:=StringTake[w,{-Floor[StringLength[w]/2.0],-1}]words = Select[notPalindromes, firstHalf[#] == lastHalf[#] &]WordCloud[words, WordOrientation -> "Random"]
Out[]=
{algal,beriberi,bonbon,cancan,chichi,coco,couscous,dodo,dumdum,edged,gaga,hotshot,lulu,magma,mama,murmur,muumuu,onion,papa,salsa,sense,shush,tartar,tsetse,tutu,verve}
Out[]=
Variations
Variations
We can also ignore if the first letter of the first half of the word matches the first letter of the second half of the word.
In[]:=
notPalindromes = Select[WordList[], # != StringReverse[#] &];notPalindromes4letters = Select[notPalindromes, StringLength[#] >= 4 &];firstHalf2[w_String] := StringTake[w, {1 + 1, Floor[StringLength[w]/2.0]}]lastHalf2[w_String] := StringTake[w, {1 + -Floor[StringLength[w]/2.0], -1}]firstHalfLetter[w_String] := StringTake[w, {1, 1}]lastHalfLetter[w_String] := StringTake[w, {-Floor[StringLength[w]/2.0], -Floor[StringLength[w]/2.0]}]words = Select[notPalindromes4letters, (firstHalf2[#] == lastHalf2[#]) ∧ (firstHalfLetter[#] != lastHalfLetter[#]) &]WordCloud[words, WordOrientation -> "Random"]
Out[]=
{aerie,aging,agog,anemone,angling,anion,anon,arbor,ardor,armor,assess,atilt,backpack,backtrack,balsa,bandstand,banyan,bedded,beige,belie,belle,besides,bigwig,boffo,bongo,bozo,bravura,brier,byway,calla,cardboard,catboat,cease,cede,coho,combo,condo,cookbook,cosmos,crier,cutout,dacha,data,deadhead,delve,denizen,dense,deuce,downtown,drear,drier,dryer,eerie,entrant,error,fatwa,fauna,fence,fete,fingering,flail,folio,foreshore,forgo,friar,fryer,gala,gamma,gene,genie,genre,geode,guru,gypsy,handstand,hangman,hardboard,heave,hedge,hedged,helve,heme,hence,herder,here,hobnob,hobo,hodgepodge,hoodoo,horror,hotchpotch,hotfoot,hotpot,hotspot,hubbub,humdrum,imam,intent,iterate,java,jingling,kappa,karma,kingpin,kiwi,known,kowtow,kudzu,lama,larva,lava,lease,leave,ledge,levee,lightweight,lingering,loco,logo,lotto,lowbrow,luau,mafia,maintain,mamba,mania,manna,manta,maria,melee,mercer,mere,merge,merger,messiness,mete,midi,mingling,mini,mono,monsoon,motto,nerve,ninepin,nitwit,ongoing,order,output,palatal,panda,para,parka,pasha,pasta,payday,peace,peeve,peewee,pekoe,pewee,picnic,polio,polo,pontoon,potshot,powwow,prepare,prior,putout,pygmy,ragbag,ragtag,recce,reduced,reeve,retie,reuse,revue,rodeo,rondo,sabra,saga,samba,sandman,sauna,sedge,segue,seine,seize,sentient,sentiment,sere,serge,serve,server,sheathe,skulk,skunk,solo,start,stet,stilt,stint,stoat,stout,strut,stunt,tease,tense,tepee,terrier,terse,thigh,tingling,torpor,torso,trier,union,unman,unpin,venue,verge,verger,vernier,verse,voodoo,waylay,weave,wedded,wedge,wedged,were,which}
Out[]=
Letter Counts
Letter Counts
Letter Reuse
Letter Reuse
Some words have only two unique letters.
In[]:=
words=Select[WordList[],Length[LetterCounts[#]]==2&]WordCloud[words, WordOrientation -> "Random"]
Out[]=
{aah,ad,add,ah,aha,all,am,an,as,at,ax,baa,be,bee,bib,bob,boo,by,coco,coo,dad,dB,deed,did,do,dodo,dud,ebb,eel,e'en,e'er,egg,eh,ell,em,en,epee,er,ere,err,eve,ewe,ex,eye,fa,fee,gag,gaga,gee,gig,go,goo,ha,he,hi,h'm,hm,ho,huh,id,if,ill,in,inn,IQ,is,it,kc,kook,kW,la,lee,lo,loll,loo,lull,lulu,ma,ma'am,mama,me,mi,mom,moo,ms,mu,mum,muumuu,my,nan,nee,no,non,noon,nu,nun,odd,of,off,oh,oho,on,ooh,ow,ox,pa,pap,papa,pee,peep,pep,pH,pi,pip,pop,pup,re,sass,see,sh,shh,sis,so,ta,tat,tee,ti,TNT,to,too,toot,tot,tut,tutu,TV,um,up,us,we,wee,woo,wow,xi,ya,ye,zoo}
Out[]=
Some words have more than twice as many total letters as they do unique letters.
Some words repeat a letter 5 times.
Note : I am using RandomSample to reduce the number of words drawn in the WordCloud because my computer did not have enough memory to compute it with all of them
Some words have 3 or more cases of pairs of identical letters.
Some words repeat all their unique letters an equal amount of times. This includes some of the palindrome and reduplication examples from earlier, which reuse each of their letters exactly twice, as well as some other interesting cases such as “teammate” and “bilabial.”
Note I excluded words which repeat all their letters exactly once.
Very Long Words
Very Long Words
Some words do not repeat any letters at all, and in spite of this reach great lengths.
Some words are just long .
Some words more than 13 unique letters.
Vowels, Alphabetical Order
Vowels, Alphabetical Order
Alphabetical Order
Alphabetical Order
Some words have their letters already in alphabetical order for you!
Or reverse alphabetical order, for that matter.
We can also search for words starting with a and ending with z .
Or vice - versa .
Vowels
Vowels
If you were taught that words always must have vowels, then you' ll be surprised to see this! Sometimes, even y is not necessary!
Or we could also search for words made only with vowels, or “y.”
Concluding Remarks
Concluding Remarks
Playing with words and letters has been one of my favorite uses of the Wolfram Language ever since I first learned about it earlier this year. I hope that you learned something new from my project!