Skip to content

Latest commit

 

History

History
163 lines (119 loc) · 4.74 KB

README.md

File metadata and controls

163 lines (119 loc) · 4.74 KB

Lexical Decision in Rioplatense Spanish

Lexical Decision in Rioplatense Spanish is a task that gathers response times for 360 words from the Rioplatense Spanish lexicon. The task was programmed using Django, Bootstrap and jsPsych, and can be run online or offline (it is configured to display a larger list of words if it is being run offline and a longer timeout for ending the task).

As this same web server could be easily adapted for running the task for a different set of words or even a different language (see instructions below), the source code is being made public for other researchers to use.

Installation

Important

If pip, venv or Postgres are not installed, install them first:

sudo apt install python3-pip
sudo apt install python3-venv
sudo apt install postgresql
  1. Create a new virtual environment:
python3 -m venv .venv
source .venv/bin/activate
  1. Install the dependencies:
python -m pip install -r requirements.txt
  1. Create the Postgres database:
createdb martin
sudo -u martin psql
CREATE DATABASE decisionlexicasp WITH OWNER martin;
  1. Set-up the initial state of the database:
python manage.py collectstatic
python manage.py makemigrations
python manage.py migrate
python manage.py createsuperuser
python manage.py seed --mode=refresh

Starting the server

  1. Activate the virtual environment:
source .venv/bin/activate
  1. Start a web server on your local machine:
gunicorn mysite.wsgi

This will start a development server at localhost. You can open that address to run the task in online mode or you can open it in offline mode (it will use a larger set of stimuli and longer timeout), or even in debug mode (it just use a very small set of stimuli). Head to the settings site to configure the size of the set of stimuli in each mode, and to the admin site to see the replies and to API to interact with the REST interface.

Adaptation

Follow the next steps to either update the list of words or language the task is run in.

Updating the set of stimuli (images with words in Rioplatense Spanish)

  1. Place the image files at folder at decisions/static/terms and update the CSV file accordingly at decisions/management/commands/seed.csv.

  2. Activate the virtual environment:

source .venv/bin/activate
  1. Fill the database with the stimuli:
python manage.py seed --mode=refresh

Creating stimuli

In order to generate images from words in any given language, you can follow these steps:

  1. Install the image manipulation software suite:
sudo apt install imagemagick
  1. Create a PNG image with the word word with the following command:
convert -gravity center -pointsize 60 -extent 640x512 \
-size 640x512 -font Liberation-Serif \
caption:"word" word.png
  1. Repeat step 2 for every word in the set of desired stimuli.

  2. Place all the generated PNG files in the folder at static/terms

  3. Update the CSV file at decisions/management/commands/seed.csv. This CSV file contains the following columns (in order): word, image filename, lexical frequency (a number from 1 to 7 where 7 is associated to high-frequency and 1 to low-frequency words), and finally, True or False whether the stimulus is a real word or not. The last two columns are used to display a score at the end of the experiment.

  4. Activate the virtual environment:

source .venv/bin/activate
  1. Update the database by running:
python manage.py seed --mode=refresh

Updating the instructions

If the task is meant to be run for a different language, you will need to update the instructions and form as well (that is, everything visible to the user that is in Spanish). To do so, walk through the following steps in the order you want:

  • The form questions are declared in decisions/views.py and the instructions in decisions/templates/index.html.

  • Update the information_paper.pdf file that is referenced in index.html.

  • The constrained set of replies the user can answer in the form are coded in decisions/models.py (you will need to update the database afterwards: python manage.py migrate).