Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

[solved] Self-paced reading task

edited November 2014 in OpenSesame

Hi all!

I would like to program a self-paced reading task experiment on OpenSesame.
I've already looked at the video tutorial and looked for tips or references in the net, without success.

Does anybody know how to to implement the pacing in the experiment loop?

Thank you.


  • edited 8:06AM


    If a "self-paced reading task" boils down to presenting screens with text many times after each other in the pace of the participant pressing a button or a key, you can simple you use text_form_display items. Write your text into these forms and tell your participants that they should press the OK button to proceed to the next page.
    You can have a look on the forms in general to get an idea of how it works.

    Give it a try, if you need help, you post your specific question here again.

    Good luck,


  • edited 8:06AM


    thank you Eduard for your response.
    I'll try to explain better myself.

    I need to test reaction reading time within sentences. I need the program to present different sequences of a sentence in response to the pressing of a button by the subject.

    For example, the sentence "John eat meat" is going to be presented by mean of three sequences. Each sequence corresponds to the prevoius one plus an element:
    1. John
    2. John eat
    3. John eat meat.
    Simplyfying, each time the subject presses a button she gets the following word.
    This way, reading times for each (in this case) word are tested, since the subject press a button to get the next sequence.

    My temporary solution consists in using .jpg files containing already cutted sequences, although it requires a lot of time because each sequence of each sentence consists of one .jpg file.

    From a corpus of sentences, given the points of cutting, how can I tell to OpenSesame how manage the administration of stimuli?

    Thank you very much!


  • edited 8:06AM

    Hi Silvia,

    Now I understand better. Thanks for the explanation. Well, the solution to this problem depends a lot on how you have saved all the sentences. If you all have them as a ".jpg" file, I can't think of a smart way that requires not too much work-arounds. I think the easiest option would be, if you had the sentences in a ".txt" file, with one sentence per line. First thing to do then is reading this file and saving the strings to a nice list. You can adapt following code in an inline_script.

    your_file = exp.get_file('file.txt') # the textfile should be in the filepool, 
    #or at least in the same folder as the experiment
    with open(your_file, 'r') as f:
        your_list =  f.readlines()
    # your_list is a list that contains every sentence as an entry

    You can put this script in the beginning of your experiment, because you need the file read only once. After that you start your loop, in which every iteration picks one sentence.

    Now you can add another inline_script to your sequence, in which split the current sentence into its pieces (so far it has been a long string, e.g. 'John eats meat'). This will again give you a list with every word as an entry:

    word_list = your_list[cur_iteration].split( ) # .split( ) will separate your 
    # string whenever it encounters a space 
    # (see python documentation for more info)
    exp.set('presented_sequence', ' ') # This set the sentence you want to 
    # display to an empty string

    Next. you add another loop with a sequence containing an inline_script and a sketchpad. In this sequence you will loop over each word, add it to the presented_sequence and show it then via the sketchpad.

    exp.presented_sequence = exp.presented_sequence + word_list[exp.word_no] 
    # word_no is the running index of the loop

    When doing this you should keep following things in mind:

    • for all inline_scripts(especially the last one), put the code in the prepare phase
    • in the sketchpad, you have to add a placeholder string: [variable] will show the content of that variable and not literally "variable".
    • in the last loop don't forget to switch off randomization, if you don't want to have scrambled sentences.
    • the code how it is now, probably won't work if you just copy it and fill some gaps. Use it as a guideline to the structure you need to get.
    • this is one way of doing it. There are many others. In my opinion, this is one is rather straightforward.

    Alright, I hope this helps, if you need more help later, just ask again.

    Good luck,


  • edited 8:06AM

    Hi Eduard,

    thanks a lot!!!
    I am going to apply your wonderful suggestions immediately.


Sign In or Register to comment.