Question types: Pattern match

Maintained by Tim at Lone Pine Koala SanctuaryTim Hunt, Picture of Phil ButcherPhil Butcher
Allows a short response of one or a few sentences that is graded by comparing against various model answers, which are described using the OU's pattern match syntax.
1234 sites
35 fans

There are working examples in eAssessment with Moodle on our OpenLearn site.

The documentation is in How to create questions in Moodle on that site.


This plugin is part of set Open University.


Screenshot #0


Tim at Lone Pine Koala Sanctuary
Tim Hunt (Lead maintainer)
Picture of Phil Butcher
Phil Butcher: Question type designer
Picture of Jamie Pratt
Jamie Pratt: Developer
Picture of Colin Chambers
Colin Chambers: Developer
Picture of John Beedell
John Beedell: Developer
Picture of Chris Nelson
Chris Nelson: Product owner
Please login to view contributors details and/or to contact them

Comments RSS

Show comments
  • Picture of Sebastian H.
    Mon, Apr 23, 2018, 8:00 PM
    Is there a chance to get it working under 3.4?

    Best regards and thanks
  • Picture of John Beedell
    Fri, Apr 27, 2018, 8:37 PM
    Sebastian, I've just checked on 3.4 and 3.5beta (current master branch) and it works. Was there a specific problem?
  • Picture of Sebastian H.
    Mon, May 14, 2018, 10:22 PM
    Hello John,
    we're planning to update from 3.1 to 3.4 and I pre-checked the compatibility-statements of our plugins. Glad to hear that it works, there was no specific problem. Thanks and best regards.
  • Picture of Adriano Ceccarelli
    Wed, Feb 13, 2019, 11:59 PM
    Hi All,
    Pattern match is a very powerful resource, saving time and also allowing for some introspective journey into the structure of language, something that being busy all the time (with grading open questions for example...) is becoming increasingly rare. So thanks for giving us this possibility at the same time!
    However there is a potential risk in case the question is of the type "give a definition of.....[anything]" as it is possible, and very quick too, to open a wikipedia page, look for the wanted definition and paste it into the answer field. Many wikipedia pages start with short definitions, very often within the limit of 20 words suggested by the PM syntax help and inevitably matching the pattern set in the question rules. This can be worked around with formative quizzes (e.g interactive with multiple tries) where the feedback could state the wikipedia origin and the quiz ask for editing the answer, but in case of summative quizzes with deferred feedback I couldn't find a way to obtain the same (state the wikipedia origin + ask and allow for an editing), and in principle anyone with appropriate knowledge could generate the same sentence. Anyone experiencing the same problem or having already solved this issue?
    Many thanks
  • Picture of Marcus Green
    Wed, May 15, 2019, 9:12 PM
    Would it be possible to change the link to documentation to ?
  • Picture of Jocelyn Chappaz
    Wed, Aug 21, 2019, 9:21 PM
    Hi. I'm on moodle 3.5.5+ and trying to upgrade your plug in to 2019071200. It is stuck on "upgrade settings.php" part... and I can't undo the upgrade, can't get back, can't go on... my moodle is stuck because of it. I've loaded a backup but the database is still in "update" mode, so I got no way to get out of this... and I need to work on it tomorrow... please help...
  • Picture of Jocelyn Chappaz
    Thu, Aug 22, 2019, 9:25 PM
    After more than 10 hours trying to solve this problem or bypass it... I'm still stuck with my moodle broken... please help
  • Tim at Lone Pine Koala Sanctuary
    Thu, Aug 22, 2019, 9:29 PM
    Sorry. I have been busy with other issues. Your options include: Trying to go back to a previous version of the plugin; trying to set these settings directly in the database, if you can work ou which setting is causing the problem; wait for a proper fix.

    For some bugs, you look at the reported symptoms, and it is just obvious how you screwed up. In other cases, and sadly this is one, the symptoms make no sense until you have time to dig into it deeply, then hpefully, you can work it out and fix the problem.
  • Tim at Lone Pine Koala Sanctuary
    Thu, Aug 22, 2019, 11:40 PM
    Right, I just had time to fix this before going on holiday for a week. Luckily, one of my development servers had not already been upgraded to latest pamtch, and so I was able to reproduce the problem.

    The solution was to add a 'No languages found' option to the setting if the list would otherwise be empty. That seems to be enough to stop Moodle getting confused. There is not need to select the otion that now appears. Just click continue.
  • Picture of Jocelyn Chappaz
    Sat, Aug 24, 2019, 8:12 PM
    I managed to get back using an old SQL backup and I just deleted the plug in... had no choice. In the other hand, it seems there's pb when you try to update to moodle 3.7 on macOS platform... both pb at the same time, it was enough for me to freak out ... -____-'
  • Picture of Toni Soto
    Tue, Sep 10, 2019, 6:53 PM
    Hi Tim,

    I tried to upgrade Pmatch qtype in my current installation (Moodle 3.5) and I got this error:

    Excepción - syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE)

    Más información sobre este error <-- Notice that my defaul language is Spanish

    ×Debug info:
    Error code: generalexceptionmessage
    ×Stack trace:
    line 48 of /question/type/pmatch/classes/local/spell/qtype_pmatch_spell_checker.php: ParseError thrown
    line ? of unknownfile: call to core_component::classloader()
    line 129 of /question/type/pmatch/db/upgrade.php: call to spl_autoload_call()
    line 632 of /lib/upgradelib.php: call to xmldb_qtype_pmatch_upgrade()
    line 1857 of /lib/upgradelib.php: call to upgrade_plugins()
    line 694 of /admin/index.php: call to upgrade_noncore()

    Fortunately I could cancel the upgrade and restore my old version.

    Before sending this message I tried it one more time after changing my default languague to English and I got the same error but with much less additional information:

    Exception - syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) <-- Just this!

    I hope that will be easy to fix. Either way, it is not urgent for me as I can go on using the current version.

    Thank you in advance Tim!

  • Tim at Lone Pine Koala Sanctuary
    Tue, Sep 10, 2019, 8:15 PM
    See This error only happens in you are using PHP 7.0. I carelessly added a PHP 7.1-style construct to the code. Sorry.
  • Picture of Toni Soto
    Wed, Sep 11, 2019, 8:46 PM
    Thank you for replying Tim. I'm going to keep my current version until I could afford to upgrade PHP. smile
  • Picture of DPM Nederland
    Thu, Dec 5, 2019, 11:00 PM
    Hi Tim and others maintaining, We love the Pattern Match question! In fact, I had someone build a combination of Pattern Match and Essay, to incorporate a larger textfield and answertemplate. We call it 'Pattern Essay and will make it available soon. However, I also encountered a bug. When using a large string of keywords (eg. 1|2|3 and so on until over 21) and then choosing answer 2 (eg. 17 keywords), 3 (eg. 14 keywords) and 4 (eg. 10 keywords) as options for 90%, 60% and 50% scores, students scoring less than 100% received a time-out error during the quiz and re-attempting it later. It took us some time to figure out the problem smile. Does this ring a bell with any of you?
  • Tim at Lone Pine Koala Sanctuary
    Thu, Dec 5, 2019, 11:22 PM
    That sounds like it is probably a performance problem. The pattern match library is quite complex, and not necessarily fast, particuarly as the patterns and the student response both get longer. (There is a reason the standard question type limits the response to 20 wrods at most.)

    It probably could be improved if anyone was brave enough to dive into the code. Initially our priority was to get it to implement the matching correctly, and that was hard enough. Optimising performance is not something we have done much work on.
1 2 3 4
Please login to post comments