Closed donhinkelman closed 2 years ago
While your typing the words are counted by Javascript in the browser. In the feedback, the words are counted by PHP. If you count the words yourself, how many would you say there are?
I tested it again and the browser gave me a 93 word count and the feedback gave me an 88 word count. By manually counting, I got 91 words. For example, I manually counted "feedback/score" as one word.
Thank you. It seems different people and different systems have different ways to count. Not sure what we do about that š¤
The cause of this is probably https://tracker.moodle.org/browse/MDL-46256, for which I recently developed a fix.
And, just to add: after further careful testing, there was a follow-up tracker issue https://tracker.moodle.org/browse/MDL-70796. From there you can get the PHP code.
The equivalent JavaScript to that (which we have at the OU, but not in Moodle core) is
_figureOutWordCount: function(text) {
// We have to filter out blank words, hence the filter call here.
return text.split(/[\sāā]+/).filter(function(word) {
return word !== '';
}).length;
}
},
Hi all. I noticed that there seems to be a difference in word count that is shown before the submission when editing the text, and after the submission. Before submission when editing the text, the counter counts e.g. "Frank's auto-generated car" as 5 words, but after the submission it's 3 words (that matches the count in for example in Microsoft Word.
And here's the situation after the submission:
It seems like the counter before the submission is failing in these cases where there is e.g. a " ' " mark or a " - " mark. It seems to think that these marks will divide the word into two words, but in real life that's not the case always. Might it be so that this is fixed in a view after the submission, but still has some bug before the submission?
We also tested that changing the editor type in Moodle between Atto HTML, Tiny MCE HTML and Plain text area didn't seem to fix this. This happened both in English and Finnish language selections. We are using Moodle 3.11.10 (Build: 20220912).
Hi Don and Rikkpa, thanks for alerting me to this issue. Based on the ideas from Tim (Thanks Tim!) I have modified the code in both the code in the browser (JavaScript) and the code on the server (PHP) to count words in a simliar way. I've also adjusted the code for the mobile app to behave in a similar fashion.
Please download the latest version of this plugin and install it at the next convenient opporunity.
If you find any further problem, feel free to reopen this issue.
Here is a second issue I found. There are two places where word count is displayed. One is on the page, below the textbox, that updates while the student is typing. The other is in the feedback/score. I notice these numbers are never the same--close but not the same. For example, in the textbox it says 90, and in the report it says 94 words. Sometimes the feedback page word count is under, and sometimes it is over. I am using the latest Essay Autograde, Moodle 3.7, and Firefox browser.