copycorpus
[iramuteq] / textaslexico.py
index 82311cd..5ff4c37 100644 (file)
@@ -17,6 +17,9 @@ import tempfile
 from ConfigParser import RawConfigParser
 from guifunct import getPage, getCorpus
 from time import sleep
+import logging
+
+log = logging.getLogger('iramuteq.spec')
 
 class Lexico(AnalyseText) :
     def doanalyse(self) :
@@ -205,10 +208,11 @@ class Lexico(AnalyseText) :
         tmpscript = open(tmpfile, 'w')
         tmpscript.write(txt)
         tmpscript.close()
-        pid = exec_rcode(self.parent.RPath, tmpfile, wait = False)
-        while pid.poll() == None :
-            sleep(0.2)
-        check_Rresult(self.parent, pid)
+        self.doR(tmpfile, dlg = self.dlg, message = 'R...')
+        #pid = exec_rcode(self.parent.RPath, tmpfile, wait = False)
+        #while pid.poll() == None :
+        #    sleep(0.2)
+        #check_Rresult(self.parent, pid)
 
     def preferences(self) :
         listet = self.corpus.make_etoiles()
@@ -234,10 +238,10 @@ class Lexico(AnalyseText) :
             else :
                 self.parametres['indice'] = 'chi2'
             self.parametres['clnb'] = len(ListEt)
-            if dial.checklem.GetValue() :
-                self.parametres['lem'] = 1 
-            else :
-                self.parametres['lem'] = 0
+            #if dial.checklem.GetValue() :
+            #    self.parametres['lem'] = 1 
+            #else :
+            #    self.parametres['lem'] = 0
             dial.Destroy()
             return self.parametres
         else :
@@ -275,12 +279,27 @@ class Lexico(AnalyseText) :
         mineff = self.parametres['mineff']
         #dlg = progressbar(self, maxi = 3)
         tabout = self.corpus.make_lexitable(mineff, self.listet)
+        #log.warning('Fmax a 200')
+        #Fmax = [line for line in tabout[1:] if sum(line[1:]) > 199]
+        #formesmax = [line[0] for line in Fmax]
+        #Fmax = [line[1:] for line in Fmax]
+        #summax = [sum(col) for col in zip(*Fmax)]
+        #tabout.append(['Fmax'] + summax)
+        #tabout = [line for line in tabout if line[0] not in formesmax]
+        #log.warning('ATTENTION : hapax par etoile')
+        #tabout.append(['hapax'] + self.corpus.gethapaxbyet(self.listet))
         write_tab(tabout, self.dictpathout['tableafcm'])
+        
+        #log.warning('ATTENTION : gethapaxuces')
+        #self.corpus.gethapaxuces()
+
         tabout = self.corpus.make_efftype_from_etoiles(self.listet)
         write_tab(tabout, self.dictpathout['tabletypem'])
-        #dlg.Update(2, u'R...')
+        if self.dlg :
+            self.dlg.Update(2, u'R...')
         self.DoR()
-        #dlg.Update(3, u'Chargement...')
+        if self.dlg :
+            self.dlg.Update(3, u'Chargement...')
         afcf_graph_list = [[os.path.basename(self.dictpathout['afcf_row']), u'lignes'],\
                             [os.path.basename(self.dictpathout['afcf_col']), u'colonnes']]
         afct_graph_list = [[os.path.basename(self.dictpathout['afct_row']), u'lignes'],\