From 740cce228f0e520879d077bcc7fb08e0484d5ca4 Mon Sep 17 00:00:00 2001 From: pierre Date: Fri, 2 Feb 2024 00:01:08 +0100 Subject: [PATCH] windows --- textsimi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/textsimi.py b/textsimi.py index 2a0ea52..08c9f63 100644 --- a/textsimi.py +++ b/textsimi.py @@ -59,7 +59,7 @@ class SimiTxt(AnalyseText): else : order_actives = [[i, act, self.corpus.getlemeff(act)] for i, act in enumerate(self.actives)] order_actives = sorted(order_actives, key=itemgetter(2), reverse = True) - with open(self.pathout['selected.csv'], 'w') as f : + with open(self.pathout['selected.csv'], 'w', encoding='utf8') as f : f.write('\n'.join([repr(order_actives[val][0]) for val in self.parametres['selected']])) continu = True if continu : @@ -129,7 +129,7 @@ class SimiTxt(AnalyseText): self.parametres['nbactives'] = len(self.actives) self.parametres['fromprof'] = False self.corpus.make_and_write_sparse_matrix_from_uces(self.actives, self.pathout['mat01.csv'], self.pathout['listeuce1.csv']) - with open(self.pathout['actives.csv'], 'w') as f : + with open(self.pathout['actives.csv'], 'w', encoding='utf8') as f : f.write('\n'.join(self.actives)) @@ -197,9 +197,9 @@ class SimiFromCluster(SimiTxt) : self.parametres['nbactives'] = len(self.actives) self.parametres['fromprof'] = True 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 : + with open(self.pathout['actives.csv'], 'w', encoding='utf8') as f : f.write('\n'.join(self.actives)) - with open(self.pathout['actives_nb.csv'], 'w') as f : + with open(self.pathout['actives_nb.csv'], 'w', encoding='utf8') as f : f.write('\n'.join([repr(val) for val in self.lfreq])) - with open(self.pathout['actives_chi.csv'], 'w') as f : + with open(self.pathout['actives_chi.csv'], 'w', encoding='utf8') as f : f.write('\n'.join([repr(val) for val in self.lchi])) -- 2.7.4