Rev 13741 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11375 | bpr | 1 | type=classify |
13715 | obado | 2 | textarea="data instruction" |
3 | iEdit="instruction" |
||
4188 | bpr | 4 | |
13704 | obado | 5 | :Classify all words of a sentence according to an attribute (for example their nature). |
6 | This exercise differs from other classification exercises in the way the data is entered, |
||
7 | the data being a sentence and not a list of words. |
||
13477 | obado | 8 | <p class="wims_credits"> |
15179 | lemaire | 9 | Author of the model: <a href="mailto:bernadette.m.riou@orange.fr">Bernadette Perrin-Riou</a> |
4188 | bpr | 10 | </p> |
11 | :%%%%%%%%%%%%%%%%% ATTENTION %%%%%%%%%%%%%%%%%%%% |
||
12 | |||
11544 | obado | 13 | Remove the above header if you destroy the model tags! (The lines starting |
14 | with a ':'.) Otherwise the exercise might not be taken back by Createxo. |
||
4188 | bpr | 15 | |
11544 | obado | 16 | :%%%%%%%% Sample parameters to be redefined %%%%%%%%%%%%%%%%% |
13704 | obado | 17 | :\title{Categorize the words of a sentence} |
5147 | bpr | 18 | :\author{Bernadette, Perrin-Riou} |
5724 | bpr | 19 | :\email{} |
20 | :\credits{} |
||
13477 | obado | 21 | |
22 | :Instructions |
||
13704 | obado | 23 | \text{instruction=Classify words of the sentence according to their nature or properties} |
4188 | bpr | 24 | |
13477 | obado | 25 | :File name |
13704 | obado | 26 | Fill only if you want to transfer the source of this exercise |
27 | to a Modtool account and use a data file (in an OEF module) of the type |
||
4188 | bpr | 28 | <pre> |
29 | V,N,Art,Adj,Prep |
||
13704 | obado | 30 | Verb, name, article, adjective, preposition |
31 | :The|Art,little|Adj,cat|N,drinks|V,milk.|N |
||
32 | :The|Art,cat|N,drinks|V,milk|N,in|Prep,a|Art,bowl.|N |
||
4188 | bpr | 33 | </pre> |
13704 | obado | 34 | In this case, the main data will not be taken into account. |
35 | Otherwise, fill in the main data. |
||
4188 | bpr | 36 | |
37 | \text{file=} |
||
38 | |||
13704 | obado | 39 | :Nature of objects |
40 | \text{nom_nature=verb, name, article, adjective, preposition} |
||
4188 | bpr | 41 | |
13704 | obado | 42 | :Nature of words (code) |
43 | This code will be used in the main data. |
||
4188 | bpr | 44 | \text{Nature=V,N,Art,Adj,Prep} |
45 | |||
13477 | obado | 46 | :Main data |
13704 | obado | 47 | One sentence per line: The words (or groups of words) in the sentence are separated by commas. |
48 | After each word, separated from the word by the vertical bar, |
||
49 | is written the nature or attribute of the word as it was written |
||
50 | in the field <span class="tt">Nature of words (code)</span>. |
||
51 | If the word (or group of words) is not followed by a vertical bar |
||
52 | and an attribute, it is not proposed in the list of words to be placed, |
||
53 | but is written in the introductory sentence. |
||
4188 | bpr | 54 | |
13704 | obado | 55 | \text{data=The|Art,little|Adj,cat|N,drinks|V,milk.|N |
56 | The|Art,cat|N,drinks|V,milk|N,in|Prep,a|Art,bowl.|N} |
||
4188 | bpr | 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 %%%%%%%%%%%%%%%% |
13725 | obado | 64 | |
65 | ##if a file name exist, use the file, otherwise use data |
||
4188 | bpr | 66 | \if{\file notsametext}{ |
67 | \text{data=wims(randrecord \file)} |
||
68 | \text{Nature=wims(record 0 of \file)} |
||
69 | \text{nom_nature=row(2,\Nature)} |
||
70 | \text{Nature=row(1,\Nature)} |
||
13704 | obado | 71 | }{ |
4188 | bpr | 72 | \text{data=randomrow(\data)} |
13704 | obado | 73 | } |
5797 | bpr | 74 | \text{accolade=wims(word 1 of \accolade)} |
75 | |||
76 | \text{data=\accolade=1 ? wims(embraced randitem \data)} |
||
4188 | bpr | 77 | \integer{cnt=items(\data)} |
78 | \integer{Nat_cnt=items(\Nature)} |
||
79 | \text{phrase=} |
||
80 | \text{nature=} |
||
81 | \text{tableau=wims(makelist videxxx for x = 1 to \Nat_cnt)} |
||
82 | \text{tableau=wims(items2lines \tableau)} |
||
83 | \for{u=1 to \cnt}{ |
||
84 | \text{w=\data[\u]} |
||
85 | \text{w=wims(replace internal | by , in \w)} |
||
86 | \text{phrase=\phrase \w[1]} |
||
87 | \for{h = 1 to \Nat_cnt}{ |
||
88 | \if{\w[2] issametext \Nature[\h]}{ |
||
89 | \text{ligne=row(\h,\tableau)} |
||
90 | \text{ligne=videxxx isitemof \ligne ? \w[1]:\ligne,\w[1]} |
||
91 | \text{tableau=wims(replace line number \h by \ligne in \tableau)} |
||
92 | \text{nature=wims(append item \w[2] to \nature)} |
||
93 | } |
||
94 | } |
||
95 | } |
||
96 | \matrix{tableau=\tableau} |
||
97 | \text{nature1=wims(listuniq \nature)} |
||
98 | \text{nature=} |
||
99 | \for{ a in \Nature}{ |
||
100 | \text{nature=\a isin \nature1 ? wims(append item \a to \nature)} |
||
101 | } |
||
102 | \text{question=} |
||
103 | \text{nom_question=} |
||
104 | \text{Step=} |
||
105 | \for{a in \nature}{ |
||
106 | \text{qu=position(\a,\Nature)} |
||
107 | \text{Step=wims(append item r \qu to \Step)} |
||
108 | \text{question=wims(append item \qu to \question)} |
||
109 | \text{nom_question=wims(append item \nom_nature[\qu] to \nom_question)} |
||
110 | } |
||
111 | \integer{question_cnt=items(\question)} |
||
112 | \steps{\Step} |
||
113 | |||
114 | \statement{\instruction |
||
13741 | obado | 115 | <div class="wims_question">\phrase</div> |
13725 | obado | 116 | <table class="wimsnoborder"> |
117 | \for{ s = 1 to \question_cnt}{ |
||
118 | <tr><th>\nom_question[\s]</th><td>\embed{\Step[\s],80 x 30 x \cnt}</td></tr> |
||
119 | } |
||
120 | </table> |
||
4188 | bpr | 121 | } |
122 | \answer{\nom_question[1]}{\tableau[1;]}{type=dragfill}{option=noorder} |
||
123 | \answer{\nom_question[2]}{\tableau[2;]}{type=dragfill}{option=noorder} |
||
124 | \answer{\nom_question[3]}{\tableau[3;]}{type=dragfill}{option=noorder} |
||
125 | \answer{\nom_question[4]}{\tableau[4;]}{type=dragfill}{option=noorder} |
||
126 | \answer{\nom_question[5]}{\tableau[5;]}{type=dragfill}{option=noorder} |
||
127 | \answer{\nom_question[6]}{\tableau[6;]}{type=dragfill}{option=noorder} |
||
128 | \answer{\nom_question[7]}{\tableau[7;]}{type=dragfill}{option=noorder} |
||
129 | \answer{\nom_question[8]}{\tableau[8;]}{type=dragfill}{option=noorder} |
||
130 | \answer{\nom_question[9]}{\tableau[9;]}{type=dragfill}{option=noorder} |
||
131 | \answer{\nom_question[10]}{\tableau[10;]}{type=dragfill}{option=noorder} |