projects
/
iramuteq
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
matrice graph classe
[iramuteq]
/
textsimi.py
diff --git
a/textsimi.py
b/textsimi.py
index
acb85a3
..
24cf213
100644
(file)
--- a/
textsimi.py
+++ b/
textsimi.py
@@
-52,11
+52,16
@@
class SimiTxt(AnalyseText):
log.info('Problem')
return False
if self.parametres['type_graph'] == 1:
log.info('Problem')
return False
if self.parametres['type_graph'] == 1:
+ if self.parametres['svg'] :
+ filename, ext = os.path.splitext(script.filename)
+ fileout = filename + '.svg'
+ else :
+ fileout = script.filename
if os.path.exists(self.pathout['liste_graph']):
graph_simi = read_list_file(self.pathout['liste_graph'])
if os.path.exists(self.pathout['liste_graph']):
graph_simi = read_list_file(self.pathout['liste_graph'])
- graph_simi.append([os.path.basename(
script.filename
), script.txtgraph])
+ graph_simi.append([os.path.basename(
fileout
), script.txtgraph])
else :
else :
- graph_simi = [[os.path.basename(
script.filename
), script.txtgraph]]
+ graph_simi = [[os.path.basename(
fileout
), script.txtgraph]]
print_liste(self.pathout['liste_graph'], graph_simi)
else :
return False
print_liste(self.pathout['liste_graph'], graph_simi)
else :
return False
@@
-126,9
+131,11
@@
class SimiTxt(AnalyseText):
f.write('\n'.join(self.actives).encode(self.ira.syscoding))
class SimiFromCluster(SimiTxt) :
f.write('\n'.join(self.actives).encode(self.ira.syscoding))
class SimiFromCluster(SimiTxt) :
- def __init__(self, ira, corpus, actives, numcluster, parametres = None, dlg = False) :
+ def __init__(self, ira, corpus, actives,
lfreq, lchi,
numcluster, parametres = None, dlg = False) :
self.actives = actives
self.numcluster = numcluster
self.actives = actives
self.numcluster = numcluster
+ self.lfreq = lfreq
+ self.lchi = lchi
parametres['name'] = 'simi_classe_%i' % (numcluster + 1)
SimiTxt.__init__(self, ira, corpus, parametres, dlg, lemdial = False)
parametres['name'] = 'simi_classe_%i' % (numcluster + 1)
SimiTxt.__init__(self, ira, corpus, parametres, dlg, lemdial = False)
@@
-167,7
+174,7
@@
class SimiFromCluster(SimiTxt) :
filename, ext = os.path.splitext(script.filename)
fileout = filename + '.svg'
else :
filename, ext = os.path.splitext(script.filename)
fileout = filename + '.svg'
else :
- fileout = s
elf.s
cript.filename
+ fileout = script.filename
if os.path.exists(self.pathout['liste_graph']):
graph_simi = read_list_file(self.pathout['liste_graph'])
graph_simi.append([os.path.basename(fileout), script.txtgraph])
if os.path.exists(self.pathout['liste_graph']):
graph_simi = read_list_file(self.pathout['liste_graph'])
graph_simi.append([os.path.basename(fileout), script.txtgraph])
@@
-184,3
+191,8
@@
class SimiFromCluster(SimiTxt) :
self.corpus.make_and_write_sparse_matrix_from_classe(self.actives, self.corpus.lc[self.numcluster], self.pathout['mat01.csv'])
with open(self.pathout['actives.csv'], 'w') as f :
f.write('\n'.join(self.actives).encode(self.ira.syscoding))
self.corpus.make_and_write_sparse_matrix_from_classe(self.actives, self.corpus.lc[self.numcluster], self.pathout['mat01.csv'])
with open(self.pathout['actives.csv'], 'w') as f :
f.write('\n'.join(self.actives).encode(self.ira.syscoding))
+ with open(self.pathout['actives_nb.csv'], 'w') as f :
+ f.write('\n'.join([`val` for val in self.lfreq]))
+ with open(self.pathout['actives_chi.csv'], 'w') as f :
+ f.write('\n'.join([`val` for val in self.lchi]))
+