1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2008-2020 Pierre Ratinaud
4 #modification pour python 3 : Laurent Mérat, 6x7 - mai 2020
7 #------------------------------------
8 # import des modules python
9 #------------------------------------
12 from time import sleep
15 #------------------------------------
16 # import des modules wx
17 #------------------------------------
20 #------------------------------------
21 # import des fichiers du projet
22 #------------------------------------
23 from chemins import ConstructPathOut, StatTxtPathOut, PathOut, ffr
24 from analysetxt import AnalyseText
25 from functions import exec_rcode, progressbar, check_Rresult, CreateIraFile, print_liste, treat_var_mod, write_tab, DoConf, TGen
26 from dialog import OptLexi
27 from PrintRScript import LabbeScript
30 log = logging.getLogger('iramuteq.labbe')
33 class DistLabbe(AnalyseText) :
36 pathout = self.pathout.dirout
37 self.dictpathout = StatTxtPathOut(pathout)
38 self.parametres['ira'] = self.dictpathout['ira']
46 def preferences(self) :
47 listet = self.corpus.make_etoiles()
49 variables = treat_var_mod(listet)
50 var = [v for v in variables]
51 dial = OptLexi(self.parent)
55 dial.list_box_1.Append(et)
57 self.dialok = dial.ShowModal()
58 if self.dialok == wx.ID_OK :
59 if dial.choice.GetSelection() == 1 :
60 ListEt = [listet[i] for i in dial.list_box_1.GetSelections()]
62 ListEt = variables[var[dial.list_box_1.GetSelections()[0]]]
65 self.parametres['mineff'] = dial.spin.GetValue()
66 if dial.choice_indice.GetSelection() == 0 :
67 self.parametres['indice'] = 'hypergeo'
69 self.parametres['indice'] = 'chi2'
70 self.parametres['typeformes'] = dial.typeformes.GetSelection()
71 self.parametres['clnb'] = len(ListEt)
73 return self.parametres
78 def make_lexico(self) :
79 mineff = self.parametres['mineff']
80 tabout = self.corpus.make_lexitable(mineff, self.listet, gram = self.parametres['typeformes'])
81 write_tab(tabout, self.dictpathout['tableafcm'])
82 #tabout = self.corpus.make_efftype_from_etoiles(self.listet)
83 #write_tab(tabout, self.dictpathout['tabletypem'])
84 self.dlg = progressbar(self, 3)
86 self.dlg.Update(2, 'R...')
87 script = LabbeScript(self)
89 self.doR(script.scriptout, dlg = self.dlg, message = 'R...')
91 self.dlg.Update(3, 'Chargement...')
92 afcf_graph_list = [[os.path.basename(self.dictpathout['afcf_row']), 'lignes'],\
93 [os.path.basename(self.dictpathout['afcf_col']), 'colonnes']]
94 #afct_graph_list = [[os.path.basename(self.dictpathout['afct_row']), 'lignes'],\
95 # [os.path.basename(self.dictpathout['afct_col']), 'colonnes']]
96 print_liste(self.dictpathout['liste_graph_afcf'],afcf_graph_list)
97 #print_liste(self.dictpathout['liste_graph_afct'],afct_graph_list)