corrections...
authorPierre <ratinaud@univ-tlse2.fr>
Mon, 10 Dec 2012 08:15:37 +0000 (09:15 +0100)
committerPierre <ratinaud@univ-tlse2.fr>
Mon, 10 Dec 2012 08:15:37 +0000 (09:15 +0100)
15 files changed:
PrintRScript.py
ProfList.py
Rscripts/Rgraph.R
chemins.py
configuration/corpus.cfg
corpusNG.py
dialog.py
guifunct.py
iramuteq.py
layout.py
listlex.py
search_list.py
textaslexico.py
textsimi.py
textwordcloud.py

index 45022f3..f4e20a1 100644 (file)
@@ -460,10 +460,12 @@ def print_simi3d(self):
         movie = "'" + ffr(os.path.dirname(self.DictPathOut['RData'])) + "'"
     else :
         movie = 'NULL'
         movie = "'" + ffr(os.path.dirname(self.DictPathOut['RData'])) + "'"
     else :
         movie = 'NULL'
-    if self.section == 'chd_dist_quest' :
-        header = 'TRUE'
-    else :
-        header = 'FALSE'
+    
+    #if self.corpus.parametres['type'] == 'corpus' :
+    #    header = 'TRUE'
+    #else :
+    #    header = 'FALSE'
+    header = 'FALSE'
     txt += """
     dm<-read.csv2("%s",row.names=1,header = %s)
     load("%s")
     txt += """
     dm<-read.csv2("%s",row.names=1,header = %s)
     load("%s")
@@ -781,7 +783,8 @@ class PrintSimiScript(PrintRScript) :
             txt += """
             et <- list()
             """
             txt += """
             et <- list()
             """
-            for i,et in enumerate(self.tableau.etline) :
+            print self.parametres
+            for i,et in enumerate(self.parametres['stars']) :
                 txt+= """
                 et[[%i]] <- c(%s)
                 """ % (i+1, ','.join(et[1:]))
                 txt+= """
                 et[[%i]] <- c(%s)
                 """ % (i+1, ','.join(et[1:]))
index 73f8ff7..7a9c245 100644 (file)
@@ -41,6 +41,7 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         self.Alceste = Alceste
         self.Source = gparent
         self.cl = cl
         self.Alceste = Alceste
         self.Source = gparent
         self.cl = cl
+        self.var_mod = {}
 
         line1 = profclasse.pop(0)
         classen = [line for line in profclasse if line[0] != '*' and line[0] != '*****']
 
         line1 = profclasse.pop(0)
         classen = [line for line in profclasse if line[0] != '*' and line[0] != '*****']
@@ -367,11 +368,19 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
             corpus = self.Source.corpus
         ClasseCHD(self.parent, corpus, self.cl)
 
             corpus = self.Source.corpus
         ClasseCHD(self.parent, corpus, self.cl)
 
+    def getselectedwords(self) :
+        words = [self.getColumnText(self.GetFirstSelected(), 6)]
+        last = self.GetFirstSelected()
+        while self.GetNextSelected(last) != -1:
+            last = self.GetNextSelected(last)
+            words.append(self.getColumnText(last, 6))
+        return words
+
     def quest_var_mod(self, evt) :
         if 'corpus' in dir(self.Source):
             corpus = self.Source.corpus
             if self.var_mod == {} :
     def quest_var_mod(self, evt) :
         if 'corpus' in dir(self.Source):
             corpus = self.Source.corpus
             if self.var_mod == {} :
-                self.var_mod = treat_var_mod([val for val in corpus.make_etoiles()])
+                self.var_mod = self.Source.corpus.make_etoiles_dict()
         else :
             corpus = self.Source.tableau
             if self.var_mod == {} :
         else :
             corpus = self.Source.tableau
             if self.var_mod == {} :
@@ -383,10 +392,10 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
-        word = self.getColumnText(self.GetFirstSelected(), 6)
+        word = self.getselectedwords()[0]
         if len(word.split('_')) > 1 :
         if len(word.split('_')) > 1 :
-            var = word.split('_')[0]
-            words = [word for word in self.var_mod[var]]
+            var = word.split('_')
+            words = ['_'.join([var[0],word]) for word in self.var_mod[var[0]]]
             words.sort()
             tableout = []
             kwords = []
             words.sort()
             tableout = []
             kwords = []
