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)
# 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)
uce_ok = corpus.getlemuces(item)
ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item])
items = dict([[i, '<br><br>'.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 = ('<html>\n<h1>%s</h1>' % item) + '<br>'.join(['<br>'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
#win.HtmlPage.SetPage(win.html)
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()
# 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")
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()
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()
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()
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) :
ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci)
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, 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 = '<html>\n' + '<br>'.join(['<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table>' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
#win.HtmlPage.SetPage(win.html)
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):
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 = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
#win.HtmlPage.SetPage(win.html)
win.Show(True)
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()
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'))
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
#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")
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'),
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)
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()
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) :
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']]
#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")
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)
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()
# 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 :
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()
rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq])
rep.sort(key = itemgetter(1), reverse = True)
items = dict([[i, '<font face="courier">' + '\t:\t'.join([str(val) for val in forme]) + '</font>'] 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 = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
#win.HtmlPage.SetPage(win.html)
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, 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):
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, 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) :
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 = "<img src='%s'>" % tmpgraph
win.HtmlPage.SetPage(txt)
#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')
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