catego
[iramuteq] / openanalyse.py
index da13f74..873f4b3 100644 (file)
@@ -1,21 +1,30 @@
-#!/bin/env python
 # -*- coding: utf-8 -*-
 #Author: Pierre Ratinaud
 # -*- coding: utf-8 -*-
 #Author: Pierre Ratinaud
-#Copyright (c) 2008-2012, Pierre Ratinaud
+#Copyright (c) 2008-2020 Pierre Ratinaud
+#modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
 #License: GNU/GPL
 
 #License: GNU/GPL
 
+#------------------------------------
+# import des modules python
+#------------------------------------
+import os
+import logging
+
+#------------------------------------
+# import des fichiers du projet
+#------------------------------------
 from chemins import ChdTxtPathOut, StatTxtPathOut, PathOut
 from chemins import ChdTxtPathOut, StatTxtPathOut, PathOut
-from layout import OpenCHDS, dolexlayout, StatLayout, WordCloudLayout, OpenCorpus, SimiLayout, SimiMatLayout, ProtoLayout, MatLayout, FreqLayout, Chi2Layout, LabbeLayout
+from layout import OpenCHDS, dolexlayout, StatLayout, WordCloudLayout, OpenCorpus, SimiLayout, SimiMatLayout, ProtoLayout, MatLayout, FreqLayout, Chi2Layout, LabbeLayout, CateLayout
 from corpus import Corpus, copycorpus
 from tableau import Tableau
 from corpus import Corpus, copycorpus
 from tableau import Tableau
-import os
 from functions import DoConf, ReadDicoAsDico
 from functions import DoConf, ReadDicoAsDico
-from tableau import Tableau
-import logging
+
 
 log = logging.getLogger('iramuteq.openanalyse')
 
 
 log = logging.getLogger('iramuteq.openanalyse')
 
+
 class OpenAnalyse():
 class OpenAnalyse():
+
     def __init__(self, parent, parametres, Alceste=True, simifromprof = False):
         log.info('OpenAnalyse')
         self.parent = parent
     def __init__(self, parent, parametres, Alceste=True, simifromprof = False):
         log.info('OpenAnalyse')
         self.parent = parent
@@ -26,7 +35,6 @@ class OpenAnalyse():
             self.conf = DoConf(parametres).getoptions()
             self.path = parametres
             self.conf = self.redopath(self.conf, parametres)
             self.conf = DoConf(parametres).getoptions()
             self.path = parametres
             self.conf = self.redopath(self.conf, parametres)
-
         if self.conf['type'] == 'corpus' :
             corpus = self.opencorpus()
         elif self.conf['type'] == 'matrix' :
         if self.conf['type'] == 'corpus' :
             corpus = self.opencorpus()
         elif self.conf['type'] == 'matrix' :
@@ -37,7 +45,6 @@ class OpenAnalyse():
             else :
                 intree = False
             corpus = self.openanalyse()
             else :
                 intree = False
             corpus = self.openanalyse()
-
             if self.conf.get('lem',1) :
                 dolem = True
             else :
             if self.conf.get('lem',1) :
                 dolem = True
             else :
@@ -56,6 +63,7 @@ class OpenAnalyse():
             corpus = None
             matrix = Tableau(self.parent, parametres = self.parent.history.matrix[self.parent.history.ordermatrix[self.conf['matrix']]])
             matrix.open()
             corpus = None
             matrix = Tableau(self.parent, parametres = self.parent.history.matrix[self.parent.history.ordermatrix[self.conf['matrix']]])
             matrix.open()
+
             #if isinstance(parametres, dict) :
             #    tableau = Tableau(parent, parametres['ira'])
             #else :
             #if isinstance(parametres, dict) :
             #    tableau = Tableau(parent, parametres['ira'])
             #else :
@@ -65,6 +73,7 @@ class OpenAnalyse():
             #tableau.dictpathout.basefiles(ChdTxtPathOut)
             #tableau.read_tableau(tableau.dictpathout['db'])
             #if self.parent.tree.IsInTree(uuid = self.conf['uuid']) :
             #tableau.dictpathout.basefiles(ChdTxtPathOut)
             #tableau.read_tableau(tableau.dictpathout['db'])
             #if self.parent.tree.IsInTree(uuid = self.conf['uuid']) :
+
             self.parent.tree.GiveFocus(uuid = self.conf['uuid'], bold = True)
             self.doopen(matrix)
         else :
             self.parent.tree.GiveFocus(uuid = self.conf['uuid'], bold = True)
             self.doopen(matrix)
         else :
@@ -172,3 +181,6 @@ class OpenAnalyse():
             FreqLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'chi2' or self.conf['type'] == 'chi2mcnemar':
             Chi2Layout(self.parent, corpus, self.conf)
             FreqLayout(self.parent, corpus, self.conf)
         elif self.conf['type'] == 'chi2' or self.conf['type'] == 'chi2mcnemar':
             Chi2Layout(self.parent, corpus, self.conf)
+        elif self.conf['type'] == 'categorisation' :
+            CateLayout(self.parent, corpus, self.conf)
+            print(self.conf)