From 9b78e6210e7fc88a7e77d178c4090aabb23580d9 Mon Sep 17 00:00:00 2001 From: Pierre Ratinaud Date: Mon, 1 Dec 2014 11:07:07 +0100 Subject: [PATCH] translation --- Liste.py | 12 +++++------ ProfList.py | 72 ++++++++++++++++++++++++++++++------------------------------- layout.py | 33 +++++++++++++++++----------- listlex.py | 16 +++++++------- textstat.py | 27 +++++++---------------- 5 files changed, 78 insertions(+), 82 deletions(-) diff --git a/Liste.py b/Liste.py index 1bd0f0a..daf58f5 100644 --- a/Liste.py +++ b/Liste.py @@ -53,9 +53,9 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte self.attr2.SetBackgroundColour("light blue") - self.InsertColumn(0, 'forme', wx.LIST_FORMAT_RIGHT) - self.InsertColumn(1, 'nb', wx.LIST_FORMAT_RIGHT) - self.InsertColumn(2, 'type', wx.LIST_FORMAT_RIGHT) + self.InsertColumn(0, _(u'Form').decode('utf8'), wx.LIST_FORMAT_RIGHT) + self.InsertColumn(1, _(u'Freq.').decode('utf8'), wx.LIST_FORMAT_RIGHT) + self.InsertColumn(2, _(u'POS').decode('utf8'), wx.LIST_FORMAT_RIGHT) #self.InsertColumn(3, '', wx.LIST_FORMAT_RIGHT) self.SetColumnWidth(0, 150) @@ -160,8 +160,8 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte # make a menu menu = wx.Menu() # add some items - menu.Append(self.popupID1, u"Formes associées") - menu.Append(self.popupID2, u"Concordancier") + menu.Append(self.popupID1, _(u"Associated forms").decode('utf8')) + menu.Append(self.popupID2, _(u"Concordance").decode('utf8')) # menu.Append(self.popupID3, "recharger") self.PopupMenu(menu) @@ -188,7 +188,7 @@ class ListPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorte uce_ok = corpus.getlemuces(item) ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item]) items = dict([[i, '

'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))]) - win = message(self, items, u"Concordancier - %s" % item, (800, 500), uceids = uce_ok) + win = message(self, items, ' - '.join([_(u"Concordance").decode('utf8'), "%s" % item]), (800, 500), uceids = uce_ok) #win = message(self, u"Concordancier", (750, 600)) #win.html = ('\n

%s

