gbateson / moodle-qtype_essayautograde

Essay (auto-grade) question type for Moodle >= 3.0
13 stars 12 forks source link

Single letter common error detection #51

Closed drachels closed 3 years ago

drachels commented 3 years ago

I know this is probably a glossary question, but is there any way to set up a glossary so that single letter word errors can be detected. e.g. u instead of the word you, i instead of I. Right now it seems that each of those examples results in every u and every i being detected as an error when they are in a word such as begun and believe. In fact, even capitalization is ignored and the correct word I gets detected as a common error.

gbateson commented 3 years ago

Hi AL, thanks for this bringing up this issue.

Actually the Glossary entries can be made to be case-sensitive and matchwhole words, but you need to enable these settings for each entry. In order to see the settings, you need to first enable the "This entry should be automatically linked" checkbox, in the "Autiolink" section of the entry's settings page.

The default for these settings if to be disabled. You can change the sitewide defaults as follows: (1) navigate to Site administration => Plugins => Activity module => Glossary (2) enable "This entry is case sensitive" and "Match whole words only" (3) click the "Save changes" button

However, that can be a little tiresome, to implement, so I propose two modifications to the qtype_essayautograde:

(1) add three new settings for matching glossary items within an Essay (auto-grade) question: [errorfullmatch]: Match full or partial words. / Match full words only. [errorcasesensitive]: Match is case-insensitive. / Match is case-sensitive [errorignorebreaks]: Recognize line breaks. / Ignore line breaks.

(2) add a new alias for pattern matching within an Essay (auto-grade) question: B (or BOUNDARY or BREAK or WORD-BOUNDARY) which can be used matching expressions for phrases or glossary items. This corresponds to the "\b" character in regular expressions

The change would not involve too much tricky coding, because the main matching function is alreay aware of these switches - see the "glossary_entry_search_text()" and "search_text()" methods, around line 670, in the question.php file for this the qtype_essayautograde plugin.

drachels commented 3 years ago

Hi Gordon,

Thank you so much for your detailed information. It is working as it should now.

I was in a hurry when I wrote the original inquiry. My wife is extremely ill with stage 4 pancreatic cancer so my time is always very limited, but I wanted to let you know that I have been using your autograde essay code as a guide for developing an autorating capability for the Diary plugin. Things are going slow due to my limited time to work on it, usually three hours or less per day.

Thankfully, your code is easy to follow as I have had to modify nearly every function to get the same results in Diary, which is now duplicating the results produced by Essay (autograde), when using the same text.

Of the statistics that are the same, both plugins give 100% the same results, but I have noticed that some of the online stats checkers are just a little bit off. The ones I tested against all seem to require so many words that it is too easy to make a mistake trying to manually verify the results.

With your code and mine, manual verification is easy, since neither one has a minimum word limit. So far, every time I have noticed a difference in results from an online checker, I have been able to pin it down to the online checker being at fault. Usually due to getting the word count wrong by including stuff the reader never sees.

I hope to have a Diary version ready for release within the next couple of weeks, but I do keep an in-progress version online at http://www.drachels.com/moodle311/login/index.php with login info on the page.

gbateson commented 3 years ago

Thanks for letting me know that you were able to ge the glossary entries to match whole words only, and sensitive to case.

Sorry to hear about your wife's poor health. I wish peace and fortitude to you both.