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.
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
- Create a new virtual environment:
python3 -m venv .venv
source .venv/bin/activate
- Install the dependencies:
python -m pip install -r requirements.txt
- Create the Postgres database:
createdb martin
sudo -u martin psql
CREATE DATABASE decisionlexicasp WITH OWNER martin;
- 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
- Activate the virtual environment:
source .venv/bin/activate
- 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.
Follow the next steps to either update the list of words or language the task is run in.
-
Place the image files at folder at
decisions/static/terms
and update the CSV file accordingly atdecisions/management/commands/seed.csv
. -
Activate the virtual environment:
source .venv/bin/activate
- Fill the database with the stimuli:
python manage.py seed --mode=refresh
In order to generate images from words in any given language, you can follow these steps:
- Install the image manipulation software suite:
sudo apt install imagemagick
- 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
-
Repeat step 2 for every word in the set of desired stimuli.
-
Place all the generated PNG files in the folder at
static/terms
-
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. -
Activate the virtual environment:
source .venv/bin/activate
- Update the database by running:
python manage.py seed --mode=refresh
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 indecisions/templates/index.html
. -
Update the
information_paper.pdf
file that is referenced inindex.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
).