with open('/tmp/testhapxuce.html','w') as f :
f.write(txt)
+ def export_dictionary(self, fileout, syscoding) :
+ listformes = [[self.formes[forme].freq, forme, self.formes[forme].lem, self.formes[forme].gram] for forme in self.formes]
+ listformes.sort(reverse = True)
+ listformes = [forme[1:] + [`forme[0]`] for forme in listformes]
+ with open(fileout, 'w') as f :
+ f.write('\n'.join(['\t'.join(forme) for forme in listformes]).encode(syscoding))
+
+ def export_lems(self, fileout, syscoding) :
+ self.make_idformes()
+ listlem = [[lem, '\t'.join(['\t'.join([self.idformes[forme].forme, `self.lems[lem].formes[forme]`]) for forme in self.lems[lem].formes])] for lem in self.lems]
+ listlem.sort()
+ with open(fileout, 'w') as f :
+ f.write('\n'.join(['\t'.join(lem) for lem in listlem]).encode(syscoding))
+
+
+
class MakeUciStat :
def __init__(self, corpus) :
self.coding = coding
self.itempath = itempath
self.parent = self.GetParent()#parent
- self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "courier"))
+ self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Arial"))
self.labels = []
self.listimg = []
self.buts = []
self.Dict = dico
self.txt = txt
self.parent = parent
- self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.FONTWEIGHT_BOLD, 0, "courier"))
+ self.SetFont(wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "Arial"))
self.labels = []
self.listimg = []
self.dirout = os.path.dirname(self.Dict['ira'])
self.read_result()
self.TabStat = aui.AuiNotebook(ira.nb, -1, wx.DefaultPosition)
self.TabStat.parametres = parametres
+ self.TabStat.corpus = corpus
+ self.TabStat.pathout = self.pathout
# CHD = GraphPanel(panel.TabChdSim, DictPathOut, list_graph, txt = self.debtext)
# panel.TabChdSim.AddPage(CHD,'CHD')
#self.TabStatTot = wx.TextCtrl(self.TabStat, -1, style=wx.NO_BORDER | wx.TE_MULTILINE | wx.TE_RICH2)
list_graph = [['zipf.png', 'zipf']]
self.TabStatTot = GraphPanel(ira.nb, self.pathout, list_graph, self.result['glob'])
- #self.TabStatTot.write(self.result['glob'])
self.TabStat.AddPage(self.TabStatTot, 'global')
for item in self.result:
if item != 'glob':
datam = [['forme', 'nb']]
self.ListPan = ListPanel(ira, self, self.result[item])
- self.TabStat.AddPage(self.ListPan, item)
- ira.nb.AddPage(self.TabStat, 'Stat')
+ self.TabStat.AddPage(self.ListPan, ' '.join(item.split('_')))
+ ira.nb.AddPage(self.TabStat, '%s' % parametres['name'])
ira.nb.SetSelection(ira.nb.GetPageCount() - 1)
ira.ShowAPane("Tab_content")
self.Tab.AddPage(self.TabStatTot, 'Nuage')
self.Tab.corpus = self.corpus
self.Tab.parametres = self.parametres
- self.ira.nb.AddPage(self.Tab, 'WordCloud %s' % self.parametres.get('corpus_name','corpus_name'))
+ self.ira.nb.AddPage(self.Tab, '%s' % self.parametres['name'])
self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1)
self.ira.ShowAPane("Tab_content")
while os.path.exists(outgraph + str(nb) + '.png') :
nb += 1
self.parametres['graphout'] = outgraph + str(nb) + '.png'
+ dial.Destroy()
def make_wordcloud(self) :
navig = menu.Append(wx.ID_ANY, u"Outil de navigation")
statclasse = menu.Append(wx.ID_ANY, u"Statistiques par classe")
rapport = menu.Append(wx.ID_ANY, u"Rapport")
-
menu.AppendSeparator()
-
self.Bind(wx.EVT_MENU, self.OpenAntipro, antipro)
self.Bind(wx.EVT_MENU, self.OnProfSR, profsr)
self.Bind(wx.EVT_MENU, self.OnProfGram, profgram)
self.Bind(wx.EVT_MENU, self.OnNavig, navig)
self.Bind(wx.EVT_MENU, self.StatClasse, statclasse)
self.Bind(wx.EVT_MENU, self.OnRapport, rapport)
-
+ elif pydata.get('type', False) == 'stat' and pydata['uuid'] in self.parent.history.opened :
+ export_dictionary = menu.Append(wx.ID_ANY, u"Exporter le dictionnaire")
+ export_lems = menu.Append(wx.ID_ANY, u"Exporter le dictionnaire des lems")
+ self.Bind(wx.EVT_MENU, self.OnExportDictionary, export_dictionary)
+ self.Bind(wx.EVT_MENU, self.OnExportLems, export_lems)
+ menu.AppendSeparator()
itemdelete = menu.Append(wx.ID_ANY, "Supprimer de l'historique")
if item == self.GetRootItem():
else :
dial.Destroy()
+ def OnExportDictionary(self, evt) :
+ corpus = self.page.corpus
+ corpus.export_dictionary(self.page.pathout['dictionary.csv'], self.parent.syscoding)
+ log.info('export dictionary %s' % self.page.pathout['dictionary.csv'])
+ dial = wx.MessageDialog(self.parent, self.page.pathout['dictionary.csv'], 'Export', wx.OK)
+ dial.ShowModal()
+ dial.Destroy()
+
+ def OnExportLems(self, evt) :
+ corpus = self.page.corpus
+ corpus.export_lems(self.page.pathout['lemmes.csv'], self.parent.syscoding)
+ log.info('export lemmes %s' % self.page.pathout['lemmes.csv'])
+ dial = wx.MessageDialog(self.parent, self.page.pathout['lemmes.csv'], 'Export', wx.OK)
+ dial.ShowModal()
+ dial.Destroy()
+
def OnItemBackground(self, event):
colourdata = wx.ColourData()
def OnItemDelete(self, event):
strs = "Are You Sure You Want To Delete Item " + self.GetItemText(self.current) + "?"
- dlg = wx.MessageDialog(None, strs, 'Deleting Item', wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
+ dlg = wx.MessageDialog(None, strs, 'Deleting Item', wx.YES | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
dlg.Destroy()