diff --git a/tetras_extraction/macao_12/result/macao_content.ttl b/tetras_extraction/macao_12/result/macao_content.ttl index c09a646bb1e054b5c230211445acb1068e20458b..6f736b15623faae540d15ac21439bd82abffb11d 100644 --- a/tetras_extraction/macao_12/result/macao_content.ttl +++ b/tetras_extraction/macao_12/result/macao_content.ttl @@ -229,6 +229,8 @@ until they are ripe and rosy, and then we shall pick them and put them quite away <b>for the</b> winter-time'.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg20" ; :index 2 ; :titre "Ecoutez et complétez (2)" ; @@ -413,6 +415,8 @@ <p align=""><br>average: 2 syllabes.</p> <p align=""><br>interested: 3 syllabes.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg262" ; :index 4 ; :titre "Compter les syllabes orales (1)" ; @@ -457,7 +461,8 @@ """ ; :id "pg288" ; :index 12 ; - :titre "Mémento : l'accentuation des syllabes (2)" ; + :titre "Mémento : l'accentuation des syllabes (2)", + "Mémento : l'accentuation des syllabes (2)" ; rdfs:subClassOf :MosEtp129 . :pg293q0 a :Reponse ; @@ -531,6 +536,63 @@ :__protege_display_name "21 | pg299 | Mémento : longueur de la voyelle" ; :commentaireSucces """<div id="divCmtSucces" onclick="SPE_clicDansBulle(event,'divCmtSucces')"></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"><p align="">Contrairement aux idées reçues, + la longueur de la voyelle n'est pas un critère pertinent pour distinguer les voyelles tendues des voyelles + lâches. La présence<br>de <img src="../media/deuxpoints.png" id="MosImg49" border="0" align="center" style="visibility:hidden"> (dans /<img src="../media/udeuxpoints.png" id="MosImg7" border="0" align="center" style="visibility:hidden">/ par exemple) + n'indique pas que la prononciation de la voyelle soit particulièrement longue ; elle indique un phénomène de + tension.<br>La même voyelle peut d'ailleurs être prononcée avec une longueur différente selon qu'elle est suivie + par exemple de <b>/k/ </b>ou de <b>/g/, </b>de <b>/t/ </b>ou de <b>/d/</b>, de <b>/p/</b> ou de + <b>/b/</b>.<br><br>Ecoutez en cliquant sur les boutons :<br><br> Prononciation<br> + </p><table class="STY_tableau" width="200" cellpadding="3" cellspacing="0" valign="top" border="0"> + <tr> + <td width="18" valign="top"></td> + <td valign="top">moins longue</td> + <td width="18" valign="top"></td> + <td valign="top">plus longue</td> + </tr> + <tr> + <td width="18" valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV90', 'bt_lick.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>lick</b></td> + <td width="18" valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV18', 'bt_big.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>big </b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV50', 'bt_sit.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>sit</b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV46', 'bt_lid.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>lid</b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV15', 'bt_sharp.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>sharp </b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV2', 'bt_rhubarb.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>rhubarb</b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV59', 'bt_leek.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>leek</b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV83', 'bt_league.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>league</b></td> + </tr> + </table> + </div> + """ ; :id "pg299" ; :index 21 ; :titre "Mémento : longueur de la voyelle" ; @@ -705,6 +767,8 @@ </table> </div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg331" ; :index 4 ; :titre "Trouver l'accent secondaire (2)" ; @@ -830,6 +894,8 @@ <p align=""><br>precise : 2 syllabes.</p> <p align=""><br><br>differently : 3 syllabes.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg396" ; :index 5 ; :titre "Compter les syllabes orales (2)" ; @@ -842,6 +908,63 @@ :__protege_display_name "00 | pg397 | Longueur de la voyelle" ; :commentaireSucces """<div id="divCmtSucces" onclick="SPE_clicDansBulle(event,'divCmtSucces')"></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"><p align="">Contrairement aux idées reçues, + la longueur de la voyelle n'est pas un critère pertinent pour distinguer les voyelles tendues des voyelles + lâches. La présence<br>de <img src="../media/deuxpoints.png" id="MosImg49" border="0" align="center" style="visibility:hidden"> (dans /<img src="../media/udeuxpoints.png" id="MosImg7" border="0" align="center" style="visibility:hidden">/ par exemple) + n'indique pas que la prononciation de la voyelle soit particulièrement longue ; elle indique un phénomène de + tension.<br>La même voyelle peut d'ailleurs être prononcée avec une longueur différente selon qu'elle est suivie + par exemple de <b>/k/ </b>ou de <b>/g/, </b>de <b>/t/ </b>ou de <b>/d/</b>, de <b>/p/</b> ou de + <b>/b/</b>.<br><br>Ecoutez en cliquant sur les boutons :<br><br> Prononciation<br> + </p><table class="STY_tableau" width="200" cellpadding="3" cellspacing="0" valign="top" border="0"> + <tr> + <td width="18" valign="top"></td> + <td valign="top">moins longue</td> + <td width="18" valign="top"></td> + <td valign="top">plus longue</td> + </tr> + <tr> + <td width="18" valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV90', 'bt_lick.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>lick</b></td> + <td width="18" valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV18', 'bt_big.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>big </b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV50', 'bt_sit.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>sit</b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV46', 'bt_lid.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>lid</b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV15', 'bt_sharp.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>sharp </b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV2', 'bt_rhubarb.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>rhubarb</b></td> + </tr> + <tr> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV59', 'bt_leek.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>leek</b></td> + <td valign="top"><b> + <script type="text/javascript">ajDocW(PF_clipAV('clipAV83', 'bt_league.swf', '17', '17', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', 'cmt'));</script> + </b></td> + <td valign="top"><b>league</b></td> + </tr> + </table> + </div> + """ ; :id "pg397" ; :index 0 ; :titre "Longueur de la voyelle" ; @@ -956,6 +1079,8 @@ """<div id="divSugg3" onclick="SPE_clicDansBulle(event,'divSugg3')"><p align=""><font color="#000000"><br><br><br><br><br>Comparez vos réponses au corrigé. Vous pouvez réécouter chaque mot :<br><br><br><br><br></font><br><br><br><img align="center" border="0" src="../media/phon_computer_p57_juste.png" id="MosImg604" style="visibility:hidden"><br><br><br><br><img align="center" border="0" src="../media/phon_identify_p57_juste.png" id="MosImg474" style="visibility:hidden"><br><br><br><img align="center" border="0" src="../media/phon_narrativ_justep57.png" id="MosImg498" style="visibility:hidden"><br><br><font color="#a60a69">Vous pouvez remarquer que l'accent primaire ne porte jamais sur une syllabe ne comportant qu'une voyelle réduite (ici, /<img align="absMiddle" border="0" src="../media/about.png" width="12" height="12" id="MosImg845873" style="visibility:hidden">/ ).</font></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg436" ; :index 6 ; :titre "Placer les accents primaire et secondaire (3)" ; @@ -978,6 +1103,16 @@ :__protege_display_name "18 | pg44 | Mémento : voyelles lâches et voyelles tendues" ; :commentaireSucces """<div id="divCmtSucces" onclick="SPE_clicDansBulle(event,'divCmtSucces')"></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"><p align=""><br><br><font color="#a60a69">Contrairement + à la voyelle de <i>leg</i> qui comporte un son unique et stable (/<img align="center" border="0" src="../media/e.png" id="MosImg808" style="visibility:hidden">/) la voyelle + de <i>boy</i> est composée de 2 sons prononcés de manière inégale : on a comme un mouvement vers /<img align="center" border="0" src="../media/i.png" id="MosImg337" style="visibility:hidden">/ sans que /<img align="center" border="0" src="../media/i.png" id="MosImg3367" style="visibility:hidden">/ soit + totalement prononcé et on dit que la voyelle de <i>boy</i> (/<img align="center" border="0" src="../media/ci_boy.png" id="MosImg445" style="visibility:hidden">/) est une voyelle + tendue. La voyelle de <i>fool </i>(/<img align="center" border="0" src="../media/u1.png" id="MosImg943" style="visibility:hidden">/) présente le même phénomène, avec cette + fois-ci une tension vers /<img align="center" border="0" src="../media/omega1.png" id="MosImg189" style="visibility:hidden">/. Dans la transcription, le mouvement de tension est + signalé soit par /ː/ (c'est le cas de /<img align="center" border="0" src="../media/u1.png" id="MosImg9443" style="visibility:hidden">/ ) soit par la présence de 2 symboles + placés à égalité (c'est le cas de (/<img align="center" border="0" src="../media/ci_boy.png" id="MosImg4418" style="visibility:hidden">/). La représentation par deux symboles + placés à égalité ne rend pas vraiment compte du phénomène de tension.</font><br><br></p></div> + """ ; :id "pg44" ; :index 18 ; :titre "Mémento : voyelles lâches et voyelles tendues" ; @@ -994,6 +1129,8 @@ :commentaireSugg """<div id="divSugg1" onclick="SPE_clicDansBulle(event,'divSugg1')"><p align="">Non. </p> <p align="">FOR est le seul mot commun aux deux énoncés. Vous pouvez réécouter les énoncés.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg444" ; :index 8 ; :titre "Reconnaître le mot commun (5)" ; @@ -1034,6 +1171,8 @@ """<div id="divSugg6" onclick="SPE_clicDansBulle(event,'divSugg6')"><p align=""><font color="#000000"><br><br><br><br><br>Comparez vos réponses au corrigé. Vous pouvez réécouter chaque mot :<br><br><br><br><br><br></font><br><br><img align="center" border="0" src="../media/phon_theoretician_p54_just.png" id="MosImg549" style="visibility:hidden"><br><br><br><br><img align="center" border="0" src="../media/phon_university__p54_juste.png" id="MosImg7745" style="visibility:hidden"><br><br><br><img align="center" border="0" src="../media/phon_recognition_54_juste.png" id="MosImg1" style="visibility:hidden"><br><br><font color="#a60a69">Vous pouvez remarquer que l'accent primaire ne porte jamais sur une syllabe ne comportant qu'une voyelle réduite (ici, /<img align="absMiddle" border="0" src="../media/about.png" width="12" height="12" id="MosImg845873" style="visibility:hidden">/ ).</font></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg449" ; :index 5 ; :titre "Placer les accents primaire et secondaire (2)" ; @@ -1087,6 +1226,8 @@ grass</b>, so, one day, my little sister looked <b>under the tree</b> and found <b>a nice big windfall</b> on the grass and she took it in for my mother to wash.<br></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg503" ; :index 3 ; :titre "Ecoutez et complétez (3)" ; @@ -1143,6 +1284,8 @@ :commentaireSugg """<div id="divSugg1" onclick="SPE_clicDansBulle(event,'divSugg1')"><p align="">Vous vous êtes trompé.</p> <p align="">TO est le seul mot commun aux deux énoncés. Vous pouvez réécouter les énoncés.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg52" ; :index 4 ; :titre "Reconnaître le mot commun (3)" ; @@ -1216,6 +1359,8 @@ <p align="">Voici la transcription appropriée : </p> <p align=""><img src="../media/phon_p37_agree_right.png" id="MosImg9" border="0" align="center" style="visibility:hidden"> et <img src="../media/phon_p37_shaking_right1.png" id="MosImg87" border="0" align="center" style="visibility:hidden"></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg545" ; :index 21 ; :titre "Compléter une transcription (1) " ; @@ -1242,6 +1387,8 @@ :commentaireSugg """<div id="divSugg1" onclick="SPE_clicDansBulle(event,'divSugg1')"><p align="">Vous vous êtes trompé.</p> <p align="">AT est le seul mot commun aux deux énoncés. Vous pouvez réécouter les énoncés.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg558" ; :index 2 ; :titre "Reconnaître le mot commun (2)" ; @@ -1340,6 +1487,8 @@ <p align=""><br>interesting: 4 "syllabes écrites".</p> <p align=""><br>dangerous: 3 "syllabes écrites".</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg60" ; :index 1 ; :titre "Repérer les syllabes écrites" ; @@ -1367,6 +1516,8 @@ <p align="">Voici la transcription appropriée : </p> <p align=""> <img align="center" border="0" src="../media/phon_to_right.png" id="MosImg35" style="visibility:hidden"> et <img align="center" border="0" src="../media/phon_about_right.png" id="MosImg88" style="visibility:hidden"></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg608" ; :index 22 ; :titre "Compléter une transcription (2) " ; @@ -1449,6 +1600,8 @@ :commentaireSugg """<div id="divSugg1" onclick="SPE_clicDansBulle(event,'divSugg1')"><p align="">Vous vous êtes trompé.</p> <p align="">OF est le seul mot commun aux deux énoncés. Vous pouvez réécouter les énoncés.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg624" ; :index 0 ; :titre "Reconnaître le mot commun (1)" ; @@ -1469,6 +1622,8 @@ sometimes my naughty little sister used to pick <b>some apples</b> and eat them. It <b>was a</b> very easy thing to do because <b>the branches</b> were so low.<br></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg6241" ; :index 1 ; :titre "Ecoutez et complétez (1)" ; @@ -2074,6 +2229,8 @@ <p align="">Voici la transcription appropriée : </p> <p align=""> <img src="../media/phon_pats_right.png" id="MosImg41" border="0" align="center" style="visibility:hidden"> et <img align="center" border="0" src="../media/phon_shes_right.png" id="MosImg92" style="visibility:hidden"></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg81" ; :index 23 ; :titre "Compléter une transcription (3) " ; @@ -2289,6 +2446,8 @@ <p align=""><br><br>oranges: 3 syllabes.</p> <p align=""><br>different: 2 syllabes.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg85" ; :index 6 ; :titre "Compter les syllabes orales (3)" ; @@ -2471,6 +2630,8 @@ </table> </div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg860" ; :index 3 ; :titre "Trouver l'accent secondaire (1)" ; @@ -2496,6 +2657,8 @@ <p align=""><br>interesting: 3 syllabes</p> <p align=""><br>dangerous: 2 syllabes</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg861" ; :index 0 ; :titre "Repérer les syllabes orales" ; @@ -2556,6 +2719,8 @@ <p align=""><i>On remarque que les mots entendus ne présentent pas le même nombre de syllabes orales et de "</i><i><font color="#000000">syllabes écrites</font></i><i><font color="#000000">":</font> par exemple , <b>chocolate</b>, qui s'écrit avec 4 syllabes, se prononce en 2 syllabes.</i></p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg88" ; :index 7 ; :titre "Compter les syllabes orales (4)" ; @@ -2578,6 +2743,16 @@ :__protege_display_name "00 | pg888 | Voyelles lâches et voyelles tendues" ; :commentaireSucces """<div id="divCmtSucces" onclick="SPE_clicDansBulle(event,'divCmtSucces')"></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"><p align=""><br><br><font color="#a60a69">Contrairement + à la voyelle de <i>leg</i> qui comporte un son unique et stable (/<img align="center" border="0" src="../media/e.png" id="MosImg808" style="visibility:hidden">/) la voyelle + de <i>boy</i> est composée de 2 sons prononcés de manière inégale : on a comme un mouvement vers /<img align="center" border="0" src="../media/i.png" id="MosImg337" style="visibility:hidden">/ sans que /<img align="center" border="0" src="../media/i.png" id="MosImg3367" style="visibility:hidden">/ soit + totalement prononcé et on dit que la voyelle de <i>boy</i> (/<img align="center" border="0" src="../media/ci_boy.png" id="MosImg445" style="visibility:hidden">/) est une voyelle + tendue. La voyelle de <i>fool </i>(/<img align="center" border="0" src="../media/u1.png" id="MosImg943" style="visibility:hidden">/) présente le même phénomène, avec cette + fois-ci une tension vers /<img align="center" border="0" src="../media/omega1.png" id="MosImg189" style="visibility:hidden">/. Dans la transcription, le mouvement de tension est + signalé soit par /ː/ (c'est le cas de /<img align="center" border="0" src="../media/u1.png" id="MosImg9443" style="visibility:hidden">/ ) soit par la présence de 2 symboles + placés à égalité (c'est le cas de (/<img align="center" border="0" src="../media/ci_boy.png" id="MosImg4418" style="visibility:hidden">/). La représentation par deux symboles + placés à égalité ne rend pas vraiment compte du phénomène de tension.</font><br><br></p></div> + """ ; :id "pg888" ; :index 0 ; :titre "Voyelles lâches et voyelles tendues" ; @@ -2730,6 +2905,8 @@ :commentaireSugg """<div id="divSugg1" onclick="SPE_clicDansBulle(event,'divSugg1')"><p align="">Vous vous êtes trompé.</p> <p align="">IN est le seul mot commun aux deux énoncés. Vous pouvez réécouter les énoncés.</p></div> """ ; + :description """<div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg948" ; :index 6 ; :titre "Reconnaître le mot commun (4)" ; @@ -2989,7 +3166,8 @@ <td valign="top">lead</td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg1000" ; :index 18 ; :titre "Choisir une transcription (9)" ; @@ -3012,7 +3190,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><p align=""><br>Voici la transcription d'un mot : </p> <p align=""><img align="center" border="0" src="../media/phon_thing.png" id="MosImg68" style="visibility:hidden"><br><br>Ecoutez les deux mots enregistrés, en cliquant sur les boutons.<br>La transcription ci-dessus correspond-elle au premier mot entendu ou au second ?<br><br>Sélectionnez - l'enregistrement qui convient : </p></div>""" ; + l'enregistrement qui convient : </p></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg108" ; :index 9 ; :titre "Choisir une prononciation (3)" ; @@ -3080,7 +3259,8 @@ cliquant sur le bouton puis validez le mot correspondant à l'enregistrement et à sa transcription : </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg149" ; :index 12 ; :titre "Choisir entre deux mots (1)" ; @@ -3133,7 +3313,8 @@ <td valign="top"><br></td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg155" ; :index 7 ; :titre "Distinguer d'éventuelles variantes (4)" ; @@ -3158,7 +3339,8 @@ bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV48', 'bt_22.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg205" ; :index 6 ; :titre "Choisir une transcription (7)" ; @@ -3235,7 +3417,8 @@ <td valign="top">use</td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg2051" ; :index 20 ; :titre "Choisir une transcription (11)" ; @@ -3258,7 +3441,8 @@ bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV55', 'bt_16.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg217" ; :index 0 ; :titre "Choisir une transcription (1)" ; @@ -3297,7 +3481,8 @@ <td valign="top"></td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg226" ; :index 19 ; :titre "Spécificité des voyelles (5)" ; @@ -3338,7 +3523,8 @@ <td valign="top">You must be joking.</td> </tr> </table> - <p align="">Dans ces énoncés, l'auxiliaire MUST est-il prononcé de façon identique ?<br></p></div>""" ; + <p align="">Dans ces énoncés, l'auxiliaire MUST est-il prononcé de façon identique ?<br></p></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg381" ; :index 0 ; :titre "L'auxiliaire MUST (1)" ; @@ -3361,7 +3547,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><p align=""><br>Voici la transcription d'un mot : </p> <p align=""><img align="center" border="0" src="../media/phon_ear.png" id="MosImg29" style="visibility:hidden"><br><br>Ecoutez les deux mots enregistrés, en cliquant sur les boutons.<br>La transcription ci-dessus correspond-elle au premier mot entendu ou au second ?<br><br>Sélectionnez - l'enregistrement qui convient : </p></div>""" ; + l'enregistrement qui convient : </p></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg386" ; :index 8 ; :titre "Choisir une prononciation (2)" ; @@ -3403,7 +3590,8 @@ </tr> </table> <br><br>L'auxiliaire est-il prononcé de façon identique ? <br>Ecoutez de nouveau les énoncés et sélectionnez - l'un des deux choix :</div>""" ; + l'un des deux choix :</div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg401" ; :index 15 ; :titre "L'auxiliaire BE (2)" ; @@ -3426,7 +3614,8 @@ le bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV60', 'bt_19.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg491" ; :index 3 ; :titre "Choisir une transcription (4)" ; @@ -3467,7 +3656,8 @@ </tr> </table> <br><br><br>L'auxiliaire CAN est-il prononcé de façon identique ? <br>Ecoutez de nouveau les énoncés et - sélectionnez l'un des deux choix :</div>""" ; + sélectionnez l'un des deux choix :</div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg531" ; :index 11 ; :titre "L'auxiliaire CAN (2)" ; @@ -3535,7 +3725,8 @@ cliquant sur le bouton puis validez le mot correspondant à l'enregistrement et à sa transcription : </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg561" ; :index 16 ; :titre "Choisir entre deux mots (5)" ; @@ -3559,7 +3750,8 @@ les deux mots enregistrés, en cliquant sur les boutons.<br>La transcription ci-dessus correspond-elle au premier mot entendu ou au second ?<br><br>Sélectionnez l'enregistrement qui convient : - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg576" ; :index 7 ; :titre "Choisir une prononciation (1)" ; @@ -3627,7 +3819,8 @@ l'enregistrement en cliquant sur le bouton puis validez le mot correspondant à l'enregistrement et à sa transcription : </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg6361" ; :index 14 ; :titre "Choisir entre deux mots (3)" ; @@ -3695,7 +3888,8 @@ l'enregistrement en cliquant sur le bouton puis validez le mot correspondant à l'enregistrement et à sa transcription : </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg699" ; :index 15 ; :titre "Choisir entre deux mots (4)" ; @@ -3732,7 +3926,8 @@ <td valign="top">group<br></td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg713" ; :index 20 ; :titre "Spécificité des voyelles (6)" ; @@ -3800,7 +3995,8 @@ cliquant sur le bouton puis validez le mot correspondant à l'enregistrement et à sa transcription : </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg758" ; :index 13 ; :titre "Choisir entre deux mots (2)" ; @@ -3823,7 +4019,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><p align=""><br>Voici la transcription d'un mot : </p> <p align=""><img align="center" border="0" src="../media/phon_cat.png" id="MosImg7" style="visibility:hidden"><br><br>Ecoutez les deux mots enregistrés, en cliquant sur les boutons.<br>La transcription ci-dessus correspond-elle au premier mot entendu ou au second ?<br><br>Sélectionnez - l'enregistrement qui convient : </p></div>""" ; + l'enregistrement qui convient : </p></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg76" ; :index 10 ; :titre "Choisir une prononciation (4)" ; @@ -3878,7 +4075,8 @@ </td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg769" ; :index 5 ; :titre "Distinguer d'éventuelles variantes (3)" ; @@ -3901,7 +4099,8 @@ le bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV65', 'bt_181.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg7691" ; :index 2 ; :titre "Choisir une transcription (3)" ; @@ -3959,7 +4158,8 @@ <td valign="top"><br></td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg813" ; :index 9 ; :titre "Distinguer d'éventuelles variantes (5)" ; @@ -4011,7 +4211,8 @@ </td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg825" ; :index 1 ; :titre "Distinguer d'éventuelles variantes (1)" ; @@ -4053,7 +4254,8 @@ </tr> </table> <br><br>Dans la réponse de chaque dialogue, l'auxiliaire WILL est-il prononcé de façon identique ? Ecoutez de - nouveau les réponses et sélectionnez l'un des deux choix :</div>""" ; + nouveau les réponses et sélectionnez l'un des deux choix :</div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg8251" ; :index 3 ; :titre "L'auxiliaire WILL (2)" ; @@ -4094,7 +4296,8 @@ </tr> </table> <br><br>L'auxiliaire HAVE est-il prononcé de façon identique ? <br>Ecoutez de nouveau les énoncés et - sélectionnez l'un des deux choix :</div>""" ; + sélectionnez l'un des deux choix :</div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg879" ; :index 7 ; :titre "L'auxiliaire HAVE (2)" ; @@ -4151,7 +4354,8 @@ </td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg890" ; :index 3 ; :titre "Distinguer d'éventuelles variantes (2)" ; @@ -4174,7 +4378,8 @@ bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV11', 'bt_21.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg893" ; :index 5 ; :titre "Choisir une transcription (6)" ; @@ -4248,7 +4453,8 @@ <td valign="top">tear</td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg894" ; :index 17 ; :titre "Choisir une transcription (8)" ; @@ -4326,7 +4532,8 @@ <td valign="top">wound</td> </tr> </table> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg93" ; :index 19 ; :titre "Choisir une transcription (10)" ; @@ -4349,7 +4556,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><p align=""><br>Voici la transcription d'un mot : </p> <p align=""><img align="center" border="0" src="../media/phon_green.png" id="MosImg88" style="visibility:hidden"><br><br>Ecoutez les deux mots enregistrés, en cliquant sur les boutons.<br>La transcription ci-dessus correspond-elle au premier mot entendu ou au second ?<br><br>Sélectionnez - l'enregistrement qui convient : </p></div>""" ; + l'enregistrement qui convient : </p></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg933" ; :index 11 ; :titre "Choisir une prononciation (5)" ; @@ -4372,7 +4580,8 @@ bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV91', 'bt_17.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg965" ; :index 1 ; :titre "Choisir une transcription (2)" ; @@ -4394,7 +4603,8 @@ le bouton puis sélectionnez la <a class="STY_lienComt" href="javascript:parent.SCO_ouvrirDoc('phonemes_liste','htm')">transcription</a> qui correspond à ce que vous entendez : <br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV15', 'bt_20.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg98" ; :index 4 ; :titre "Choisir une transcription (5)" ; @@ -4429,7 +4639,8 @@ à l'aide de la souris, sélectionnez l'affirmation qui vous semble juste.<br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV34', 'bt_9.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> <b>boy</b> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg220" ; :index 16 ; :titre "Spécificité des voyelles (3)" ; @@ -4455,7 +4666,8 @@ <script type="text/javascript">ajDocW(PF_clipAV('clipAV77', 'bt_10.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> <b>fool</b> </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg41" ; :index 17 ; :titre "Spécificité des voyelles (4)" ; @@ -4478,7 +4690,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><br>Ecoutez le mot <i>leg</i> en cliquant sur le bouton, puis à l'aide de la souris, sélectionnez l'affirmation qui vous semble juste.<br><br> <script type="text/javascript">ajDocW(PF_clipAV('clipAV45', 'bt_leg.swf', '18', '18', 'false', 'Flash', 'false', '', 'Quality:high;wmode:transparent', ''));</script> - <b>leg</b></div>""" ; + <b>leg</b></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg639" ; :index 15 ; :titre "Spécificité des voyelles (2)" ; @@ -4518,7 +4731,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><br>Essayez de prononcer le mot transcrit et enregistrez-vous. Puis écoutez l'enregistrement-modèle en cliquant sur la transcription. Vous pouvez renouveler votre enregistrement si nécessaire. - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg313" ; :index 14 ; :titre "Lire des transcriptions phonétiques (2)" ; @@ -4557,7 +4771,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><br>Essayez de prononcer le mot transcrit et enregistrez-vous. Puis écoutez l'enregistrement-modèle en cliquant sur la transcription. Vous pouvez renouveler votre enregistrement si nécessaire. - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg400" ; :index 13 ; :titre "Lire des transcriptions phonétiques (1)" ; @@ -4600,7 +4815,8 @@ :description """<div id="STY_question" class="STY_question" style=" "><br>Essayez de prononcer le mot transcrit et enregistrez-vous. Puis écoutez l'enregistrement-modèle en cliquant sur la transcription. Vous pouvez renouveler votre enregistrement si nécessaire. - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg966" ; :index 15 ; :titre "Lire des transcriptions phonétiques (3)" ; @@ -4710,10 +4926,12 @@ the <i>desert</i>.</font></td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg112" ; :index 8 ; - :titre "Choisir l'accentuation adéquate (2)" ; + :titre "Choisir l'accentuation adéquate (2)", + "Choisir l'accentuation adéquate (2)" ; rdfs:subClassOf :MosEtp746 . :pg228 a :ExerciceQC_QCM, @@ -4755,10 +4973,12 @@ <i>intimate</i> friend ? </font></td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg228" ; :index 10 ; - :titre "Choisir l'accentuation adéquate (4)" ; + :titre "Choisir l'accentuation adéquate (4)", + "Choisir l'accentuation adéquate (4)" ; rdfs:subClassOf :MosEtp746 . :pg293 a :ExerciceQC_QCM, @@ -4807,10 +5027,12 @@ their music on a colour <i>record</i>. </font></td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg293" ; :index 11 ; - :titre "Choisir l'accentuation adéquate (5)" ; + :titre "Choisir l'accentuation adéquate (5)", + "Choisir l'accentuation adéquate (5)" ; rdfs:subClassOf :MosEtp746 . :pg6121 a :ExerciceQC_QCM, @@ -4861,7 +5083,8 @@ <script type="text/javascript">ajDocW(PF_clipAV('clipAV78', 'bouton_photographer.swf', '17', '17', 'false', 'Flash', 'false', 'middle', 'Quality:high;wmode:transparent', ''));</script> <b>photographer</b>." </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg6121" ; :index 3 ; :titre "Vérifier la place de l'accent primaire (4) " ; @@ -4916,7 +5139,8 @@ </td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg665" ; :index 7 ; :titre "Choisir l'accentuation adéquate (1)" ; @@ -4966,10 +5190,12 @@ <i>content</i> and joy</font></td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg71" ; :index 12 ; - :titre "Choisir l'accentuation adéquate (6)" ; + :titre "Choisir l'accentuation adéquate (6)", + "Choisir l'accentuation adéquate (6)" ; rdfs:subClassOf :MosEtp746 . :pg740 a :ExerciceQC_QCM, @@ -5021,10 +5247,12 @@ series of tests.</font></td> </tr> </table> - </font></div>""" ; + </font></div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg740" ; :index 9 ; - :titre "Choisir l'accentuation adéquate (3)" ; + :titre "Choisir l'accentuation adéquate (3)", + "Choisir l'accentuation adéquate (3)" ; rdfs:subClassOf :MosEtp746 . :MosEtp335 a :SousPartie, @@ -5121,7 +5349,8 @@ <script type="text/javascript">ajDocW(PF_clipAV('clipAV49', 'bouton_characters.swf', '17', '17', 'false', 'Flash', 'false', 'middle', 'Quality:high;wmode:transparent', ''));</script> <b>characters</b>." </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg6811" ; :index 1 ; :titre "Vérifier la place de l'accent primaire (2) " ; @@ -5184,7 +5413,8 @@ <script type="text/javascript">ajDocW(PF_clipAV('clipAV85', 'bouton_beginning.swf', '17', '17', 'false', 'Flash', 'false', 'middle', 'Quality:high;wmode:transparent', ''));</script> <b>beginning</b>"... </p> - </div>""" ; + </div><div id="divConsigne" onclick="SPE_clicDansBulle(event,'divConsigne')"></div> + """ ; :id "pg8412" ; :index 2 ; :titre "Vérifier la place de l'accent primaire (3) " ; diff --git a/tetras_extraction/macao_12/script/extract_page.py b/tetras_extraction/macao_12/script/extract_page.py index f79fe463f568ee979680eac622e66011ceb02fe7..6d525f33010dc496cfa0b17684271b0d9503ce0a 100644 --- a/tetras_extraction/macao_12/script/extract_page.py +++ b/tetras_extraction/macao_12/script/extract_page.py @@ -8,43 +8,98 @@ from typing import Any, List, Optional import esprima as es from lxml import etree, html from lxml.etree import _Element -from rdflib import RDF, BNode, Graph, Literal +from lxml.html import HtmlElement +from rdflib import RDF, Graph, Literal from common import * class Comment: - id: str - num: int - text: str - html: Any - elem: _Element + def __init__(self): + self.id: str + self.num: int + self.text: str + self.html: Any + self.elem: _Element def __repr__(self): return str(self.__dict__) class Activity: - id: str = "" - """The ID of the page this activity is in (`pg###`)""" - title: str = "" - """Human-readable title of the activity""" - description: Optional[str] = None - """Description of the activity's body (HTML), - e.g. the instructions for an exercise activity""" - comment_success: Optional[Comment] = None - """Comment displayed on success, if applicable""" - comments_sugg: List[Comment] = [] - """Help comments displayed on failure, if applicable""" - comments_misc: List[Comment] = [] - """Any other comments, if present""" + def __init__(self): + self.id: str = "" + """The ID of the page this activity is in (`pg###`)""" + self.title: str = "" + """Human-readable title of the activity""" + self.description: Optional[str] = None + """Description of the activity's body (HTML), + e.g. the instructions for an exercise activity""" + self.comment_consigne: Optional[Comment] = None + """Another form of activity description but in a comment. May or may not + coexist with a regular description""" + self.comment_success: Optional[Comment] = None + """Comment displayed on success, if applicable""" + self.comments_sugg: List[Comment] = [] + """Help comments displayed on failure, if applicable""" + self.comments_misc: List[Comment] = [] + """Any other comments, if present""" def save(self, graph: Graph): - """Save activity data to the graph. Subclasses extend this method + """Save activity data to the graph. Subclasses may override this method to save their specific data.""" - graph.add((NS[self.id], RDF.type, NS[self.get_name()])) - if self.description is not None: - graph.add((NS[self.id], NS["description"], Literal(self.description))) + self.ref = NS[self.id] + # => Type + graph.add((self.ref, RDF.type, NS[self.get_name()])) + # => Title + graph.add((self.ref, NS["titre"], Literal(self.title))) + # => Description + description = self.description or "" + if self.comment_consigne is not None: + description += self.comment_consigne.html + if description != "": + graph.add((self.ref, NS["description"], Literal(description))) + # => Comments + if self.comment_success is not None: + graph.add( + (self.ref, NS["commentaireSucces"], Literal(self.comment_success.html)) + ) + for comment in self.comments_sugg: + graph.add((self.ref, NS["commentaireSugg"], Literal(comment.html))) + for comment in self.comments_misc: + graph.add((self.ref, NS["commentaireInfo"], Literal(comment.html))) + + def parse_html(self, tree): + """From a `lxml.html` parsing tree, extract all data relevant to this class. + Subclasses may override this method to extract more specific data. + """ + root = tree.getroot() + # => Title + self.title = root.xpath("/html/head/title")[0].text + # => Comments + zi = root.get_element_by_id("zoneInvisible") + for cmt_div in zi: + comment = Comment() + comment.text = cmt_div.text_content() + comment.html = to_html(cmt_div) + comment.elem = cmt_div + comment.id = cmt_div.get("id") or "" + # Split id in two parts (non-digits and digits), then match on these parts + m = regex_comment.match(comment.id) + if m is not None: + match m.groups(): + case ["divCmt", num]: + comment.num = int(num) + self.comments_misc.append(comment) + case ["divSugg", num]: + comment.num = int(num) + self.comments_sugg.append(comment) + case ["divCmtSucces", _]: + self.comment_success = comment + case ["divConsigne", _]: + self.comment_consigne = comment + case [alpha, num]: + eprint(f"No match for comment {alpha}[{num}] ('{comment.id}')") def get_name(self) -> str: return type(self).__name__ @@ -78,24 +133,23 @@ class Cours(Activity): class Choice: """A possible answer for a question, correct or not""" - index: int = 0 - is_correct: bool = False - html: str = "" + def __init__(self, index=0): + self.index: int = index + self.is_correct: bool = False + self.html: str = "" class ChoiceGroup: - label: str - items: List[Choice] + def __init__(self): + self.label: str + self.items: List[Choice] class ExerciceQC(Activity): - is_qcm: bool - choices: List[Choice] - def __init__(self, is_qcm=False) -> None: super().__init__() - self.is_qcm = is_qcm - self.choices = [] + self.is_qcm: bool = is_qcm + self.choices: List[Choice] = [] def get_name(self) -> str: return "ExerciceQC_QCM" if self.is_qcm else "ExerciceQC_QCU" @@ -137,17 +191,23 @@ class ExerciceQC(Activity): class ExerciceQM(Activity): - questions: List[ChoiceGroup] + def __init__(self): + super().__init__() + self.questions: List[ChoiceGroup] class ExerciceTAT(Activity): - text: str # can be HTML - gaps: List[ChoiceGroup] + def __init__(self): + super().__init__() + self.text: str # can be HTML + self.gaps: List[ChoiceGroup] class ExerciceGD(Activity): - targets: List[str] - draggables: List[List[Choice]] + def __init__(self): + super().__init__() + self.targets: List[str] + self.draggables: List[List[Choice]] class JSParser: @@ -337,11 +397,10 @@ class MatchParser(JSParser): """A parser for the JS portion of an activity, that uses Python match statements to navigate the abstract syntax tree (AST) produced by Esprima""" - activity: Optional[Activity] = None - def __init__(self, graph: Graph, act_id: str) -> None: self.graph = graph self.act_id = act_id + self.activity: Optional[Activity] = None def parse(self, js, output=sys.stdout) -> Activity: self.output = output @@ -436,7 +495,7 @@ def parse_page(graph: Graph, filepath: str, id: str): root = tree.getroot() # Collect all inline scripts (no external 'src') and join them in a # block of JS code - scripts: List[html.HtmlElement] = root.xpath( + scripts: List[HtmlElement] = root.xpath( '/html/head/script[@type="text/javascript" and not(@src)]' ) js = "\n".join((s.text_content() for s in scripts)) @@ -467,32 +526,7 @@ def parse_page(graph: Graph, filepath: str, id: str): # Parse generic activity attributes activity.id = id - activity.title = root.xpath("/html/head/title")[0].text - # Parse comments - zi = root.get_element_by_id("zoneInvisible") - for cmt_div in zi: - comment = Comment() - comment.text = cmt_div.text_content() - comment.html = to_html(cmt_div) - comment.elem = cmt_div - comment.id = cmt_div.get("id") or "" - # Split id in two parts (non-digits and digits), then match on these parts - m = regex_comment.match(comment.id) - if m is not None: - match m.groups(): - case ["divCmt", num]: - comment.num = int(num) - activity.comments_misc.append(comment) - graph.add((NS[id], NS["commentaireInfo"], Literal(comment.html))) - case ["divSugg", num]: - comment.num = int(num) - activity.comments_sugg.append(comment) - graph.add((NS[id], NS["commentaireSugg"], Literal(comment.html))) - case ["divCmtSucces", _]: - activity.comment_success = comment - graph.add((NS[id], NS["commentaireSucces"], Literal(comment.html))) - case [other, _]: - pass + activity.parse_html(tree) # Save everything to the graph activity.save(graph) # pprint(activity)