-class WordCloud():
- def __init__(self, parent, cmd = False, lem = True, exp = True):
-####################################################################
- self.conf = None
- self.parent = parent
- self.type = 'alceste'
- self.cmd = cmd
- self.ConfigPath = parent.ConfigPath
- self.DictPath = parent.DictPath
- self.KeyConf = RawConfigParser()
- self.KeyConf.read(self.ConfigPath['key'])
- page = getPage(self.parent)
- if page is not None :
- self.corpus = getCorpus(page)
- if self.corpus is not None :
- self.pathout = ConstructPathOut(self.corpus.parametre['openpath'], 'WordCloud')
- self.dictpathout = StatTxtPathOut(self.pathout)
- self.val = wx.ID_OK
- else :
- self.corpus = Corpus(parent)
- self.corpus.parametre['encodage'] = parent.corpus_encodage
- self.corpus.parametre['lang'] = parent.corpus_lang
- self.corpus.parametre['filename'] = parent.filename
- self.pathout = ConstructPathOut(self.corpus.parametre['filename'], 'WordCloud')
- self.dictpathout = StatTxtPathOut(self.pathout)
- self.corpus.dictpathout = self.dictpathout
- if not self.cmd :
- dial = StatDialog(self,parent)
- dial.CenterOnParent()
- self.val = dial.ShowModal()
- else :
- self.val = wx.ID_OK
- if self.val == wx.ID_OK :
- if not self.cmd :
- if dial.radio_lem.GetSelection() == 0 : lem = True
- else : lem = False
- if dial.exp.GetSelection() == 0 : exp = True
- else : exp = False
- self.make_uce = dial.check_uce.GetValue()
- self.corpus.parametre['nbforme_uce'] = dial.spin_ctrl_4.GetValue()
- self.corpus.parametre['max_actives'] = dial.spin_max_actives.GetValue()
- self.corpus.parametre['eff_min_uce'] = self.corpus.parametre['nbforme_uce']
- else :
- lem = True
- exp = True
- self.make_uce = False
- self.corpus.parametre['nbforme_uce'] = None
- self.corpus.parametre['eff_min_uce'] = None
- self.corpus.parametre['lem'] = lem
- self.corpus.parametre['expressions'] = exp
- self.corpus.supplementaires = [option for option in self.KeyConf.options('KEYS') if self.KeyConf.get('KEYS', option) == "2"]
- self.corpus.typeactive = [option for option in self.KeyConf.options('KEYS') if self.KeyConf.get('KEYS', option) == "1"]
- self.make_corpus()
-
- if self.val == wx.ID_OK :
- if 'supplementaires' not in dir(self.corpus) :
- self.corpus.supplementaires = [option for option in self.KeyConf.options('KEYS') if self.KeyConf.get('KEYS', option) == "2"]
- if 'typeactive' not in dir(self.corpus) :
- self.corpus.typeactive = [option for option in self.KeyConf.options('KEYS') if self.KeyConf.get('KEYS', option) == "1"]
- self.make_stats()
-
- def make_corpus(self) :
- if not self.cmd :
- self.dlg = progressbar(self, 7)
- else :
- self.dlg = None
- self.corpus.content = self.parent.content
- ucis_txt, ucis_paras_txt = self.corpus.start_analyse(self.parent, dlg = self.dlg, cmd = self.cmd, fromtt = False)
- del ucis_txt
-
- if not self.cmd :
- self.dlg.Update(5, '%i UCI...' % len(ucis_paras_txt))
- self.corpus.make_ucis_paras_uces(ucis_paras_txt, make_uce = self.make_uce)
- del ucis_paras_txt