Common dogma says you can train your phone to "remember" words if you type them repeatedly, but the staff has discovered (much to their dismay) that this tends to last for only a short period of time before it forgets them again.
Upon hearing this, I decided to do a little investigation, and what I found rather surprised me; the way my 2.2 iPhone updated its user word database wasn't what I expected.
That database is stored in the "mobile" user directory, in /private/var/mobile/Library/Keyboard. The file is called dynamic-text.dat. It consists of a (mostly) plain text list of words that the iPhone has marked for special attention. Once a word appears in that list, the autocorrect feature updates itself and accepts those items as proper spellings. It's really convenient for jargon words and last names that are part of your normal typing but don't appear in the standard dictionary.
In order to test the data update, I fired up the Notes application and started typing words in an attempt to see how many repetitions it would take until the dictionary "learned" them. About an infinite number, it would appear. I say this because, after typing and typing and typing, the last modified date for my dynamic-text.dat file remained yesterday.
-rw------- 1 mobile mobile 1244 Jan 15 18:40 dynamic-text.da
It wasn't until I left Notes and hopped over to Mobile Safari that I was able to make any difference at all. In Mobile Safari, I opened a new browser, typed the same words into the Google search field and, in the words of Steve Jobs, boom. Just as one would hope, the dynamic-text.dat file immediately updated without any further repetition needed. I could also see the words by looking through the file.
-rw------- 1 mobile mobile 1359 Jan 16 11:51 dynamic-text.da
To test my update, I then returned to Notes and tried typing my words again. This time, Notes immediately recognized my new additions as correct, without offering a special suggestion bubble.
What did I uncover here today? Well, clearly, not every iPhone application can "learn" words. Notes seems to be brain-dead in that regard. At the same time, using Safari's Google text entry field worked every time, expanding the database and adding new items to my keyboard dictionary.
This isn't the way you'd expect the iPhone to work. You'd imagine that the keyboard learning algorithm would apply to all text no matter where you enter it, but apparently not. Hopefully this little trick will help you out when you want to add words that you don't want autocorrected.