Subversion Repositories wimsdev

Rev

Rev 13476 | Rev 13725 | 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
13716 obado 2
textarea="data instruction"
3
iEdit="instruction"
4188 bpr 4
 
12169 mquerol 5
:Classificar totes les paraules d'una frase escrita d'acord amb un atribut (per exemple, la seva naturalesa).
6
Aquest exercici és diferent d'altres exercicis de classificació en la forma en què les dades són
7
entrades, les dades són una frase i no una llista de paraules.
13476 obado 8
<p class="wims_credits">
12169 mquerol 9
Autor del model: Bernadette Perrin-Riou <bpr@math.u-psud.fr>
4188 bpr 10
</p>
11
:%%%%%%%%%%%%%%%%%      ATTENTION      %%%%%%%%%%%%%%%%%%%%
12
 
13
Enlevez l'en-tête ci-dessus si vous détruisez les balises pour le modèle !
14
(Ce sont les lignes qui commencent par un ':'.)
15
Sinon l'exercice risque de ne pas pouvoir repasser sous Createxo.
16
 
17
:%%%%%%%% Paramètres d'exemples à redéfinir %%%%%%%%%%%%%%%%%
12169 mquerol 18
:\title{Classificar les paraules d'una frase}
5147 bpr 19
:\author{Bernadette, Perrin-Riou}
12169 mquerol 20
:\email{}
21
:\credits{}
13476 obado 22
 
12169 mquerol 23
:Enunciat
4188 bpr 24
\text{instruction= Classer les mots selon leur nature ou des propriétés}
25
 
12169 mquerol 26
:Nom del fitxer
27
Ompliu-ho només si voleu transferir el codi d'aquest exercici a un compte de Modtool
28
i utilitzar un fitxer de dades (en un mòdul OEF)
29
del tipus
4188 bpr 30
<pre>
31
 V,N,Art,Adj,Prep
32
 Verbe,Nom,Article,Adjectif,Préposition
4674 bpr 33
 &#58;Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait.|N
34
 &#58;Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol.|N
4188 bpr 35
</pre>
12169 mquerol 36
En aquest cas, les dades principals no es tindran en compte.
37
En cas contrari, ompliu les dades principals.
4188 bpr 38
 
39
\text{file=}
40
 
12169 mquerol 41
:Naturalesa dels objectes
4188 bpr 42
\text{nom_nature=Verbe,Nom,Article,Adjectif,Préposition}
43
 
12169 mquerol 44
:Naturalesa dels objectes (codi)
45
Aquest codi s'utilitzarà a les dades principals.
4188 bpr 46
\text{Nature=V,N,Art,Adj,Prep}
47
 
12169 mquerol 48
:Dades principals.
49
Una frase per línia: les paraules (o grups de paraules) de la frase estan separades per comes. Després de cada paraula,
50
separada de la paraula per la barra vertical <span class="tt">|</span>, està escrita la naturalesa o l'atribut de la paraula tal
51
que estava escrivint al camp <span class="tt">Naturalesa de les paraules (codi)</span>. Si la paraula (o grup de paraules)
52
no va seguida d'una barra vertical
53
i un atribut, no es proposa a la llista de paraules a classificar,
54
encara que estigui escrita en la frase introductòria.
4188 bpr 55
 
56
\text{data=Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait|N
57
Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol|N
58
Le,chat|N,boit|V,du,lait|N,dans|Prep,un,bol|N}
59
 
12169 mquerol 60
:S'accepta text aleatori posat entre claus
61
$embraced_randitem
62
\text{accolade=item(1,1 sí,
63
2 no)}
4188 bpr 64
 
65
:%%%%%%%%%%%%%% Rien à modifier avant l'énoncé %%%%%%%%%%%%%%%%
13716 obado 66
\css{<style>
4188 bpr 67
   .question {background-color: #FFFFCC;margin: 2% 2%;padding: 1%;}
68
   .reponse {background-color: #FFCC99;color: black;margin: 2% 2%;padding: 0%;}
69
   .oefstatement{}
70
   ol li {list-style: upper-alpha; }
71
 </style>}
72
 ##s'il y a un nom de fichier dans file, utilise le fichier, sinon utilise data
73
\if{\file notsametext}{
74
  \text{data=wims(randrecord \file)}
75
  \text{Nature=wims(record 0 of \file)}
76
  \text{nom_nature=row(2,\Nature)}
77
  \text{Nature=row(1,\Nature)}
78
  }{
79
  \text{data=randomrow(\data)}
11375 bpr 80
  }
12169 mquerol 81
\text{accolade=wims(word 1 of \accolade)}
82
 
83
\text{data=\accolade=1 ? wims(embraced randitem \data)}
4188 bpr 84
\integer{cnt=items(\data)}
85
\integer{Nat_cnt=items(\Nature)}
86
\text{phrase=}
87
\text{nature=}
88
\text{tableau=wims(makelist videxxx for x = 1 to \Nat_cnt)}
89
\text{tableau=wims(items2lines \tableau)}
90
\for{u=1 to \cnt}{
91
  \text{w=\data[\u]}
92
  \text{w=wims(replace internal | by , in \w)}
93
  \text{phrase=\phrase \w[1]}
94
  \for{h = 1 to \Nat_cnt}{
95
    \if{\w[2] issametext \Nature[\h]}{
96
       \text{ligne=row(\h,\tableau)}
97
       \text{ligne=videxxx isitemof \ligne ? \w[1]:\ligne,\w[1]}
98
       \text{tableau=wims(replace line number \h by \ligne in \tableau)}
99
       \text{nature=wims(append item \w[2] to \nature)}
100
    }
101
   }
102
}
103
\matrix{tableau=\tableau}
104
\text{nature1=wims(listuniq \nature)}
105
\text{nature=}
106
\for{ a in \Nature}{
107
   \text{nature=\a isin \nature1 ? wims(append item \a to \nature)}
108
}
109
\text{question=}
110
\text{nom_question=}
111
\text{Step=}
112
\for{a in \nature}{
113
   \text{qu=position(\a,\Nature)}
114
   \text{Step=wims(append item r \qu to \Step)}
115
   \text{question=wims(append item \qu to \question)}
116
   \text{nom_question=wims(append item \nom_nature[\qu] to \nom_question)}
117
}
118
\integer{question_cnt=items(\question)}
119
\steps{\Step}
120
 
121
\statement{\instruction
122
<div class="question">\phrase.</div>
12169 mquerol 123
<table class="wimsnoborder">
4188 bpr 124
\for{ s = 1 to \question_cnt}{
125
  <tr><th>\nom_question[\s]</th><td>\embed{\Step[\s],80 x 30 x \cnt}</td></tr>
126
}
127
</table>
128
}
129
\answer{\nom_question[1]}{\tableau[1;]}{type=dragfill}{option=noorder}
130
\answer{\nom_question[2]}{\tableau[2;]}{type=dragfill}{option=noorder}
131
\answer{\nom_question[3]}{\tableau[3;]}{type=dragfill}{option=noorder}
132
\answer{\nom_question[4]}{\tableau[4;]}{type=dragfill}{option=noorder}
133
\answer{\nom_question[5]}{\tableau[5;]}{type=dragfill}{option=noorder}
134
\answer{\nom_question[6]}{\tableau[6;]}{type=dragfill}{option=noorder}
135
\answer{\nom_question[7]}{\tableau[7;]}{type=dragfill}{option=noorder}
136
\answer{\nom_question[8]}{\tableau[8;]}{type=dragfill}{option=noorder}
137
\answer{\nom_question[9]}{\tableau[9;]}{type=dragfill}{option=noorder}
138
\answer{\nom_question[10]}{\tableau[10;]}{type=dragfill}{option=noorder}