Game Dictionary

Jericho allows access to the dictionary of a game through jericho.FrotzEnv.get_dictionary(). The dictionary contains a list of jericho.DictionaryWord that are recognized by the game’s parser.

class jericho.DictionaryWord(word, is_noun=False, is_verb=False, is_prep=False, is_meta=False, is_plural=False, is_dir=False, is_adj=False, is_special=False)

A word recognized by a game’s parser.

Parameters:
  • word (string) – The dictionary word itself.
  • is_noun (boolean) – Is the word a noun.
  • is_verb (boolean) – Is the word a verb.
  • is_prep (boolean) – Is the word a preposition.
  • is_meta (boolean) – Used for meta commands like ‘verbose’ and ‘script’
  • is_plural (boolean) – Used for pluralized nouns (e.g. bookcases, rooms)
  • is_dir (boolean) – Used for direction words (e.g. north, aft)
  • is_special (boolean) – Used for special commands like ‘again’ which repeats last action.
Example:
>>> from jericho import *
>>> env = FrotzEnv('zork1.z5')
>>> vocab = env.get_dictionary()
[$ve, ., ,, ", a, across, activa, advent, ... zork, zorkmi, zzmgck]
>>> [w for w in vocab if w.is_noun]
[advent, advert, air, air-p, altar, art, aviato, ax, axe, bag, ... ]
>>> [w for w in vocab if w.is_adj]
[ancien, antiqu, bare, beauti, birds, black, bloody, blue, ... ]

Note

Many parsers will recognize only the first six or nine characters of each word. For example northwest is functionally equivalent to northw.

Warning

Not all games specify the parts of speech for dictionary words.