# -*- 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
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
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)
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())
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()
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)
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
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)
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) :
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,
# '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]
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
import sys
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008-2009, Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import urllib2
import socket
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
import tempfile
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008-2012 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import wx
import re
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) :
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)
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 = []
for uce in uces :
ucetxt = ucestxt1[uce].split()
ucetxt = ' '.join([dmots.get(mot, mot) for mot in ucetxt])
- ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '</b></p>')
+ if not uci :
+ ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '</b></p>')
+ else :
+ ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[uce].etoiles) + '</b></p>')
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
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008-2011 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import wx
import os
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":
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 :
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()
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()
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()
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
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 )
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 )
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 )
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)
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 )
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 :
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 :
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']
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import wx
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2013 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2010 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
from optparse import OptionParser
# 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' :
# -*- 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
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 :
# -*- 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
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2012 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
import codecs
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2012-2013 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import os
import codecs
# -*- 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
def ParseDocument(filename) :
print filename
with codecs.open(filename, 'r', 'utf-8') as f :
- content = f.read()
+ content = f.read()
content = content.replace('<hlt>', ' ').replace('</hlt>', ' ')
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 != [] :
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")
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])
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) :
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()
#!/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
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 = """
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)
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')
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")
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 :
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 = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
win.HtmlPage.SetPage(win.html)
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2011 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import wx
from search_list import SearchList
# -*- 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):
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):
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2008-2009 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import wx
import os