WebRhubarb hyphen problem

WebRhubarb hyphen problem

di Glenys Hanson -
Numero di risposte: 2

Hi Gordon,

I'm using WebRhubarb with modified source code so that students are not penalised for typing punctuation marks. All works fine and the code validates but some hyphenated words are accepted and others not.

For example, when you type "square-bottomed", you see "square - bottomed" appear in the text, but when you type "brown-paper", you see only "brown - " You can then type "paper" and everything is OK. It doesn't affect the scoring.

I've uploaded an exmple to your site:

I've uploaded the modified source code to your site too with a Word file which details all the code changes, but this is the relevant bit :

function CheckGuess(){
var Input = TrimString(document.getElementById('Guess').value);
var seps=new RegExp("[ ,;:.?!-]+", "g");
if (Input.length < 1){return;};
if ((Input.indexOf(' ')<0)&&(Input.indexOf(',')<0)&&(Input.indexOf(';')<0)&&(Input.indexOf(':')<0)&&(Input.indexOf('.')<0)&&(Input.indexOf('?')<0)&&(Input.indexOf('!')<0)&&(Input.indexOf('-')<0)){
CheckWord(Input);
}
else{
var InputWords = Input.split(seps);
for (var i=0; i<InputWords.length; i++){
CheckWord(InputWords[i]);
}
}
}

The basic code was written by my ex-colleague Patrick Verguet, but I added the hyphen bit. Maybe I didn't do it exactly right?

There is absolutely nothing urgent about this as it doesn't affect scoring.

Media dei voti: -
In riposta a Glenys Hanson

Re: WebRhubarb hyphen problem

di Gordon Bateson -
Immagine Core developers Immagine Peer reviewers Immagine Plugin developers

Hi Glenys,

> some hyphenated words are accepted and others not

... and you would like *all* hyphenated words to be accepted - is that right?

The javascript looks a little inefficient. It seems to me that you don't need all those "if ((Input.indexOf('xxx')<0)" because if you just do the "var InputWords = Input.split(seps)" you can be sure that none of the "InputWords" have any of the punctuation chars in them.

Anyway, if you say it is not urgent, let us mull it over for a while

regards
Gordon

In riposta a Gordon Bateson

Re: WebRhubarb hyphen problem

di Glenys Hanson -

Hi Gordon,

I think this was Patrick's first attempt at coding in Javascript so I'm sure it's not up to your standard but it fixes a problem with the original WebRubarb. In the original, if a student types any kind of punctuation mark - full stops, commas, question marks, etc. they're counted as errors and students lose points.

Patrick made two variants on WebRhubarb which I find pedagogically very useful for language learners:

  1. Only the vowels are removed, the consonants remain.
  2. No freebies. When the first "the" is typed, all the "the"s in the text do not appear.Each word has to be typed.

I use WebRhubarb mainly for dictation-like exercises and these modifications make it (almost) perfect for that.

Yes, no urgency whatever.

Cheers,

Glenys