(please don't try this with a wikipedia database of 10 million terms lol)
eelixduppy
6:30 pm on Dec 1, 2011 (gmt 0)
If I had to guess I'm sure Wikipedia must limits the domain of words it selects from by subject matter (or some other meta data) for that particular article. Also, I'm sure they have some type of caching mechanism built in.
You should only need to do this find/replace when either the string changes or the names domain changes; in both cases, you only need to search what has changed (the new names or the new text) if you've already searched the text before. Timestamps on the "names" table should be able to aid in this.