A-maze

Code
jspsych-maze (plugin)
maze-distractor-generator

Current tools
Distractor generation (Hugging Face models)
Generating distractors
Other languages
jsPsych
Running A-maze in jsPsych
A-maze for kids

Demos
All demos
Kid-friendly reading
Sentences with RT graph
Sentences without redo
Short vignettes
Natural Stories story

Background
What is A-maze?
Papers using A-maze
An argument for 'redo' mode
Adding a delay to 'redo' mode
Experiment design
Parameter considerations

Older tools
Original distractor generation (Boyce et al. 2020; Boyce & Levy 2023)
Install instructions
Basic use
Parameters
Advanced options
Ibex
Using Ibex for Maze
Hosting an Ibex-Maze server

A-maze in other languages

The distractor generator is set up for English. Nothing in the method is English-specific, though. A-maze needs three ingredients, and for another language you could supply your own version of each:

  1. A list of possible distractor words. These should be real words that participants will recognize. Computer dictionaries can help, but usually need cutting (abbreviations, proper nouns, swear words).
  2. Word frequencies, to draw candidates that match the correct word in length and frequency – or whatever properties you want to match on.
  3. A language model that can say how surprising a word is in context.

What to change in the generator

Set three things in your parameters file:

language: "fr"                      # a wordfreq language code
include_words: "french_words.txt"   # candidate distractors, one per line
model: "<a French or multilingual Hugging Face model>"

language is a wordfreq language code; wordfreq has frequency data for about 40 languages. Frequencies for both the candidate distractors and the real words come from that language, so candidates are matched to your words on length and frequency. An unknown code is an error. If you don’t want wordfreq, you could edit the code to use a different frequency source, or a different matching procedure.

include_words is required outside English; there is no default word list for other languages. Candidates must be all-lowercase letters (accented letters are fine), which drops proper nouns and abbreviations. English’s curated_word_list.txt took a fair amount of hand-filtering (offensive words, sensitive topics). Use exclude_words if you want to build up a blacklist rather than curate everything at the start.

model can be any Hugging Face causal or masked model (backend). Use one trained on your language, either monolingual or a multilingual model with good coverage of it. It’s worth checking that it gives sensible surprisals on a few of your sentences before generating everything (get_surprisal.py).

If you need different rules for which words are allowed, copy wordfreq_dict in wordfreq_distractor.py and set dictionary_class to your class.

Things to think about

If you adapt the generator for another language, contributions to maze-distractor-generator are welcome (send a PR if you like).