' % item) + '
'.join(['
'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n' #win.HtmlPage.SetPage(win.html) diff --git a/ProfList.py b/ProfList.py index a127a04..a85c23a 100644 --- a/ProfList.py +++ b/ProfList.py @@ -246,7 +246,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def onsearchall(self, evt) : if 'FrameSearch' not in dir(self.Source) : - self.Source.FrameSearch = SearchFrame(self.parent, -1, u"Rechercher...", self.Source.corpus) + self.Source.FrameSearch = SearchFrame(self.parent, -1, _(u"Search...").decode('utf8'), self.Source.corpus) self.dial = SearchDial(self, self.Source.FrameSearch.liste, 1, False) self.dial.CenterOnParent() self.dial.Show() @@ -310,37 +310,37 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col # make a menu menu = wx.Menu() - menu.Append(self.popupID1, u"Formes associées") - menu.Append(self.idtablex, u"Chi2 par classe") - menu.Append(self.idlexdendro, u"Chi2 par classe + dendro") - menu.Append(self.idchimod, u"Chi2 modalités de la variable") - menu.Append(self.idwordgraph, u"Graphe du mot") + menu.Append(self.popupID1, _(u"Associated forms").decode('utf8')) + menu.Append(self.idtablex, _(u"Chi2 by cluster").decode('utf8')) + menu.Append(self.idlexdendro, _(u"Chi2 by cluster on dendrogram").decode('utf8')) + menu.Append(self.idchimod, _(u"Chi2 modalities of variable").decode('utf8')) + menu.Append(self.idwordgraph, _(u"Word graph").decode('utf8')) #menu.Append(self.export_classes, u"Exporter le corpus...") #menu.Append(self.popupID10, u"Spécificités") menu_conc = wx.Menu() - menu_conc.Append(self.popupID2, u"dans les segments de texte de la classe") - menu_conc.Append(self.popupID3, u"dans les segments de texte classés") - menu_conc.Append(self.popupID4, u"dans tous les segments de texte") - menu.AppendMenu(-1, u"Concordancier", menu_conc) + menu_conc.Append(self.popupID2, _(u"In segments of this cluster").decode('utf8')) + menu_conc.Append(self.popupID3, _(u"In segments of this clustering").decode('utf8')) + menu_conc.Append(self.popupID4, _(u"In all segments").decode('utf8')) + menu.AppendMenu(-1, _(u"Concordance").decode('utf8'), menu_conc) menu.Append(self.onmaketgen, _(u"Make Tgen").decode('utf8')) menu_cnrtl = wx.Menu() - menu_cnrtl.Append(self.popupID5, u"Définition") - menu_cnrtl.Append(self.popupID6, u"Etymologie") - menu_cnrtl.Append(self.popupID7, u"Synonymie") - menu_cnrtl.Append(self.popupID8, u"Antonymie") - menu_cnrtl.Append(self.popupID9, u"Morphologie") - menu_cnrtl.Append(self.popup_proxe, u"Proxémie") - menu.AppendMenu(-1, u"Outils du CNRTL", menu_cnrtl) + menu_cnrtl.Append(self.popupID5, _(u"Definition").decode('utf8')) + menu_cnrtl.Append(self.popupID6, _(u"Etymology").decode('utf8')) + menu_cnrtl.Append(self.popupID7, _(u"Synonymous").decode('utf8')) + menu_cnrtl.Append(self.popupID8, _(u"Antonym").decode('utf8')) + menu_cnrtl.Append(self.popupID9, _(u"Morphology").decode('utf8')) + menu_cnrtl.Append(self.popup_proxe, _(u"Proxemy").decode('utf8')) + menu.AppendMenu(-1, _(u"Tools from CNRTL (french only)").decode('utf8'), menu_cnrtl) menu.AppendSeparator() - menu.Append(self.popupIDgraph, u"Graphe de la classe") - menu.Append(self.idseg, u"Segments répétés") - menu.Append(self.iducecarac, u"Segments de texte caractéristiques") - menu.Append(self.idcloud, u"Nuage de la classe") - menu.Append(self.idexport, u'Exporter...') - menu.Append(self.idexporttropes, 'Exporter pour Tropes') - menu.Append(self.idexportowledge, 'Exporter pour Owledge') + menu.Append(self.popupIDgraph, _(u"Graph of cluster").decode('utf8')) + menu.Append(self.idseg, _(u"Repeated segments").decode('utf8')) + menu.Append(self.iducecarac, _(u"Typical text segments").decode('utf8')) + menu.Append(self.idcloud, _(u"Word cloud of cluster").decode('utf8')) + menu.Append(self.idexport, _(u'Export...').decode('utf8')) + menu.Append(self.idexporttropes, _(u'Export for Tropes').decode('utf8')) + menu.Append(self.idexportowledge, _('Exporter for Owledge').decode('utf8')) #menu.Append(self.popupID2, u"Concordancier") # menu.Append(self.popupID3, "recharger") @@ -356,10 +356,10 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col self.Bind(wx.EVT_MENU, self.quest_var_mod, id=self.pop3) menu = wx.Menu() - menu.Append(self.pop2, u"Chi2 par classe") - menu.Append(self.pop3, u"Chi2 modalités de la variable") + menu.Append(self.pop2, _(u"Chi2 by cluster").decode('utf8')) + menu.Append(self.pop3, _(u"Chi2 modalities of variable").decode('utf8')) menu.AppendSeparator() - menu.Append(self.pop1, u"Graphe de la classe") + menu.Append(self.pop1, _(u"Graph of cluster").decode('utf8')) self.PopupMenu(menu) menu.Destroy() @@ -425,7 +425,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col def quest_var_mod(self, evt) : word = self.getselectedwords()[0] if len(word.split('_')) <= 1 : - dial = wx.MessageDialog(self, u"Ce n'est pas une forme du type variable_modalité", u"Problème", wx.OK | wx.ICON_WARNING) + dial = wx.MessageDialog(self, _(u"This is not a variable_modality form").decode('utf8'), _(u"Problem").decode('utf8'), wx.OK | wx.ICON_WARNING) dial.CenterOnParent() dial.ShowModal() dial.Destroy() @@ -459,7 +459,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col try : words = [word for word in var_mod[var[0]]] except KeyError: - dial = wx.MessageDialog(self, _(u"This is not a meta-data"), u"Problème", wx.OK | wx.ICON_WARNING) + dial = wx.MessageDialog(self, _(u"This is not a meta-data"), _(u"Problem").decode('utf8'), wx.OK | wx.ICON_WARNING) dial.CenterOnParent() dial.ShowModal() dial.Destroy() @@ -587,7 +587,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col first = ['','',''] para={'dico': d,'fline':first} dlg.Destroy() - win = wliste(self, -1, u"Segments répétés - Classe %i" % self.cl, d, first, size=(600, 500)) + win = wliste(self, -1, ' - '.join([_(u"Repeated segments").decode('utf8'), "Classe %i" % self.cl]), d, first, size=(600, 500)) win.Show(True) def on_uce_carac(self,evt) : @@ -619,7 +619,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci) items = dict([[i, '
'.join([ucis_txt[i], '
score : %.2f

