From: Pierre Date: Tue, 11 Feb 2014 13:11:45 +0000 (+0100) Subject: mainly translation and more X-Git-Url: http://iramuteq.org/git?a=commitdiff_plain;h=69b6d701d4298a125c51cd0ac8e884359f93a6ad;p=iramuteq mainly translation and more --- diff --git a/analysetxt.py b/analysetxt.py index 544362c..ab19b3c 100644 --- a/analysetxt.py +++ b/analysetxt.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- -#Author: Pierre Ratinaud -#lisence : GNU GPL -#copyright : 2012-2013 (c) Pierre Ratinaud +# Author: Pierre Ratinaud +# lisence : GNU GPL +# copyright : 2012-2013 (c) Pierre Ratinaud import logging from chemins import PathOut, ChdTxtPathOut @@ -14,12 +14,11 @@ from OptionAlceste import OptionAlc from layout import PrintRapport from openanalyse import OpenAnalyse from dialog import StatDialog -from time import time log = logging.getLogger('iramuteq.analyse') class AnalyseText : - def __init__(self, ira, corpus, parametres = None, dlg = False, lemdial = True) : + def __init__(self, ira, corpus, parametres=None, dlg=False, lemdial=True) : self.corpus = corpus self.ira = ira self.parent = ira @@ -30,9 +29,9 @@ class AnalyseText : self.val = False self.keys = DoConf(self.ira.ConfigPath['key']).getoptions() if not 'pathout' in self.parametres : - self.pathout = PathOut(corpus.parametres['originalpath'], analyse_type = parametres['type'], dirout = corpus.parametres['pathout']) + self.pathout = PathOut(corpus.parametres['originalpath'], analyse_type=parametres['type'], dirout=corpus.parametres['pathout']) else : - self.pathout = PathOut(filename = corpus.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type']) + self.pathout = PathOut(filename=corpus.parametres['originalpath'], dirout=self.parametres['pathout'], analyse_type=self.parametres['type']) self.parametres = self.lemparam() if self.parametres is not None : self.parametres = self.make_config(parametres) @@ -42,7 +41,7 @@ class AnalyseText : gramact = [k for k in self.keys if self.keys[k] == 1] gramsup = [k for k in self.keys if self.keys[k] == 2] self.parametres['pathout'] = self.pathout.mkdirout() - self.pathout = PathOut(dirout = self.parametres['pathout']) + self.pathout = PathOut(dirout=self.parametres['pathout']) self.pathout.createdir(self.parametres['pathout']) self.parametres['corpus'] = self.corpus.parametres['uuid'] self.parametres['uuid'] = str(uuid4()) @@ -50,26 +49,26 @@ class AnalyseText : self.parametres['type'] = parametres['type'] self.parametres['encoding'] = self.ira.syscoding self.t1 = time() - self.corpus.make_lems(lem = self.parametres['lem']) + self.corpus.make_lems(lem=self.parametres['lem']) self.corpus.parse_active(gramact, gramsup) result_analyse = self.doanalyse() if result_analyse is None : - self.time = time() - self.t1 - minutes, seconds = divmod(self.time, 60) - hours, minutes = divmod(minutes, 60) - self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds) - self.parametres['ira'] = self.pathout['Analyse.ira'] - DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira']) - self.ira.history.add(self.parametres) - if dlg : - dlg.Destroy() - OpenAnalyse(self.parent, self.parametres['ira']) - self.ira.tree.AddAnalyse(self.parametres) - self.val = 5100 + self.time = time() - self.t1 + minutes, seconds = divmod(self.time, 60) + hours, minutes = divmod(minutes, 60) + self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds) + self.parametres['ira'] = self.pathout['Analyse.ira'] + DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira']) + self.ira.history.add(self.parametres) + if dlg : + dlg.Destroy() + OpenAnalyse(self.parent, self.parametres['ira']) + self.ira.tree.AddAnalyse(self.parametres) + self.val = 5100 else : - self.val = False - if dlg : - dlg.Destroy() + self.val = False + if dlg : + dlg.Destroy() else : if dlg : dlg.Destroy() @@ -115,9 +114,9 @@ class AnalyseText : def printRscript(self) : pass - def doR(self, Rscript, wait = False, dlg = None, message = '') : + def doR(self, Rscript, wait=False, dlg=None, message='') : log.info('R code...') - pid = exec_rcode(self.ira.RPath, Rscript, wait = wait) + pid = exec_rcode(self.ira.RPath, Rscript, wait=wait) while pid.poll() is None : if dlg : self.dlg.Pulse(message) @@ -135,6 +134,7 @@ class Alceste(AnalyseText) : self.actives, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 1) self.parametres['eff_min_forme'] = lim self.parametres['nbactives'] = len(self.actives) + uci = False if self.parametres['classif_mode'] == 0 : lenuc1, lenuc2 = self.corpus.make_and_write_sparse_matrix_from_uc(self.actives, self.parametres['tailleuc1'], self.parametres['tailleuc2'], self.pathout['TableUc1'], self.pathout['TableUc2'], self.pathout['listeuce1'], self.pathout['listeuce2']) self.parametres['lenuc1'] = lenuc1 @@ -143,18 +143,19 @@ class Alceste(AnalyseText) : self.corpus.make_and_write_sparse_matrix_from_uces(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1']) elif self.parametres['classif_mode'] == 2 : self.corpus.make_and_write_sparse_matrix_from_uci(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1']) + uci = True Rscript = self.printRscript() - self.doR(Rscript, dlg = self.dlg, message = 'CHD...') + self.doR(Rscript, dlg=self.dlg, message='CHD...') self.corpus.make_ucecl_from_R(self.pathout['uce']) - self.corpus.make_and_write_profile(self.actives, self.corpus.lc, self.pathout['Contout']) + self.corpus.make_and_write_profile(self.actives, self.corpus.lc, self.pathout['Contout'], uci = uci) self.sup, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 2) - self.corpus.make_and_write_profile(self.sup, self.corpus.lc, self.pathout['ContSupOut']) - self.corpus.make_and_write_profile_et(self.corpus.lc, self.pathout['ContEtOut']) + self.corpus.make_and_write_profile(self.sup, self.corpus.lc, self.pathout['ContSupOut'], uci = uci) + self.corpus.make_and_write_profile_et(self.corpus.lc, self.pathout['ContEtOut'], uci = uci) self.clnb = len(self.corpus.lc) self.parametres['clnb'] = self.clnb Rscript = self.printRscript2() - self.doR(Rscript, dlg = self.dlg, message = 'profils et A.F.C. ...') + self.doR(Rscript, dlg=self.dlg, message='profils et A.F.C. ...') self.time = time() - self.t1 minutes, seconds = divmod(self.time, 60) hours, minutes = divmod(minutes, 60) @@ -189,7 +190,7 @@ class Alceste(AnalyseText) : return None def printRscript(self) : - RchdTxt(self.pathout, self.parent.RscriptsPath, self.parametres['mincl'], self.parametres['classif_mode'], nbt = self.parametres['nbcl_p1'] - 1, svdmethod = self.parametres['svdmethod'], libsvdc = self.parent.pref.getboolean('iramuteq','libsvdc'), libsvdc_path = self.parent.pref.get('iramuteq','libsvdc_path'), R_max_mem = False, mode_patate = self.parametres['mode.patate']) + RchdTxt(self.pathout, self.parent.RscriptsPath, self.parametres['mincl'], self.parametres['classif_mode'], nbt=self.parametres['nbcl_p1'] - 1, svdmethod=self.parametres['svdmethod'], libsvdc=self.parent.pref.getboolean('iramuteq', 'libsvdc'), libsvdc_path=self.parent.pref.get('iramuteq', 'libsvdc_path'), R_max_mem=False, mode_patate=self.parametres['mode.patate']) return self.pathout['Rchdtxt'] def printRscript2(self) : @@ -208,12 +209,12 @@ class Alceste(AnalyseText) : chd_graph_list.append([os.path.basename(self.pathout['arbre1']), u'chd1']) if self.parametres['classif_mode'] == 0 : chd_graph_list.append([os.path.basename(self.pathout['arbre2']), u'chd2']) - print_liste(self.pathout['liste_graph_afc'],afc_graph_list) - print_liste(self.pathout['liste_graph_chd'],chd_graph_list) + print_liste(self.pathout['liste_graph_afc'], afc_graph_list) + print_liste(self.pathout['liste_graph_chd'], chd_graph_list) PrintRapport(self, self.corpus, self.parametres) -#keys = {'art_def' : 2, +# keys = {'art_def' : 2, # 'pre' : 2, # 'adj_dem' : 2, # 'ono' : 2, @@ -240,7 +241,7 @@ class Alceste(AnalyseText) : # 'num' : 2, # 'nr' : 1, # 'sw' : 2, -#} +# } # -#gramact = [k for k in keys if keys[k] == 1] -#gramsup = [k for k in keys if keys[k] == 2] +# gramact = [k for k in keys if keys[k] == 1] +# gramsup = [k for k in keys if keys[k] == 2] diff --git a/checkinstall.py b/checkinstall.py index 8fbf6d7..5895c9c 100644 --- a/checkinstall.py +++ b/checkinstall.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os import sys diff --git a/checkversion.py b/checkversion.py index 4fa6010..743f7ca 100644 --- a/checkversion.py +++ b/checkversion.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2009, Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import urllib2 import socket diff --git a/chemins.py b/chemins.py index 6b124ef..9afba84 100644 --- a/chemins.py +++ b/chemins.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os import tempfile diff --git a/functions.py b/functions.py index 1f4d8bb..aa260b3 100644 --- a/functions.py +++ b/functions.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2012 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx import re @@ -124,7 +124,9 @@ class History : def clean(self) : corpustodel = [corpus for corpus in self.history if not os.path.exists(corpus['ira'])] + print corpustodel for corpus in corpustodel : + print 'cleaning :', corpus['corpus_name'] self.delete(corpus, corpus = True) def __str__(self) : @@ -315,7 +317,8 @@ def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()): FileReader.close() DictProfile = {} count = 0 - rows = [row.replace('\n', '').replace("'", '').replace('\"', '').replace(',', '.').replace('\r','').split(';') for row in Filecontent] + #rows = [row.replace('\n', '').replace("'", '').replace('\"', '').replace(',', '.').replace('\r','').split(';') for row in Filecontent] + rows = [row.replace('\n', '').replace("'", '').replace('\"', '').replace('\r','').split(';') for row in Filecontent] rows.pop(0) ClusterNb = rows[0][2] rows.pop(0) @@ -669,20 +672,30 @@ def progressbar(self, maxi) : def treat_var_mod(variables) : var_mod = {} - for variable in variables : - if u'_' in variable : - forme = variable.split(u'_') - var = forme[0] - mod = forme[1] - if not var in var_mod : - var_mod[var] = [variable] - else : - if not mod in var_mod[var] : - var_mod[var].append(variable) + variables = list(set(variables)) + varmod = [variable.split('_') for variable in variables] + vars = list(set([var[0] for var in varmod if len(var) >=2])) + for var in vars : + mods = ['_'.join(v) for v in varmod if v[0] == var] + var_mod[var] = mods + +# for variable in variables : +# if u'_' in variable : +# forme = variable.split(u'_') +# var = forme[0] +# mod = forme[1] +# if not var in var_mod : +# var_mod[var] = [variable] +# else : +# if not mod in var_mod[var] : +# var_mod[var].append(variable) return var_mod -def doconcorde(corpus, uces, mots) : - ucestxt1 = [row for row in corpus.getconcorde(uces)] +def doconcorde(corpus, uces, mots, uci = False) : + if not uci : + ucestxt1 = [row for row in corpus.getconcorde(uces)] + else : + ucestxt1 = [row for row in corpus.getuciconcorde(uces)] ucestxt1 = dict(ucestxt1) ucestxt = [] ucis_txt = [] @@ -693,7 +706,15 @@ def doconcorde(corpus, uces, mots) : for uce in uces : ucetxt = ucestxt1[uce].split() ucetxt = ' '.join([dmots.get(mot, mot) for mot in ucetxt]) - ucis_txt.append('

' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '

') + if not uci : + ucis_txt.append('

' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '

') + else : + ucis_txt.append('

' + ' '.join(corpus.ucis[uce].etoiles) + '

') ucestxt.append(ucetxt) return ucis_txt, ucestxt + +def getallstcarac(corpus, analyse) : + pathout = PathOut(analyse['ira']) + profils = ReadProfileAsDico(pathout['PROFILE_OUT'], Alceste, self.encoding) + print profils diff --git a/guifunct.py b/guifunct.py index b16c58c..e699043 100644 --- a/guifunct.py +++ b/guifunct.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2011 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx import os @@ -14,7 +14,7 @@ from functions import treat_var_mod def OnOpen(self, type): if type == "Data": - wildcard = u"Fichiers supportés|*.ods;*.xls;*.csv;*.txt|Openoffice Calc|*.ods|Excel 97/2000/XP/2003|*.xls|Fichier csv|*.csv|Fichier texte|*.txt|Tous les fichiers|*" + wildcard = u"Fichiers supportés|*.ods;*.xls;*.csv;*.txt|Openoffice Calc|*.ods|Excel 97/2000/XP/2003|*.xls|Fichier csv|*.csv|Fichier texte|*.txt|Tous les fichiers|*" elif type == "Texte": wildcard = "Fichier texte|*.txt|Tous les fichiers|*" elif type == "Analyse": @@ -23,7 +23,7 @@ def OnOpen(self, type): if defaultDir.strip() == '': defaultDir = self.UserConfigPath.replace('.iramuteq','') dlg = wx.FileDialog( - self, message="Choisissez un fichier", defaultDir=defaultDir, + self, message=_(u"Choose a file").decode('utf8'), defaultDir=defaultDir, defaultFile="", wildcard=wildcard, style=wx.OPEN | wx.CHANGE_DIR) dlg.CenterOnParent() if dlg.ShowModal() == wx.ID_OK : @@ -47,7 +47,7 @@ def getfileextension(file) : def get_table_param(self, filename) : if getfileextension(filename) == '.csv': - dlg = dialog.FileOptionDialog(self, -1, u"Format du fichier", sep=True, size=(350, 200), + dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=True, size=(350, 200), style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnParent() val = dlg.ShowModal() @@ -60,7 +60,7 @@ def get_table_param(self, filename) : else : dlg.Destroy() elif getfileextension(filename) == '.xls' : - dlg = dialog.FileOptionDialog(self, -1, u"Format du fichier", sep=False, sheet = True, size=(350, 200), + dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200), style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnParent() val = dlg.ShowModal() @@ -73,7 +73,7 @@ def get_table_param(self, filename) : else : dlg.Destroy() elif getfileextension(filename) == '.ods': - dlg = dialog.FileOptionDialog(self, -1, u"Format du fichier", sep=False, size=(350, 200), + dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, size=(350, 200), style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnParent() val = dlg.ShowModal() @@ -161,7 +161,7 @@ class SelectColumn : class PrefSimi ( wx.Dialog ): def __init__( self, parent, ID, paramsimi, indices, wordlist = None, selected = None, actives = None): - wx.Dialog.__init__ ( self, None, id = wx.ID_ANY, title = u"Paramètres", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE ) + wx.Dialog.__init__ ( self, None, id = wx.ID_ANY, title = _(u"Settings").decode('utf8'), pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE ) self.parent = parent self.ira = parent self.paramsimi=paramsimi @@ -197,7 +197,7 @@ class PrefSimi ( wx.Dialog ): if not self.paramsimi['first'] : - self.m_staticText271 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Utiliser les coordonnées\nprécédentes", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText271 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Use previous coordinates").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText271.Wrap( -1 ) fgSizer3.Add( self.m_staticText271, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -210,7 +210,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline37 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline37, 0, wx.EXPAND, 5 ) - self.m_staticText3 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Indice", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText3 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Score").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText3.Wrap( -1 ) fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -225,7 +225,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline292 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline292, 0, wx.EXPAND, 5 ) - self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Layout", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText4 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Layout").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText4.Wrap( -1 ) fgSizer3.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -240,15 +240,15 @@ class PrefSimi ( wx.Dialog ): self.m_staticline295 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline295, 0, wx.EXPAND, 5 ) - self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Type de graph", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText5 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Graphical type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText5.Wrap( -1 ) fgSizer3.Add( self.m_staticText5, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) - choice3Choices = [ u"dynamique", u"statique", u"3D" ] + choice3Choices = [ u"dynamique", u"statique", u"3D", u'web2D', u"web3D" ] self.choice3 = wx.Choice( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, choice3Choices, 0 ) self.choice3.SetSelection( 0 ) - label_format = wx.StaticText(self.m_panel2, -1, u"Format de l'image") + label_format = wx.StaticText(self.m_panel2, -1, _(u"Picture format").decode('utf8')) self.choix_format = wx.Choice(self.m_panel2, -1, (100,50), choices = ['png', 'svg']) self.choix_format.SetSelection( 0 ) hsizer = wx.BoxSizer(wx.HORIZONTAL) @@ -263,7 +263,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline297 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline297, 0, wx.EXPAND, 5 ) - self.m_staticText8 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Arbre maximum", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText8 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Maximum tree").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText8.Wrap( -1 ) fgSizer3.Add( self.m_staticText8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -276,7 +276,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline299 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline299, 0, wx.EXPAND, 5 ) - self.m_staticText91 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Graph à seuil", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText91 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Edges threshold").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText91.Wrap( -1 ) fgSizer3.Add( self.m_staticText91, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -297,7 +297,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline2911 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline2911, 0, wx.EXPAND, 5 ) - self.m_staticText19 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Texte sur les sommets", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText19 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Text on vertex").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText19.Wrap( -1 ) fgSizer3.Add( self.m_staticText19, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -310,7 +310,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline2913 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline2913, 0, wx.EXPAND, 5 ) - self.m_staticText20 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Indices sur les arêtes", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText20 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Score on edges").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText20.Wrap( -1 ) fgSizer3.Add( self.m_staticText20, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -323,7 +323,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline2915 = wx.StaticLine( self.m_panel2, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer3.Add( self.m_staticline2915, 0, wx.EXPAND, 5 ) - self.m_staticText27 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Taille du texte", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText27 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Text size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText27.Wrap( -1 ) fgSizer3.Add( self.m_staticText27, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -338,7 +338,7 @@ class PrefSimi ( wx.Dialog ): bsizer34 = wx.BoxSizer(wx.HORIZONTAL) - comtext = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Communauté", wx.DefaultPosition, wx.DefaultSize, 0 ) + comtext = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Communities").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) comtext.Wrap( -1 ) bsizer34.Add(comtext, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -357,7 +357,7 @@ class PrefSimi ( wx.Dialog ): fgSizer3.Add( sizer54, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) if 'bystar' in self.paramsimi : - self.m_staticText40 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Sélectionner une variable", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText40 = wx.StaticText( self.m_panel2, wx.ID_ANY, _(u"Select a variable").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText40.Wrap( -1 ) fgSizer3.Add( self.m_staticText40, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -376,7 +376,7 @@ class PrefSimi ( wx.Dialog ): self.m_panel2.SetSizer( bSizer18 ) self.m_panel2.Layout() bSizer18.Fit( self.m_panel2 ) - self.m_notebook1.AddPage( self.m_panel2, u"Paramètres du graph", True ) + self.m_notebook1.AddPage( self.m_panel2, _(u"Graphic settings").decode('utf8'), True ) self.m_panel3 = wx.Panel( self.m_notebook1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TAB_TRAVERSAL ) fgSizer5 = wx.FlexGridSizer( 0, 3, 0, 0 ) fgSizer5.SetFlexibleDirection( wx.BOTH ) @@ -386,7 +386,7 @@ class PrefSimi ( wx.Dialog ): fgSizer51.SetFlexibleDirection( wx.BOTH ) fgSizer51.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) - self.m_staticText6 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Taille du graphique", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText6 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Picture size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText6.Wrap( -1 ) fgSizer51.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -394,14 +394,14 @@ class PrefSimi ( wx.Dialog ): fgSizer31.SetFlexibleDirection( wx.BOTH ) fgSizer31.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED ) - self.m_staticText9 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"hauteur", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText9 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"height").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText9.Wrap( -1 ) fgSizer31.Add( self.m_staticText9, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) self.spin_height = wx.SpinCtrl( self.m_panel3, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.SP_ARROW_KEYS, 10, 100000, 800 ) fgSizer31.Add( self.spin_height, 0, wx.ALL, 5 ) - self.m_staticText10 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"largeur", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText10 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"width").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText10.Wrap( -1 ) fgSizer31.Add( self.m_staticText10, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -417,7 +417,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline4 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline4, 0, wx.EXPAND, 5 ) - self.m_staticText101 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Taille des sommets \nproportionnelle à l'effectif\n(les scores sont normalisés)", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText101 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex size proportional to frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText101.Wrap( -1 ) fgSizer51.Add( self.m_staticText101, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -464,7 +464,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline32 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline32, 0, wx.EXPAND, 5 ) - self.m_staticText1011 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Taille du texte des sommets \nproportionnelle à l'effectif\n(les scores sont normalisés)", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText1011 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex text size proportional to frequency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText1011.Wrap( -1 ) fgSizer51.Add( self.m_staticText1011, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -511,7 +511,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline322 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline322, 0, wx.EXPAND, 5 ) - self.m_staticText10111 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Largeur des arêtes\nproportionnelle à l'indice", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText10111 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Edges width proportional to score").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText10111.Wrap( -1 ) fgSizer51.Add( self.m_staticText10111, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -550,7 +550,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline34 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline34, 0, wx.EXPAND, 5 ) - self.m_staticText28 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Gradiant de gris sur les textes en fonction \nde l'effectif (du chi2) (0=noir; 1=blanc)", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText28 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Gray scale on text proportional to frequency (0=black, 1=white)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText28.Wrap( -1 ) fgSizer51.Add( self.m_staticText28, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 ) @@ -599,7 +599,7 @@ class PrefSimi ( wx.Dialog ): bSizer5 = wx.BoxSizer( wx.HORIZONTAL ) - self.m_staticText21 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Couleur des sommets", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText21 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText21.Wrap( -1 ) bSizer5.Add( self.m_staticText21, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -611,7 +611,7 @@ class PrefSimi ( wx.Dialog ): bSizer6 = wx.BoxSizer( wx.HORIZONTAL ) - self.m_staticText22 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Couleur des arêtes", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText22 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Edges color").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText22.Wrap( -1 ) bSizer6.Add( self.m_staticText22, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -627,7 +627,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline332 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline332, 0, wx.EXPAND, 5 ) - self.m_staticText23 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Taille des sommets unique", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText23 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Vertex size").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText23.Wrap( -1 ) fgSizer51.Add( self.m_staticText23, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -648,7 +648,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline334 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline334, 0, wx.EXPAND, 5 ) - self.m_staticText24 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Transparence des sphères", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText24 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Spheres transparency").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText24.Wrap( -1 ) fgSizer51.Add( self.m_staticText24, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -661,7 +661,7 @@ class PrefSimi ( wx.Dialog ): self.m_staticline336 = wx.StaticLine( self.m_panel3, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL ) fgSizer51.Add( self.m_staticline336, 0, wx.EXPAND, 5 ) - self.m_staticText25 = wx.StaticText( self.m_panel3, wx.ID_ANY, u"Faire un film", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText25 = wx.StaticText( self.m_panel3, wx.ID_ANY, _(u"Make a movie").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText25.Wrap( -1 ) fgSizer51.Add( self.m_staticText25, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 ) @@ -684,7 +684,7 @@ class PrefSimi ( wx.Dialog ): self.m_panel3.SetSizer( fgSizer5 ) self.m_panel3.Layout() fgSizer5.Fit( self.m_panel3 ) - self.m_notebook1.AddPage( self.m_panel3, u"Paramètres graphiques", False ) + self.m_notebook1.AddPage( self.m_panel3, _(u"Graphical settings").decode('utf8'), False ) fgSizer10.Add( self.m_notebook1, 1, wx.EXPAND |wx.ALL, 5 ) @@ -734,7 +734,7 @@ class PrefSimi ( wx.Dialog ): self.choice1.SetSelection(self.paramsimi['coeff']) self.choice2.SetSelection(self.paramsimi['layout']) self.choice3.SetSelection(self.paramsimi['type_graph']) - if self.paramsimi['type_graph'] != 2 : + if self.paramsimi['type_graph'] not in [2,3] : self.film.Enable(False) self.slider_sphere.Enable(False) else : @@ -839,7 +839,7 @@ class PrefSimi ( wx.Dialog ): else : self.spin_width.Enable(True) self.spin_height.Enable(True) - if event.GetInt() != 2 : + if event.GetInt() not in [2,3] : self.film.Enable(False) self.slider_sphere.Enable(False) else : @@ -954,8 +954,9 @@ class PrepSimi : param['cexfromchi'] = self.dial.checkit.GetValue() if 'sfromchi' in self.parametres : param['sfromchi'] = self.dial.checki.GetValue() + print param if 'vlabcolor' in self.parametres : - param['vlabcolor'] = self.parametres['vlabcolor'] + param['vlabcolor'] = self.parametres['vlabcolor'] if 'check_bystar' in dir(self.dial) : param['bystar'] = self.dial.check_bystar.GetValue() param['stars'] = self.parametres['stars'] diff --git a/guiparam3d.py b/guiparam3d.py index 87c461c..cc8102e 100755 --- a/guiparam3d.py +++ b/guiparam3d.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx diff --git a/import_txm.py b/import_txm.py index 6ef0c2b..d9eea31 100644 --- a/import_txm.py +++ b/import_txm.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2013 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os diff --git a/iracmd.py b/iracmd.py index 3d496cb..1b8ff65 100644 --- a/iracmd.py +++ b/iracmd.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2010 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os from optparse import OptionParser @@ -143,16 +143,20 @@ class CmdLine : # log.warning('ATTENTION gethapaxuces') # MakeUciStat(corpus) #corpus.gethapaxuces() - ucisize = corpus.getucisize() - ucisize = [`val` for val in ucisize] - uciet = [[val.split('_')[1] for val in uci.etoiles[1:]] for uci in corpus.ucis] - #for line in uciet : - # print '\t'.join(line) + # ucisize = corpus.getucisize() + # ucisize = [`val` for val in ucisize] + #uciet = [uci.etoiles[1:] for uci in corpus.ucis] + uceet = [corpus.ucis[uce.uci].etoiles[1:] for uci in corpus.ucis for uce in uci.uces] + print uceet[0:10] + for line in uceet : + print '\t'.join(line) #res = zip(uciet, ucisize) - res = [uciet[i] + [ucisize[i]] for i, val in enumerate(uciet)] - print res[0:10] - with open('ucisize.csv', 'w') as f : - f.write('\n'.join(['\t'.join(val) for val in res])) + # res = [uciet[i] + [ucisize[i]] for i, val in enumerate(uciet)] + # print res[0:10] + #ucesize = corpus.getucesize() + #print ucesize[0:40] + #with open('sentences_size.csv', 'w') as f : + # f.write('\n'.join([`val` for val in ucesize])) # self.content = f.read() #self.content = self.content.replace('\r','') if options.type_analyse == 'alceste' : diff --git a/locale/fr_FR/LC_MESSAGES/iramuteq.mo b/locale/fr_FR/LC_MESSAGES/iramuteq.mo index 11fcb18..7108ff6 100644 Binary files a/locale/fr_FR/LC_MESSAGES/iramuteq.mo and b/locale/fr_FR/LC_MESSAGES/iramuteq.mo differ diff --git a/openanalyse.py b/openanalyse.py index 77d08a7..b02c1fe 100644 --- a/openanalyse.py +++ b/openanalyse.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2012, Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL from chemins import ChdTxtPathOut, StatTxtPathOut, PathOut from layout import OpenCHDS, dolexlayout, StatLayout, WordCloudLayout, OpenCorpus, SimiLayout, SimiMatLayout, ProtoLayout @@ -38,9 +38,9 @@ class OpenAnalyse(): intree = False corpus = self.openanalyse() if self.conf.get('lem',1) : - corpus.make_lems(True) + corpus.make_lems(True) else : - corpus.make_lems(False) + corpus.make_lems(False) if not intree : self.parent.tree.AddAnalyse(self.conf, bold = True) else : diff --git a/parse_factiva_html.py b/parse_factiva_html.py index b8f03a0..850dfde 100644 --- a/parse_factiva_html.py +++ b/parse_factiva_html.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2012 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL from HTMLParser import HTMLParser import wx.lib.sized_controls as sc diff --git a/parse_factiva_mail.py b/parse_factiva_mail.py index e73d510..285e627 100644 --- a/parse_factiva_mail.py +++ b/parse_factiva_mail.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2012 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os import codecs diff --git a/parse_factiva_txt.py b/parse_factiva_txt.py index eddbe47..21f70aa 100644 --- a/parse_factiva_txt.py +++ b/parse_factiva_txt.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2012-2013 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import os import codecs diff --git a/parse_factiva_xml.py b/parse_factiva_xml.py index 2be8bed..6eff72d 100644 --- a/parse_factiva_xml.py +++ b/parse_factiva_xml.py @@ -2,14 +2,12 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2010 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import xml.dom.minidom -import wx.lib.sized_controls as sc import wx.lib.filebrowsebutton as filebrowse import os import codecs -import sys import re import wx from parse_factiva_mail import ParseFactivaMail @@ -19,12 +17,11 @@ from import_txm import TXM2IRA def ParseDocument(filename) : print filename with codecs.open(filename, 'r', 'utf-8') as f : - content = f.read() + content = f.read() content = content.replace('', ' ').replace('', ' ') dom = xml.dom.minidom.parseString(content.encode("utf-8")) result = [] articles = dom.getElementsByTagName("article") - i = 0 for article in articles : headline = article.getElementsByTagName("headline") if headline != [] : @@ -50,7 +47,7 @@ def ParseDocument(filename) : if sourceName != [] : val_sourceName = sourceName[0].firstChild.nodeValue.replace('\n', ' ') else : - val_sourceName = INCONNU + val_sourceName = 'INCONNU' tailParagraphs = article.getElementsByTagName("tailParagraphs") if tailParagraphs != [] : para_tailParagraphs = tailParagraphs[0].getElementsByTagName("paragraph") @@ -65,13 +62,12 @@ def ParseDocument(filename) : def getcorpus_from_xml(xmldir, corpus_out): files = os.listdir(xmldir) - files = [os.path.join(xmldir,file) for file in files if os.path.splitext(file)[1] == '.xml'] + files = [os.path.join(xmldir,f) for f in files if os.path.splitext(f)[1] == '.xml'] if len(files) == 0 : return 'nofile' - result = [] fileout = codecs.open(corpus_out, 'w', 'utf-8') - for file in files : - rs = ParseDocument(file) + for f in files : + rs = ParseDocument(f) #dates = [row[2].split('-') for row in rs] #dates = [[date[0],date[1],date[2].split('T')[0]] for date in dates] #txt = '\n'.join(['\n'.join([' '.join([u'****', '*%s' % row[1].replace(' ','_').replace('\'','_'), '*%s' % row[2].replace('-','_')]), row[3], row[4]]) for row in rs]) @@ -134,7 +130,7 @@ class PrefImport(wx.Dialog): def fbbCallback(self, evt): if self.fbb.GetValue() == "" : - self.fbb.SetValue(os.path.join(self.dbb.GetValue(), 'corpus.txt')) + self.fbb.SetValue(os.path.join(self.dbb.GetValue(), 'corpus.txt')) #self.log.write('FileBrowseButton: %s\n' % evt.GetString()) def checkfile(self, evt) : @@ -160,21 +156,21 @@ class PrefImport(wx.Dialog): class ImportFactiva(): def __init__(self, parent, methode): - self.dial = PrefImport(parent, methode=methode) - self.dial.CenterOnParent() - val = self.dial.ShowModal() - if val == wx.ID_OK : - xmldir = self.dial.dbb.GetValue() - corp_out = self.dial.fbb.GetValue() - if methode == 'xml' : + self.dial = PrefImport(parent, methode=methode) + self.dial.CenterOnParent() + val = self.dial.ShowModal() + if val == wx.ID_OK : + xmldir = self.dial.dbb.GetValue() + corp_out = self.dial.fbb.GetValue() + if methode == 'xml' : res = getcorpus_from_xml(xmldir, corp_out) - elif methode == 'mail' : - res = ParseFactivaMail(xmldir, corp_out, 'utf8', parent.syscoding) - elif methode == 'txt' : - res = ParseFactivaPaste(xmldir, corp_out, 'utf8', parent.syscoding) - elif methode == 'txm' : - res = TXM2IRA(xmldir, corp_out, 'utf8', parent.syscoding) - if res == 'nofile' : + elif methode == 'mail' : + res = ParseFactivaMail(xmldir, corp_out, 'utf8', parent.syscoding) + elif methode == 'txt' : + res = ParseFactivaPaste(xmldir, corp_out, 'utf8', parent.syscoding) + elif methode == 'txm' : + res = TXM2IRA(xmldir, corp_out, 'utf8', parent.syscoding) + if res == 'nofile' : dlg = wx.MessageDialog(parent, u"Pas de fichier \'.xml\' dans %s" % xmldir, 'ATTENTION', wx.OK | wx.NO_DEFAULT | wx.ICON_WARNING) dlg.CenterOnParent() dlg.ShowModal() diff --git a/profile_segment.py b/profile_segment.py index 1eeee9c..b7e1f24 100644 --- a/profile_segment.py +++ b/profile_segment.py @@ -1,17 +1,13 @@ #!/bin/env python # -*- coding: utf-8 -*- -#Author: Pierre Ratinaud -#Copyright (c) 2010, Pierre Ratinaud -#Lisense: GNU/GPL +# Author: Pierre Ratinaud +# Copyright (c) 2010, Pierre Ratinaud +# License: GNU/GPL import tempfile from ProfList import * import wx -if wx.__version__ >= '2.11' : -#import agw.aui as aui - import wx.lib.agw.aui as aui -else : - import aui +import wx.lib.agw.aui as aui from functions import exec_rcode, check_Rresult, ReadProfileAsDico, ReadList from listlex import * from dialog import PrefSegProf, PrefProfTypes @@ -26,25 +22,25 @@ class ProfileSegment() : dial = PrefSegProf(self.parent) dial.CenterOnParent() if dial.ShowModal() == wx.ID_OK : - if dial.box_lem.GetSelection() == 0 : - self.lem = True - else : - self.lem = False - self.mini = dial.spin_min.GetValue() - self.maxi = dial.spin_max.GetValue() - self.eff = dial.spin_eff.GetValue() - dial.Destroy() - self.dlg = progressbar(self, maxi = 4) - self.dlg.Update(1, u'Recherche des segments') - self.make_table() - self.make_prof() - self.dlg.Update(3, u'ouverture des profils') - self.do_layout() - self.dlg.Update(4, 'fini') - self.dlg.Destroy() + if dial.box_lem.GetSelection() == 0 : # @IndentOk + self.lem = True + else : + self.lem = False + self.mini = dial.spin_min.GetValue() + self.maxi = dial.spin_max.GetValue() + self.eff = dial.spin_eff.GetValue() + dial.Destroy() + self.dlg = progressbar(self, maxi=4) + self.dlg.Update(1, u'Recherche des segments') + self.make_table() + self.make_prof() + self.dlg.Update(3, u'ouverture des profils') + self.do_layout() + self.dlg.Update(4, 'fini') + self.dlg.Destroy() def make_table(self) : - self.corpus.make_segments_profile(self.dictpathout['segments_classes'], lenmin = self.mini, lenmax = self.maxi, effmin = self.eff, lem = self.lem) + self.corpus.make_segments_profile(self.dictpathout['segments_classes'], lenmin=self.mini, lenmax=self.maxi, effmin=self.eff, lem=self.lem) def make_prof(self) : txt = """ @@ -60,7 +56,7 @@ class ProfileSegment() : fo = tempfile.mktemp(dir=self.parent.TEMPDIR) with open(fo, 'w') as f : f.write(txt) - pid = exec_rcode(self.parent.RPath, fo, wait = False) + pid = exec_rcode(self.parent.RPath, fo, wait=False) while pid.poll() == None : self.dlg.Pulse(u'Construction des profils...') sleep(0.2) @@ -71,7 +67,7 @@ class ProfileSegment() : page = self.parent.nb.GetPage(SelectTab).TabChdSim prof_seg = ReadProfileAsDico(self.dictpathout['prof_seg'], True, self.parent.syscoding) prof_seg_nb = aui.AuiNotebook(self.parent, -1, wx.DefaultPosition) - for i in range(0,len(self.corpus.lc)) : + for i in range(0, len(self.corpus.lc)) : ntab = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1) prof_seg_nb.AddPage(ntab, 'classe %i' % (i + 1)) page.AddPage(prof_seg_nb, u'Profils des segements répétés') @@ -92,24 +88,24 @@ class ProfilType() : alceste = True else : alceste = False - #if 'outprof' in self.corpus.parametre : + # if 'outprof' in self.corpus.parametre : # self.corpus.parametre['outprof'][self.outprof] = alceste - #else : + # else : # self.corpus.parametre['outprof'] = {self.outprof: alceste} - self.dlg = progressbar(self, maxi = 4) + self.dlg = progressbar(self, maxi=4) self.dlg.Update(1, u'Recherche des types') self.make_table() self.dlg.Update(1, u'Construction des profils') - self.make_prof(alceste = alceste) + self.make_prof(alceste=alceste) self.dlg.Update(3, u'Ouverture des profils') - self.do_layout(alceste = alceste) + self.do_layout(alceste=alceste) self.dlg.Update(4, 'fini') self.dlg.Destroy() def make_table(self) : self.corpus.make_proftype(self.corpus.dictpathout['type_cl']) - def make_prof(self, alceste = True) : + def make_prof(self, alceste=True) : txt = """ load("%s") source("%s") @@ -128,24 +124,24 @@ class ProfilType() : to <- AsLexico2(dt) write.csv2(to[[1]], file = "%s") """ % (self.outprof) - #write.csv2(to[[3]], file = "%s") + # write.csv2(to[[3]], file = "%s") # % (self.outprof) fo = tempfile.mktemp(dir=self.parent.TEMPDIR) with open(fo, 'w') as f : f.write(txt) - pid = exec_rcode(self.parent.RPath, fo, wait = False) + pid = exec_rcode(self.parent.RPath, fo, wait=False) while pid.poll() == None : self.dlg.Pulse(u'Construction des profils...') sleep(0.2) check_Rresult(self.parent, pid) - def do_layout(self, alceste = True) : + def do_layout(self, alceste=True) : SelectTab = self.parent.nb.GetSelection() page = self.parent.nb.GetPage(SelectTab).TabChdSim prof_seg_nb = aui.AuiNotebook(self.parent, -1, wx.DefaultPosition) if alceste : prof_seg = ReadProfileAsDico(self.outprof, True) - for i in range(0,len(self.corpus.lc)) : + for i in range(0, len(self.corpus.lc)) : ntab = ProfListctrlPanel(self.parent, self, prof_seg[str(i + 1)], False, i + 1) prof_seg_nb.AddPage(ntab, 'classe %i' % (i + 1)) else : diff --git a/search_list.py b/search_list.py index 527ce58..42d1765 100644 --- a/search_list.py +++ b/search_list.py @@ -197,7 +197,7 @@ class SearchList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSort lems = corpus.lems rep = [] for forme in lems[word] : - rep.append([forme, corpus.formes[forme][0]]) + rep.append([forme, corpus.formes[forme][0]]) win = message(self, u"Formes associées", size=(300, 200)) win.html = '\n' + '
'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n' win.HtmlPage.SetPage(win.html) diff --git a/search_tools.py b/search_tools.py index d9838a8..53206e6 100644 --- a/search_tools.py +++ b/search_tools.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2011 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx from search_list import SearchList diff --git a/sheet.py b/sheet.py index c4fbd69..76fcde2 100644 --- a/sheet.py +++ b/sheet.py @@ -2,11 +2,10 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2009 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL from wx.lib import sheet -import wx class MySheet(sheet.CSheet): @@ -21,14 +20,9 @@ class MySheet(sheet.CSheet): event.Skip() def Populate(self,content): - c=0 - for r in content: - c+=1 nrow=len(content) - print 'nrow', nrow self.SetNumberRows(nrow) ncol=len(content[1]) - print 'ncol',ncol self.SetNumberCols(ncol) for y in range(0,nrow): for i in range(0,ncol): diff --git a/tabafcm.py b/tabafcm.py index ae91828..cd5102c 100644 --- a/tabafcm.py +++ b/tabafcm.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2009 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx import os