Pairing two lists together

PennController for IBEX Forums Support Pairing two lists together

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #7513
    guy
    Participant

    Hello,

    I’m just starting out with pcIBEX, so I apologize if I’m missing something obvious.

    Is there a way for me to create a Template with two paired CSVs? I have a series of words that I want to place into frame sentences, but I would like the words (from a table of words) and the frame sentences (from a table of frame sentences) to be paired off randomly. Can I do this in Templates alone, or do I have to do it by manually constructing one big CSV with grouping?

    Thank you!

    #7514
    Jeremy
    Keymaster

    Hello,

    This is actually a question that regularly comes back. If you have the same number of words and sentence frames, and you can pair them in any possible ways, you could do something like this. List the sentence frames and the words in the same table:

    Sentence,Word
    Hello _!,world
    Bye _...,Earth

    Then you can do something like this:

    words = []
    
    Template( row => newTrial("dummy", words.push(row.Word)) )
    
    Template( row =>
      newTrial( "mytrial",
        fisherYates(words),
        word = words.pop()
        ,
        newButton( row.Sentence.replace('_',word) ).print().wait()
      )
    )

    Jeremy

    #7516
    guy
    Participant

    I will try this, thank you!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.