@@ -650,14 +659,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
-        words = [self.getColumnText(self.GetFirstSelected(), 6)]
-        tableout = [vchistable[fchistable.index(words[0])]]
-        last = self.GetFirstSelected()
-        while self.GetNextSelected(last) != -1:
-            last = self.GetNextSelected(last)
-            word = self.getColumnText(last, 6)
-            words.append(word)
-            tableout.append(vchistable[fchistable.index(word)])
+        words = self.getselectedwords()
+        tableout = [vchistable[fchistable.index(word)] for word in words]
         tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
         nbcl = len(title)
         txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph)
         tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
         nbcl = len(title)
         txt = barplot(tableout, words, title, self.Source.parent.RscriptsPath['Rgraph'], tmpgraph)
@@ -685,14 +688,8 @@ class ProfListctrlPanel(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Col
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
         chistable.pop(0)
         vchistable = [line[1:] for line in chistable]
         fchistable = [line[0] for line in chistable]
-        words = [self.getColumnText(self.GetFirstSelected(), 6)]
-        tableout = [vchistable[fchistable.index(words[0])]]
-        last = self.GetFirstSelected()
-        while self.GetNextSelected(last) != -1:
-            last = self.GetNextSelected(last)
-            word = self.getColumnText(last, 6)
-            words.append(word)
-            tableout.append(vchistable[fchistable.index(word)])
+        words = self.getselectedwords()
+        tableout = [vchistable[fchistable.index(word)] for word in words]
         tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
         txttable = 'c(' + ','.join([','.join(line) for line in tableout]) + ')'
         rownames = 'c("' + '","'.join(words) + '")'
         tmpgraph = tempfile.mktemp(dir=self.Source.parent.TEMPDIR)
         txttable = 'c(' + ','.join([','.join(line) for line in tableout]) + ')'
         rownames = 'c("' + '","'.join(words) + '")'
index 85f1ff8..061c1dd 100644 (file)
@@ -296,7 +296,7 @@ create_afc_table <- function(x) {
        res
 }
 
        res
 }
 
-make_afc_graph <- function(toplot,classes,clnb, xlab, ylab, cex.txt = NULL, leg = FALSE, cmd = FALSE) {
+make_afc_graph <- function(toplot,classes,clnb, xlab, ylab, cex.txt = NULL, leg = FALSE, cmd = FALSE, black = FALSE) {
        rain <- rainbow(clnb)
     compt <- 1
     tochange <- NULL
        rain <- rainbow(clnb)
     compt <- 1
     tochange <- NULL
@@ -316,6 +316,9 @@ make_afc_graph <- function(toplot,classes,clnb, xlab, ylab, cex.txt = NULL, leg
         }
     }
        cl.color <- rain[classes]
         }
     }
        cl.color <- rain[classes]
+    if (black) {
+        cl.color <- 'black'
+    }
        plot(toplot[,1],toplot[,2], pch='', xlab = xlab, ylab = ylab)
        abline(h=0,v=0, lty = 'dashed')
     #print('ATTENTION Rgraph.R : utilisation de maptools !')
        plot(toplot[,1],toplot[,2], pch='', xlab = xlab, ylab = ylab)
        abline(h=0,v=0, lty = 'dashed')
     #print('ATTENTION Rgraph.R : utilisation de maptools !')
