psychopy.org | Reference | Downloads | Github

Self paced reading task

If this template helps then use it. If not then just delete and start from scratch.

OS Win10
PsychoPy version 2021.1.2

What are you trying to achieve?:
I’m developing a word-by-word self paced reading task.
What did you try to make it work?:
With the help of @wakecarter, I came up with the right code of python to run the SPR section. But now i want to insert a comprehension question for each item. And I did this:


What specifically went wrong when you tried that?:
After the appearance of the first item, the first question was displayed. Perfect, right? wrong. The rest of the questions were displayed following the first Q. What I want is this order:

  • First item, first Q
  • Second item, second Q

    I’m no familiar with coding but i think i should enter a code for that. I appreciate any help of yours in advance.

I’d suggest changing the topic to “Builder”
What you want to do is create an excel file or csv (it’s called a “conditions file”) with all your questions listed in different cells, and reference this file in the “trials” loop settings. Then, just make one question routine, and for the text of each question, have it reference the column name from your file where all the questions are listed.
See here:
https://phon.wordpress.ncsu.edu/lab-manual/perception-experiments/2-psychopy-tutorial-loops-and-trials-lexical-decision-task/
Or this video, at 16:40

(they are using it to change words on each loop, but you will have full questions)

dear @asia2
Thank you! It was much easier than what I imagined.

Is it also possible to come up with wh-questions in which participants have to type different answers?

Hi Zeinab,
Happy to help. I’m not sure I understood your question-- you mean you want a place for people to type free responses instead of choosing a response?

This community is great with people like you :shamrock:
Exactly. I wonder whether it is possible to ask questions with different answers like

  • how many people were there? answer: three
  • whose house was robbed? answer: Anna’s

See? so instead of defining an exact key like ‘y’ or ‘n’ in yes/no questions, the answers are varied and have to be typed up. It will not be easy. My question is,
is it even possible to do that?

Possible, definitely.

You can either use an editable text box or text response in code (which I use in my free recall and sentence cloze tasks).

Hi @wakecarter!

Could you kindly share the code of that? Just one thing to bear in mind, I’m going to run the experiment on Pavlovia ultimately, so the goal is for the whole thing to run smoothly. If typing the answer’s going to cause some problem later, I’ll write yes/no questions.

Almost everything I write nowadays is for online.

I’ve recently improved my text code to allow mouse and arrow key interactions so I think it’s time I added it to my code snippets page.

Thanks @wakecarter!
@Zeinab_Alipour just keep in mind that if you allow a participant to type something, they can type anything in there (and sometimes nothing); and so it is much more effort to process the data afterwards and you risk lower data quality. Yes/no questions will be standard and simpler to analyze but lack in some flexibility and force an interpretation on the participant.

For example, for your first question, “How many people were there?” You could limit your valid responses to the numbers on the keyboard 0-9. This would be a nice compromise compared to yes/no. “Whose house was robbed?” is more difficult; you could do a multiple choice question with buttons for different people’s names, but if you want the participant to retrieve the name themselves, it is probably better to do a free response as you said.

Also, FYI I’ve been having some problems with the textbox lately (that’s the component you want to use if you are looking for typed responses). But maybe it’s because I have been updating some old experiments instead of starting a fresh one.

great! looking forward to receiving it!
Just another question about the output of SPR task that I made with your code:


As you see, the RT for each word is not the pure RT. Well, it’s easy to calculate that. But I wonder whether there is a way to present the RT of a sentence in one column. It will much easier for data analysis, you know.

Hmmm… thanks for telling me!

I guess I go with the y/n questions and I’ll consider a limit for the number of their correct responses, like a cutting score for the accuracy. The comprehension questions should be there to ensure that the participants are actually reading the items in the SPR and are not just pressing buttons.
And thank you for the heads-up. I can’t really run the risk of wasting the credits over an inefficient textbox. :slight_smile:

Don’t get me wrong, free response can be useful, especially if you want to check that people are being conscientious, as that is very hard to tell with y/n questions. It just depends on what the goal of your experiment is. But this is getting into experimental design, not the topic of this thread :wink:

I prefer to have the RTs all from the start of the routine, rather than from the previous word, to avoid compounding errors. It would be simple enough to save both.

To start a new line for each word, just add thisExp.nextEntry()

If you save what they type as well as the score then you can always look for close matches later in the data file.

No, I understood exactly what you meant. It’s just that I thought for the purposes of my experiment, y/n questions will suffice. Plus, if they answer haphazardly, like if the accuracy of their scores is less than say 90 % accurate, their answers will be discarded.
Well, it all depends on my supervisor’s opinion at the end of the day.

Sure, thanks again.

Thank you @wakecarter,
But where should I exactly insert this code? cuz i added it to once the routine and then to frame;
it stopped working.

Straight after you save the RT, ensuring that you don’t accidentally add a new data row every single frame

dear @wakecarter, there is no RT in the code:
Each routine:
words=Sentence.split(’ ‘)
nWords=len(words)
wordNum=0
oldWordNum=-1
phrase=’’
event.clearEvents()

Each frame:
if wordNum>oldWordNum:
phrase+=words[wordNum]+’ ’
text.text=words[wordNum]
oldWordNum=wordNum

keys=event.getKeys()
if ‘space’ in keys:
wordNum+=1
thisExp.addData(‘Word’+str(wordNum),t)
if wordNum==nWords:
continueRoutine=False

Regards

This is saving the time. Add thisExp.nextEntry() after this line.

I did. It shows the first word of the sentence, then collapses.

ps: dear @wakecarter and @aisa2 , do you have the code for the textbox we discussed last night? My supervisor’s opinion is to write these questions.

Are you testing this online? If so, have you defined thisExp in code_JS? If not, what error message are you getting?

I’m currently trying to upload the attached file to a new demo area I’ve created in my Pavlovia account.

free-recall.psyexp (42.0 KB)