X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=blobdiff_plain;f=OptionAlceste.py;h=80366de25cdc5d12c1af9150b6ef19f695f56d81;hp=ea3ba80956ac12e7053a41e07ce8b0884df4ae7c;hb=42499e5db4394973bd0761d40ea09e515925ed4b;hpb=22cd27b2bbe9ab1ffa7ef06fa764b5147ae17dad diff --git a/OptionAlceste.py b/OptionAlceste.py index ea3ba80..80366de 100755 --- a/OptionAlceste.py +++ b/OptionAlceste.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- #Author: Pierre Ratinaud #Copyright (c) 2008-2009 Pierre Ratinaud -#Lisense: GNU/GPL +#License: GNU/GPL import wx import shutil @@ -20,50 +20,54 @@ class OptionAlc(wx.Dialog): self.DictPath = parametres['pathout'] self.AlcesteConf = parametres self.choose = False - - self.label_1 = wx.StaticText(self, -1, u"Lemmatisation") - self.radio_1 = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) + self.svdmethod = ['svdR', 'irlba'] + if self.parent.pref.getboolean('iramuteq','libsvdc') : + self.svdmethod.append('svdlibc') + #self.label_1 = wx.StaticText(self, -1, u"Lemmatisation") + #self.radio_1 = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) - self.label_12 = wx.StaticText(self, -1, u"Classification") - self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=[u"double sur UC", u"simple sur UCE", u"simple sur UCI"], majorDimension=0, style=wx.RA_SPECIFY_ROWS) #, u"simple sur UCE (non implemente)" - self.label_2 = wx.StaticText(self, -1, u"taille uc 1") - self.spin_ctrl_1 = wx.SpinCtrl(self, -1, "formes actives",size = (100,30), min=0, max=100) - self.label_3 = wx.StaticText(self, -1, u"taille uc 2") - self.spin_ctrl_2 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=100) - self.lab_nbcl = wx.StaticText(self, -1, u"nombre de classes terminales de la phase 1") - self.spin_nbcl = wx.SpinCtrl(self, -1, "",size = (100,30), min=2, max=100) - txt = """Nombre minimum d'uce par classe -(0 = automatique)""" + self.label_12 = wx.StaticText(self, -1, _(u"Clustering").decode('utf8')) + self.radio_box_2 = wx.RadioBox(self, -1, u"", choices=[_(u"double on RST").decode('utf8'), _(u"simple on text segments").decode('utf8'), _(u"simple on texts").decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS) #, u"simple sur UCE (non implemente)" + self.label_2 = wx.StaticText(self, -1, _(u"Size of rst1").decode('utf8')) + self.spin_ctrl_1 = wx.SpinCtrl(self, -1, _(u"actives forms").decode('utf8'),size = (100,30), min=0, max=1000000) + self.label_3 = wx.StaticText(self, -1, _(u"Size of rst2").decode('utf8')) + self.spin_ctrl_2 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000000) + self.lab_nbcl = wx.StaticText(self, -1, _(u"Number of terminal clusters on phase 1").decode('utf8')) + self.spin_nbcl = wx.SpinCtrl(self, -1, "",size = (100,30), min=2, max=1000000) + txt = _(u"Minimum frequency of text segments by clusters (0=automatic)").decode('utf8') self.label_7 = wx.StaticText(self, -1, txt) - self.spin_ctrl_4 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000) - txt = u"""Fréquence minimum d'une forme -analysée (2 = automatique)""" + self.spin_ctrl_4 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000000) + txt = _(u"Minimum frequency of an analyzed form (2=automatic)").decode('utf8') self.label_8 = wx.StaticText(self, -1, txt) - self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=2, max=1000) - self.label_max_actives = wx.StaticText(self, -1, u"Nombre maximum de formes analysées") - self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=10000) - self.label_4 = wx.StaticText(self, -1, u"Configuration \ndes clés d'analyse") - self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "") + self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=2, max=1000000) + self.label_max_actives = wx.StaticText(self, -1, _(u"Maximum number of analyzed forms").decode('utf8')) + self.spin_max_actives = wx.SpinCtrl(self, -1, "",size = (100,30), min=20, max=1000000) + self.label_svd = wx.StaticText(self, -1, _(u"svd method").decode('utf8')) + self.choicesvd = wx.Choice( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, self.svdmethod, 0 ) + self.label_patate = wx.StaticText(self, -1, _(u"Potato mode (less precise, faster)").decode('utf8')) + self.check_patate = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + #self.label_4 = wx.StaticText(self, -1, u"Configuration \ndes clés d'analyse") + #self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "") self.button_1 = wx.Button(self, wx.ID_CANCEL, "") - self.button_2 = wx.Button(self, wx.ID_DEFAULT, u"Valeurs par défaut") + self.button_2 = wx.Button(self, wx.ID_DEFAULT, _(u"Default values").decode('utf8')) self.button_4 = wx.Button(self, wx.ID_OK, "") self.static_line_1 = wx.StaticLine(self, -1) self.__set_properties() self.__do_layout() - self.Bind(wx.EVT_BUTTON, self.OnKeyPref, self.button_5) + #self.Bind(wx.EVT_BUTTON, self.OnKeyPref, self.button_5) self.Bind(wx.EVT_BUTTON, self.OnDef, self.button_2) def __set_properties(self): - self.SetTitle("Options") + self.SetTitle(_(u"Settings").decode('utf8')) #lang = self.AlcesteConf.get('ALCESTE', 'lang') #self.choice_dict.SetSelection(self.langues.index(lang)) - DefaultLem = self.parametres['lem'] - if DefaultLem : - self.radio_1.SetSelection(0) - else: - self.radio_1.SetSelection(1) + #DefaultLem = self.parametres['lem'] + #if DefaultLem : + # self.radio_1.SetSelection(0) + #else: + # self.radio_1.SetSelection(1) self.radio_box_2.SetSelection(int(self.parametres['classif_mode'])) self.spin_ctrl_1.SetValue(int(self.parametres['tailleuc1'])) self.spin_ctrl_2.SetValue(int(self.parametres['tailleuc2'])) @@ -72,20 +76,29 @@ analysée (2 = automatique)""" self.spin_ctrl_5.Disable() self.spin_max_actives.SetValue(int(self.parametres['max_actives'])) self.spin_nbcl.SetValue(int(self.parametres['nbcl_p1'])) + if 'svdmethod' in self.parametres : + self.choicesvd.SetSelection(self.svdmethod.index(self.parametres['svdmethod'])) + else : + self.choicesvd.SetSelection(1) + if 'mode.patate' in self.parametres : + self.check_patate.SetValue(self.parametres['mode.patate']) + else : + self.check_patate.SetValue(False) + def __do_layout(self): sizer_1 = wx.BoxSizer(wx.VERTICAL) sizer_2 = wx.BoxSizer(wx.VERTICAL) - grid_sizer2 = wx.FlexGridSizer(15, 2, 0, 0) + grid_sizer2 = wx.FlexGridSizer(0, 2, 0, 0) grid_button = wx.FlexGridSizer(1, 3, 0, 0) #grid_sizer2.Add(self.label_dict, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) #grid_sizer2.Add(self.choice_dict, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) - grid_sizer2.Add(self.label_1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) - grid_sizer2.Add(self.radio_1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) - grid_sizer2.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 1) - grid_sizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 1) + #grid_sizer2.Add(self.label_1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + #grid_sizer2.Add(self.radio_1, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + #grid_sizer2.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 1) + #grid_sizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 1) grid_sizer2.Add(self.label_12, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer2.Add(self.radio_box_2, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) @@ -122,8 +135,13 @@ analysée (2 = automatique)""" grid_sizer2.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 1) grid_sizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 1) - grid_sizer2.Add(self.label_4, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) - grid_sizer2.Add(self.button_5, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + grid_sizer2.Add(self.label_svd, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + grid_sizer2.Add(self.choicesvd, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + grid_sizer2.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 1) + grid_sizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 1) + + grid_sizer2.Add(self.label_patate, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) + grid_sizer2.Add(self.check_patate, 0, wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0) grid_sizer2.Add(wx.StaticLine(self), 0, wx.EXPAND | wx.ALL, 1) grid_sizer2.Add(wx.StaticLine(self, -1), 0, wx.EXPAND | wx.ALL, 1) @@ -168,8 +186,8 @@ class OptionPam(wx.Dialog): self.label_1 = wx.StaticText(self, -1, u"Lemmatisation") self.radio_1 = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) - self.label_exp = wx.StaticText(self, -1, u"Utiliser le dict. des expressions") - self.radio_exp = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) + #self.label_exp = wx.StaticText(self, -1, u"Utiliser le dict. des expressions") + #self.radio_exp = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS) txt = u"""Methode de construction de la matrice des distances""" self.label_12 = wx.StaticText(self, -1, txt) @@ -212,10 +230,10 @@ de la matrice des distances""" else: self.radio_1.SetSelection(1) expressions = self.pamconf.getboolean('pam', 'expressions') - if expressions : - self.radio_exp.SetSelection(0) - else : - self.radio_exp.SetSelection(1) + #if expressions : + # self.radio_exp.SetSelection(0) + #else : + # self.radio_exp.SetSelection(1) self.choice_1.SetSelection(self.distance.index(self.pamconf.get('pam', 'method'))) if self.pamconf.get('pam', 'cluster_type') == u'pam' : self.radio_box_3.SetSelection(0)