1 # -*- coding: utf-8 -*-
2 #Author: Pierre Ratinaud
3 #Copyright (c) 2016-2017 Pierre Ratinaud
6 from chemins import ConstructPathOut, StatTxtPathOut, PathOut, ffr
7 from analysetxt import AnalyseText
10 from functions import exec_rcode, progressbar, check_Rresult, CreateIraFile, print_liste, treat_var_mod, write_tab, DoConf, TGen
11 from dialog import OptLexi
13 from PrintRScript import LabbeScript
14 from time import sleep
17 log = logging.getLogger('iramuteq.labbe')
19 class DistLabbe(AnalyseText) :
21 pathout = self.pathout.dirout
22 self.dictpathout = StatTxtPathOut(pathout)
23 self.parametres['ira'] = self.dictpathout['ira']
31 def preferences(self) :
32 listet = self.corpus.make_etoiles()
34 variables = treat_var_mod(listet)
35 var = [v for v in variables]
36 dial = OptLexi(self.parent)
40 dial.list_box_1.Append(et)
42 self.dialok = dial.ShowModal()
43 if self.dialok == wx.ID_OK :
44 if dial.choice.GetSelection() == 1 :
45 ListEt = [listet[i] for i in dial.list_box_1.GetSelections()]
47 ListEt = variables[var[dial.list_box_1.GetSelections()[0]]]
50 self.parametres['mineff'] = dial.spin.GetValue()
51 if dial.choice_indice.GetSelection() == 0 :
52 self.parametres['indice'] = 'hypergeo'
54 self.parametres['indice'] = 'chi2'
55 self.parametres['typeformes'] = dial.typeformes.GetSelection()
56 self.parametres['clnb'] = len(ListEt)
58 return self.parametres
63 def make_lexico(self) :
64 mineff = self.parametres['mineff']
65 tabout = self.corpus.make_lexitable(mineff, self.listet, gram = self.parametres['typeformes'])
66 write_tab(tabout, self.dictpathout['tableafcm'])
67 #tabout = self.corpus.make_efftype_from_etoiles(self.listet)
68 #write_tab(tabout, self.dictpathout['tabletypem'])
70 self.dlg.Update(2, u'R...')
71 script = LabbeScript(self)
73 self.doR(script.scriptout, dlg = self.dlg, message = 'R...')
76 self.dlg.Update(3, u'Chargement...')
77 afcf_graph_list = [[os.path.basename(self.dictpathout['afcf_row']), u'lignes'],\
78 [os.path.basename(self.dictpathout['afcf_col']), u'colonnes']]
79 #afct_graph_list = [[os.path.basename(self.dictpathout['afct_row']), u'lignes'],\
80 # [os.path.basename(self.dictpathout['afct_col']), u'colonnes']]
81 print_liste(self.dictpathout['liste_graph_afcf'],afcf_graph_list)
82 #print_liste(self.dictpathout['liste_graph_afct'],afct_graph_list)