Subversion Repositories wimsdev

Rev

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

!if $wims_read_parm!=slib_header
 !goto proc
!endif
slib_title=For marking words with mistake
slib_parms=1\
,the input text (embedding delimiter: `??false_word|bon??' no coma or semi-column between the ??)
slib_author=Bernadette PERRIN-RIOU
slib_out= a matrix :\
   position of the false_word in the sentence ; Text output with comas beetween words;\
list of good answers;number of words in the sentence

slib_comment=<b>Preliminary version subject to further change, user with care!</b>\
the two first lines can be use directly as the answer with type=mark.
slib_example= The ball is ??rond|round?? and ??gren|green??.\
??They bal|The ball?? is ??raid|red?? and green.\
??The ball?? is ??raid|red?? and green.
!exit

:proc

slib_texte=!lines2words $wims_read_parm
slib_texte= !embraced randitem $slib_texte
slib_texte=!rows2lines $slib_texte
slib_texte=!replace internal $\
$ by &#59; in $slib_texte
slib_texte=!replace internal ?? by ; in $slib_texte

slib_cntrow=!rowcnt $slib_texte
slib_TEXTE=
slib_rep=
slib_cnt=0
slib_JUSTE=
slib_texte=!replace internal , by &#44; in $slib_texte
!for slib_i= 1 to $slib_cntrow
  slib_H = !row $slib_i of $slib_texte
  slib_cnt_w=!wordcnt $slib_H
  slib_k=$[$slib_i%2]
  !if $slib_k = 0
    slib_faux=!replace internal | by , in $slib_H
    !distribute items $slib_faux into slib_H,slib_juste
    !if $slib_juste=
      slib_JUSTE = !append item slib_ZZZZZ to $slib_JUSTE
    !else
      slib_JUSTE = !append item $slib_juste to $slib_JUSTE
    !endif
  !endif
  slib_cnt_w=!wordcnt $slib_H
  !if $slib_k = 0
    slib_rep1 = !values $slib_cnt + x for x=1 to $slib_cnt_w
    slib_rep  = !append item $slib_rep1 to $slib_rep
  !endif
  slib_cnt= $[$slib_cnt+$slib_cnt_w]
  slib_HH = !words2items $slib_H
  slib_TEXTE = !append item $slib_HH to $slib_TEXTE
!next slib_i
slib_rep=!nonempty items $slib_rep

slib_TEXTE = !nonempty items $slib_TEXTE
slib_JUSTE = !replace internal slib_ZZZZZ by in $slib_JUSTE

slib_out= $slib_rep;$slib_TEXTE;$slib_JUSTE;$slib_cnt