Short answers

Short answers

by luciano biondo -
Number of replies: 26
I have some problem with short answers.

I wrote a question, it's right answer can be written in a lot of ways, but all the right answer contains the same "needed_word": I would need a wildcard * so I could write the right answer in the following way: *needed_word*.

The excellence would be to have the chance to extabilish that the answer is right if it contains ALL the following words: "...", but I suppose this would request major changes into the script.

Moreover, a very frequent problem is the following: I would write a comment for every answer that is not matching with any of the ones I have foreseen.

Anybody can help me?
Average of ratings: -
In reply to luciano biondo

Re: Short answers

by luciano biondo -
A further problem. If the learner has given a wrong answer, there is a way to let him be directed to a previous page?
In reply to luciano biondo

Re: Short answers

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
Yes, if you have written the page, you can choose this page to direct him to the page.
In reply to Ralf Hilgenstock

Re: Short answers

by luciano biondo -
I can if I have foreseen the wrong answer. But, in short answer, you can have a lot of unforeseen wrong answers. When the wrong answer is an unforeseen one, I am not able to direct to a prevoius page. Can you give me instructions?
In reply to luciano biondo

Re: Short answers

by Ralf Hilgenstock -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Translators
I think, every unforseen answer is a wrong answer. You can direct eyery wrong answer to one previous page. I haven't checked this. You can not categorize different unforseen answers to different previous pages.
In reply to Ralf Hilgenstock

Re: Short answers

by Ray Kingdon -
No, there's not a "catch-all" jump which could direct all wrong answers to a particular page. That would be a new feature.

One thing I would find useful as well is to record what the students are actually typing in to short answer questions. This information could build up a "catalogue" of common wrong answers so they could be "trapped" and sent off to an appropriate page. Obviously that would a little time to collect.

In reply to Ray Kingdon

Re: Short answers

by luciano biondo -
When I will be able to solve the wildcard problem, this problem should solve too, writing simply * as wrong answer and obtaing that the script examine the wrong answer after the right answer.
In reply to Ray Kingdon

Re: Short answers

by Michael Penney -
Hi Ray, the custom scoring mod we did on lesson discussed here:
http://media.humboldt.edu/~cded/

enables the teacher to set a 0 (0r -#) grade for an answer. The jump can then be sent anywhere in the lesson without affecting the grade, so one could make a catchall page and send all wrong answers there.

Of course the 'next page' link from the catchall page would be hard, I suppose one could make a branch table with the catchall message for a group of questions, give wrong answers a 0 score and send them there, and make similar pages for other groups of questions, so the jumps out of the catchall pages could go back into the question group or elsewhere.

In reply to luciano biondo

Re: Short answers

by Ray Kingdon -
Luciano, yes the sort answer question looks for a "complete" match between the student's input and the answer(s). For case insensive matches (the default) the module uses the PHP function strcasecmp(). It's at about line 353 in mod/lesson/lesson.php. I suspect what you want might be achieved by replacing the strcasecmp() function with the eregi() function. This opens up the wide and wonderful world of regular expression matches. Your answers could then use all the special character combinations such as the wild carding you are looking for. It would be interesting to experiment with... just a single change of function and LOL "It's full of stars"...

Can you make the change to the eregi() function and remove the "== 0" bit as well and give it a quick test? If it looks reasonable it's probably best handled as an(other) option on short answer questions. Regualr expressions would only be called for occasionally. (And they have a steep learning curve with the level bit at the top always beyond me I'm afraid.)

In reply to Ray Kingdon

Re: Short answers

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
You might want to look at the Short Answer code in the quiz module which allows * wildcards.

   *  == 0 or more characters
In reply to Martin Dougiamas

Re: Short answers

by Ray Kingdon -
Indeed... in quiz/lib.php around line 1869? Looks like it understands a bit more than just *. You can backslash a * to "preserve" it and use a + character safely. No harm in adding that peice of code into the lesson module... smile
In reply to Ray Kingdon

Re: Short answers

by luciano biondo -
I tried to change line 353 but it doesn't work. I don't know what strcasecmp and eregi functions means, so I can't go further, at the moment. I will study some php more...
In reply to luciano biondo

Re: Short answers

by Ray Kingdon -
As Martin suggested I've filtched some code from the quiz module. Short Answers in the lesson module now allow an asterix (*) to stand for any number of characters, including zero characters. So the answer Long* will match longer, longest and long. * on it's own will match any answer, it can be used as a "catch-all" wrong answer.

It's in CVS, please see if functions as you expect it to, thanks.
In reply to Ray Kingdon

Re: Short answers

by Ray Lawrence -
I must be thick, thoughtful but I can't see how can this be used as a catch all wrong answer unless the correct answer is somehow excluded from the lsit of possible answers. Can you put me out of my misery? smile
In reply to Ray Lawrence

Re: Short answers

by Ray Kingdon -
Of course... I tried the following Short Anwser Question:

Question: What the opposite to Short?

Answer 1: Long
Response 1:
Jump to: Next page
Answer 2: Tall
Response 2: Yes, I suppose so
Jump to: Next Page
Answer 3: *
Response 3: Don't be silly
Jump To: Same page