' % ntab2[i][0], ucestxt[i]])] for i, uce in enumerate(nuces)]) dlg.Destroy() - win = message(self, items, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 600), uceids = nuces) + win = message(self, items, ' - '.join([_(u"Typical text segments").decode('utf8'), "Classe %i" % self.cl]), (750, 600), uceids = nuces) #win.SetWindowStyle(wx.STAY_ON_TOP) #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) @@ -685,19 +685,19 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col if 'corpus' in dir(self.Source) : corpus = self.Source.corpus uces = corpus.lc[self.cl-1] - win = self.make_concord(uces, "Concordancier - Classe %i" % self.cl) + win = self.make_concord(uces, ' - '.join([_(u"Concordance").decode('utf8'), "Classe %i" % self.cl])) win.Show(True) def OnPopupThree(self, event): corpus = self.Source.corpus uces = [classe[i] for classe in corpus.lc for i in range(0,len(classe))] - win = self.make_concord(uces, "Concordancier - Segments de texte classés") + win = self.make_concord(uces, ' - '.join([_(u"Concordance").decode('utf8'), _(u"Segments of this clustering").decode('utf8')])) win.Show(True) def OnPopupFour(self, event): corpus = self.Source.corpus uces = [classe[i] for classe in corpus.lc for i in range(0,len(classe))] + corpus.lc0 - win = self.make_concord(uces, "Concordancier - Tous les segments de texte") + win = self.make_concord(uces, ' - '.join([_(u"Concordance").decode('utf8'), _(u"All segments").decode('utf8')])) win.Show(True) def OnPopupFive(self, event): @@ -751,7 +751,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col rep.sort(key = itemgetter(1), reverse = True) #win = message(self, u"Formes associées", wx.Size(300, 200)) items = dict([[i, '\t:\t'.join([str(val) for val in forme])] for i, forme in enumerate(rep)]) - win = message(self, items, u"Formes associées", (300, 200)) + win = message(self, items, _(u"Associated Forms").decode('utf8'), (300, 200)) #win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' #win.HtmlPage.SetPage(win.html) win.Show(True) @@ -764,7 +764,7 @@ class wliste(wx.Frame): def __init__(self, parent, id, title, d, fline, size=(600, 500)): wx.Frame.__init__(self, parent, id) self.liste = ListForSpec(self, parent, d, fline[1:], menu = False) - self.button_1 = wx.Button(self, -1, "Fermer") + self.button_1 = wx.Button(self, -1, _(u"Close").decode('utf8')) self.Bind(wx.EVT_BUTTON, self.OnCloseMe, self.button_1) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) self.__do_layout() diff --git a/layout.py b/layout.py index e84ac8f..f22ef5f 100644 --- a/layout.py +++ b/layout.py @@ -726,7 +726,7 @@ class dolexlayout : self.TabStat.AddPage(self.ListPan, _(u'Forms').decode('utf8')) if os.path.exists(self.pathout['banalites.csv']) : self.TabStat.AddPage(self.listban, _(u'Banal forms').decode('utf8')) - self.TabStat.AddPage(self.ListPant, _(u'POS').deode('utf8')) + self.TabStat.AddPage(self.ListPant, _(u'POS').decode('utf8')) self.TabStat.AddPage(self.ListPanEff, _(u'Forms frequencies').decode('utf8')) self.TabStat.AddPage(self.ListPanEffType, _(u'POS frequencies').decode('utf8')) self.TabStat.AddPage(self.ListPanEffRelForme, _(u'Forms relative frequencies').decode('utf8')) @@ -741,7 +741,7 @@ class dolexlayout : self.TabAFC.AddPage(self.tabAFCTGraph, _(u'CA POS').decode('utf8')) self.TabStat.AddPage(self.TabAFC, _(u'CA').decode('utf8')) - ira.nb.AddPage(self.TabStat, u'Spécificités') + ira.nb.AddPage(self.TabStat, ' - '.join([_(u'Specificities').decode('utf8'), self.parametres['name']])) self.ira = ira self.TabStat.corpus = self.corpus @@ -769,12 +769,19 @@ class StatLayout: #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.TabStat.AddPage(self.TabStatTot, 'global') + self.TabStat.AddPage(self.TabStatTot, _(u'Abstract').decode('utf8')) + + dictlabel = {'total' : _(u'Total').decode('utf8'), + u'formes_actives' : _(u'Actives forms').decode('utf8'), + u'formes_supplémentaires': _(u'Supplementary forms').decode('utf8'), + u'hapax' : _(u'Hapax').decode('utf8'), + } + for item in self.result: if item != 'glob': datam = [['forme', 'nb']] self.ListPan = ListPanel(ira, self, self.result[item]) - self.TabStat.AddPage(self.ListPan, ' '.join(item.split('_'))) + self.TabStat.AddPage(self.ListPan, dictlabel[item]) ira.nb.AddPage(self.TabStat, '%s' % parametres['name']) ira.nb.SetSelection(ira.nb.GetPageCount() - 1) ira.ShowAPane("Tab_content") @@ -1019,7 +1026,7 @@ class CopusPanel(wx.Panel) : self.m_staticText21.Wrap( -1 ) fgSizer5.Add( self.m_staticText21, 0, wx.ALL, 5 ) - description = {'lang' : _(u'Langage').decode('utf8'), + description = {'lang' : _(u'Language').decode('utf8'), 'encoding' : _(u'Characters set').decode('utf8'), 'ucinb' : _(u'Number of texts').decode('utf8'), 'ucenb' : _(u'Number of text segments').decode('utf8'), @@ -1116,7 +1123,7 @@ class SimiLayout(DefaultTextLayout) : self.graphpan.Bind(wx.EVT_BUTTON, self.redosimi, self.graphpan.butafc) self.graphpan.Bind(wx.EVT_BUTTON, self.export, self.graphpan.butexport) self.tabsimi.AddPage(self.graphpan, 'Graph') - self.ira.nb.AddPage(self.tabsimi, 'Analyse de graph') + self.ira.nb.AddPage(self.tabsimi, _(u'Graph analysis').decode('utf8')) self.ira.ShowTab(True) self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1) @@ -1208,7 +1215,7 @@ class SimiLayout(DefaultTextLayout) : with open(filetmp, 'w') as f : f.write(txt) exec_rcode(self.ira.RPath, filetmp) - mss = wx.MessageDialog(self.ira, fileout, u'Fichier exporté', wx.OK) + mss = wx.MessageDialog(self.ira, fileout, _(u'File exported').decode('utf8'), wx.OK) mss.CenterOnParent() mss.ShowModal() mss.Destroy() @@ -1235,7 +1242,7 @@ class FreqLayout(DefaultMatLayout) : res = normpath_win32(self.pathout['resultats.html']).replace('\\','/') self.tab.LoadPage(res) self.tab.parametres = self.parametres - self.ira.nb.AddPage(self.tab, u"Fréquences") + self.ira.nb.AddPage(self.tab, ' - '.join([_(u"Frequency").decode('utf8'), self.parametres['name']])) class Chi2Layout(DefaultMatLayout) : @@ -1246,14 +1253,14 @@ class Chi2Layout(DefaultMatLayout) : res = normpath_win32(self.pathout['resultats-chi2.html']).replace('\\','/') self.tab.LoadPage(res) self.tab.parametres = self.parametres - self.ira.nb.AddPage(self.tab, ' - '.join([u"Chi2", "%s" % self.parametres['name']])) + self.ira.nb.AddPage(self.tab, ' - '.join([u"Chi2", self.parametres['name']])) #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1) #self.ira.ShowAPane("Tab_content") class ProtoLayout(DefaultMatLayout) : def dolayout(self) : - list_graph = [['proto.png', 'Analyse prototypique']] + list_graph = [['proto.png', _(u'Prototypical analysis').decode('utf8')]] #self.Tab = aui.AuiNotebook(self.ira.nb, -1, wx.DefaultPosition) #if self.parametres['svg'] : # list_graph = [['nuage_1.svg', 'Nuage']] @@ -1263,7 +1270,7 @@ class ProtoLayout(DefaultMatLayout) : #self.Tab.AddPage(self.TabProto, 'Analyse Prototypique') #self.Tab.corpus = self.corpus self.TabProto.parametres = self.parametres - self.ira.nb.AddPage(self.TabProto, 'Analyse Prototypique - %s' % self.parametres['name']) + self.ira.nb.AddPage(self.TabProto, ' - '.join([_(u'Prototypical analysis').decode('utf8'), self.parametres['name']])) #self.ira.nb.SetSelection(self.ira.nb.GetPageCount() - 1) #self.ira.ShowAPane("Tab_content") @@ -1285,7 +1292,7 @@ class SimiMatLayout(DefaultMatLayout) : self.graphpan.Bind(wx.EVT_BUTTON, self.export, self.graphpan.butexport) self.tabsimi.AddPage(self.graphpan, 'Graph') self.tabsimi.parametres = self.parametres - self.parent.nb.AddPage(self.tabsimi, 'Analyse de graph') + self.parent.nb.AddPage(self.tabsimi, ' - '.join([_(u'Graph analysis').decode('utf8'), self.parametres['name']])) #self.parent.ShowTab(True) #self.parent.nb.SetSelection(self.parent.nb.GetPageCount() - 1) @@ -1451,7 +1458,7 @@ class SimiMatLayout(DefaultMatLayout) : with open(filetmp, 'w') as f : f.write(txt) exec_rcode(self.ira.RPath, filetmp) - mss = wx.MessageDialog(self.ira, fileout, u'Fichier exporté', wx.OK) + mss = wx.MessageDialog(self.ira, fileout, _(u'File exported').decode('utf8'), wx.OK) mss.CenterOnParent() mss.ShowModal() mss.Destroy() diff --git a/listlex.py b/listlex.py index d4e730f..e03df7a 100644 --- a/listlex.py +++ b/listlex.py @@ -195,9 +195,9 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor # make a menu menu = wx.Menu() # add some items - menu.Append(self.popupID1, u"Formes associées") - menu.Append(self.popupID2, u"Concordancier") - menu.Append(self.popupID3, u"Graphique") + menu.Append(self.popupID1, _(u"Associated forms").decode('utf8')) + menu.Append(self.popupID2, _(u"Concordance").decode('utf8')) + menu.Append(self.popupID3, _(u"Graphic").decode('utf8')) menu_stcaract = wx.Menu() self.menuid = {} if not self.tgen : @@ -206,7 +206,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor self.menuid[nid] = i menu_stcaract.Append(nid, et) self.Bind(wx.EVT_MENU, self.onstcaract, id = nid) - menu.AppendMenu(-1, u"Segments de texte caractéristiques", menu_stcaract) + menu.AppendMenu(-1, _(u"Typical text segments").decode('utf8'), menu_stcaract) menu.Append(self.onmaketgen, _(u"Make Tgen").decode('utf8')) self.PopupMenu(menu) menu.Destroy() @@ -230,7 +230,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq]) rep.sort(key = itemgetter(1), reverse = True) items = dict([[i, '' + '\t:\t'.join([str(val) for val in forme]) + ''] for i, forme in enumerate(rep)]) - win = message(self, items, u"Formes associées", (300, 200)) + win = message(self, items, _(u"Associated forms").decode('utf8'), (300, 200)) #win = message(self, u"Formes associées", (300, 200)) #win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' #win.HtmlPage.SetPage(win.html) @@ -271,7 +271,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor nuces = [val[1] for val in ntab2] ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la) items = dict([[i, '
'.join([ucis_txt[i], '
score : %.2f