@@ -509,8 +512,9 @@ make.simi.afc <- function(x,chitable,lim=0, alpha = 0.1, movie = NULL) {
     cc<-mc[cc]
     #mass<-(rowSums(x)/max(rowSums(x))) * 5
     maxchi<-norm.vec(maxchi, 0.03, 0.3)
     cc<-mc[cc]
     #mass<-(rowSums(x)/max(rowSums(x))) * 5
     maxchi<-norm.vec(maxchi, 0.03, 0.3)
-    rglplot(g1,vertex.label = vire.nonascii(rownames(x)),vertex.label.color='black',vertex.color=cc,vertex.size = 0.1, layout=lo, rescale=FALSE)
-    rgl.spheres(lo, col = cc, radius = maxchi, alpha = alpha)
+    rglplot(g1,vertex.label = vire.nonascii(rownames(x)),vertex.label.color= cc,vertex.label.cex = maxchi, vertex.size = 0.1, layout=lo, rescale=FALSE)
+    text3d(lo[,1], lo[,2],lo[,3], rownames(x), cex=maxchi, col=cc)
+    #rgl.spheres(lo, col = cc, radius = maxchi, alpha = alpha)
     rgl.bg(color = c('white','black'))
     if (!is.null(movie)) {
         require(tcltk)
     rgl.bg(color = c('white','black'))
     if (!is.null(movie)) {
         require(tcltk)
index e448064..18ce8e8 100644 (file)
@@ -146,6 +146,8 @@ def ConstructDicoPath(AppliPath):
         'swedish_exp' :  os.path.join(BasePath, 'expression_sw.txt'),
         'portuguese' : os.path.join(BasePath, 'lexique_pt.txt'),
         'portuguese_exp': os.path.join(BasePath, 'expression_pt.txt'),
         'swedish_exp' :  os.path.join(BasePath, 'expression_sw.txt'),
         'portuguese' : os.path.join(BasePath, 'lexique_pt.txt'),
         'portuguese_exp': os.path.join(BasePath, 'expression_pt.txt'),
+        'greek' : os.path.join(BasePath, 'lexique_gr.txt'),
+        'greek_exp' : os.path.join(BasePath, 'expression_gr.txt'),
     }
     return DictPath
 
     }
     return DictPath
 
index 52491e6..9452f14 100644 (file)
@@ -6,7 +6,7 @@ encoding = utf8
 lang = french
 douce = 1
 ucemethod = 1
 lang = french
 douce = 1
 ucemethod = 1
-ucesize = 35
+ucesize = 40
 keep_ponct = 0
 tolist = 0
 etoile = 1
 keep_ponct = 0
 tolist = 0
 etoile = 1
index 6a027dc..7354463 100644 (file)
@@ -512,18 +512,21 @@ class Corpus :
             et = etoile.split('_')
             if et[0] in det :
                 try :
             et = etoile.split('_')
             if et[0] in det :
                 try :
-                    if et[1] in det[et[0]] :
-                        det[et[0]][et[1]] += 1
+                    endet = '_'.join(et[1:])
+                    if endet in det[et[0]] :
+                        det[et[0]][endet] += 1
                     else :
                     else :
-                        det[et[0]][et[1]] = 1
+                        det[et[0]][endet] = 1
                 except IndexError :
                     det[et[0]] += 1
             else :
                 try :
                 except IndexError :
                     det[et[0]] += 1
             else :
                 try :
-                    det[et[0]] = {et[1] :1}
+                    endet = '_'.join(et[1:])
+                    det[et[0]] = {endet :1}
                 except IndexError :
                     det[et[0]] = 1
         print det
                 except IndexError :
                     det[et[0]] = 1
         print det
+        return det
 
     def make_and_write_profile_et(self, ucecl, fileout) :
         log.info('etoiles/classes')
 
     def make_and_write_profile_et(self, ucecl, fileout) :
         log.info('etoiles/classes')
@@ -906,8 +909,9 @@ class BuildCorpus :
             self.cleans.append(self.dolower)
         if self.corpus.parametres.get('firstclean', 1) :
             self.cleans.append(self.firstclean)
             self.cleans.append(self.dolower)
         if self.corpus.parametres.get('firstclean', 1) :
             self.cleans.append(self.firstclean)
-        self.rule = self.corpus.parametres.get('keep_caract', u"^a-zA-Z0-9àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇßœŒ’ñ.:,;!?*'_")
-        self.cleans.append(self.docharact)
+        if self.corpus.parametres['charact'] :
+            self.rule = self.corpus.parametres.get('keep_caract', u"^a-zA-Z0-9àÀâÂäÄáÁéÉèÈêÊëËìÌîÎïÏòÒôÔöÖùÙûÛüÜçÇßœŒ’ñ.:,;!?*'_")
+            self.cleans.append(self.docharact)
         if self.corpus.parametres.get('expressions', 1) :
             self.cleans.append(self.make_expression)
         if self.corpus.parametres.get('apos', 1) :
         if self.corpus.parametres.get('expressions', 1) :
             self.cleans.append(self.make_expression)
         if self.corpus.parametres.get('apos', 1) :
@@ -1047,7 +1051,11 @@ class BuildFromAlceste(BuildCorpus) :
             ucetxt = txt.split('laphrasepoursplitter')
         else :
             txt = ' '.join(txt)
             ucetxt = txt.split('laphrasepoursplitter')
         else :
             txt = ' '.join(txt)
+
+            print txt
             txt = self.make_cleans(txt)
             txt = self.make_cleans(txt)
+
+            print txt
             ucetxt = self.make_uces(txt, self.corpus.parametres['douce'])
         if self.corpus.ucis[-1].paras == [] :
             idpara += 1
             ucetxt = self.make_uces(txt, self.corpus.parametres['douce'])
         if self.corpus.ucis[-1].paras == [] :
             idpara += 1
index 44b7dc8..1bdeedb 100755 (executable)
--- a/dialog.py
+++ b/dialog.py
@@ -2550,6 +2550,21 @@ class PrefWordCloud ( wx.Dialog ):
         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
         
         self.m_staticline6 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
         fgSizer1.Add( self.m_staticline6, 0, wx.EXPAND |wx.ALL, 5 )
         
+        self.typeformes = wx.StaticText( self, wx.ID_ANY, u"formes retenues", wx.DefaultPosition, wx.DefaultSize, 0 )
+        self.typeformes.Wrap( -1 )
+        fgSizer1.Add( self.typeformes, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        typeformeschoiceChoices = [ u"actives", u"supplémentaires", u"actives et supplémentaires" ]
+        self.typeformeschoice = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, typeformeschoiceChoices, 0 )
+        self.typeformeschoice.SetSelection( 0 )
+        fgSizer1.Add( self.typeformeschoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+        
+        self.m_staticline11 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+        fgSizer1.Add( self.m_staticline11, 0, wx.EXPAND |wx.ALL, 5 )
+        
+        self.m_staticline12 = wx.StaticLine( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL )
+        fgSizer1.Add( self.m_staticline12, 0, wx.EXPAND |wx.ALL, 5 )        
+        
         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Taille du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
         self.m_staticText6.Wrap( -1 )
         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
         self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Taille du texte", wx.DefaultPosition, wx.DefaultSize, 0 )
         self.m_staticText6.Wrap( -1 )
         fgSizer1.Add( self.m_staticText6, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
@@ -2767,8 +2782,8 @@ class CorpusPref ( wx.Dialog ):
     def __init__( self, parent, parametres ):
         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
         self.parent = parent 
     def __init__( self, parent, parametres ):
         wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Préférences", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
         self.parent = parent 
-        langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)']
-        self.langues = [u'french', u'english', u'german', 'italian', 'swedish', u'portuguese']
+        langues_n = [u'français', u'english', u'german (expérimentale)', u'italian (expérimentale)', u'swedish (exp.)', u'portuguese (exp.)', 'greek', 'other...']
+        self.langues = [u'french', u'english', u'german', 'italian', 'swedish', u'portuguese', 'greek', 'other']
         self.encodages = [enc[0].lower() for enc in encodages]
 
         ucimark = [u'****', u'0000']
         self.encodages = [enc[0].lower() for enc in encodages]
 
         ucimark = [u'****', u'0000']
@@ -2930,7 +2945,7 @@ class CorpusPref ( wx.Dialog ):
         self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
         fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
 
         self.check_ponct = wx.CheckBox( self.m_panel2, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
         fgSizer3.Add( self.check_ponct, 0, wx.ALL, 5 )
 
-        self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Pas d'espace entre deux formes (pour le chinois par exemple)", wx.DefaultPosition, wx.DefaultSize, 0 )
+        self.m_staticText16 = wx.StaticText( self.m_panel2, wx.ID_ANY, u"Pas d'espace entre deux formes", wx.DefaultPosition, wx.DefaultSize, 0 )
         self.m_staticText16.Wrap( -1 )
         fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
         
         self.m_staticText16.Wrap( -1 )
         fgSizer3.Add( self.m_staticText16, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
         
index f7e6249..981f58b 100644 (file)
@@ -9,6 +9,7 @@ import sys
 from copy import copy
 import dialog
 from listlex import *
 from copy import copy
 import dialog
 from listlex import *
+from functions import treat_var_mod
 
 
 def OnOpen(self, type):
 
 
 def OnOpen(self, type):
@@ -156,6 +157,21 @@ class PrepSimi :
         self.dial.CenterOnParent()
         self.val = self.dial.ShowModal()
         if self.val == wx.ID_OK :
         self.dial.CenterOnParent()
         self.val = self.dial.ShowModal()
         if self.val == wx.ID_OK :
+            if self.dial.check_bystar.GetValue() :
+                variables = treat_var_mod(self.parametres['stars'])
+                vardial = dialog.OptLexi(parent) 
+                vardial.listet = self.parametres['stars']
+                vardial.variables = [v for v in variables]
+                for et in vardial.variables :
+                    vardial.list_box_1.Append(et)
+                nval = vardial.ShowModal()
+                if nval == wx.ID_OK :
+                    if vardial.choice.GetSelection() == 1 :
+                        listet = [vardial.listet[i] for i in dial.list_box_1.GetSelections()]
+                    else :
+                        listet = variables[vardial.variables[dial.list_box_1.GetSelections()[0]]]
+                    dial.Destroy()
+                    self.tableau.etline = self.Source.corpus.make_etline(listet)
             self.make_param()
 
     def make_param(self) :
             self.make_param()
 
     def make_param(self) :
index 3ebb9dd..699bde5 100644 (file)
@@ -13,7 +13,6 @@ parser.add_option("-f", "--file", dest="filename",
 
 #print args
 #print options
 
 #print args
 #print options
-
 import sys
 reload(sys)
 import locale
 import sys
 reload(sys)
 import locale
@@ -104,8 +103,9 @@ if sys.platform == 'darwin' :
 else :
     sys.setdefaultencoding(locale.getpreferredencoding())
 #chemin de l'application
 else :
     sys.setdefaultencoding(locale.getpreferredencoding())
 #chemin de l'application
-
+#print 'ATTENTION APPLIPATH'
 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
 AppliPath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
+#AppliPath = '/home/pierre/workspace/iramuteqNG'
 #chemin des images
 ImagePath = os.path.join(AppliPath, 'images')
 #configuration generale
 #chemin des images
 ImagePath = os.path.join(AppliPath, 'images')
 #configuration generale
@@ -1123,7 +1123,6 @@ class MyApp(wx.App):
         Create and show the splash screen.  It will then create and show
         the main frame when it is time to do so.
         """
         Create and show the splash screen.  It will then create and show
         the main frame when it is time to do so.
         """
-
         wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
         self.SetAppName("Iramuteq")       
         splash = MySplashScreen()
         wx.SystemOptions.SetOptionInt("mac.window-plain-transition", 1)
         self.SetAppName("Iramuteq")       
         splash = MySplashScreen()
index 642121c..0211668 100644 (file)
--- a/layout.py
+++ b/layout.py
@@ -952,7 +952,7 @@ class SimiLayout(DefaultTextLayout) :
         if self.actives is None :
             with codecs.open(self.pathout['actives.csv'], 'r', self.parametres['encoding']) as f :
                 self.actives = f.read()
         if self.actives is None :
             with codecs.open(self.pathout['actives.csv'], 'r', self.parametres['encoding']) as f :
                 self.actives = f.read()
-            self.actives = [act for act in self.actives.splitlines()]
+            self.actives = self.actives.splitlines()#[act for act in self.actives.splitlines()]
         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'], selected = selected) 
         prep = PrepSimi(self.ira, self.parametres, indices_simi)
         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'], selected = selected) 
         prep = PrepSimi(self.ira, self.parametres, indices_simi)
index 43f4564..4b417e3 100644 (file)
@@ -168,12 +168,19 @@ class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSor
         self.PopupMenu(menu)
         menu.Destroy()
 
         self.PopupMenu(menu)
         menu.Destroy()
 
+    def getselectedwords(self) :
+        words = [self.getColumnText(self.GetFirstSelected(), 6)]
+        last = self.GetFirstSelected()
+        while self.GetNextSelected(last) != -1:
+            last = self.GetNextSelected(last)
+            words.append(self.getColumnText(last, 1))
+        return words
 
     def OnPopupOne(self, event):
         activenotebook = self.parent.nb.GetSelection()
         page = self.parent.nb.GetPage(activenotebook)
         corpus = page.corpus
 
     def OnPopupOne(self, event):
         activenotebook = self.parent.nb.GetSelection()
         page = self.parent.nb.GetPage(activenotebook)
         corpus = page.corpus
-        word = self.getColumnText(self.GetFirstSelected(), 0)
+        word = self.getselectedwords()[0]
         lems = corpus.getlems()
         rep = []
         for forme in lems[word].formes :
         lems = corpus.getlems()
         rep = []
         for forme in lems[word].formes :
index eb80f07..65b83c4 100644 (file)
@@ -120,6 +120,11 @@ class SearchList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSort
         s = self.itemDataMap[index][col]
         return s
 
         s = self.itemDataMap[index][col]
         return s
 
+    def OnGetItemData(self, item) :
+        index = self.itemIndexMap[item]
+        s = self.itemDataMap[index]
+        return s
+
     def OnItemSelected(self, event):
         self.currentItem = event.m_itemIndex
         event.Skip()
     def OnItemSelected(self, event):
         self.currentItem = event.m_itemIndex
         event.Skip()
@@ -180,6 +185,13 @@ class SearchList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSort
         self.PopupMenu(menu)
         menu.Destroy()
 
         self.PopupMenu(menu)
         menu.Destroy()
 
+    def getselectedwords(self) :
+        words = [self.getColumnText(self.GetFirstSelected(), 6)]
+        last = self.GetFirstSelected()
+        while self.GetNextSelected(last) != -1:
+            last = self.GetNextSelected(last)
+            words.append(self.getColumnText(last, 6))
+        return words
 
     def OnPopupOne(self, event):
         activenotebook = self.parent.nb.GetSelection()
 
     def OnPopupOne(self, event):
         activenotebook = self.parent.nb.GetSelection()
@@ -248,11 +260,11 @@ class SearchList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSort
         win.Show(True)
 
     def OnPopupThree(self, event) :
         win.Show(True)
 
     def OnPopupThree(self, event) :
-        datas = [self.dlist[self.GetItemData(self.GetFirstSelected())]]
+        datas = [self.OnGetItemData(self.GetFirstSelected())]
         last = self.GetFirstSelected()
         while self.GetNextSelected(last) != -1:
             last = self.GetNextSelected(last)
         last = self.GetFirstSelected()
         while self.GetNextSelected(last) != -1:
             last = self.GetNextSelected(last)
-            data = self.dlist[self.GetItemData(last)]
+            data = self.OnGetItemData(last)
             datas += [data]
         colnames = self.first[2:]
         rownames = [val[1] for val in datas]
             datas += [data]
         colnames = self.first[2:]
         rownames = [val[1] for val in datas]
@@ -271,11 +283,11 @@ class SearchList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSort
 
     def ongraphdendro(self, evt) :
         corpus = self.parent.corpus
 
     def ongraphdendro(self, evt) :
         corpus = self.parent.corpus
-        datas = [self.dlist[self.GetItemData(self.GetFirstSelected())]]
+        datas = [self.OnGetItemData(self.GetFirstSelected())]
         last = self.GetFirstSelected()
         while self.GetNextSelected(last) != -1:
             last = self.GetNextSelected(last)
         last = self.GetFirstSelected()
         while self.GetNextSelected(last) != -1:
             last = self.GetNextSelected(last)
-            data = self.dlist[self.GetItemData(last)]
+            data = self.OnGetItemData(last)
             datas += [data]
         colnames = self.first[2:]
         rownames = [val[1] for val in datas]
             datas += [data]
         colnames = self.first[2:]
         rownames = [val[1] for val in datas]
index d78c8fd..4982cbd 100644 (file)
@@ -278,15 +278,15 @@ class Lexico(AnalyseText) :
         mineff = self.parametres['mineff']
         #dlg = progressbar(self, maxi = 3)
         tabout = self.corpus.make_lexitable(mineff, self.listet)
         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))
+        #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')
         write_tab(tabout, self.dictpathout['tableafcm'])
         
         #log.warning('ATTENTION : gethapaxuces')
index c8d1d62..8b296bb 100644 (file)
@@ -110,6 +110,7 @@ class SimiTxt(AnalyseText):
         self.listet = self.corpus.make_etoiles()
         self.listet.sort()
         self.parametres['stars'] = copy(self.listet)
         self.listet = self.corpus.make_etoiles()
         self.listet.sort()
         self.parametres['stars'] = copy(self.listet)
+        self.stars = copy(self.listet)
         self.parametres['sfromchi'] = False
 
 
         self.parametres['sfromchi'] = False
 
 
index 01ccf9a..199d4a6 100644 (file)
@@ -27,15 +27,16 @@ class WordCloud(AnalyseText):
         self.parametres['type'] = 'wordcloud'
         #FIXME
         limit = 3
         self.parametres['type'] = 'wordcloud'
         #FIXME
         limit = 3
-        mode = 'both'
-        if mode == 'both' :
+        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)
             self.actives = self.corpus.make_actives_limit(limit, 1)
             self.actives += self.corpus.make_actives_limit(limit, 2)
-        elif mode == 'act' :
+        elif self.parametres['mode'] == 0 :
             self.actives = self.corpus.make_actives_limit(limit, 1)
             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)]) 
         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'])
-        self.make_option()
+        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()
@@ -48,12 +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['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['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') :