Pushkin
  • Welcome!
  • Getting Started
    • Installing Pushkin and dependencies
      • macOS
      • Windows 10
        • Windows Subsystem for Linux
        • AWS EC2 Instance
      • Ubuntu Linux
    • Quickstart
      • Quickstart: Example Outputs
    • Deploying to AWS
      • Install required software.
      • Configure the AWS and ECS CLIs.
      • Register a domain.
      • Set up DockerHub.
      • Initialize AWS Deploy.
    • Tutorial: Simple Experiment
  • FAQ
    • FAQ
  • Advanced
    • Pushkin CLI
    • Using Experiment Templates
      • Lexical decision template
      • Grammaticality judgment template
      • Self-paced reading template
    • Experiment Component Structure
      • Experiment Config.yaml Files
      • Experiment Web Page Component
      • Worker Component, Migration, and Seed
    • Modifying Site Template
      • React Bootstrap
      • Header and Footer
      • Home Page
      • Findings Page
      • About Page
      • Feedback Page
    • Troubleshooting Pushkin
    • Pushkin Client
    • pushkin-api
      • API Controller Builder
      • Core API
    • Users & Authentication
    • Deployment
      • Deleting AWS
  • Developers
    • Developing with Pushkin
    • Getting Started on Development
    • Overview of Technologies
    • Testing Pushkin with Jest
    • Working with Templates
Powered by GitBook
On this page
  • config.js
  • stim.js
  • Example: Customizing a grammaticality judgment experiment
  • Finding experiment files to modify
  • Modifying the experiment configuration and stimuli files

Was this helpful?

  1. Advanced
  2. Using Experiment Templates

Grammaticality judgment template

PreviousLexical decision templateNextSelf-paced reading template

Last updated 1 year ago

Was this helpful?

To install this experiment template, use the command pushkin install experiment, then select grammaticality.

config.js

When correctiveFeedback is set to true: the two-alternative forced choice question will indicate if the participant's response was correct (in green font) or not (in red font). For the likert scale or slider, text indicating if the sentence was grammatical or ungrammatical will show. For all response types, when this is set to false, a fixation cross appears instead of corrective feedback.

responseType: Set whether the response type is two-alternative forced choice (set to "2afc"), five-point likert scale (set to "likert"), or a slider from 0-100 (set to "slider").

stim.js

sentence_grammatical: The grammatically correct sentence.

sentence_ungrammatical: The grammatically incorrect sentence.

Example: Customizing a grammaticality judgment experiment

Finding experiment files to modify

If you have installed an experiment using the grammaticality judgment experiment template and called it gram, you should have a directory called gram in your experiments folder. This directory should be structured like this:

gram
├── api controllers
├── config.yaml
├── LICENSE
├── migrations
├── README.md
├── web page
└── worker

In order to customize your simple grammaticality judgment experiment, you will need to access two files, config.js and stim.js. These files can be found in web page/src/, a directory that looks like this:

src
├── assets
├── config.js
├── consent.js
├── debrief.js
├── experiment.js
├── index.js
└── stim.js

Modifying the experiment configuration and stimuli files

Modifying config.js

This file controls the aesthetics of your experiment, including font color, font size, and font family. If you wanted to set the font color to green, set the font size to 24px, and set the font family to a monospace font such as Courier New, you would modify config.js as follows:

// Custom stylin'

var experimentConfig = {
    fontColor: "green",
    fontSize: "24px",
    fontFamily: "'Courier New', Courier, monospace",
    correctiveFeedback: true
    responseType: “2afc”
}

export default experimentConfig;

You'll also notice that correctiveFeedback is set to true. You can change this to false so that participants don't receive any feedback. Once you make this change, your config.js should look like this:

// Custom stylin'

var experimentConfig = {
    fontColor: "green",
    fontSize: "24px",
    fontFamily: "'Courier New', Courier, monospace",
    correctiveFeedback: false
    responseType: “2afc”
}

export default experimentConfig;

By default, responseType is set to 2afc. You can change this to likert or slider to change the response type to a 5-item likert scale or a slider from 0-100. If you wanted to use a likert scale, your final config.js should look like this:

// Custom stylin'

var experimentConfig = {
    fontColor: "green",
    fontSize: "24px",
    fontFamily: "'Courier New', Courier, monospace",
    correctiveFeedback: false
    responseType: “likert”
}

export default experimentConfig;

You can run pushkin prep and pushkin start to see your changes.

Modifying stim.js

This file controls the stimuli presented to participants. It specifies the sentences for each trial and denotes which is grammatical (sentence_grammatical) and which is not (sentence_ungrammatical).

Say you have created the following table of stimuli for your experiment.

sentence_grammatical
sentence_ungrammatical

The frog is jumping.

The frog are jumping.

Where did she go?

Where she did go?

He went for a walk.

He went a walk.

This is an example.

This an example.

Once it has been converted, paste the JSON into the stim.js file. You may need to manually add spaces, as the file should now look like this:

// Example stimuli

const stimArray = [
  {
    sentence_grammatical: "The frog is jumping.",
    sentence_ungrammatical: "The frog are jumping.",
  },
  {
    sentence_grammatical: "Where did she go?",
    sentence_ungrammatical: "Where she did go?",
  },
  {
    sentence_grammatical: "He went for a walk.",
    sentence_ungrammatical: "He went a walk.",
  },
  {
    sentence_grammatical: "This is an example.",
    sentence_ungrammatical: "This an example.",
  },
];

export default stimArray;

Run pushkin prep and pushkin start again, and your experiment should be ready to go!

You'll notice that 'Courier New' is not fontFamily's only specification. This is because it's important to list backup fonts in case your preferred font can't be loaded. You can read more about this practice and see other CSS font combination ideas .

In order to be able to use these stimuli in the grammaticality judgment experiment, you must use a table-to-JSON converter such as to format it correctly for jsPsych.

here
here
this one
config info
stim info
Example: Customizing a grammaticality judgment experiment
Grammaticality judgment experiment template, with corrective response set to true.