Merge remote-tracking branch 'origin/master'
authorpierre <ratinaud@univ-tlse2.fr>
Thu, 1 Oct 2020 14:57:42 +0000 (16:57 +0200)
committerpierre <ratinaud@univ-tlse2.fr>
Thu, 1 Oct 2020 14:57:42 +0000 (16:57 +0200)
functions.py
iramuteq.py
layout.py

index 8c0c66c..c74f352 100755 (executable)
@@ -114,6 +114,11 @@ class History :
         self.matrixanalyse = dict([[mat['uuid'], mat] for mat in self.matrix])
         self.ordermatrix = dict([[matrix['uuid'], i] for i, matrix in enumerate(self.matrix)])
         d.close()
+        d = {}
+        d['history'] = self.history
+        d['matrix'] = self.matrix
+        with open('/home/pierre/hystory.json', 'w') as f :
+            f.write(json.dumps(d, indent=4, default=str))
 
     def write(self) :
         d = shelve.open(self.filein)
@@ -805,7 +810,7 @@ def treat_var_mod(variables) :
 #                     var_mod[var].append(variable)
     return var_mod
 
-def doconcorde(corpus, uces, mots, uci = False) :
+def doconcorde(corpus, uces, mots, uci = False, et = False) :
     if not uci :
         ucestxt1 = [row for row in corpus.getconcorde(uces)]
     else :
@@ -813,8 +818,11 @@ def doconcorde(corpus, uces, mots, uci = False) :
     ucestxt1 = dict(ucestxt1)
     ucestxt = []
     ucis_txt = []
-    listmot = [corpus.getlems()[lem].formes for lem in mots]
-    listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem]
+    if not et :
+        listmot = [corpus.getlems()[lem].formes for lem in mots]
+        listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem]
+    else :
+        listmot = mots
     mothtml = ['<font color=red><b>%s</b></font>' % mot for mot in listmot]
     dmots = dict(zip(listmot, mothtml))
     for uce in uces :
@@ -883,7 +891,7 @@ def gettranslation(words, lf, lt) :
     request = urllib2.Request(link, headers=agent)
     raw_data = urllib2.urlopen(request).read()
     data = json.loads(raw_data)
-    return [line[0].decode('utf8').replace(u"'", u'_').replace(u' | ', u'|').replace(u' ', u'_').replace(u'-',u'_').replace(u'\n','') for line in data[0]]
+    return [line[0].decode('utf8', error='replace').replace(u"'", u'_').replace(u' | ', u'|').replace(u' ', u'_').replace(u'-',u'_').replace(u'\n','') for line in data[0]]
 
 def makenprof(prof, trans, deb=0) :
     nprof=[]
@@ -901,7 +909,7 @@ def treatempty(val) :
     else :
         return val
 
-def translateprofile(corpus, dictprofile, lf='it', lt='fr', maxword = 50) :
+def translateprofile(corpus, dictprofile, lf='it', lt='fr', maxword = 20) :
     nprof = {}
     lems = {}
     for i in range(len(dictprofile)) :
index d653391..6dfa3ea 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/env python
 # -*- coding: utf-8 -*-
 #Author: Pierre Ratinaud
-#Copyright (c) 2008-2016, Pierre Ratinaud
+#Copyright (c) 2008-2020, Pierre Ratinaud
 #License: GNU GPL
 #test
 
@@ -14,6 +14,7 @@ parser.add_option("-f", "--file", dest="filename",
 
 import sys
 reload(sys)
+#sys.path.insert(0, '/usr/lib/python2.7/dist-packages/wxPython-4.0.1-py2.7-linux-amd64.egg')
 import locale
 import tempfile
 import codecs
@@ -29,6 +30,7 @@ import wx.lib.agw.aui as aui
 import wx.html
 import wx.grid
 import wx.lib.hyperlink as hl
+#import wx.lib.agw.hyperlink as hl
 #------------------------------------
 from functions import BugReport, PlaySound, History, progressbar
 from checkversion import NewVersion
@@ -52,7 +54,7 @@ from textaslexico import Lexico
 from textlabbe import DistLabbe
 from textsimi import SimiTxt, SimiFromCluster
 from textwordcloud import WordCloud, ClusterCloud
-from textreinert import Reinert
+from textreinert import Reinert, ReDoReinert
 #from textcheckcorpus import checkcorpus
 from openanalyse import OpenAnalyse
 from corpus import Builder, SubBuilder, MergeClusters
@@ -1032,6 +1034,9 @@ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, États-Unis."""
         #FIXME
         AnalyseMerge(self, {'type': 'merge', 'fileout' : '/tmp/test.txt'}, dlg = 5)
 
+    def OnEliminate(self, corpus, parametres) :
+        print parametres
+
     def OnMergeClusters(self, evt) :
         builder = MergeClusters(self, {})
         if builder.res == wx.ID_OK :
index 4ea02da..90c9a61 100644 (file)
--- a/layout.py
+++ b/layout.py
@@ -799,6 +799,7 @@ class dolexlayout :
 
         self.TabStat.corpus = self.corpus
         self.TabStat.etoiles = self.etoiles
+        self.TabStat.pathout = self.pathout
         if os.path.exists(os.path.join(self.parametres['pathout'], 'tgenspec.csv')) :
             self.parametres['tgenspec'] = os.path.join(self.parametres['pathout'], 'tgenspec.csv')
             TgenLayout(self.TabStat)