Howdy, Stranger!

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

Supported by

Shuffling and randomization

Hi

I have four variable in a loop :

"word" that is included with 64 words

"type" that included with singular (e.g., apple) or plural nouns (apples)

"location" that is included with -320 and 320

"counter" that is included with the numbers form 0-31

After a random selection, two words to be selected out of 64 words, one from singular and one from the plural words. One of them to be presented in the middle screen and the second on the periphery (-320 or 320) in a fully randomized way.

The words are added to the sketchpad at the -320, middle screen and 320 and I need help to know how manage the opensesame to randomize presentation so each time only one word is selected from singular and one from plurals and such the selection has no repetitions for both the selected words. I do not want two similar words (apple and apple) or two words from one category (both singular or both plurals) together in one trial. In addition, the total number of presented trails for each person needs to be 32.

Please can you kindly help managing this experiment?

Peace,

Masoud

Comments

  • Dear Masoud,


    As Eduard already suggested in response to your previous comment, you should define your word lists in an inline_script item rather than in your block_loop. Next, you'll need a second inline_script item to retrieve the words for the current trial.


    More precisely:


    • Append an inline_script item to your block_sequence and place something like below in the Prepare phase tab:
    import random # We need this module to shuffle the lists
    
    # Define the two lists of 32 words:
    list_singular = ["apple", "banana", "book", "script", \
    	"dog"]
    	
    list_plural = ["apples", "bananas", "books", "scripts", \
    	"dogs"]
    	
    
    # Shuffle the lists:
    random.shuffle(list_singular)
    random.shuffle(list_plural)
    


    • Append another inline_script item to your trial_sequence and put something like this in the Prepare phase tab:
    while True:
    	# Get the next word from the shuffled list:
    	var.word_singular = list_singular.pop()
    	var.word_plural = list_plural.pop()
    
    	# Check whether the plural is not the plural of the singular word:
    	# (I assumed that the stem is the plural minus the last letter (i.e., the 's'):
    	stem = var.word_plural[:-1]
    	
    	if stem != var.word_singular:
    		break
    


    • In your block_loop, you'll only have to define the variables for the x-loxation of the plural and the singular word of the current trial.

    All together, your experimental structure should resemble something like this:


    NOTE that for checking that your trials won't contain 'apple' and 'apples', I assumed that all your plural words are formed by placing an 's' at the end of the singular form. So 'book' -> 'books', but not 'bunny' -> 'bunnies'.

    I attached a working example script. I hope this helps!


    Cheers,


    Lotje


  • Dear Lotje

    Thanks very much. I have used the singular and plural names just as an example. In fact, I am using the words from two categories including "A reading Stuff" and "A four foot animal".

    I have 32 words for the reading stuffs (e.g., book, story etc) and the same from animals (cat, dog etc). I want to have roughly the same number of words from each categories to be resented in the middle/right or left the screen. To have it completely randomized, the 64 words are pooled together (32 plurals + 32 singulars) and each of two lists comes with 64 words, both are similar. I want 32 selections or 32 trials out of possible compositions of 64 (+64 similar) words.

    The program not presents the same number of words on each location and it also shows repetitions.

    Can we change the inline script so for each of the 32 trials, it selects one word from each list and and to present them by random in the middle/left or right the screen so the number of presentations remained the same across the locations and lists with no repetitions?


    Peace,

    Masoud


Sign In or Register to comment.