Self-paced-reading task

  • 27th Sep 2024
  • Updated on 14th May 2025
Experiment element only

This documentation describes only one part of an experiment. For other tasks, see the related pages.

Self-paced reading

The self-paced reading paradigm is a method used in psycholinguistics to study sentence processing. Participants read a sentence in word-by-word or phrase-by-phrase, pressing a button to reveal each segment. In this implementation, the sentence segments that were revealed, disappear as soon as the next segment is displayed.

Self-paced reading experiments record the time spent reading each segment. This allows researchers to gauge how difficult or easy it is for participants to process different parts of the sentence. Differences in reading time between help to understand the cognitive mechanisms underlying the processing of language.

Self-paced reading experiments are often accompanied by forced-choice comprehension questions or an acceptability judgment task.

Overview

This code sets up an online psycholinguistic experiment using PCIbex, handling participant instructions, displaying reading materials, inserting comprehension questions with attention checks, and tracking accuracy.

The structure of the code is as follows:

  1. Setup and Configuration
  2. Experiment Structure (order of the experiment stages)
    1. Set Latin square group/select list
    2. Exercise
    3. Start of main experiment notice: "start_experiment"
    4. Main experiment: rshuffle("experiment-filler", "experiment-item")
    5. Sending results: SendResults()
  3. List counter
  4. Start of experiment notification
  5. Experiment trial structure

Dependencies

  1. Resources
    • items.csv list of exercise stimuli
  2. Scripts
    • main.js
  3. Aesthetics
    • global_main.css
    • PennController.css
    • SelfPAcedReadingParadigmSentence.css
  4. Modules
    • PennController.js
    • SelfPAcedReadingParadigmSentence.js

Other modules and aesthetics may be necessary if your experiment uses other trials, e.g. a form for recording participant information.

Stimulus file

Names

The column names and their capitalization matters. If you change the column names and file name, adjust your code accordingly.

The stimuli file items.csv has the following structure as in the table below. The column names and their capitalization matters.

  • ITEM: the item ID
  • CONDITION: the condition ID
  • SENTENCE: the sentence to be displayed during self-paced reading; sentence segment boundaries are indicated by *
  • LIST: the list ID or Latin square group, used for experiment version presentation
  • TYPE: the stimulus type (exercise, item, or filler)
    • exercise: shown only during the exercise trials in random order
    • item and filler: shown only during the main experiment trials in pseudorandomized order

In the exercise, the sentences are presented in random order. In the main experiment, the sentence order is randomized and the filler order is randomized. Then, the items and fillers are shuffled in a random order.

ITEMCONDITIONSENTENCELISTTYPE
11Andrea*war*abweisend,*um*das Date*schneller*zu beenden.1item
12Anja*war*aggressiv,*um*die Rivalin*zu irritieren.2item
22Svenja*war*barbarisch,*um*die Wikinger*für sich*zu gewinnen.1item
21Clara*war*bescheiden,*um*die Stiefmutter*von sich*zu überzeugen.2item
10011001Henrike*fuhr*nach Brasilien.1filler
10011001Henrike*fuhr*nach Brasilien.2filler
10021001Die Polizei*bat*um Hilfe.1filler
10021001Die Polizei*bat*um Hilfe.2filler
20010In Internetforen*diskutierten*Eltern.1exercise
20010In Internetforen*diskutierten*Eltern.2exercise
20020Beide Einrichtungen*wurden*von Freiwilligen betrieben.1exercise
20020Beide Einrichtungen*wurden*von Freiwilligen betrieben.2exercise
Read more on randomization

in the PCIbex and Ibex documentations.

Self-paced reading code

The self-paced reading procedure is governed by 3 files: the SelfPacedReadingParadigmSentence.js module, the SelfPacedReadingParadigmSentence.css style file, and the trial setup in main.js.

Phrase-by-phrase presentation

Self-paced reading phrase-by-phrase task

The main.js file must contain a variation of the following code:

// Trial
// display a primer that can be clicked away by pressing space bar
const newPrimer = () => [
  newText('primer','*')
    .css("font-size", "30pt")
    .css("margin-top", "8px")
    .center()
    .print(),
  newKey(" ").wait(),
  getText('primer').remove(),
];

Template("items.csv", row =>
    newTrial( "experiment-"+row.TYPE,
              newPrimer(),
           newController("SelfPacedReadingParadigmSentence", {s : row.SENTENCE, splitRegex: /\*/})
           .center()
           .print()
           .log()
           .wait()
           .remove())
    .log( "list"      , row.LIST)
    .log( "item"      , row.ITEM)
    .log( "condition" , row.CONDITION)
);

This code snippet is structured to conduct a series of experimental trials. Within a single trial, participants navigate by pressing the SPACE bar. The participants:

  1. See a primer (e.g. a fixation point *)
  2. For each row in a items.csv, a new trial is created with a sentence displayed. The letters are substituted for underscores _.
  3. The sentence is split at designated points (indicated by asterisks *) for self-paced reading.
  4. After each pressing of the space bar, the previous sentence segment is obscured and the next one is revealed.
  5. Additional trial information is logged (list, item, and condition). This information is logged based on the values in the corresponding columns of items.csv for each row (currently displayed sentence).

Word-by-word presentation

Self-paced reading word-by-word task

To change the presentation to word-by-word, you need to make 2 changes to your experiment. In the main.js file, substitute * for an empty space:

newController("SelfPacedReadingParadigmSentence", {s : row.SENTENCE, splitRegex: / /})

In the stimulus CSV file, replace * for empty spaces:

ITEMCONDITIONSENTENCELISTTYPE
11Andrea war abweisend, um das Date schneller zu beenden.1item

Optional: Start experiment screen

This code sets up the beginning of an experiment by initializing a new trial and displaying a message to the participants that indicates the experiment is starting. It separates the exercise trials from the main experiment. The participants must click on the button "Continue" to proceed to the next part of the experiment.

// Start experiment screen

newTrial( "start_experiment" ,
    newText("The main experiment begins now.")
        .print()
    ,
    newButton("go_to_experiment", "Continue")
        .print()
        .wait()
);

Running Code

To run the code, clone/download the content of the GitHub repository and copy it into a new empty project in your PCIbex farm. Alternatively, click on the demo link (phrase-by-phrase, word-by-word) and clone the template.