2017 Problem Authoring Workshop

Context String; multiple aliases

by shirley yap -
Number of replies: 1

I’d like to create fill-in-the-blank problems that can accept a variety of answers. I’ve figured out how to

use contextString.pl (and also contextABCD.pl) to do this, but when you are creating your own vocabulary

with

, it’s not clear how to me how to add more synonyms. I’ve tried:

Context("String")->strings->add(word=>{}, (synonym1, synonym2) =>{alias=>”word”});

Context("String")->strings->add(word=>{}, [synonym1, synonym2] =>{alias=>”word”});

and a few other variants of the above, but no dice.

In general, I’d like to know how to access the student answer directly. I understand that the benefit of Math Objects is that it abstracts away the process of having to read in the student input and compare the answer, but I’m hoping to learn enough Perl to be able to write a subroutine that can read in that input and compare or manipulate that student answer.

In reply to shirley yap

Re: Context String; multiple aliases

by Davide Cervone -
You need to do the two (or more) synonyms separately:
Context("String")->strings->add(
word => {},
synonym1 => {alias=>"word"},
synonym2 =>{alias=>”word”},
);