indices_simi = [u'cooccurrence' ,'pourcentage de cooccurrence',u'Russel',u'Jaccard', 'Kulczynski1', 'Kulczynski2', 'Mountford', 'Fager', 'simple matching', 'Hamman', 'Faith', 'Tanimoto', 'Dice', 'Phi', 'Stiles', 'Michael', 'Mozley', 'Yule', 'Yule2', 'Ochiai', 'Simpson', 'Braun-Blanquet','Chi-squared', 'Phi-squared', 'Tschuprow', 'Cramer', 'Pearson', 'binomial']
+def normpath_win32(path) :
+ if not sys.platform == 'win32' :
+ return path
+ while '\\\\' in path :
+ path = path.replace('\\\\', '\\')
+ if sys.platform == 'win32' and path.startswith('\\') and not path.startswith('\\\\') :
+ path = '\\' + path
+ return path
+
class TGen :
def __init__(self, path = None, encoding = 'utf8'):
self.path = path
if path is None :
path = self.path
with open(path, 'w') as f :
- f.write('\n'.join(['\t'.join([val] + self.tgen[val]) for val in self.tgen]))
+ f.write('\n'.join(['\t'.join([val] + self.tgen[val]) for val in self.tgen]).encode(self.encoding))
def writetable(self, pathout, tgens, totocc):
etoiles = totocc.keys()
+ etoiles.sort()
with open(pathout, 'w') as f :
line = '\t'.join([u'tgens'] + etoiles) + '\n'
f.write(line.encode(self.encoding))
while totname + `i` in tgens :
i += 1
totname = totname + `i`
- line = '\t'.join([totname] + [`totocc[et]` for et in etoiles])
+ line = '\t'.join([totname] + [`totocc[et]` for et in etoiles]) + '\n'
f.write(line.encode(self.encoding))
class History :
def __init__(self, configfile=None, diff = None, parametres = None) :
self.configfile = configfile
self.conf = ConfigParser()
+
if configfile is not None :
+ configfile = normpath_win32(configfile)
self.conf.readfp(codecs.open(configfile, 'r', 'utf8'))
self.parametres = {}
if parametres is not None :
txt += '%s = %s\n' % (option, `parametres[i][option]`)
if outfile is None :
outfile = self.configfile
- with codecs.open(outfile, 'w', 'utf8') as f :
- f.write(txt)
+ outfile = normpath_win32(outfile)
+ with open(outfile, 'w') as f :
+ f.write(txt.encode('utf8'))
#self.conf.write(f)
def totext(self, parametres) :
txt += u'*************************************\n'
txt += '\n'.join(excTb).replace(' ', ' ')
txt += excName + '\n'
- txt += exc
+ txt += `exc`
title = "Bug"
dial = BugDialog(parent, **{'title' : title})
else :
parent.lexique = ReadDicoAsDico(filein)
else :
- parent.lexique = {}
+ if filein is None :
+ parent.lexique = {}
+ else :
+ parent.lexique = ReadDicoAsDico(filein)
def ReadList(filein, encoding = sys.getdefaultencoding(), sep = ';'):
#file = open(filein)
parent = self.parent
else :
parent = self
+ try :
+ print '###horrible hack progressbar'
+ maxi = int(maxi)
+ except :
+ maxi = 1
return wx.ProgressDialog("Traitements",
"Veuillez patienter...",
maximum=maxi,