From: cynthia Date: Sun, 7 Oct 2012 15:40:17 +0000 (+0200) Subject: ... X-Git-Url: http://iramuteq.org/git?p=iramuteq;a=commitdiff_plain;h=c5650ea708101e654d8851350494c0e9a712b6ed ... --- diff --git a/PrintRScript.py b/PrintRScript.py index d21ad22..1bb0af1 100644 --- a/PrintRScript.py +++ b/PrintRScript.py @@ -912,18 +912,19 @@ class PrintSimiScript(PrintRScript) : class WordCloudRScript(PrintRScript) : def make_script(self) : - self.Source([self.analyse.parent.RscriptsPath['Rgraph']]) + self.sources([self.analyse.parent.RscriptsPath['Rgraph']]) self.packages(['wordcloud']) bg_col = Rcolor(self.parametres['col_bg']) txt_col = Rcolor(self.parametres['col_text']) txt = """ act <- read.csv2("%s", header = FALSE, row.names=1, sep='\t') selected.col <- read.table("%s") - toprint <- act[selected.col + 1,] + toprint <- act[selected.col[,1] + 1,] open_file_graph("%s", width = %i, height = %i) par(bg=rgb%s) wordcloud(row.names(toprint), toprint[,1], scale=c(%f,%f), random.order=FALSE, colors=rgb%s) dev.off() - """ % (self.parametres['actives_eff.csv'], self.parametres['selected.csv'], self.parametres['graphout'], self.parametres['width'], self.parametres['height'], bg_col, self.parametres['maxcex'], self.parametres['mincex'], txt_col) + """ % (ffr(self.analyse.pathout['actives_eff.csv']), ffr(self.analyse.pathout['selected.csv']), + ffr(self.parametres['graphout']), self.parametres['width'], self.parametres['height'], bg_col, self.parametres['maxcex'], self.parametres['mincex'], txt_col) self.add(txt) self.write() diff --git a/textwordcloud.py b/textwordcloud.py index b56d16d..b31e940 100644 --- a/textwordcloud.py +++ b/textwordcloud.py @@ -11,6 +11,7 @@ from guifunct import getPage, getCorpus, SelectColumn from ConfigParser import RawConfigParser from functions import sortedby, progressbar, CreateIraFile, exec_rcode, check_Rresult, MessageImage from dialog import StatDialog, PrefWordCloud +from PrintRScript import WordCloudRScript #from openanalyse import OpenAnalyse #from ttparser import * import tempfile @@ -41,24 +42,24 @@ class WordCloud(AnalyseText): dial.CenterOnParent() res = dial.ShowModal() if res == wx.ID_OK : - self.parametres['width'] = pref.spin_L.GetValue() - self.parametres['height'] = pref.spin_H.GetValue() - #maxword = pref.spin_maxword.GetValue() - self.parametres['mincex'] = float(pref.spin_mincex.GetValue())/float(10) - self.parametres['maxcex'] = float(pref.spin_maxcex.GetValue())/float(10) - self.parametres['col_text'] = pref.color_text.GetColour() - self.parametres['col_bg'] = pref.color_bg.GetColour() + self.parametres['width'] = dial.spin_L.GetValue() + self.parametres['height'] = dial.spin_H.GetValue() + #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() outgraph = os.path.join(os.path.dirname(self.pathout['zipf.png']), 'nuage_') nb = 1 while os.path.exists(outgraph + str(nb) + '.png') : nb += 1 - self.parametres['outgraph'] = outgraph + str(nb) + '.png' + self.parametres['graphout'] = outgraph + str(nb) + '.png' def make_wordcloud(self) : - act = [[act, self.corpus.getlemeff(act)] for act in self.actives] + act = ['\t'.join([act, `self.corpus.getlemeff(act)`]) for act in self.actives] with open(self.pathout['actives_eff.csv'], 'w') as f : - f.write('\n'.join('\t'.join([[val[0], `val[1]`] for val in act]))) + f.write('\n'.join(act).encode(self.ira.syscoding)) #################################################################### # self.conf = None # self.parent = parent