Rev 5907 | Rev 12169 | 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. |
||
7 | <p> |
||
8 | Auteur du modèle : Bernadette Perrin-Riou <bpr@math.u-psud.fr> |
||
9 | </p> |
||
10 | :%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%% |
||
11 | |||
12 | Enlevez l'en-tête ci-dessus si vous détruisez les balises pour le modèle ! |
||
13 | (Ce sont les lignes qui commencent par un ':'.) |
||
14 | Sinon l'exercice risque de ne pas pouvoir repasser sous Createxo. |
||
15 | |||
16 | :%%%%%%%% Paramètres d'exemples à redéfinir %%%%%%%%%%%%%%%%% |
||
4514 | bpr | 17 | :\title{Classer les mots d'une phrase} |
5147 | bpr | 18 | :\author{Bernadette, Perrin-Riou} |
4188 | bpr | 19 | :Consigne |
20 | \text{instruction= Classer les mots selon leur nature ou des propriétés} |
||
21 | |||
22 | :Nom du fichier |
||
11375 | bpr | 23 | Ne remplissez que si vous vous désirez transférer le source de cet exercice dans un compte Modtool |
4188 | bpr | 24 | et utiliser un fichier de données (dans un module OEF) |
25 | du type |
||
26 | <pre> |
||
27 | V,N,Art,Adj,Prep |
||
28 | Verbe,Nom,Article,Adjectif,Préposition |
||
4674 | bpr | 29 | :Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait.|N |
30 | :Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol.|N |
||
4188 | bpr | 31 | </pre> |
11375 | bpr | 32 | Dans ce cas, les données principales ne seront pas prises en compte. |
4188 | bpr | 33 | Sinon, remplissez les données principales. |
34 | |||
35 | \text{file=} |
||
36 | |||
37 | :Nature des objets |
||
38 | \text{nom_nature=Verbe,Nom,Article,Adjectif,Préposition} |
||
39 | |||
40 | :Nature des mots (code) |
||
41 | C'est ce code qui sera utilisé dans les données principales. |
||
42 | \text{Nature=V,N,Art,Adj,Prep} |
||
43 | |||
44 | :Données principales. |
||
11375 | bpr | 45 | 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 | 46 | séparé du mot par la barre verticale <span class="tt">|</span>, est écrit la nature ou l'attribut du mot telle |
11375 | bpr | 47 | 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 | 48 | n'est pas suivi d'une barre verticale |
11375 | bpr | 49 | et d'un attribut, il n'est pas proposé dans la liste des mots à placer, |
4188 | bpr | 50 | mais est écrit dans la phrase d'introduction. |
51 | |||
52 | \text{data=Le|Art,petit|Adj,chat|N,boit|V,du|Art,lait|N |
||
53 | Le|Art,chat|N,boit|V,du|Art,lait|N,dans|Prep,un|Art,bol|N |
||
54 | Le,chat|N,boit|V,du,lait|N,dans|Prep,un,bol|N} |
||
55 | |||
56 | |||
57 | :%%%%%%%%%%%%%% Rien à modifier avant l'énoncé %%%%%%%%%%%%%%%% |
||
58 | \css{<style type="text/css"> |
||
59 | .question {background-color: #FFFFCC;margin: 2% 2%;padding: 1%;} |
||
60 | .reponse {background-color: #FFCC99;color: black;margin: 2% 2%;padding: 0%;} |
||
61 | .oefstatement{} |
||
62 | ol li {list-style: upper-alpha; } |
||
63 | </style>} |
||
64 | ##s'il y a un nom de fichier dans file, utilise le fichier, sinon utilise data |
||
65 | \if{\file notsametext}{ |
||
66 | \text{data=wims(randrecord \file)} |
||
67 | \text{Nature=wims(record 0 of \file)} |
||
68 | \text{nom_nature=row(2,\Nature)} |
||
69 | \text{Nature=row(1,\Nature)} |
||
70 | }{ |
||
71 | \text{data=randomrow(\data)} |
||
11375 | bpr | 72 | } |
4188 | bpr | 73 | \text{data=wims(embraced randitem \data)} |
74 | \integer{cnt=items(\data)} |
||
75 | \integer{Nat_cnt=items(\Nature)} |
||
76 | \text{phrase=} |
||
77 | \text{nature=} |
||
78 | \text{tableau=wims(makelist videxxx for x = 1 to \Nat_cnt)} |
||
79 | \text{tableau=wims(items2lines \tableau)} |
||
80 | \for{u=1 to \cnt}{ |
||
81 | \text{w=\data[\u]} |
||
82 | \text{w=wims(replace internal | by , in \w)} |
||
83 | \text{phrase=\phrase \w[1]} |
||
84 | \for{h = 1 to \Nat_cnt}{ |
||
85 | \if{\w[2] issametext \Nature[\h]}{ |
||
86 | \text{ligne=row(\h,\tableau)} |
||
87 | \text{ligne=videxxx isitemof \ligne ? \w[1]:\ligne,\w[1]} |
||
88 | \text{tableau=wims(replace line number \h by \ligne in \tableau)} |
||
89 | \text{nature=wims(append item \w[2] to \nature)} |
||
90 | } |
||
91 | } |
||
92 | } |
||
93 | \matrix{tableau=\tableau} |
||
94 | \text{nature1=wims(listuniq \nature)} |
||
95 | \text{nature=} |
||
96 | \for{ a in \Nature}{ |
||
97 | \text{nature=\a isin \nature1 ? wims(append item \a to \nature)} |
||
98 | } |
||
99 | \text{question=} |
||
100 | \text{nom_question=} |
||
101 | \text{Step=} |
||
102 | \for{a in \nature}{ |
||
103 | \text{qu=position(\a,\Nature)} |
||
104 | \text{Step=wims(append item r \qu to \Step)} |
||
105 | \text{question=wims(append item \qu to \question)} |
||
106 | \text{nom_question=wims(append item \nom_nature[\qu] to \nom_question)} |
||
107 | } |
||
108 | \integer{question_cnt=items(\question)} |
||
109 | \steps{\Step} |
||
110 | |||
111 | \statement{\instruction |
||
112 | <div class="question">\phrase.</div> |
||
113 | <table> |
||
114 | \for{ s = 1 to \question_cnt}{ |
||
115 | <tr><th>\nom_question[\s]</th><td>\embed{\Step[\s],80 x 30 x \cnt}</td></tr> |
||
116 | } |
||
117 | </table> |
||
118 | } |
||
119 | \answer{\nom_question[1]}{\tableau[1;]}{type=dragfill}{option=noorder} |
||
120 | \answer{\nom_question[2]}{\tableau[2;]}{type=dragfill}{option=noorder} |
||
121 | \answer{\nom_question[3]}{\tableau[3;]}{type=dragfill}{option=noorder} |
||
122 | \answer{\nom_question[4]}{\tableau[4;]}{type=dragfill}{option=noorder} |
||
123 | \answer{\nom_question[5]}{\tableau[5;]}{type=dragfill}{option=noorder} |
||
124 | \answer{\nom_question[6]}{\tableau[6;]}{type=dragfill}{option=noorder} |
||
125 | \answer{\nom_question[7]}{\tableau[7;]}{type=dragfill}{option=noorder} |
||
126 | \answer{\nom_question[8]}{\tableau[8;]}{type=dragfill}{option=noorder} |
||
127 | \answer{\nom_question[9]}{\tableau[9;]}{type=dragfill}{option=noorder} |
||
128 | \answer{\nom_question[10]}{\tableau[10;]}{type=dragfill}{option=noorder} |