??? How to implement word definition lookup

In the interactive fiction that I create, I would like to add a new feature. Specifically, when the reader encounters an unknown word, the reader can quickly and easily display a definition.

I need advice about implementing this feature.


  1. I do not want to build my own dictionary. I would rather use a dictionary service online or an application.

Reason: There are many existing dictionaries available through the Internet; they are the experts. Moreover, building my own dictionary contributes to redundancy.

  1. I want the definition to appear in a popup window, not in a new browser tab.

Reason: My interactive fiction story files run in a window, so for consistency and to minimize yanking the reader out of immersion in the interactive fiction, a popup window seems better.

  1. I will link words in the text of the interactive fiction that have an associated definition.

Reason: The reader simply needs to click the link in order to display the popup window that contains the definition

Less desirable possibilities:

  • The reader can highlight any word in the text of the interactive fiction, then press a hotkey combination to display the popup window that contains the definition
  • The reader can hover the cursor over any word in the text of the interactive fiction, then press a hotkey combination to display the popup window that contains the definition
  1. If a dictionary entry has more than one definition, I should be able to specify (e.g. through a parameter on the call statement) the exact definition that should appear in the popup window.

Reason: Eliminates the need for the reader to sift through the definitions


  1. Support for multiple dictionaries

Reason: The text of the interactive fiction could contain both

  • a “difficult” English word such as proscenium, in which case an English definition needs to appear in the popup window
  • a foreign-language word such as précieuses, in which case an English translation needs to appear in the popup window


I would appreciate any advice about a specific dictionary service online or a specific application to use, a specific work of interactive fiction that successfully allows word definition lookups, design techniques, etc.


Look at Vorple. I think there was an example that showed how to pull data from Wikipedia into a game.

You might want to look at WordNet. The database is available in several different flavors, including some online versions. I’m currently integrating a MySQL version into an online text analysis tool.

There are also WordNets in other languages and multilingual versions, but I don’t have any experience with them.

Might not be the Answer you want to hear, but:
In order to avoid redundancy, I believe you should not implement a complete dictionary into an IF-Interpreter (or website). Why? Because the ideally the – only one! – dictionary a user needs will work inside your game as well as with all other applications.

For example I’m using goldendict as my one and only dictionary. I encounter an unknown word, I select it, tap my self-defined shortcut-key, and it displays all avaiable explanations/translations. Works great in all applications, even on my phone.

Maybe you should take a look at it, they’re doing exactly what you’re describing, but not limited to one game/website.

well, your “IF” is really just static fiction, so if you publish it on the kindle, voilá, the user only needs to hold onto a word so the dictionary definition shows up…

then again, I don’t think the kindle supports videoclips…