X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=ProfList.py;h=b64d633e6916079a3bfac3fc92aad90f91500b70;hp=d6050c62caf0e14a15d10de492439048d1143a55;hb=441459f18ef9957b592f26743eea037bca431e55;hpb=437f0dd98164afb134c221fe4c4378ec7e3b64e5 diff --git a/ProfList.py b/ProfList.py index d6050c6..b64d633 100644 --- a/ProfList.py +++ b/ProfList.py @@ -27,7 +27,7 @@ import webbrowser #import cStringIO import tempfile import codecs -from functions import exec_rcode, MessageImage, progressbar, treat_var_mod +from functions import exec_rcode, MessageImage, progressbar, treat_var_mod, doconcorde from PrintRScript import barplot from textclassechd import ClasseCHD from shutil import copyfile @@ -358,7 +358,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col parametres['clusterprof'] = prof parametres['type'] = 'clustercloud' parametres['prof'] = self.Source.pathout['actprof_classe_%i.csv' % self.cl] - print parametres['prof'] + del parametres['uuid'] #if not os.path.exists(self.Source.pathout['actprof_classe_%i.csv' % self.lc]) : # with open(self.Source.pathout['actprof_classe_%i.csv' % self.lc], 'w') as f : # f.write('\n'.join(prof).encode(self.parent.syscoding)) @@ -431,6 +431,10 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def quest_simi(self, evt) : tableau = self.Source.tableau + if self.tmpchi is None : + self.tmpchi = tempfile.mktemp(dir=self.Source.parent.TEMPDIR) + with open(self.tmpchi, 'w') as f: + f.write('\n'.join([str(val) for val in self.lchi])) tab = tableau.make_table_from_classe(self.cl, self.la) pathout = ConstructPathOut(self.Source.pathout.dirout, 'simi_classe_%i' %self.cl) self.filename = os.path.join(pathout,'mat01.csv') @@ -468,7 +472,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col 'film': False, 'com' : 0, 'communities' : 0, - 'halo' : 0 + 'halo' : 0, + 'tmpchi': self.tmpchi } act = {} tableau.chi = {} @@ -553,24 +558,10 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col ntab2 = ntab2[:limite] nuces = [val[1] for val in ntab2] dlg.Update(3, u'concordancier...') - #ucestxt = [corpus.ucis_paras_uces[val[1][0]][val[1][1]][val[1][2]] for val in ntab2] - ucestxt1 = [row for row in corpus.getconcorde(nuces)] - ucestxt = [] - ucis_txt = [] - for uce in ucestxt1 : - ucetxt = ' '+uce[1]+' ' - ucis_txt.append(' '.join(corpus.ucis[corpus.getucefromid(uce[0]).uci].etoiles) + '
') - for lem in self.la : - listmot = corpus.getlems()[lem].formes - for id in listmot : - forme = corpus.getforme(id).forme - ucetxt = ucetxt.replace(' '+forme+' ', ' ' + forme + ' ') - ucestxt.append(ucetxt) - #ucestxt = [corpus.make_concord(self.la, ' '.join(uce), 'red') for uce in ucestxt] + ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la) dlg.Update(4, u'texte...') - #ucis_txt = [' '.join(corpus.ucis[val[1][0]][0]) for val in ntab2] win = message(self, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600)) - win.html = '\n' + '

'.join(['
'.join([ucis_txt[i], 'score : ' + str(ntab2[i][0]), ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + win.html = '\n' + '
'.join(['
'.join([ucis_txt[i], '
score : %.2f
' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' win.HtmlPage.SetPage(win.html) dlg.Destroy() win.Show(True) @@ -667,26 +658,13 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col while self.GetNextSelected(last) != -1: last = self.GetNextSelected(last) ListWord.append(self.getColumnText(last, 6)) - listmot = [forme for item in ListWord for forme in corpus.getlems()[item].formes] - win = message(self, title, size=(750, 600)) - toshow = ['\n

Concordancier

\n'] - toshow.append('

' % color + ' '.join(ListWord) + '


') - duce = {} ucef = [] for word in ListWord : ucef += list(set(corpus.getlemuces(word)).intersection(uces)) - ucef = list(set(ucef)) - ucef.sort() - res = corpus.getconcorde(ucef) - txt = '
'.join(toshow) +'

' - for uce in res : - ucetxt = ' '+uce[1]+' ' - txt += ' '.join(corpus.ucis[corpus.getucefromid(uce[0]).uci].etoiles) + '
' - for forme in listmot: - forme = corpus.getforme(forme).forme - ucetxt = ucetxt.replace(' '+forme+' ', ' ' + forme + ' ') - txt += ucetxt + '

' - win.HtmlPage.SetPage(txt) + ucis_txt, ucestxt = doconcorde(corpus, ucef, ListWord) + win = message(self, title, size=(750, 600)) + win.html = ('\n

%s

' % ' '.join(ListWord)) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' + win.HtmlPage.SetPage(win.html) return win def OnPopupTwo(self, event):