Blanks problem

Blanks problem

by Philippe Decloitre -
Number of replies: 24

Hello,

In open questions it is possible to tell Moodle either to differentiate or not between "the cat" and "THE CAT". In some cases capital letters do matter. In others , they don't.

Why cannot we have the same approach vis-a-vis blanks or "spaces".

In some cases "The     cat"
isjust as goo as "The cat".
(whatever the number of blanks between the expected "strings")

Does anyone else feel that way?

Thanks fo your time, patches or even workarounds.

Philippe

Average of ratings: -
In reply to Philippe Decloitre

Re: Blanks problem

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

Which version of Moodle ? 1.9.x or 2.0 / 1 / 2?

In reply to Joseph Rézeau

Re: Blanks problem

by Philippe Decloitre -
Hello, Thanks for answering my 'message in a bottle' We (Rouen Univ.) are currently using 1.9, but also considering phasing into 2.2 so either version would do. Short term is fine, long term is good for patience '-) Philippe
In reply to Philippe Decloitre

Re: Blanks problem

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

Hi Philippe,

The attached patch against current Moodle 1.9.16+ (Build: 20120119) removes extra blank spaces from student's answer in shortanswer questions.

Hope this helps,

Joseph

In reply to Joseph Rézeau

Re: Blanks problem

by Philippe Decloitre -

Waou!
That sounds like the pot of gold when I least expected it.
Thanks Joseph.

We use the "test" activity throughout Rouen University. When this is put in place I think they'll send you a chocolate box each!

(At least I will smile

)

Philippe

In reply to Joseph Rézeau

Re: Blanks problem

by Philippe Decloitre -

Hello Joseph,

Our admin installed you script, but he had to make minor alterations in order for it to work in our environement.

So I am not sure the script is doing exactly what it is supposed to. Here is the behavior:

1:Correct student input with extra space(s) at the begining of the "short answer" quiz (i.e. befeore the very first letter of the answer "    the cat"): extras space(s) removed and perfect scoring.

2: Correct student input with extra space(s) between strings (i.e "the     cat"): extra space(s) removed but answser counted as wrong. IF STUDENT PRESSES ON "SEND" A SECOND TIME, answer is counted as correct (which looks logical, since there is then no more extra space).

Is this the intended behavior of the script, or should it remove the extra spaces wherevere they are and count the answer as correct right from the start?

Thanks
Philippe

In reply to Philippe Decloitre

Re: Blanks problem

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

It would be reasonable to add a 'normalise whitespace' option, or something like that, to the shortanswer question type. Nice idea.

In reply to Tim Hunt

Re: Blanks problem

by Philippe Decloitre -

' Possible to standardize that in Moodle 2.x?

Cheers

In reply to Philippe Decloitre

Re: Blanks problem

by Philippe Decloitre -

Hello Joseph and all Quiz activity users,

Joseph, you were kind enough to provide a fix to the extra space(s) situation disscussed in this thread.

We (Rouen univ.) have now moved to Moodle2.x.
I am quite sure our students, and many in the community, would be very grateful if you could offer us the same fix for M2.x.

In advance, many thanks to our "very useful" moodlers!

Philippe

In reply to Philippe Decloitre

Re: Blanks problem

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

Which version of Moodle 2 are you using?

I'll have a look at the extra whitespace removal problem.

Joseph

In reply to Joseph Rézeau

Re: Blanks problem

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

Here is a patch against moodle 2.5.1+ This patch implies a few lines changes in 2 files.

When a student enters a correct answer with extra blanks (1), upon checking, the blanks are removed and the answer is considered as correct (2).

screenshot #1

@Tim, how about adding the "extra blanks removal" option to the shortanswer question edit form?

Joseph

In reply to Joseph Rézeau

Re: Blanks problem

by Jean-Michel Védrine -

Hello Joseph, hello Tim,

I think we should try to get this option integrated before Moodle 2.6 code freeze.

If I understand Joseph's patch correctly the student response is saved in the database unmodified, and blanks are removed on grading and display.

Do both of you think this is the best solution, or would it be better to save the normalized response in database.

In reply to Jean-Michel Védrine

