Subversion Repositories wimsdev

Rev

Rev 11544 | Rev 13704 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
11375 bpr 1
type=classify
4188 bpr 2
textarea="data"
3
 
4
:Classer tous les mots d'une phrase écrite selon un attribut (par exemple leur nature).
5
Cet exercice diffère d'autres exercices de classification par la manière dont les données sont
6
rentrées, la donnée étant une phrase et non une liste de mots.
13477 obado 7
<p class="wims_credits">
11544 obado 8
Author of the model: Bernadette Perrin-Riou <bpr@math.u-psud.fr>
4188 bpr 9
</p>
10
:%%%%%%%%%%%%%%%%%      ATTENTION      %%%%%%%%%%%%%%%%%%%%
11
 
11544 obado 12
Remove the above header if you destroy the model tags! (The lines starting
13
with a ':'.) Otherwise the exercise might not be taken back by Createxo.
4188 bpr 14
 
11544 obado 15
:%%%%%%%% Sample parameters to be redefined %%%%%%%%%%%%%%%%%
4514 bpr 16
:\title{Classer les mots d'une phrase}
5147 bpr 17
:\author{Bernadette, Perrin-Riou}
5724 bpr 18
:\email{}
19
:\credits{}
13477 obado 20
 
21
:Instructions
4188 bpr 22
\text{instruction= Classer les mots selon leur nature ou des propriétés}
23
 
13477 obado 24
:File name
7718 bpr 25
Ne remplissez que si vous vous désirez transférer le source de cet exercice dans un compte Modtool
4188 bpr 26
et utiliser un fichier de données (dans un module OEF)
27
du type
28
<pre>
29
 V,N,Art,Adj,Prep
30
 Verbe,Nom,Article,Adjectif,Préposition
4674 bpr 31
 &#58;Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait.|N
32
 &#58;Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol.|N
4188 bpr 33
</pre>
7718 bpr 34
Dans ce cas, les données principales ne seront pas prises en compte.
4188 bpr 35
Sinon, remplissez les données principales.
36
 
37
\text{file=}
38
 
39
:Nature des objets
40
\text{nom_nature=Verbe,Nom,Article,Adjectif,Préposition}
41
 
42
:Nature des mots (code)
43
C'est ce code qui sera utilisé dans les données principales.
44
\text{Nature=V,N,Art,Adj,Prep}
45
 
13477 obado 46
:Main data
7718 bpr 47
Une phrase par ligne : les mots (ou groupes de mots) de la phrase sont séparés par des virgules. Après chaque mot,
5907 bpr 48
séparé du mot par la barre verticale <span class="tt">|</span>, est écrit la nature ou l'attribut du mot telle
7718 bpr 49
qu'il a été écrit dans le champ <span class="tt">Nature des mots (code)</span>. Si le mot (ou groupe de mots)
4188 bpr 50
n'est pas suivi d'une barre verticale
7718 bpr 51
et d'un attribut, il n'est pas proposé dans la liste des mots à placer,
4188 bpr 52
mais est écrit dans la phrase d'introduction.
53
 
54
\text{data=Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait|N
55
Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol|N
56
Le,chat|N,boit|V,du,lait|N,dans|Prep,un,bol|N}
57
 
11544 obado 58
:Embraced random items
5797 bpr 59
$embraced_randitem
11544 obado 60
\text{accolade=item(1,1 yes,
61
2 no)}
4188 bpr 62
 
11544 obado 63
:%%%%%%%%%%%%%% Nothing to modify until statement %%%%%%%%%%%%%%%%
4188 bpr 64
\css{<style type="text/css">
65
   .question {background-color: #FFFFCC;margin: 2% 2%;padding: 1%;}
66
   .reponse {background-color: #FFCC99;color: black;margin: 2% 2%;padding: 0%;}
67
   .oefstatement{}
68
   ol li {list-style: upper-alpha; }
69
 </style>}
70
 ##s'il y a un nom de fichier dans file, utilise le fichier, sinon utilise data
71
\if{\file notsametext}{
72
  \text{data=wims(randrecord \file)}
73
  \text{Nature=wims(record 0 of \file)}
74
  \text{nom_nature=row(2,\Nature)}
75
  \text{Nature=row(1,\Nature)}
76
  }{
77
  \text{data=randomrow(\data)}
5797 bpr 78
  }
79
\text{accolade=wims(word 1 of \accolade)}
80
 
81
\text{data=\accolade=1 ? wims(embraced randitem \data)}
4188 bpr 82
\integer{cnt=items(\data)}
83
\integer{Nat_cnt=items(\Nature)}
84
\text{phrase=}
85
\text{nature=}
86
\text{tableau=wims(makelist videxxx for x = 1 to \Nat_cnt)}
87
\text{tableau=wims(items2lines \tableau)}
88
\for{u=1 to \cnt}{
89
  \text{w=\data[\u]}
90
  \text{w=wims(replace internal | by , in \w)}
91
  \text{phrase=\phrase \w[1]}
92
  \for{h = 1 to \Nat_cnt}{
93
    \if{\w[2] issametext \Nature[\h]}{
94
       \text{ligne=row(\h,\tableau)}
95
       \text{ligne=videxxx isitemof \ligne ? \w[1]:\ligne,\w[1]}
96
       \text{tableau=wims(replace line number \h by \ligne in \tableau)}
97
       \text{nature=wims(append item \w[2] to \nature)}
98
    }
99
   }
100
}
101
\matrix{tableau=\tableau}
102
\text{nature1=wims(listuniq \nature)}
103
\text{nature=}
104
\for{ a in \Nature}{
105
   \text{nature=\a isin \nature1 ? wims(append item \a to \nature)}
106
}
107
\text{question=}
108
\text{nom_question=}
109
\text{Step=}
110
\for{a in \nature}{
111
   \text{qu=position(\a,\Nature)}
112
   \text{Step=wims(append item r \qu to \Step)}
113
   \text{question=wims(append item \qu to \question)}
114
   \text{nom_question=wims(append item \nom_nature[\qu] to \nom_question)}
115
}
116
\integer{question_cnt=items(\question)}
117
\steps{\Step}
118
 
119
\statement{\instruction
120
<div class="question">\phrase.</div>
5723 bpr 121
<table class="wimsnoborder">
4188 bpr 122
\for{ s = 1 to \question_cnt}{
123
  <tr><th>\nom_question[\s]</th><td>\embed{\Step[\s],80 x 30 x \cnt}</td></tr>
124
}
125
</table>
126
}
127
\answer{\nom_question[1]}{\tableau[1;]}{type=dragfill}{option=noorder}
128
\answer{\nom_question[2]}{\tableau[2;]}{type=dragfill}{option=noorder}
129
\answer{\nom_question[3]}{\tableau[3;]}{type=dragfill}{option=noorder}
130
\answer{\nom_question[4]}{\tableau[4;]}{type=dragfill}{option=noorder}
131
\answer{\nom_question[5]}{\tableau[5;]}{type=dragfill}{option=noorder}
132
\answer{\nom_question[6]}{\tableau[6;]}{type=dragfill}{option=noorder}
133
\answer{\nom_question[7]}{\tableau[7;]}{type=dragfill}{option=noorder}
134
\answer{\nom_question[8]}{\tableau[8;]}{type=dragfill}{option=noorder}
135
\answer{\nom_question[9]}{\tableau[9;]}{type=dragfill}{option=noorder}
136
\answer{\nom_question[10]}{\tableau[10;]}{type=dragfill}{option=noorder}