You are here

The synonyms

21 January, 2016 - 14:46

Analysis of tasks' solutions can indicate that course participant prepared a good solution of a task, but used different tags from those defined in a template. XML elements must follow a few naming rules (e.g. names cannot contain spaces), but any name can be used, because no words are reserved. Therefore mechanisms for defining synonyms were developed. Again, the mod_form.php file was utilized. The set of elements defining teacher's window was extended with one more html editor for synonyms providing (Figure 2.11).

$mform->addElement('htmleditor','synonyms',get_string('synonyms', 'xml'));

A synonym format is specified to facilitate an analysis of entered words. Each tag with additional words should be surrounded by square brackets: "[" ,"]". First word in that scope should be a tag ended by ":" character. After that, synonyms for a given tag, separated by a space, could be placed. Once more, example of the universities students’ thesis data will be taken into consideration.

media/image11.png
Figure 2.11 The synonyms html editor element visible in the teacher's window 

To define alternative words for UnivName, Student and Master tags, teacher should prepare following script:

[UnivName: academy college university school]

[student: person learner apprentice]

[Master: MSc thesis]

Such script has to be placed within the synonyms element when task is being defined or edited. Subsequently, it is analyzed by the validation function, in which the operation of additional HTML symbols removal comes first. Next, each row of the script is being prepared to be loaded into the database. Two versions of database structures for storing synonyms were analyzed. On one hand, they can be inserted into one column and treated as one text. On the other, they can be spread into two tables - one being a kind of synonyms dictionary with one record per synonym and second one associating tags with their synonyms. This solution allows for writing a synonym once and then map it to many tags, but requires more tables' joins than in the first case. However, both of them were implemented and comparing their effectiveness is planned in the further research.

The simplified algorithm of the procedure for validating participant's solution correctness, which takes mechanism of synonyms management into account, is shown in the listing 1.

media/image12.png
Figure 2.12 View of a participant's window with a solution using synonyms 

get participant's solution;

while (next_line_read){

check participant_tag in the tags_template table;

if (not found){

check participant_tag in the Synonyms table(s);

if (not found){

show error message;

set error_var;

}else

get tag for a participant_tag;

}

if (not error_var){

check a level of participant_tag;

if (level_error)

show error message;

}

}

Listing 1. The simplified algorithm of validating participant's solution correctness. 

Thanks to the developed synonyms management functionality, mechanisms for validation of participants task solutions become more flexible. In case when function, which implements this functionality, discovers differences in template and student tags, it can still consider a given solution as a correct one (Figure 2.12) if it finds a tag, provided by a student, in the synonyms table/tables.

Moreover, in case of a need, a once-defined set of synonyms can be extended by usage of the mechanism described in subsequent parts of the chapter.