OS X's "Word of the Day" screensaver is a great way to passively learn words: ![](https://dl.dropbox.com/u/4427/screenshots/2015-06-21_1401.png) But I've always thought that its word list kind of stunk—it was full of obscure words that I could never really see myself using. I'd prefer something like Norman Schur's [1000 Most Important Words](http://jsomers.net/1000.html). What if you could plug your own word list into the screensaver? On a rather obscure [comment thread](http://macenstein.com/default/2008/04/apples-word-of-the-day-screensaver-keeping-us-all-equally-smart/comment-page-1/#comment-273128), someone explained where you might find the word list that Apple uses to power the screensaver. It is at `/System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt`. The file looks like this: ``` m_en_us1282510 quinsy m_en_us1273791 orbicular m_en_us1220945 alimony m_en_us1250517 genome m_en_us1275124 palimpsest m_en_us1246836 fibrillate m_en_us1304617 volant m_en_us1248876 fraudulent m_en_us1264803 lunette m_en_us1244369 entrepot ``` It is a list of tab-separated entries. On the right you have the word, and on the left, what looks like an ID. But what's it an ID for, and how would you be able to find it for another word not already on the list? As you might expect, the ID refers to an entry in Apple's default dictionary, the "New Oxford American Dictionary". (That's what "NOAD" stands for in the word-list path above.) I've played around with Apple's built-in dictionary files before—for my post, ["You're probably using the wrong dictionary"](http://jsomers.net/blog/dictionary). You can find them at `/Library/Dictionaries`. Unfortunately, when you dig around in the dictionary packages, you find promising files—like `/Library/Dictionaries/New\ Oxford\ American\ Dictionary.dictionary/Contents/EntryID.data`—but these turn out to be in a custom binary format. How to parse them? A fellow named Joseph Gentle, in a [series](http://josephg.com/blog/reverse-engineering-apple-dictionaries/) of blog posts, shows how to get at the underlying data. In his ["Apple dictionaries, part 2"](https://josephg.com/blog/apple-dictionaries-part-2/) post, he points to code that unpacks the binary file into XML. Using the `dedict.c` and `strip.c` files found [here](https://gist.github.com/josephg/5e134adf70760ee7e49d), and following Gentle's example, I used the following bash commands to get at the NOAD's XML (these commands are run from the directory where you downloaded the `dedict.c` and `strip.c` files): ```bash clang dedict.c -Wall -lz -o dedict clang strip.c -Wall -lz -o strip ./dedict "New Oxford American Dictionary" | ./strip > dict.xml ``` When I `head`-ed the first few lines of the `dict.xml` file, I saw something promising, with entries that looked like this: ```xml ``` Notice that `id` param... it's an identifier that looks exactly like the one in the screensaver word list! I wrote the following Ruby script to parse the XML, and then, using my own word list, create a _new_ screensaver file that maps my own words to their IDs in the dictionary: ```rb raw = File.open("./dict.xml").read my_words = File.open("./word_list.txt").readlines.map(&:chomp) word_id_map = {} raw.scan(//).each do |entry| word_id_map[entry[1]] = entry[0] end my_words.each do |word| if id = word_id_map[word] puts [id, word].join(' ') end end ``` When I replaced the original screensaver file with this new one, it worked. You can now have a "Word of the Day" screensaver for any word list you'd like. (See below for my pre-made list using Norman Schur's 1000 Most Important Words. Just copy and paste it into `/System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt` using your favorite text editor. You will need to enter your Administrator password to save the file.)