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