+ def OnMergeClusterGraph(self, evt) :
+ MergeClusterGraph(self.parent, self.page.corpus, self.page.parametres)
+ print 'merge done !'
+
+ def OnStCaract(self, evt) :
+ dial = PrefUCECarac(self, self.parent)
+ dial.CenterOnParent()
+ if self.page.parametres['classif_mode'] != 2 :
+ uci = False
+ else :
+ uci = True
+
+ if dial.ShowModal() == wx.ID_OK :
+ limite = dial.spin_eff.GetValue()
+ atype = dial.radio_type.GetSelection()
+ dial.Destroy()
+ corpus = self.page.corpus
+ dlg = progressbar(self.ira, maxi = len(corpus.lc))
+ dlg.Update(1, 'wait...')
+ for i in range(0, len(corpus.lc)) :
+ page = self.page.ProfNB.GetPage(i)
+ rcl = page.cl - 1
+ dlg.Update(i, u'Cluster %i' % (i+1))
+ uces = corpus.lc[rcl]
+ tab = corpus.make_table_with_classe(uces, page.la, uci = uci)
+ tab.pop(0)
+ if atype == 0 :
+ ntab = [round(sum([page.lchi[j] for j, word in enumerate(line) if word == 1]),2) for line in tab]
+ else :
+ ntab = [round(sum([page.lchi[j] for j, word in enumerate(line) if word == 1])/float(sum(line)),2) if sum(line)!=0 else 0 for line in tab]
+ ntab2 = [[ntab[j], uces[j]] for j, val in enumerate(ntab)]
+ del ntab
+ ntab2.sort(reverse = True)
+ ntab2 = ntab2[:limite]
+ nuces = [val[1] for val in ntab2]
+ ucis_txt, ucestxt = doconcorde(corpus, nuces, page.la, uci = uci)
+ items = ['<br>'.join([ucis_txt[j], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table><br>' % ntab2[j][0], ucestxt[j]]) for j, uce in enumerate(nuces)]
+ filename = self.page.pathout['st_caract_cl_%i.html' % (rcl+1)]
+ with open(filename, 'w') as f :
+ f.write('\n'.join(items))
+ dlg.Destroy()
+
+