Checking the accuracy of a string response

Paul Gr pauls_postbus at hotmail.com
Fri Mar 3 14:21:31 UTC 2006


hi eddie,

you probably want to remove special {
} tokens before doing any comparison 
with a ‘correct’ response. This can be done with some functions below. You 
also have to think about the use of the spacebar: would the response be 
incorrect if the subject uses the spacebar more that once? If multiple 
spaces are OK, then you can probably filter out the spaces altogether and 
also remove the spaces from the correct responses in the trial definition 
list.

Some example code follows.

best,
Paul Groot
Vrije Universiteit Amsterdam




Dim correctresp as string
Dim s as string

s = DisplayObject.RESP
s = RemoveStrings(s, "{SHIFT}")
s = RemoveStrings(s, "{ENTER}")
s = RemoveStrings(s, "{BACKSPACE}") '  ???
s = ReplaceStrings(s, "{SPACE}", " ")     ' or use RemoveString ?

s.SetAttrib "FilteredResponse", s   ' just for checking

correctresp = c.GetAttrib("CorrectResponse")

if StrComp(s,correctresp)=0 then
    DisplayObject.ACC = 1
else
    DisplayObject.ACC = 0
end if


' copy functions below to USER SCRIPT section in Script WIndow

Function RemoveStrings(ByVal s as String, subs as String) as String
   dim pos as integer
   Do
       pos = InStr(1,s,subs,1)
       if pos>0 then
           s = Left$(s,pos-1) & Mid$(s,pos+Len(subs))
      end if
      Loop Until pos<=0
      RemoveStrings = s
End Function

Function ReplaceStrings(ByVal s as String, subs as String, insert as String) 
as String
   dim pos as integer
   Do
       pos = InStr(1,s,subs,1)
       if pos>0 then
            s = Left$(s,pos-1) & insert & Mid$(s,pos+Len(subs))
       end if
   Loop Until pos<=0
   ReplaceStrings = s
End Function




>From: "Eddie Dubourg" <eddie at ling.ed.ac.uk>
>To: <eprime at mail.talkbank.org>
>Subject: Checking the accuracy of a string response
>Date: Fri, 3 Mar 2006 10:35:10 -0000
>
>I assisting with a script, and the researcher wishes to check a string
>response against the stimulus.
>
>Is this possible?  I've tried a variety of permutations, but with no luck.
>The datafile will have for the stimulus:-
>
>This is a sentence
>
>But the response is recorded as:-
>
>{SHIFT}This{SPACE}is{SPACE}a{SPACE}sentence{ENTER}
>
>And a zero is placed in the DisplayObject.Acc parameter
>
>Any ideas?
>
>Thanks,
>
>Eddie Dubourg
>Computing/Technical support Officer
>Linguistics and English Language
>PPLS, CHSS, UoE
>
>



More information about the Eprime mailing list