Rev 11311 | Rev 13477 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
type=classify
textarea="data"
:Classify the items according to their properties by filling a checkbox in a table.
A list of items with various properties is presented.
The table has to be filled in by clicking on the relevant boxes for each item.
<p>
To make an exercise with this model, type the list of items and a list of properties.
If an item has a property write 1, if it does not, write 0 in the same order as the list of properties.
The properties should be separated by a comma.
<p>
This exercise can easily be modified if it is intended to be included in an OEF module and you wish to
include the data in a separate file.
<p>
Author of the model: Bernadette Perrin-Riou <bpr@math.u-psud.fr>
:%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%%
Remove the above header if you destroy the model tags i.e. the lines starting
with a ':'. Otherwise the exercise might not be recognised by Createxo.
:%%%%%%%% Example parameters to be redefined %%%%%%%%%%%%%%%%%
:\title{Classification (table)}
:\author{Csilla, Ducrocq}
:\email{csilla.ducrocq@u-psud.fr}
:\credits{}
:Instruction
\text{instruction=Fill in the table.}
:Number of items chosen randomly
\integer{N=3}
:Name of the data file
Only enter a name if you wish to create a separate data file
(in an OEF module)
of the following type
<pre>
fur,feathers,four legs,wings
:magpie,0,1,1,1
:cow,1,0,1,0
<pre>
\text{file=}
:List of properties
\text{attribut=fur,feathers,four feet,wings}
:Main data
each item should be written on a separate line.
\text{data=magpie,0,1,1,1
cow,1,0,1,0
cat,1,0,1,0
mosquito,0,0,0,1
butterfly,0,0,0,1
rabbit,1,0,0,0}
:Text for the feedback.
\text{nonoui=--,X}
:%%%%%%%%%%%%%% Nothing to modify before the statement%%%%%%%%%%%%%%%%
\text{size=50,50}
\integer{w=\size[1]+10}
\text{couleur=#FFFFCC}
\css{<style type="text/css">
.question {background-color: #FFFFCC;margin: 2% 2%;padding: 1%;}
table.tableau {border:solid 1px;
border-collapse:collapse;margin-left:auto;margin-right:auto;}
table.tableau td, th {background-color:#FFFFCC;text-align:left;border:solid 1px;width:55px;
padding-left:10px;margin-left:20px;}
ol li {list-style: upper-alpha; }
table.tableau th { background-color:#CCCFFF;}
table.tableau tr > th:first-child {width:400px;}
</style>}
\text{nonoui=\nonoui issametext ? <img src="scripts/authors/jm.evers/gifs/ok.gif" width="15"/>,<img src="scripts/authors/jm.evers/gifs/nok.gif" width="15"/>}
\if{\file notsametext}{
\text{file=randitem(\file)}
\text{attribut=wims(record 0 of \file)}
\integer{datacnt=wims(recordcnt \file)}
\integer{N=min(\N,\datacnt)}
\text{choix=shuffle(\datacnt)}
\text{choix=\choix[1..\N]}
\text{data=}
\for{s in \choix}{
\text{data=\data
wims(record \s of \file)}
}
\matrix{data=\data}
\text{data=wims(replace internal ;; by ; in \data)}
}{
\text{objet_cnt=rows(\data)}
\integer{N=min(\N,\objet_cnt)}
\text{bat=shuffle(\objet_cnt)}
\text{bat=\bat[1..\N]}
\matrix{data=\data}
\matrix{data=\data[\bat;]}
}
\integer{attribut_cnt=items(\attribut)}
\text{Data=}
\text{R=}
\for{u=1 to \N}{
\for{v=2 to \attribut_cnt+1}{
\integer{uu=(\u-1)*\attribut_cnt + \v -1}
\text{Data=\data[\u;\v]=1? wims(append item \uu to \Data)}
}
}
\text{C=wims(makelist x for x=1 to \N*\attribut_cnt)}
\text{C1=wims(makelist x for x=1 to \N*\attribut_cnt)}
\text{nstep=r1}
\nextstep{\nstep}
\text{col=1}
\statement{
<div class="question"> \instruction
<table class="tableau"><tr> <th></th>
\for{k=1 to \attribut_cnt}{<th colspan="\col">\attribut[\k]</th>}
</tr>
\for{j=1 to \N}{
<tr><th>\data[\j;1]</th>
\for{k=1 to \attribut_cnt}{
\if{\step=1}{<td style="color:\couleur">\embed{r1,\C[(\attribut_cnt)*(\j-1)+\k]}</td>}{<td>\C[(\attribut_cnt)*(\j-1)+\k]</td>}
}
</tr>
}
</table>
</div>
}
\answer{}{\Data;\C1}{type=checkbox}{option=split noanalyzeprint nonstop}
\text{nstep=}
\text{C=}
\text{col=2}
\text{croix=<span style="color:black; font-size:20pt;font-style:bold;">X</span></td>}
\text{nocroix=<span style="color:black; font-size:20pt;font-style:bold;"> </span></td>}
\text{croix=X}
\text{nocroix=}
\for{u=1 to \N}{
\for{v=2 to \attribut_cnt+1}{
\integer{uu=(\u-1)*\attribut_cnt + \v -1}
\text{C=\uu isitemof \reply1 and \uu isitemof \Data ? wims(append item \croix <td>\nonoui[1] to \C)}
\text{C=\uu isitemof \reply1 and \uu notitemof \Data ? wims(append item \croix <td>\nonoui[2] to \C)}
\text{C=\uu notitemof \reply1 and \uu isitemof \Data ? wims(append item \nocroix <td>\nonoui[2] to \C)}
\text{C=\uu notitemof \reply1 and \uu notitemof \Data ? wims(append item \nocroix <td>\nonoui[1] to \C)}
}
}
\feedback{1=1}{\nonoui[1] : correct answer, \nonoui[2] : wrong answer
}