Subversion Repositories wimsdev

Rev

Rev 13725 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

type=classify
textarea="data instruction"
iEdit="instruction"

:Classify all words of a sentence according to an attribute (for example their nature).
This exercise differs from other classification exercises in the way the data is entered,
 the data being a sentence and not a list of words.
<p class="wims_credits">
Author of the model: Bernadette Perrin-Riou <bpr@math.u-psud.fr>
</p>
:%%%%%%%%%%%%%%%%%      ATTENTION      %%%%%%%%%%%%%%%%%%%%

Remove the above header if you destroy the model tags! (The lines starting
with a ':'.) Otherwise the exercise might not be taken back by Createxo.

:%%%%%%%% Sample parameters to be redefined %%%%%%%%%%%%%%%%%
:\title{Categorize the words of a sentence}
:\author{Bernadette, Perrin-Riou}
:\email{}
:\credits{}

:Instructions
\text{instruction=Classify words of the sentence according to their nature or properties}

:File name
Fill only if you want to transfer the source of this exercise
 to a Modtool account and use a data file (in an OEF module) of the type
<pre>
 V,N,Art,Adj,Prep
 Verb, name, article, adjective, preposition
 &#58;The|Art,little|Adj,cat|N,drinks|V,milk.|N
 &#58;The|Art,cat|N,drinks|V,milk|N,in|Prep,a|Art,bowl.|N
</pre>
In this case, the main data will not be taken into account.
Otherwise, fill in the main data.

\text{file=}

:Nature of objects
\text{nom_nature=verb, name, article, adjective, preposition}

:Nature of words (code)
This code will be used in the main data.
\text{Nature=V,N,Art,Adj,Prep}

:Main data
One sentence per line: The words (or groups of words) in the sentence are separated by commas.
After each word, separated from the word by the vertical bar,
 is written the nature or attribute of the word as it was written
 in the field <span class="tt">Nature of words (code)</span>.
If the word (or group of words) is not followed by a vertical bar
 and an attribute, it is not proposed in the list of words to be placed,
 but is written in the introductory sentence.

\text{data=The|Art,little|Adj,cat|N,drinks|V,milk.|N
The|Art,cat|N,drinks|V,milk|N,in|Prep,a|Art,bowl.|N}

:Embraced random items
$embraced_randitem
\text{accolade=item(1,1 yes,
2 no)}

:%%%%%%%%%%%%%% Nothing to modify until statement %%%%%%%%%%%%%%%%

##if a file name exist, use the file, otherwise use data
\if{\file notsametext}{
  \text{data=wims(randrecord \file)}
  \text{Nature=wims(record 0 of \file)}
  \text{nom_nature=row(2,\Nature)}
  \text{Nature=row(1,\Nature)}
}{
  \text{data=randomrow(\data)}
}
\text{accolade=wims(word 1 of \accolade)}

\text{data=\accolade=1 ? wims(embraced randitem \data)}
\integer{cnt=items(\data)}
\integer{Nat_cnt=items(\Nature)}
\text{phrase=}
\text{nature=}
\text{tableau=wims(makelist videxxx for x = 1 to \Nat_cnt)}
\text{tableau=wims(items2lines \tableau)}
\for{u=1 to \cnt}{
  \text{w=\data[\u]}
  \text{w=wims(replace internal | by , in \w)}
  \text{phrase=\phrase \w[1]}
  \for{h = 1 to \Nat_cnt}{
    \if{\w[2] issametext \Nature[\h]}{
       \text{ligne=row(\h,\tableau)}
       \text{ligne=videxxx isitemof \ligne ? \w[1]:\ligne,\w[1]}
       \text{tableau=wims(replace line number \h by \ligne in \tableau)}
       \text{nature=wims(append item \w[2] to \nature)}
    }
   }
}
\matrix{tableau=\tableau}
\text{nature1=wims(listuniq \nature)}
\text{nature=}
\for{ a in \Nature}{
   \text{nature=\a isin \nature1 ? wims(append item \a to \nature)}
}
\text{question=}
\text{nom_question=}
\text{Step=}
\for{a in \nature}{
   \text{qu=position(\a,\Nature)}
   \text{Step=wims(append item r \qu to \Step)}
   \text{question=wims(append item \qu to \question)}
   \text{nom_question=wims(append item \nom_nature[\qu] to \nom_question)}
}
\integer{question_cnt=items(\question)}
\steps{\Step}

\statement{\instruction
  <div class="wims_question">\phrase</div>
  <table class="wimsnoborder">
  \for{ s = 1 to \question_cnt}{
    <tr><th>\nom_question[\s]</th><td>\embed{\Step[\s],80 x 30 x \cnt}</td></tr>
  }
  </table>
}
\answer{\nom_question[1]}{\tableau[1;]}{type=dragfill}{option=noorder}
\answer{\nom_question[2]}{\tableau[2;]}{type=dragfill}{option=noorder}
\answer{\nom_question[3]}{\tableau[3;]}{type=dragfill}{option=noorder}
\answer{\nom_question[4]}{\tableau[4;]}{type=dragfill}{option=noorder}
\answer{\nom_question[5]}{\tableau[5;]}{type=dragfill}{option=noorder}
\answer{\nom_question[6]}{\tableau[6;]}{type=dragfill}{option=noorder}
\answer{\nom_question[7]}{\tableau[7;]}{type=dragfill}{option=noorder}
\answer{\nom_question[8]}{\tableau[8;]}{type=dragfill}{option=noorder}
\answer{\nom_question[9]}{\tableau[9;]}{type=dragfill}{option=noorder}
\answer{\nom_question[10]}{\tableau[10;]}{type=dragfill}{option=noorder}