« Format GIFT » : différence entre les versions

De MoodleDocs
Aller à :navigation, rechercher
Ligne 173 : Ligne 173 :
S'il existe une seule bonne réponse, elle peut être écrite sans symbole d'égalité la précédant, en autant qu'elle ne puisse pas être confondue avec une question vrai-faux.
S'il existe une seule bonne réponse, elle peut être écrite sans symbole d'égalité la précédant, en autant qu'elle ne puisse pas être confondue avec une question vrai-faux.


===Matching===
===Appariement===
Matching pairs begin with an equal sign (=) and are separated by this symbol "->". There must be at least three matching pairs.
Les différents appariements commencent par un symbole d'égalité (=) et sont séparés par ce symbole « -> ». Il doit y avoir au moins trois appariements (au moins trois éléments différents d'un côté et au moins deux éléments différents de l'autre).
   
   
Match the following countries with their corresponding capitals. {
Appariez les pays suivants avec les capitales correspondantes. {
     =Canada -> Ottawa
     =Canada -> Ottawa
     =Italy  -> Rome
     =Italie -> Rome
     =Japan  -> Tokyo
     =Japon -> Tokyo
     =India  -> New Delhi
     =Inde -> New Delhi
     }
     }


Matching questions do not support feedback or percentage answer weights.
Les questions d'appariement ne peuvent pas inclure de rétroaction ni de pondération.


===Missing word===
===Missing word===

Version du 17 avril 2013 à 16:07

Le format GIFT permet d'utiliser un éditeur de texte pour écrire des questions à choix multiple, vrai ou faux, à réponse courte, à mot manquant, et à réponse numérique dans un format simple pouvant être importé. Le format GIFT est aussi un fichier d'exportation disponible dans la banque de questions. Le format a été développé dans la communauté Moodle, mais d'autres logiciels peuvent être compatibles avec ce format à un degré plus ou moins important.

  • Lorsque vous créez un grand nombre de questions, GIFT peut offrir un moyen rapide de mettre beaucoup de questions en même temps dans une catégorie de questions ou dans une leçon.
  • Parfois, il est plus facile de tester les questions d'une catégorie de questions en les visualisant dans un fichier GIFT.

Instructions générales

Au moins une ligne vide doit être laissée entre chaque question.

