Why quoted text removed from answer displays by Webwork? (Still graded right.)
by Christian Seberino - Number of replies: 4
In reply to Christian Seberino
Re: Why quoted text removed from answer displays by Webwork? (Still graded right.)
by Davide Cervone -
You will need to provide the pg file where this occurred, and the seed for the student in question. It would also help to give the specific answer that caused the problem. We really can't help without knowing more of the specifics of the situation.
In reply to Davide Cervone
Re: Why quoted text removed from answer displays by Webwork? (Still graded right.)
by Christian Seberino -
Very odd but I can't seem to recreate the problem now. It seemed to have gone away or I'm forgetting exactly what caused it. I'll post code next time I see it.
In reply to Christian Seberino
Re: Why quoted text removed from answer displays by Webwork? (Still graded right.)
by Christian Seberino -
OK it happened again. I have an idea why it is happening.
I'm using a custom grader for string answers that strips
whitespace and ignores capitalization differences. It also allows
multiple possible answers.
It is obvious why Webwork has no idea what to post in the "The correct answer is:" field.
Is there any way to set a string to display as the answer when students select "Show correct answers" ?
Here is my automatic grader code by the way..
Context("ArbitraryString");
@string_answers = ("scalene", "scalene triangle");
$strings = Compute("")->cmp(checker => sub {
my ($temp1, $response, $temp2) = @_;
$response =~ s/^~~s+|~~s+$//g;
$response = lc($response);
foreach (@string_answers) {
if ($response eq lc($_)) {
return 1;
}
}
return 0;
});
Here is the question...
BEGIN_PGML
What is the term for triangles that have no sides
of the same length?
[____________]{$strings}
END_PGML
I'm using a custom grader for string answers that strips
whitespace and ignores capitalization differences. It also allows
multiple possible answers.
It is obvious why Webwork has no idea what to post in the "The correct answer is:" field.
Is there any way to set a string to display as the answer when students select "Show correct answers" ?
Here is my automatic grader code by the way..
Context("ArbitraryString");
@string_answers = ("scalene", "scalene triangle");
$strings = Compute("")->cmp(checker => sub {
my ($temp1, $response, $temp2) = @_;
$response =~ s/^~~s+|~~s+$//g;
$response = lc($response);
foreach (@string_answers) {
if ($response eq lc($_)) {
return 1;
}
}
return 0;
});
Here is the question...
BEGIN_PGML
What is the term for triangles that have no sides
of the same length?
[____________]{$strings}
END_PGML
In reply to Christian Seberino
Re: Why quoted text removed from answer displays by Webwork? (Still graded right.)
by Davide Cervone -Is there any way to set a string to display as the answer when students select "Show correct answers" ?
Sure. Whatever you put in the quotations for Compute
will be the correct answer. So
$strings = Compute($string_answers[0])->cmp(checker => sub {...});would do it.
On the other hand, I think this this type of answer checker is a bad idea, as they give no useful feedback when students are wrong (e.g., due to a spelling error). Unless their knowledge of the existence of the word "scalene" is what you are trying to test, I would rather see a pop-up menu with "Equilateral", "Isosceles", and "Scalene".
Alternatively, you could use the contextString.pl
file and the String
context to get better results. Here is an example:
DOCUMENT(); loadMacros( "PGstandard.pl", "MathObjects.pl", "contextString.pl", "PGML.pl", ); TEXT(beginproblem()); Context("String"); Context()->strings->add( Equilateral => {}, Isosceles => {}, Scalene => {}, "Equilateral triangle" => {alias => "Equaliateral"}, "Isosceles triangle" => {alias => "Isosceles"}, "Scalene triangle" => {alias => "Scalene"}, ); $ans = "Scalene"; BEGIN_PGML [$ans] = [____________]{$ans} END_PGML ENDDOCUMENT();This gives better error messages. See if that works better for you.
Davide