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 += """
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:]))
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] != '*****']
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 == {} :
- 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 == {} :
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 :
- 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 = []
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)
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) + '")'
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
}
}
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 !')
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)
'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
lang = french
douce = 1
ucemethod = 1
-ucesize = 35
+ucesize = 40
keep_ponct = 0
tolist = 0
etoile = 1
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 :
- det[et[0]][et[1]] = 1
+ det[et[0]][endet] = 1
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
+ return det
def make_and_write_profile_et(self, ucecl, fileout) :
log.info('etoiles/classes')
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) :
ucetxt = txt.split('laphrasepoursplitter')
else :
txt = ' '.join(txt)
+
+ print 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
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 )
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.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 )
from copy import copy
import dialog
from listlex import *
+from functions import treat_var_mod
def OnOpen(self, type):
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) :
#print args
#print options
-
import sys
reload(sys)
import locale
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 = '/home/pierre/workspace/iramuteqNG'
#chemin des images
ImagePath = os.path.join(AppliPath, 'images')
#configuration generale
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()
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)
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
- word = self.getColumnText(self.GetFirstSelected(), 0)
+ word = self.getselectedwords()[0]
lems = corpus.getlems()
rep = []
for forme in lems[word].formes :
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()
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()
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)
- data = self.dlist[self.GetItemData(last)]
+ data = self.OnGetItemData(last)
datas += [data]
colnames = self.first[2:]
rownames = [val[1] for val in datas]
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)
- data = self.dlist[self.GetItemData(last)]
+ data = self.OnGetItemData(last)
datas += [data]
colnames = self.first[2:]
rownames = [val[1] for val in datas]
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')
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['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)
- elif mode == 'act' :
+ elif self.parametres['mode'] == 0 :
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)])
- 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()
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['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') :