Dans sa forme la plus simple, la question vient d'abord, suivie des réponses entre parenthèses, accompagnées d'un symbole d'égalité (=) indiquant la bonne réponse ou les bonnes réponses ou d'un tilde (~) indiquant les mauvaises réponses. Un dièse (#) permet d'insérer une rétroaction. Les questions peuvent être pondérées en plaçant des symboles de pourcentage (%..%) autour de la pondération. Les commentaires sont précédés de deux barres obliques (//) et ne sont pas importés.

Voici quelques exemples utiles de GIFT qui peuvent être importés ou utilisés comme modèles de base ou comme point de départ.

Encodage UTF-8

Tout fichier GIFT doit être correctement encodé en UTF8. Vous pouvez utiliser l'éditeur de texte Notepad de Microsoft qui vient avec Windows pour enregistrer vos fichiers en UTF-8.

Note : le format ANSI fonctionnera (seulement) dans les langues sans caractères spéciaux (comme ä, ö, ü, æ, å, ø, œ or ß). N’utilisez pas « Unicode » comme format, puisqu'il s'agit de UTF-16 et que cela ne fonctionnera pas.

Symboles

Voici certains des symboles communs en GIFT et leur utilité.

Symboles Utilité
// Texte Commentaire jusqu'à la fin de la ligne (optionnel)
::Titre:: Titre de la question (optionnel)
Texte Texte de la question (devient le titre si aucun titre n'est saisi)
[...Format...] Format du passage suivant de texte. Les options sont [html], [moodle], [plain] et [markdown]. Par défaut, le format est [moodle] pour le texte de la question; les autres parties de la question ont par défaut le même format que celui utilisé pour le texte de la question.
{ Début des réponses -- Sans réponses, le texte est une description de question
{T} ou {F} Réponses vrai ou faux; aussi {TRUE} et {FALSE}
{ ... =Bonne réponse ... } Bonne réponse pour les choix multiples ou les textes troués
{ ... ~Mauvaise réponse ... } Mauvaise réponse pour les choix multiples ou les textes troués
{ ... =Élément -> réponse ... } Réponse pour les questions d'appariement
#Rétroaction Rétroaction pour les réponses aux questions à choix multiple, à réponse numérique ou aux textes troués
{# Début des réponses numériques
Réponse:marge d'erreur Réponse numérique acceptée à l'intérieur d'une marge d'erreur
Limite inférieure..Limite supérieure marges de valeurs inférieure et supérieure acceptées dans une question à réponse numérique
=%n%réponse:marge d'erreur n pour cent accordé à une réponse numérique acceptée à l'intérieur d'une marge d'erreur
} Fin des réponses
\caractère Une barre oblique inverse permet de bloquer la signification de ~, =, #, {, }, et :
\n Ajout un saut de ligne dans le texte de la question -- les lignes vides délimitent les questions

Voici quelques brefs exemples :

// true/false
::Q1:: 1+1=2 {T}

// Choix multiple avec rétroaction spécifique pour les bonnes et les mauvaises réponses
::Q2:: Quelle couleur se trouve entre l'orange et le vert dans le spectre? 
{=jaune #Bonne réponse; bravo! ~rouge #Mauvaise réponse, c'est jaune. ~bleu #Mauvaise réponse, c'est jaune.}

// Texte troué
::Q3:: Deux plus {=deux =2} égalent quatre.

// Appariement
::Q4:: Quel animal mange quoi? {=Chat -> Nourriture pour chats =Chien -> Nourriture pour chiens}

// Question à réponse numérique avec marge
::Q5:: Nommez un chiffre de 1 à 5. {#3:2}

// Question à réponse numérique avec marge (intervalle marqué par des points)
::Q6:: Nommez un chiffre de 1 à 5. {#1..5}
// Lors de l'importation, cette question devient la même que Q5, mais non disponible dans l'interface de questions de Moodle.

// réponses numériques multiples avec points partiels et rétroaction
::Q7:: En quelle année est né Ulysses S. Grant? {#
         =1822:0      # Bravo! Tous les points.
         =%50%1822:2  # Il est né en 1822. Votre réponse était proche, vous avez la moitié des points.
}

// Composition
::Q8:: Comment allez-vous? {}

Explication des symboles

Dans le format choix multiple, les barres de commentaires // pour la question se transforment en numéro ID unique lors de l'exportation.

La première paire de :: précède le titre de la question.

La deuxième paire de :: précède la question. La première accolade { indique le début des réponses. Les bonnes réponses sont précédées de = et les mauvaises réponses sont précédées de ~. Les rétroactions de l'enseignant commencent par un #. La question se termine par } et une ligne vide. Veuillez noter qu'il s'agit d'accolades { } et non de parenthèses ( )!

//Commentaires 
::Titre de la question 
:: Question {
=Bonne réponse
~Mauvaise réponse 1
#Rétroaction pour la mauvaise réponse 1
~Mauvaise réponse 2
#Rétroaction pour la mauvaise réponse 2
~Mauvaise réponse 3
#Rétroaction pour la mauvaise réponse 3
~Mauvaise réponse 4
#Rétroaction pour la mauvaise réponse 4
}

Le plus petit format pour une question à choix multiple est :

Question{=Bonne réponse ~Mauvaise réponse 1 ~Mauvaise réponse 2 ~Mauvaise réponse 3 ~Mauvaise réponse 4}
Conseil : si vous ne précisez pas de titre pour votre question, la question COMPLÈTE sera utilisée comme titre lors de l'importation dans Moodle.
    • Désavantage : cela peut ajouter beaucoup de mots inutiles et peut inclure des caractères qui ne seront peut-être pas reconnus lors de l'exportation.
    • Avantages : Si chaque question commence d'une façon différente, cela peut faciliter la recherche d'une question parmi une catégorie de questions. Il n'est pas recommandé d'avoir le même titre pour toutes les questions.

Exemples de formats de questions

Il y a plusieurs façons d'utiliser un éditeur de texte pour écrire en format GIFT. Nous tenterons de montrer la version simple comme exemple et pour certains formats, nous introduirons quelques options plus complexes qui peuvent être importées dans différents formats de questions Moodle.

Choix multiple

Pour les questions à choix multiple, les mauvaises réponses sont précédées d'un tilde (~) et les bonnes réponses sont précédées d'un symbole d'égalité (=).

Voici un format GIFT simple de choix multiple acceptable : Qui repose dans la Grant's tomb? {=Grant ~Personne ~Napoléon ~Churchill ~Mère Teresa}

Voici un format plus long qui utilise davantage d'éléments GIFT :

 // Question : 1 Nom : Grant's tomb
::Grant's tomb::Qui repose dans la Grant's tomb à New-York? {
=Grant
~Personne
#C'était vrai pendant 12 ans, mais la dépouille de Grant a été enterrée dans cette tombe en 1897.
~Napoléon
#Il a été enterré en France.
~Churchill
#Il a été enterré en Angleterre.
~Mère Teresa
#Elle a été enterrée en Inde.
}

Choix multiple avec plusieurs bonnes réponses

Cela signifie que les boutons radio sont remplacés par des cases à cocher :

Parmi ces personnes, nommez-en deux qui sont enterrées dans la Grant's tomb. {
   ~%-100%Personne
   ~%50%Grant
   ~%50%L'épouse de Grant
   ~%-100%Le père de Grant
}

Vrai-faux

Dans ce type de question, la réponse indique si une proposition est vraie ou fausse. La réponse doit être écrite comme {TRUE} (vrai) ou {FALSE} (faux), ou abrégée {T} ou {F}.

// Question : 0 Nom : Proposition vraie
::Proposition vraie à propos de Grant::Grant a été enterré dans une tombe à New-York.{T}

// Question : 0 Nom : Proposition fausse
::Proposition fausse à propos du soleil::Le soleil se lève à l'Ouest.{FALSE}

Réponse courte

Les réponses d'une question de type réponse courte sont toutes précédées d'un symbole d'égalité (=), indiquant que toutes ces réponses sont bonnes. Les réponses ne doivent pas contenir de tilde.

Voici deux exemples utilisant la méthode simple de montrer les réponses possibles. Qui est enterré dans la Grant's tomb? {=Grant =Ulysses S. Grant =Ulysses Grant}

Deux plus deux égalent {=quatre =4 =IV}

S'il existe une seule bonne réponse, elle peut être écrite sans symbole d'égalité la précédant, en autant qu'elle ne puisse pas être confondue avec une question vrai-faux.

Appariement

Les différents appariements commencent par un symbole d'égalité (=) et sont séparés par ce symbole « -> ». Il doit y avoir au moins trois appariements (au moins trois éléments différents d'un côté et au moins deux éléments différents de l'autre).

Appariez les pays suivants avec les capitales correspondantes. {

   =Canada -> Ottawa
   =Italie -> Rome
   =Japon -> Tokyo
   =Inde -> New Delhi
   }

Les questions d'appariement ne peuvent pas inclure de rétroaction ni de pondération.

Missing word

The Missing Word format automatically inserts a fill-in-the-blank line (like this _____) in the middle of the sentence. To use the Missing Word format, place the answers where you want the line to appear in the sentence.

Moodle costd{~lots of money =nothing ~a small amount} to download from moodle.org.

If the answers come before the closing punctuation mark, a fill-in-the-blank line will be inserted for the "missing word" format. All question types can be written in the Missing Word format.

There must be a blank line (double carriage return) separating questions. For clarity, the answers can be written on separate lines and even indented. Some examples:

Mahatma Gandhi birthday is an Indian holiday on  {
~15th
~3rd
=2nd
} of October.

Since {
  ~495 AD
  =1066 AD
  ~1215 AD
  ~ 43 AD
}
the town of Hastings England has been "famous with visitors".

Numerical questions

The answer section for Numerical questions must start with a number sign (#). Numerical answers can include an error margin, which is written following the correct answer, separated by a colon. So for example, if the correct answer is anything between 1.5 and 2.5, then it would be written as follows {#2:0.5}. This indicates that 2 with an error margin of 0.5 is correct (i.e., the span from 1.5 to 2.5). If no error margin is specified, it will be assumed to be zero.

Here is a simple numerical format question. It will accept a range of 5 years.

When was Ulysses S. Grant born?{#1822:5}

It is a good idea to check the margins of the range, 3.141 is not counted as correct and 3.142 is considered in the range.

What is the value of pi (to 3 decimal places)? {#3.14159:0.0005}.

Optionally, numerical answers can be written as a span in the following format {#MinimumValue..MaximumValue}.

What is the value of pi (to 3 decimal places)? {#3.141..3.142}.

Moodle's browser interface does not support multiple numerical answers, but Moodle's code can and so does GIFT. This can be used to specify numerical multiple spans, and can be particularly usefully when combined with percentage weight grades. If multiple answers are used, they must be separated by an equal sign, like short answer questions.

When was Ulysses S. Grant born? {#
   =1822:0
   =%50%1822:2
}

Note that since Moodle's browser GUI didn't support multiple answers for Numerical questions, there's no way in older Moodle versions to see them or edit them through Moodle. The only way to change a numerical answer beyond the first, is to delete the question and re-import it (or use something like phpMyAdmin). But better would be to upgrade your Moodle to at least 1.9.

Essay

An essay question is simply a question with an empty answer field. Nothing is permitted between the curly braces at all.

Write a short biography of Dag Hammarskjöld. {}

Description

A description "question" has no answer part at all

You can use your pencil and paper for these next math questions.

Options

In addition to these basic question types, this filter offers the following options: line comments, question name, feedback and percentage answer weight.

Line Comments

Comments that will not be imported into Moodle can be included in the text file. This can be used to provide headers or more information about questions. All lines that start with a double backslash (not counting tabs or spaces) will be ignored by the filter.

// Subheading: Numerical questions below
What's 2 plus 2? {#4}

Comments will be exported from Moodle and will include the unique question id. The above question after it was imported and then exported from Moodle:

// question: 914  name: What's 2 plus 2? 
::What's 2 plus 2?::What's 2 plus 2?{#
    =4:0#
}

Question Name

A question name can be specified by placing it first and enclosing it within double colons (::...::).

::Kanji Origins::Japanese characters originally
came from what country? {=China}
::Thanksgiving Date::The American holiday of Thanksgiving is 
celebrated on the {~second ~third =fourth} Thursday of November.

If no question name is specified, the entire question will be used as the name by default.

Feedback

Feedback can be included for each answer by following the answer with a number sign (# also known as a hash mark) and the feedback.

What's the answer to this multiple-choice question? {
  ~wrong answer#feedback comment on the wrong answer
  ~another wrong answer#feedback comment on this wrong answer
  =right answer#Very good!
}
 
//From The Hitchhiker's Guide to the Galaxy
Deep Thought said " {
  =forty two#Correct according to The Hitchhiker's Guide to the Galaxy!
  =42#Correct, as told to Loonquawl and Phouchg
  =forty-two#Correct!
}  is the Ultimate Answer to the Ultimate Question of Life, The Universe, and Everything."

   42 is the Absolute Answer to everything.{
FALSE#42is the Ultimate Answer.#You gave the right answer.}

For Multiple Choice questions, feedback is displayed only for the answer the student selected. For short answer, feedback is shown only when students input the corresponding correct answer. For true-false questions, there can be one or two feedback strings. The first is shown if the student gives the wrong answer. The second if the student gives the right answer.

Percentage Answer Weights

Percentage answer weights are available for both Multiple Choice and Short Answer questions. Percentage answer weights can be included by following the tilde (for Multiple Choice) or equal sign (for Short Answer) with the desired percent enclosed within percent signs (e.g., %50%). This option can be combined with feedback comments.

Difficult question.{~wrong answer ~%50%half credit answer =full credit answer}

::Jesus' hometown::Jesus Christ was from {
   ~Jerusalem#This was an important city, but the wrong answer.
   ~%25%Bethlehem#He was born here, but not raised here.
   ~%50%Galilee#You need to be more specific.
   =Nazareth#Yes! That's right!
}.
    
::Jesus' hometown:: Jesus Christ was from {
   =Nazareth#Yes! That's right!
   =%75%Nazereth#Right, but misspelled.
   =%25%Bethlehem#He was born here, but not raised here.
}

Note that the last two examples are essentially the same question, first as multiple choice and then as short answer.

Note that it is possible to specify percentage answer weights that are NOT available through the browser interface. The Match Grades drop-down on the import page determines how these are handled. You can either request that an error be reported or that the answer weight be adjusted to the nearest valid answer weight.

Specify text-formatting for the question The question text (only) may have an optional text format specified. Currently the available formats are moodle (Moodle Auto-Format), html (HTML format), plain (Plain text format) and markdown (Markdown format). The format is specified in square brackets immediately before the question text. See Formatting text for further information.

[markdown]The *American holiday of Thanksgiving* is celebrated on the {
   ~second
   ~third
   =fourth
} Thursday of November.

Multiple Answers

The Multiple Answers option is used for multiple choice questions when two or more answers must be selected in order to obtain full credit. The multiple answers option is enabled by assigning partial answer weight to multiple answers, while allowing no single answer to receive full credit.

What two people are entombed in Grant's tomb? {
   ~No one
   ~%50%Grant
   ~%50%Grant's wife
   ~Grant's father
}

Note that there is no equal sign (=) in any answer and the answers should total no more than 100%, otherwise Moodle will return an error. To avoid the problem of students automatically getting 100% by simply checking all of the answers, it is best to include negative answer weights for wrong answers.

What two people are entombed in Grant's tomb? {
   ~%-50%No one
   ~%50%Grant
   ~%50%Grant's wife
   ~%-50%Grant's father
}

Special Characters ~ = # { }

These symbols ~ = # { } : control the operation of this filter and cannot be used as normal text within questions. Since these symbols have a special role in determining the operation of this filter, they are called "control characters." But sometimes you may want to use one of these characters, for example to show a mathematical formula in a question. The way to get around this problem is "escaping" the control characters. This means simply putting a backslash (\) before a control character so the filter will know that you want to use it as a literal character instead of as a control character. For example:

Which answer equals 5? {
   ~ \= 2 + 2
   = \= 2 + 3
   ~ \= 2 + 4
}
::GIFT Control Characters::
Which of the following is NOT a control character for the GIFT import format? {
  ~ \~     # \~ is a control character.
  ~ \=     # \= is a control character.
  ~ \#     # \# is a control character.
  ~ \{     # \{ is a control character.
  ~ \}     # \} is a control character.
  = \      # Correct! \ (backslash) is not a control character. BUT,
             it is used to escape the control characters.
}

When the question is processed, the backslash is removed and is not saved in Moodle.

Specifying Categories

It is possible to change the category into which the questions are added within the GIFT file. You can change the category as many times as you wish within the file. All questions after the modifier up to the next modifier or the end of the file will be added to the specified category. Up to the first category modifier the category specified on the import screen will be used. Note that for this to work the from file: box must be ticked on the import screen.

To include a category modifier include a line like this (with a blank line before and after):

$CATEGORY: tom/dick/harry

or simply

$CATEGORY: mycategory

...the first example specifies a path of nested categories. In this case the questions will go into harry. The categories are created if they do not exist.

Making questions case sensitive

Short Answer questions can be made case sensitive by changing "0" to "1" in the following line of your moodle/question/format/gift/format.php file:

$question->usecase = 0; // Ignore case

Hints and Tips

  • Use the ::title:: at the beginning of every question to organize your questions when Moodle presents a list or exports them as another GIFT file. When the title is left blank, Moodle will put the beginning of the question as the title. Some teachers want to see something like "001 LIT101 Poe ref Purloin Letter" or "The Purloin Letter was written by (AmLit pg 254)" in the title.
  • You can specify markup if you need to format the question by setting [html], [moodle], [plain] or [markdown] just before the question text. See more about this in the reference pdf below.
  • In the Lesson module, in a question page, correct answers jump by default to Next page and incorrect answers jump to This page (i.e. student has to "try again"). When importing from a GIFT format file, this is exactly the mechanism which is used.
  • If you want a student to be taken directly from one question to the next irrespective of their answer being correct or incorrect: in the Lesson Settings, set Maximum number of attempts: to 1.
    • Please note, however, that a message "correct / incorrect" will still be displayed to the student upon answering each question. If you do not want this (default) feedback message to be displayed then enter your own feedback message (i.e. "continue", "---", etc.)
    • In case you want no visible message displayed then enter a non-breaking space as feedback. Moodle will not put it's automatic response because it sees the blank space. To do this, put a # after the answer and write Fichier:Nbsp.png (without spaces between these characters).
  • Need to use a special GIFT character in your question or answer? Put a \ in front of the GIFT character.
    • For example if you want to use curly braces, { or }, or equal sign, =, or # or ~ in a GIFT file (in a math question including TeX expressions) you must "escape" them by preceding them with a \ directly in front of each { or } or =. It is possible to use a replace program/macro/editor filter to do this conversion before importing to Moodle.
  • Want to change T/F type questions to multiple choice? Consider exporting the T/F questions as a GIFT file, then using a text editor to replace the (T) with (=True ~False). Perhaps change the title slightly so you will recognize the new questions.
  • Alphabetic case-sensitive comparison is disabled by default. If you need case-sensitive comparison for short answer questions (an unusual need), precede them with:
  $question->usecase = 1;

surrounded by blank lines.

Word processor and spreadsheet tools that create GIFTs

Several contributors have used macros to generate GIFT files from a more familiar popular programs.

  • There are Word macros available for easily creating GIFT files. See Broken link Moodle4Teachers for downloads and instructions for use.
  • There are several Excel spreadsheets for generating GIFT files. Several people have built upon other contributors work.
  • There are Open Office templates for generating GIFT files in Writer. These are located in the Quiz forum in the OOo template to write exams and convert to GIFT format thread.
    • The most recent for OO 2.x is "OOo2GIFT_Template_05.zip" posted 17 December 2005 by Enrique Castro.
    • An earlier version is "GIFT_template_OOo.zip" posted 22 March 2005 by Enrique Castro.
  • There is an easy to use on line multiple question generator at a4esl.org. Here you write your question(s) without formating marks, select Moodle and press the generate quiz button. This creates GIFT formatted text that can be pasted into a file for importing into Moodle.
    • The initial format requires fewer keystrokes (it uses line position and returns) than the GIFT format, so you should save time and be less likely to create invalid data.
    • Quiz authoring template for Microsoft Word link
    • Moodle XML Converter [1]
    • GIFT format parser library in Ruby [2]

See also

External links