- win = message(self, u"Concordancier", (750, 600))
- avap=60
- listmot = corpus.getlems()[item].formes
- uce_ok = corpus.getlemuces(item)
- txt = '<h1>Concordancier</h1>'
- res = corpus.getconcorde(uce_ok)
- for uce in res :
- ucetxt = ' '+uce[1]+' '
- txt += ' '.join(corpus.ucis[corpus.getucefromid(uce[0]).uci].etoiles) + '<br>'
- for forme in listmot :
- forme = corpus.getforme(forme).forme
- ucetxt = ucetxt.replace(' '+forme+' ', '<font color=red> ' + forme + ' </font>')
- txt += ucetxt + '<br><br>'
- win.HtmlPage.SetPage(txt)
+ parametres = page.parametres
+ paneff = self.gparent.ListPanEff
+ panchi = self.gparent.ListPan
+ et = self.etoiles[ind]
+ uces = corpus.getucesfrometoile(et)
+ self.la = [panchi.dlist[i][0] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
+ self.lchi = [panchi.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
+ if max(self.lchi) == float('inf') :
+ nchi = []
+ for val in self.lchi :
+ if val == float('inf') :
+ nchi.append(0)
+ else :
+ nchi.append(val)
+ nmax = max(nchi)
+ nchi = [val if val != float('inf') else nmax + 2 for val in self.lchi]
+ self.lchi = nchi
+ tab = corpus.make_pondtable_with_classe(uces, self.la)
+ tab.pop(0)
+ ntab = [round(sum([(self.lchi[i] * word) for i, word in enumerate(line) if word != 0]),2) for line in tab]
+ ntab2 = [[ntab[i], uces[i]] for i, val in enumerate(ntab) if ntab[i] != 0]
+ del ntab
+ ntab2.sort(reverse = True)
+ ntab2 = ntab2[:limite]
+ nuces = [val[1] for val in ntab2]
+ ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la)
+ items = dict([[i, '<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table><br>' % ntab2[i][0], ucestxt[i]])] for i in range(0,len(ucestxt))])
+ win = message(self, items, ' - '.join([_("Typical text segments"), "%s" % self.first[ind]]), (900, 600))
+ win.Show(True)
+
+ def OnPopupTwo(self, event):
+ if 'nb' in dir(self.parent) :
+ activenotebook = self.parent.nb.GetSelection()
+ page = self.parent.nb.GetPage(activenotebook)
+ corpus = page.corpus
+ else :
+ corpus = self.parent.parent.parent.corpus
+ ira = wx.GetApp().GetTopWindow()
+ item=self.getColumnText(self.GetFirstSelected(), 0)
+ if not self.tgen :
+ uce_ok = corpus.getlemuces(item)
+ wordlist = [item]
+ else :
+ uce_ok = corpus.gettgenst(self.tgens[item])
+ wordlist = [val for val in self.tgens[item] if val in corpus.lems]
+ ucis_txt, ucestxt = doconcorde(corpus, uce_ok, wordlist)
+ items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
+ win = message(ira, items, ' - '.join([_("Concordance"), "%s" % item]), (800, 500), uceids = uce_ok)