' % ntab2[i][0], ucestxt[i]])] for i in range(0,len(ucestxt))]) - win = message(self, items, u"Segments de texte caractéristiques - %s" % self.first[ind], (900, 600)) + win = message(self, items, ' - '.join([_(u"Typical text segments").decode('utf8'), "%s" % self.first[ind]]), (900, 600)) win.Show(True) def OnPopupTwo(self, event): @@ -291,7 +291,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor wordlist = [val for val in self.tgens[item] if val in corpus.lems] ucis_txt, ucestxt = doconcorde(corpus, uce_ok, wordlist) items = dict([[i, '

'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))]) - win = message(ira, items, u"Concordancier - %s" % item, (800, 500), uceids = uce_ok) + win = message(ira, items, ' - '.join([_(u"Concordance").decode('utf8'), "%s" % item]), (800, 500), uceids = uce_ok) win.Show(True) def getinf(self, txt) : @@ -342,7 +342,7 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor with open(tmpscript, 'w') as f : f.write(txt) exec_rcode(self.parent.RPath, tmpscript, wait = True) - win = MessageImage(self, -1, u"Graphique", size=(700, 500),style = wx.DEFAULT_FRAME_STYLE) + win = MessageImage(self, -1, _(u"Graphic").decode('utf8'), size=(700, 500),style = wx.DEFAULT_FRAME_STYLE) win.addsaveimage(tmpgraph) txt = "" % tmpgraph win.HtmlPage.SetPage(txt) diff --git a/textstat.py b/textstat.py index 76ecb40..c25b9dc 100644 --- a/textstat.py +++ b/textstat.py @@ -5,20 +5,10 @@ #License: GNU/GPL from chemins import ffr -from chemins import PathOut from analysetxt import AnalyseText -#from corpus import Corpus -from guifunct import getPage, getCorpus -from ConfigParser import RawConfigParser -from functions import sortedby, progressbar, CreateIraFile, exec_rcode, check_Rresult, DoConf -from dialog import StatDialog -from openanalyse import OpenAnalyse -#from ttparser import * +from functions import sortedby, progressbar, exec_rcode, check_Rresult import tempfile from time import sleep -import wx -import os - import logging logger = logging.getLogger('iramuteq.textstat') @@ -57,14 +47,13 @@ class Stat(AnalyseText) : phapax = (float(len(hapax)) / float(occurrences)) * 100 phapax_forme = (float(len(hapax)) / (float(len(formes)))) * 100 moy_occu_mot = float(occurrences) / float(len(formes)) - txt = 'Globale\n' - txt += 'nombre de textes : %i\n' % len(self.corpus.ucis) - txt += 'nombre d\'occurrences : %i\n' % occurrences - txt += 'nombre de formes : %i\n' % (len(formes)) - txt += 'moyenne d\'occurrences par forme : %.2f\n' % moy_occu_mot - txt += 'nombre d\'hapax : %i (%.2f%% des occurrences - %.2f%% des formes)\n' % (len(hapax), phapax, phapax_forme) - print float(occurrences), float(len(self.corpus.ucis)) - txt += 'moyenne d\'occurrences par texte : %.2f' % (float(occurrences)/float(len(self.corpus.ucis))) + txt = ''.join([_(u'Abstract').decode('utf8'), '\n']) + txt += ''.join([_(u'Number of texts').decode('utf8'),' : ', '%i\n' % len(self.corpus.ucis)]) + txt += ''.join([_(u"Number of occurrences").decode('utf8'),' : %i\n' % occurrences]) + txt += ''.join([_(u'Number of forms').decode('utf8'), ' : %i\n' % (len(formes))]) + txt += ''.join([_(u"Number of hapax").decode('utf8'),' : %i (%.2f%%' % (len(hapax),phapax), _(u'of occurrences').decode('utf8'), ' - %.2f%% ' % phapax_forme, _(u'of forms').decode('utf8'), ')\n']) + #print float(occurrences), float(len(self.corpus.ucis)) + txt += ''.join([_(u"Mean of occurrences by text").decode('utf8'), ' : %.2f' % (float(occurrences)/float(len(self.corpus.ucis)))]) if self.dlg : self.dlg.Update(7, u'Ecriture...') self.result['glob'] = txt -- 2.7.4