In fact having the answers in a different order (the wild card as Answer 2 and "Tall" as answer 3) appears to work OK too.

In reply to Ray Kingdon

Re: Short answers

by Tim Allen -

Hi Ray,

Just thought I'd catch your attention while you're here - I hope you don't mind that.  shy wink

I'm not sure if you have noticed these threads recently regarding an issue with the dialogue module:  thoughtful

http://moodle.org/mod/forum/discuss.php?d=5826&parent=36142

http://moodle.org/mod/forum/discuss.php?d=8392

And in the bugtracker:

http://moodle.org/bugs/bug.php?op=show&bugid=1429&pos=2

If you were aware of them and just had other priorities then please forget about it, I am so grateful for your generous contributions to the moodle community and don't want to take up too much of your time.  smile  big grin  approve

However, if you have any feedback or even a bug fix for this issue it would be great!  I may not use the dialogue module next semester because of this, preferring to rely on email to make sure I don't miss any communication from my students.  surprise

By the way, everything you have done here is first class, including the dialogue module!  cool

Thanks in advance,  tongueout

Tim. 

In reply to Ray Kingdon

Re: Short answers

by Ray Lawrence -

Thanks.

Tried this out and it works!

Cheers

Ray L

In reply to Ray Lawrence

Re: Short answers

by luciano biondo -
I tried the * wildcard in lesson module with moodle 1.4, it works, but the script read the answer starting from the highest. So the * used as "catch all wrong responses" must be put as answer one.

Example:
Question: What is the best website?
1: *
don't be silly
2 moodle.*
you have good thought but the answer is not totally right
3
moodle.org
right
Inverting the order I get always: "don't be silly".

It would be more logical the inverse, but no problem: the important thing is that the order doesn't change in next versions. So if a changement is to be done, please , make it at once, otherwise let it work so for eternity...

Bye
Luciano
In reply to luciano biondo

Re: Short answers

by Ray Kingdon -
Luciano, I agree, the module is getting it the wrong way round. I think it's because I tested it with only one of the answers containing a * character. Your set of answers is a bit more subtle and the old code did not cope with them too well.

I've just submitted a new version of the lesson.php file into CVS which handles the short answers in the order that they appear on the page. Each answer is compared with the student's input and once a match is found the comparisons are stopped and the corresponding response is shown. This means the "catch-all" wrong answer (the single *) now goes at the end. Which I think is a more logical position.

If possible, could you have a look at this new version (It will on the Module download page tomorrow). Please let me know if this now behaves correctly with your sophisticated set of answers. smile
Thanks, Ray

In reply to Ray Kingdon

Re: Short answers

by Ray Kingdon -
I've just added a few sentences to the Short Answers section of the Question Types help file. Hopefully they make it clear how the module now handles answers which contain *'s.
Ray
In reply to Ray Kingdon

Re: Short answers

by luciano biondo -
I downloaded the lesson module 1.4 from modules page, but nothing seems changed in short answer. I didn't find the new help page too.
Must I use 1.5 version of lesson module? But can I install it on 1.4 moodle?

Luciano
In reply to luciano biondo

Re: Short answers

by Ray Kingdon -
Luciano, yes, the changes are in the 1.5 (dev) version. I think that will install OK in the 1.4 version of Moodle. There's been a general tidy of the code but the module should be usable. The changes are quite innocuous.

In reply to Ray Kingdon

Re: Short answers

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Ray,
Apparently the ' * ' catch all wrong answers function never made it to Moodle 1.5. But it works in 1.5.2 and 1.5.3.
Unfortunately our admin is not willing to update from 1.5...sad
All the best,
Joseph
In reply to Ray Kingdon

Re: Short answers

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Hello,

Writing this a year and a half after Ray's excellent suggestion of allowing access to regular expressions in short answers in both the lesson and the quiz modules, I am surprised nothing has been done in the latest versions of Moodle in this direction. Or am I wrong?wide eyes

I do need the power of regular expressions for enhanced response analysis. I can not make the changes myself, not being an admin of our institution's site and our admin only agrees to use regular distributions, no hacks.

What can I do?

Joseph

In reply to Joseph Rézeau

Re: Short answers

by Mark Nielsen -
The lesson module's short answer allows the use of the * as a wild card.  When you create a new question, there is a help button near or at the top of the page that explains all of the question types.  In this help doc, the use of the wild card in the short answer question is explained in detail.

I know that at one point the wild card feature was not working correctly.  So, using a more current version of the lesson module would be advisable.

No other regular expression syntax is supported as of now.

Cheers,
Mark
In reply to luciano biondo

Re: new question

by Juan Pablo Bettancourt -
Hello Luciano:

Hope you forgive me, but I have a question. You look to work OK with moodle so I thought I could have the oportunity of making a question.

¿What are lessons for?
I opend the module and I was especting to be able to organize a class, but it starts wuith a questionaire... I can´t get it...
Please, what do you use Lessons for?

From very far (Chile)
Juan Pablo