Millisecond Forums

String Matching

https://forums.millisecond.com/Topic12368.aspx

By Marcel - 2/18/2014


Hi,

I'm trying to understand the behaviour of the following code. 

<list question>
/ items = ("2 + 2 = ")
</list>

<list answer>
/items = ("4")
</list>

<textbox question>
/caption = "<%list.question.item(1)%>"
/correctresponse = ("<%list.answer.item(1)%>")
</textbox>

<surveypage test>
/questions = [1=question]
</surveypage>

<block test>
/ trials = [1=test]
</block>


When trying to implement a routine that requires string matching what is best practice?

Thanks

Marcel
By Dave - 2/18/2014

To do something like this, it is best to

(a) use <openended> elements, not <textbox> / <surveypage>

(b) use /isvalidresponse, not /correctesponse

<list question>
/ items = ("2 + 2 = ")
</list>

<list answer>
/items = ("4")
</list>

<text question>
/items = ("<%list.question.item(1)%>")
/ position = (50%, 40%)
</text>

<openended test>
/ stimulusframes = [1=question]
/ iscorrectresponse = [openended.test.response == list.answer.item(1)]
</openended>

<block test>
/ trials = [1=test]
</block>
By Diane - 5/4/2014

Hi,


I'm trying to implement this, and I can't figure out what the (1) in " list.answer.item(1) " should be when the question and answer lists have multiple items and the question is randomly selected. I've managed to pair the question and answer using the text.name.currentindex, but it doesn't work in the openended element, it gives a 0 in the correct columnfor every response in the data file, no matter if the response was correct or wrong.

Can anyone tell me how to refer to the right item?


By Dave - 5/4/2014

<block myblock>
/ trials = [1-3=myoe]
</block>

<openended myoe>
/ stimulusframes = [1=q]
/ iscorrectresponse = [openended.myoe.response == item.myas.item(text.q.currentindex)]
</openended>

<text q>
/ items = myqs
/ select = noreplace
/ position = (50%, 40%)
</text>

<item myqs>
/ 1 = "The cow says ...?"
/ 2 = "The dog says ...?"
/ 3 = "The cat says ...?"
</item>

<item myas>
/ 1 = "moo"
/ 2 = "woof"
/ 3 = "meow"
</item>

By Diane - 5/5/2014

Great, it works!

Thanks so much!