By kurtisstewart1948 - 5/13/2015
Hi,
Is there an Inquisit function(s) that can take a subject's text input (e.g., Apples) and randomize the order of the letters (i.e., splepa)?
Thanks
|
By Dave - 5/13/2015
Yes, you can build something like that using the string functions documented in the functions reference in the Inquisit documentation and e.g. a <list> element. Example:
<values> / nletters = 0 / index = 0 / input = "" / jumbled_output = "" / currentletter = "" </values>
<expressions> / fill_list = if (values.index < values.nletters) { values.index+=1; list.randomizeletters.appenditem(values.index); expressions.fill_list; } / jumble = if (list.randomizeletters.unselectedcount > 0) { values.currentletter=substring(values.input, list.randomizeletters.nextindex-1, 1); values.jumbled_output=concat(values.jumbled_output, values.currentletter); expressions.jumble; } </expressions>
<list randomizeletters> / selectionrate = always </list>
<block myblock> / trials = [1-4=sequence(split, jumble)] </block>
<openended split> / ontrialend = [values.input=openended.split.response; values.nletters=length(values.input); values.index=0; list.randomizeletters.reset(); expressions.fill_list; ] </openended>
<trial jumble> / ontrialbegin = [values.jumbled_output=""; expressions.jumble; ] / stimulusframes = [1=mytext] / validresponse = (57) </trial>
<text mytext> / items = ("<%values.jumbled_output%>") </text>
|
By kurtisstewart1948 - 5/14/2015
Hi Dave,
This is great, thanks!
However, when I try to include that code into my script, the <%values.jumbled_output%> returns a blank string. I am trying to modify Olson and Fazio's Affective Priming Paradigm script so that participants first input a name and that this name and the jumbled version of the name are subsequently used as primes. Please let me know if you have any suggestions on how to do that.
Cheers,
Kurtis
|
By Dave - 5/14/2015
> However, when I try to include that code into my script, the <%values.jumbled_output%> returns a blank string.
Does the code I posted work for you? If so, there's something you missed when trying to incorporate it into your own script. What that is I cannot tell you without the actual code.
|
By kurtisstewart1948 - 5/15/2015
The code that you posted works. I have attached my script. I either want the <%values.jumbled_output%> to be used as the second item in <item primes> or to be the item in <text prime2>. I have tried to incorporate it into both places but both return a blank string as the prime.
Any help with getting the jumbled output in the right place would be greatly appreciated.
Thanks!
|
By Dave - 5/15/2015
The problem is that you never execute expressions.jumble anywhere in your script. Hence values.jumbled_output is never set to anything. Do:
<openended childname> / ontrialend = [values.input=openended.childname.response; values.nletters=length(values.input); values.index=0; list.randomizeletters.reset(); expressions.fill_list; expressions.jumble; ] /required = true / mask = alphabetic /charlimit = 10 </openended>
|
By kurtisstewart1948 - 5/15/2015
It worked! Thank you,
Kurtis
|