## WeBWorK Problems

### Tailored feedback for string comparison

by Danny Glin -
Number of replies: 2
Here is what I'm looking to do:

A student enters a string (which is actually generated by a java applet, then dumped into WeBWorK). I want to compare against a correct string, but also compare against a list of predicted incorrect strings, each with a customized feedback message.

I'd like to do this using MathObjects, as most of the pieces seem to be there already. The problem I have right now is that there doesn't appear to be a String context, which allows the input of any string as a response. I can add a fixed list of acceptable strings to a context, but I want the students to be able to enter any string (and if it happens to be close to the correct answer, give them relevant feedback).

Any suggestions on how to do this?

Danny
In reply to Danny Glin

### Re: Tailored feedback for string comparison

by Davide Cervone -
Danny:

The contextArbitraryString.pl macro file defines a context in which any string can be entered by the student, and you provide a custom checker that determines if the string is correct or not. Your custom checker could determine which message to give (and use Value->Error() to generate the message), or you could combine this with answerHints.pl to get the results you want (it allows you to give partial credit).

Davide
In reply to Davide Cervone

### Re: Tailored feedback for string comparison

by Danny Glin -
Okay, those two together mostly accomplish what I need, but I've run into another snag.
The correct answer for one of my problems contains the # character. My custom grader properly checks answers and provides the appropriate feedback (it's just doing perl string compares), but when WW tries to display the correct answer or preview the student's answer, I run into problems.
jsMath tells me "You can't use 'macro parameter character #' in math mode", while images mode just drops the #.
Is there an easy way to tell WW not to typeset answers for this question (i.e. not put the answer preview or correct answer in math mode)?
Danny