Re: Blanks problem

by Joshua Bragg -

Just playing devil's/usability advocate for a moment here:

Can anyone think of a reason why someone would NOT want extraneous whitespace removed?

If there aren't any examples of this then why shouldn't this just become part of what short answer questions do automatically?  The questions that support units already do this.

I realize the hesitancy to change the operation of a question but I'm having a hard time coming up with a situation where this change would be a problem for someone.

In reply to Joshua Bragg

Re: Blanks problem

by Marcus Green -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

I cannot think of any, and I have been thinking about this in relation to my gapfill question type. I had assumed that most gaps would be single words, but it has become clear that is not the assumption made by everyone.

Up to now I had been thinking in terms of using wildcards to address this issue, but that is overly complex.

In reply to Joshua Bragg

Re: Blanks problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

How about the thought that students should be responsible for typing their answers correctly - we would not accept the answer if they typed an extra letter so why do we feel the need to remove extra spaces for them?

I don't necessarily disagree with the idea to remove them automatically but wanted to follow along with the devil's advocate thread!

In reply to Emma Richardson

Re: Blanks problem

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

Emma "... we would not accept the answer if they typed an extra letter so why do we feel the need to remove extra spaces for them?"

Well, these are two really different cases. In the good old days of handwritten exercises, a teacher would never have measured the blank space separating two words and counting extra large spaces as "incorrect" the same as extra letters would be counted incorrect in student's answers.wink

If you were using a Moodle quiz's SA questions to test a student's knowledge in typography or Web design, then the extra blank spaces might be counted "incorrect". But I doubt that that is a typical use of the Moodle quiz. In my experience, it is not infrequent that students unconsciously type 2 consecutive blank spaces (leaving their thumb too long on the space bar), do not "see" it, and wonder why their answer is counted as "incorrect" in a quiz.

So I think it would be sensible to automatically remove any extra blank spaces from the students' answers in quiz. No need to make it yet one more "option" on the already cluttered question editing screen.

Joseph

In reply to Joseph Rézeau

Re: Blanks problem

by Philippe Decloitre -

Joseph, You're a genius and and a generous one at that!

Thanks for the patch, I 'll report here if ther is any debugging to be done...

(I doubt it, it worked just fine with M1.9 smile

I hope it does become a core part of 2.6 but... but I also hoped aliases would become part of backups wink

Thanks again!

Philippe

Average of ratings: Useful (1)
In reply to Philippe Decloitre

Re: Blanks problem

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I think that we cannot just do this. There are probably technical question where whitespace matters (a question about regular expressions, someone teaching typography who things there should be exactly two spaces after a full stop, other programming language questions.)

So, I think it should be another option in the question settings. (Can we put it in the same setting as case does not matter? Probably not.)

However, I can see that it is a useful option to add.

In reply to Joseph Rézeau

Re: Blanks problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

As I said, I don't disagree that it would be a good option - I was just answering the previous question!  I know a few teachers that are anal enough to expect the answer to be entered to a t.  

In reply to Joshua Bragg

Re: Blanks problem

by Joshua Bragg -

Good points all.  In particular I had obviously not considered the typography option and wasn't sure it would matter in programming questions since the little I know about it whitespace seems irrelevant many times.

Tim, is there some reason why you think it shouldn't go next to the case sensitivity?

Can we agree that extra whitespace should be removed by default?  Of course any questions created prior to the upgrade should have the same characteristics as they do now...

In reply to Joshua Bragg

Re: Blanks problem

by Tim Hunt -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I think a separate option next to whitespace is probably the right thing.

Of course, at the moment, we do modify some whitespace. We remove leading and trailing whitespace (which might be a problem for programming questions) but we don't normalise whitespace within the string. So, there are potentially several useful options to add.

Note that the OU's pmatch question type always normalises whitespace, without giving you the option (I think) since its matching is based on words.

In reply to Joshua Bragg

Re: Blanks problem

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Case sensitivity is somewhat different as there are many cases when you do need students to use case correctly.  I know in Hot Potatoes, there was always the option whether the answer should be case sensitive or not and it would be great to see this carried across to relevant question types.