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.

Comments

  • edited 11:43PM

    Hi,

    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,

    Eduard

    Buy Me A Coffee

  • edited 11:43PM

    Hi,

    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!

    Silvia

  • edited 11:43PM

    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,

    Eduard

    Buy Me A Coffee

  • edited 11:43PM

    Hi Eduard,

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

    Silvia

  • Hi Eduard, Hi Silviark,

    I am also currenty working on a very similar experiment. I will try your solutions too, so thank you for these answers.

    But I wanted to ask that, I have my sentences in an Excel file, and in my case every sentence should be presented next to a picture: so participants will think a person (picture) says the sentence. I am thinking of using your suggested method, but I am not sure how can I trick Opensesame to pull the corresponding picture to the corresponding sentence, and then make it present in the same way one word at a time. I am new to OpenSesame, and I came kind of so far but I am stuck here. I would be really glad for your help.

    PS: I have variable codes for everything: say if my Speaker 1 is A, she will say the sentence coded 00, or Speaker 2 will need to have the sentence 01. They are all in the Excel files.


    Best,

    Hülya

  • Hi Hulya,

    One way of doing it is giving the files the same names (except the ending of course). Like that, you can code the name in the loop table and load the corresponding variables. Presenting pictures next to the text is not particularly hard. The procedure that I described above is primarily relevant for generating the sentences step-by step. The actual presentation on a sketchpad is straightforward. You just need to draw an image and a text item (at a different location).

    Does that make sense?

    Eduard

    Buy Me A Coffee

  • Hi Eduard,

    Thank you very much for your answer!

    Yes, I am able to make them in the sketchpad as you said, so that is okay. But I think I couldn't explain the main problem, so I will try:

    I have 4 pictures that will be assigned to 160 sentences. And those are all randomized in an Excel file beforehand, so the lists are ready. So I was wondering if I need to draw every one of them one by one in the sketchpads, that is going to take so long and kind of feels like bad practice... Therefore I was wondering if I can make my sequence grab the picture names and their assigned sentences automatically into one sketchpad, and follow the sequence in the Excel file. So what I want to do is: Picture 1 with sentence 150, picture 2 with sentence 35, picture 4 with sentence 60, picture 3 with sentence 63, picture 2 with sentence 23.... and loop like this until the end of the list. (and they are going to be self-paced reading so picture needs to stay while words are shown one by one with the button press). Can I say, to the table in OpenSesame, the variable names; and copy-paste my Excel list there, and just draw [pic_variable_name] and [sentence_codes] in one sketchpad to do this?

    I am sorry if I am being confusing...because I am confused too...

    Best,

    Hülya

  • Hello!

    I solved the problem, apparently I could do it :) Thank you!

    Best,

    Hülya

  • Very nice!

    Buy Me A Coffee

  • Hi,

    I would like to transform an older E-Prime self-paced reading study of mine into an OSWeb study to test subjects online. However, my sentences are not seperated by words, but in chunks of phrases + the critical phrase has to be marked, so your approach with the script wouldn't work in my case (I think).

    I have the sentences in an Excel format and how it worked in E-Prime, was that I had the text in the loop and there was a column for 'Phrase 1', then 'Phrase 2', 'target -1' 'target', 'target+1', 'Phrase 3'...'Last Phrase' and basically like this it would go from one phrase to the other, if a phrase was empty, I could put in the sequence that it would jump to 'target -1' and if after the target there was an empty phrase it would jump to 'last phrase', which is quite relevant as the sentences differed sometimes with respect to the number of phrases. With this approach I could also randomize the sentences.

    Is it possible to do this in the same way in OpenSesame?

    Thank you!!

  • Hi @Joanna_RUG ,


    Yes, this is certainly possible. How about the following procedure?


    • Firstly, define your sentences in the block_loop the same way that you did in E-Prime, that is, by having separate columns for Phrase 1, Phrase2, Target_minus_1 (note that column names do not take hypens), etc. If a phrase is empty, simply leave the cell empty:


    • Append another loop-sequence structure to your trial_sequence. In this nested loop, you (re-)define the content of the phrases. However, you do not have to use the absolute values (that is, the actual words) again, you can simply refer to the previously defined variables by using the square-bracket syntax, like so:


    • Make sure the nested loop (here called self_paced_reading_loop) contains as many rows as the maximum number of phrases defined earlier. Also, make sure that the order of this loop, in contrast to the block_loop, is set to "sequential".


    • In the sketchpad, you prepare the different sketchpad contents for each cycle separately. For example, on the first cycle, the sketchpad should only show the very first chunk of text. Therefore, the corresponding sketchpad script will look as follows:
    draw textline center=0 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes text="[Phrase1]" x=-400 y=-100 z_index=0
    


    (Make sure that you set center to 0, such that the sentence always starts at the same x position, regardless of how long it is.)

    • However, you only want to show this particular sketchpad content for the very first cycle. Therefore, you add a show-if statement to this line of script, saying that it should only be shown if [phrase_counter] = 1:


    draw textline center=0 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if="[phrase_counter] = 1" text="[Phrase1]" x=-400 y=-100 z_index=0
    


    • For the second cycle, you add the second chunk of text to the sketchpad content and use [phrase_counter] = 2 as show-if statement:


    draw textline center=0 color=white font_bold=no font_family=mono font_italic=no font_size=18 html=yes show_if="[phrase_counter] = 2" text="[Phrase1] [Phrase2]" x=-400 y=-100 z_index=0
    


    Etc.


    Finally, to make sure that participants don't have to press a button if the current text chunk is empty, add the following Run-if statement for the sketchpad and keyboard_response items in the sequence:



    I hope all this helps. I uploaded an example script containing two sentences. Just let us know if you have any further questions!


    Cheers,


    Lotje





    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Dear Lotje,

    thank you so much for your detailed answer and help! I saw your reply only now and will try it out these days and let you know!!

    Cheers,

    Joanna

  • Hi @Joanna_RUG ,


    Good luck and keep us posted.


    Cheers,


    Lotje

    Did you like my answer? Feel free to Buy Me A Coffee :)

  • Hi Lotje,

    so, I tried your example file, however, it worked offline, but not in OSWeb.

    I also looked at my old self-paced reading task in E-Prime again and saw that only the currently read part of the sentence was shown and the rest of the sentence

    was masked with dashes. Is this also possible with OS? I attach a screenshot and a copy of the E-Prime script, I think that probably helps...

    Thank you in advance...

    Joanna

  • Hi @Joanna_RUG ,


    I tried your example file, however, it worked offline, but not in OSWeb.


    That's probably because there was a bug in the previous version of OSWeb. I think when you update, everything will run correctly.

    Regarding the dashes: Ok, so this changes the design quite a bit from what I understood from your initial description. The new design requires some inline scripting. And, because you are running your study online, the language in which we are going to program is JavaScript (instead of Python, with which OpenSesame normally works).

    I'm not able to run E-Prime scripts, but I think the following should work. (There are no doubt more elegant ways to do this, but I'm not in expert in JavaScript myself yet...)


    • Define all possible sentences (where only the relevant phrase is shown, the rest are dashes) in an inline_javascript item in the trial_sequence of your experiment (in the Prepare tab):
    // Define the dummy letter, here x
    var dummy_char
    dummy_char = "-"
    
    // Array containing the separate phrases of the current sentence:
    var sentence_array
    sentence_array = [vars.Phrase1, vars.Phrase2, vars.Target_minus_1, vars.Target	, vars.Target_plus_1, vars.Phrase3, vars.Phrase4	, vars.Phrase5]
    
    // Array containing phrases of which the words are replaced by x's (currently empty)
    var placeholder_sentence_array
    placeholder_sentence_array = []
    
    // Walk through the current phrases:
    var i
    for (i = 0; i < sentence_array.length; i++) {
        
        var current_phrase
        current_phrase = sentence_array[i]
        
        // Define a placeholder for the current phrase:
        var placeholder_phrase
        placeholder_phrase = []
        
        // Walk through the letters of the current phrase:
        var j
        for (j = 0; j < current_phrase.length; j++) {
        
            
            var current_char
            current_char = current_phrase[j]
            
            // If the current character is a space, a space is
            // added to the placeholder string
            if (current_char === " "){
                placeholder_phrase.push(" ")
                }
            
            // Else, the current character is replaced by the dummy character
            else {
                placeholder_phrase.push(dummy_char)
                }
    
            }    
        
        // Merge so that placeholder x's form a string instead of 
        // an array
        var placeholder_prhase_string
        placeholder_phrase_string = placeholder_phrase.join("")
    
        
        // Append the current placeholder to the array of 
        // placeholders
        placeholder_sentence_array.push(placeholder_phrase_string)
        }
        
    var sentence_phrase1
    var sentence_phrase2
    var sentence_phrase3
    var sentence_phrase4
    var sentence_phrase5
    var sentence_phrase6
    var sentence_phrase7
    var sentence_phrase8
    
    // Initially, all phrases are copies of the dummy sentence
    sentence_phrase1 = placeholder_sentence_array.slice()
    sentence_phrase2 = placeholder_sentence_array.slice()
    sentence_phrase3 = placeholder_sentence_array.slice()
    sentence_phrase4 = placeholder_sentence_array.slice()
    sentence_phrase5 = placeholder_sentence_array.slice()
    sentence_phrase6 = placeholder_sentence_array.slice()
    sentence_phrase7 = placeholder_sentence_array.slice()
    sentence_phrase8 = placeholder_sentence_array.slice()
    
    
    // Replace the relevant part of the sentence:
    sentence_phrase1[0] = vars.Phrase1
    sentence_phrase2[1]= vars.Phrase2
    sentence_phrase3[2] = vars.Target_minus_1
    sentence_phrase4[3] = vars.Target
    sentence_phrase5[4] = vars.Target_plus_1
    sentence_phrase6[5] = vars.Phrase3
    sentence_phrase7[6] = vars.Phrase4
    sentence_phrase8[7] = vars.Phrase5
    
    // Join separate phrases to a single text string
    vars.sentence_phrase1_string = sentence_phrase1.join(" ")
    vars.sentence_phrase2_string = sentence_phrase2.join(" ")
    vars.sentence_phrase3_string = sentence_phrase3.join(" ")
    vars.sentence_phrase4_string = sentence_phrase4.join(" ")
    vars.sentence_phrase5_string = sentence_phrase5.join(" ")
    vars.sentence_phrase6_string = sentence_phrase6.join(" ")
    vars.sentence_phrase7_string = sentence_phrase7.join(" ")
    vars.sentence_phrase8_string = sentence_phrase8.join(" ")
    


    • Define a new variable representing the "current sentence" in a loop item that is nested in the trial_sequence (in my example called "self_paced_reading_loop") like so:


    • Use the square-bracket syntax to show the current sentence in a sketchpad item like so:
    set duration 0
    set description "Displays stimuli"
    draw textline center=0 color=white font_bold=no font_family=mono font_italic=no font_size=30 html=yes show_if=always text="[current_sentence]" x=-384 y=-32 z_index=0
    


    I uploaded a new example script. Hope this helps!


    Cheers,


    Lotje


    Did you like my answer? Feel free to Buy Me A Coffee :)

