svg for afc
[iramuteq] / textwordcloud.py
index b31e940..199d4a6 100644 (file)
@@ -4,8 +4,6 @@
 #Copyright (c) 2008-2009 Pierre Ratinaud
 #Lisense: GNU/GPL
 
 #Copyright (c) 2008-2009 Pierre Ratinaud
 #Lisense: GNU/GPL
 
-from chemins import ConstructPathOut, StatTxtPathOut, ffr, FFF
-#from corpus import Corpus
 from analysetxt import AnalyseText
 from guifunct import getPage, getCorpus, SelectColumn
 from ConfigParser import RawConfigParser
 from analysetxt import AnalyseText
 from guifunct import getPage, getCorpus, SelectColumn
 from ConfigParser import RawConfigParser
@@ -28,10 +26,17 @@ class WordCloud(AnalyseText):
     def doanalyse(self) :
         self.parametres['type'] = 'wordcloud'
         #FIXME
     def doanalyse(self) :
         self.parametres['type'] = 'wordcloud'
         #FIXME
-        self.actives = self.corpus.make_actives_limit(3)        
-        dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) 
-        SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'])
+        limit = 3
         self.make_option()
         self.make_option()
+        if self.parametres['mode'] == 2 :
+            self.actives = self.corpus.make_actives_limit(limit, 1)
+            self.actives += self.corpus.make_actives_limit(limit, 2)
+        elif self.parametres['mode'] == 0 :
+            self.actives = self.corpus.make_actives_limit(limit, 1)
+        elif self.parametres['mode'] == 1 :
+            self.actives = self.corpus.make_actives_limit(limit, 2)
+        dictcol = dict([[i, [act, self.corpus.getlemeff(act)]] for i, act in enumerate(self.actives)]) 
+        SelectColumn(self.ira, dictcol, self.actives, self.pathout['selected.csv'], dlg = True)
         self.make_wordcloud()
         script = WordCloudRScript(self)
         script.make_script()
         self.make_wordcloud()
         script = WordCloudRScript(self)
         script.make_script()
@@ -44,11 +49,12 @@ class WordCloud(AnalyseText):
         if res == wx.ID_OK :
             self.parametres['width'] = dial.spin_L.GetValue()
             self.parametres['height'] = dial.spin_H.GetValue()
         if res == wx.ID_OK :
             self.parametres['width'] = dial.spin_L.GetValue()
             self.parametres['height'] = dial.spin_H.GetValue()
-            #maxword = dial.spin_maxword.GetValue()
+            self.parametres['maxword'] = dial.spin_maxword.GetValue()
             self.parametres['mincex'] = float(dial.spin_mincex.GetValue())/float(10)
             self.parametres['maxcex'] = float(dial.spin_maxcex.GetValue())/float(10)
             self.parametres['col_text'] = dial.color_text.GetColour()
             self.parametres['col_bg'] = dial.color_bg.GetColour()
             self.parametres['mincex'] = float(dial.spin_mincex.GetValue())/float(10)
             self.parametres['maxcex'] = float(dial.spin_maxcex.GetValue())/float(10)
             self.parametres['col_text'] = dial.color_text.GetColour()
             self.parametres['col_bg'] = dial.color_bg.GetColour()
+            self.parametres['mode'] = dial.typeformeschoice.GetSelection()
             outgraph = os.path.join(os.path.dirname(self.pathout['zipf.png']), 'nuage_')
             nb = 1
             while os.path.exists(outgraph + str(nb) + '.png') :
             outgraph = os.path.join(os.path.dirname(self.pathout['zipf.png']), 'nuage_')
             nb = 1
             while os.path.exists(outgraph + str(nb) + '.png') :