Some code to help you remember numbers

[This article was first published on Decision Science News » R, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

HANDY COMPUTER PROGRAMS FOR TURNING NUMBERS INTO MEMORABLE WORDS

Two posts ago we showed you the digit sound system for remembering numbers. This week we provide two Python programs (and one R program) to help you create mnemonics.

w2num.py – converts every word in the English language to a number
find.py – takes a longish number and gives you words that when put together translate into that number using the digit-sound system.

If you are not a programmer, or if you are lazy, you can get to the chase and just download the relevant outupt files here

wordNum.txt – every word in English translated into a number using the digit-sound system
numWords.txt – All the English words that translate into a given number

However, you have a long number that you want to make a mnemonic for, you’re better off using find.py or find.R below to find mnemonics. These handy programs break up long numbers into shorter ones which do have mnemonics.

NOTES:
These programs use phonetics (not spelling) to make the mnemonics. Read the small print on Jap Murre’s site to see why “letter” is 514 and not 5114 and why “ing” is 27. Thanks to Daniel Reeves for convincing discussions on the merits of using a purely phonetic system.

As usual, we’re open for suggestions on how to improve these programs … they’re both kind of slapdash jobs.

##w2num.py##
Prerequisites: You need to save a couple of wordlists locally. In particular
1) You need to save a copy of http://bit.ly/xz8YIC
as cmudict-0.4.scm. This is a mapping from words in English to phonemes.
2) You need to save a copy of http://scrapmaker.com/data/wordlists/twelve-dicts/2of12inf.txt
as wordlist.txt. This is a list of reasonably common English words (b/c some of the words in cmudict are too rare to be useful).
3) Put cmudict-0.4.scm and wordlist.txt in the same directory as
w2num.py and then do
python w2num.py > wordNum.txt
to generate the number corresponding to every English word. (If in the future these URLs break, just search around for copies of cmudict-0.4.scm and 2of12inf.txt …there are many copies of these dictionaries around.)

##find.py##
This is the program you use when you have a longish number and you want to find words that encode it. It uses recursive ™ technology to break up numbers a few different ways to increase your chances of finding a mnemonic you like.
Prerequisite: You must have created wordNum.txt (by running python w2num.py > wordNum.txt) in the previous step and saved it to the same directory as this program before running.
To turn a number like 8675309 into words do
python find.py 8675309

Lastly, for kicks I wrote a slightly dumber version of find.py in R. It lacks the cool “rec3″ method of finding mnemonics but it gets the job done.

##find.R##
Same as find.py
Prerequisite: same as find.py
To turn a number like 8675309 into words change the variable mstr to ’8675309′ and run the program.

To leave a comment for the author, please follow the link and comment on their blog: Decision Science News » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)