Sign In or Register to comment.

agen judi bola , sportbook, casino, togel, number game, singapore, tangkas, basket, slot, poker, dominoqq, agen bola. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 50.000 ,- bonus cashback hingga 10% , diskon togel hingga 66% bisa bermain di android dan IOS kapanpun dan dimana pun. poker , bandarq , aduq, domino qq , dominobet. Semua permainan bisa dimainkan hanya dengan 1 ID. minimal deposit 10.000 ,- bonus turnover 0.5% dan bonus referral 20%. Bonus - bonus yang dihadirkan bisa terbilang cukup tinggi dan memuaskan, anda hanya perlu memasang pada situs yang memberikan bursa pasaran terbaik yaitu http://45.77.173.118/ Bola168. Situs penyedia segala jenis permainan poker online kini semakin banyak ditemukan di Internet, salah satunya TahunQQ merupakan situs Agen Judi Domino66 Dan BandarQ Terpercaya yang mampu memberikan banyak provit bagi bettornya. Permainan Yang Di Sediakan Dewi365 Juga sangat banyak Dan menarik dan Peluang untuk memenangkan Taruhan Judi online ini juga sangat mudah . Mainkan Segera Taruhan Sportbook anda bersama Agen Judi Bola Bersama Dewi365 Kemenangan Anda Berapa pun akan Terbayarkan. Tersedia 9 macam permainan seru yang bisa kamu mainkan hanya di dalam 1 ID saja. Permainan seru yang tersedia seperti Poker, Domino QQ Dan juga BandarQ Online. Semuanya tersedia lengkap hanya di ABGQQ. Situs ABGQQ sangat mudah dimenangkan, kamu juga akan mendapatkan mega bonus dan setiap pemain berhak mendapatkan cashback mingguan. ABGQQ juga telah diakui sebagai Bandar Domino Online yang menjamin sistem FAIR PLAY disetiap permainan yang bisa dimainkan dengan deposit minimal hanya Rp.25.000. DEWI365 adalah Bandar Judi Bola Terpercaya & resmi dan terpercaya di indonesia. Situs judi bola ini menyediakan fasilitas bagi anda untuk dapat bermain memainkan permainan judi bola. Didalam situs ini memiliki berbagai permainan taruhan bola terlengkap seperti Sbobet, yang membuat DEWI365 menjadi situs judi bola terbaik dan terpercaya di Indonesia. Tentunya sebagai situs yang bertugas sebagai Bandar Poker Online pastinya akan berusaha untuk menjaga semua informasi dan keamanan yang terdapat di POKERQQ13. Kotakqq adalah situs Judi Poker Online Terpercayayang menyediakan 9 jenis permainan sakong online, dominoqq, domino99, bandarq, bandar ceme, aduq, poker online, bandar poker, balak66, perang baccarat, dan capsa susun. Dengan minimal deposit withdraw 15.000 Anda sudah bisa memainkan semua permaina pkv games di situs kami. Jackpot besar,Win rate tinggi, Fair play, PKV Games