#wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(1.5, 0.2), random.order=FALSE, colors = colcloud[i])
yval <- 1.1
plot(0,0,pch='', axes = FALSE)
- vcex <- norm.vec(lclasses[[i]], 1.5, 1.5)
+ vcex <- norm.vec(lclasses[[i]], 1, 2)
for (j in 1:length(lclasses[[i]])) {
yval <- yval-(strheight( names(lclasses[[i]])[j],cex=vcex[j])+0.02)
text(-0.9, yval, names(lclasses[[i]])[j], cex = vcex[j], col = colcloud[i], adj=0)
}
}
+ if (!from.cmd) {
+ dev.off()
+ }
}
lclasses <- list()
for (classe in 1:length(sum.cl)) {
ntoplot <- toplot[,classe]
+ names(ntoplot) <- rownames(toplot)
ntoplot <- ntoplot[order(ntoplot, decreasing = TRUE)]
ntoplot <- round(ntoplot, 0)
- ntoplot <- ntoplot[1:nbbycl]
+ if (length(toplot) > nbbycl) {
+ ntoplot <- ntoplot[1:nbbycl]
+ }
ntoplot <- ntoplot[order(ntoplot)]
+ ntoplot <- which(ntoplot > 0)
#ntoplot <- ifelse(length(ntoplot) > nbbycl, ntoplot[1:nbbycl], ntoplot)
lclasses[[classe]] <- ntoplot
}
plot.phylo(tree,label.offset=0.1,tip.col=col, type=type.dendro)
for (i in rev(tree.order)) {
par(mar=c(0,0,1,0),cex=0.9)
- wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(4, 0.8), random.order=FALSE, colors = colcloud[i])
+ wordcloud(names(lclasses[[i]]), lclasses[[i]], scale = c(2.5, 0.5), random.order=FALSE, colors = colcloud[i])
}
}
self.dlg = dlg
self.parametres = parametres
self.val = False
- print self.parametres
if not 'pathout' in self.parametres :
self.parametres['pathout'] = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']).mkdirout()
- print self.parametres
self.pathout = PathOut(analyse_type = self.parametres['type'], dirout = self.parametres['pathout'])
- print self.pathout.dirout
else :
self.pathout = PathOut(filename = tableau.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
else :
self.val = False
if dlg :
- self.dlg.Destroy()
+ try :
+ self.dlg.Destroy()
+ except :
+ pass
else :
#if isinstance(dlg, wx.ProgressDialog) :
# self.dlg.Destroy()
willowy willowy adj
willpower willpower nom
willpowers willpower nom
-wills will nom
+wills wills nom
wilt wilt nom
wilted wilt ver
wilting wilt ver
yours yours sw
yourself yourself sw
yourselves yourselves sw
-yous you nom
+yous yous nom
youth youth nom
youthfulness youthfulness nom
youthfulnesses youthfulness nom
def __getitem__(self, key):
return self.tgen[key]
- def read(self, path):
+ def read(self, path = None):
+ if path is None :
+ path = self.path
with codecs.open(path, 'r', self.encoding) as f :
tgen = f.read()
tgen = [line.split('\t') for line in tgen.splitlines()]
return [i, int(line[0]), int(line[1]), float(line[2]), float(line[3]), line[6], line[4], line[5]]
def ReadProfileAsDico(File, Alceste=False, encoding = sys.getdefaultencoding()):
- #print 'lecture des profils : ReadProfileAsDico'
- #if Alceste :
- # print 'lecture du dictionnaire de type'
- # dictlem = {}
- # for line in parent.corpus.lem_type_list :
- # dictlem[line[0]] = line[1]
dictlem = {}
print 'lecture des profiles'
- #encoding = sys.getdefaultencoding()
FileReader = codecs.open(File, 'r', encoding)
Filecontent = FileReader.readlines()
FileReader.close()
return '\n\n'.join(proflist)
def formatExceptionInfo(maxTBlevel=5):
- cla, exc, trbk = sys.exc_info()
- try :
- excName = cla.__name__
- except :
- excName = 'None'
- try:
- excArgs = exc.args[0]
- except :
- excArgs = "<no args>"
- excTb = traceback.format_tb(trbk, maxTBlevel)
- return (excName, excArgs, excTb)
+ cla, exc, trbk = sys.exc_info()
+ try :
+ excName = cla.__name__
+ except :
+ excName = 'None'
+ try:
+ excArgs = exc.args[0]
+ except :
+ excArgs = "<no args>"
+ excTb = traceback.format_tb(trbk, maxTBlevel)
+ return (excName, excArgs, excTb)
#fonction des etudiants de l'iut
else :
parent = self
try :
- print '###horrible hack progressbar'
maxi = int(maxi)
except :
maxi = 1
if self.tableau.parametres['colsep'] == 'tabulation' :
self.tableau.parametres['colsep'] = '\t'
self.tableau.parametres['filetype'] = 'csv'
+ self.tableau.parametres['encodage'] = dlg.le[dlg.list_encodages.GetSelection()]
elif getfileextension(filename) == '.xls' :
dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, sheet = True, size=(350, 200),
style=wx.DEFAULT_DIALOG_STYLE)
param['cexfromchi'] = self.dial.checkit.GetValue()
if 'sfromchi' in self.parametres :
param['sfromchi'] = self.dial.checki.GetValue()
- print param
if 'vlabcolor' in self.parametres :
param['vlabcolor'] = self.parametres['vlabcolor']
if 'check_bystar' in dir(self.dial) :
#License: GNU GPL
from optparse import OptionParser
+from wx import BusyCursor
parser = OptionParser()
parser.add_option("-f", "--file", dest="filename",
help="open FILE", metavar="FILE", default=False)
(options, args) = parser.parse_args()
-#print args
-#print options
import sys
reload(sys)
import locale
import tempfile
import codecs
import os
-import shutil
from random import randint
-from ConfigParser import *
+from ConfigParser import ConfigParser, RawConfigParser
import webbrowser
import gettext
import logging
#------------------------------------
import wx
-#import wx.aui
import wx.lib.agw.aui as aui
import wx.html
import wx.grid
import wx.lib.hyperlink as hl
#------------------------------------
-from functions import BugReport, PlaySound, ReadLexique, History, DoConf, ReadDicoAsDico, progressbar
+from functions import BugReport, PlaySound, History
from checkversion import NewVersion
from guifunct import *
from tableau import Tableau
-from dialog import PrefDialog, CorpusPref
+from dialog import PrefDialog
from tabfrequence import Frequences, FreqMultiple
from tabchi2 import ChiSquare
#from tabstudent import MakeStudent
from tabrsimple import InputText
from tabverges import Prototypical
from tabsplitvar import SplitMatrixFromVar
-#from textafcuci import AfcUci
from textdist import AnalysePam
from textstat import Stat
from textaslexico import Lexico
from textsimi import SimiTxt, SimiFromCluster
from textwordcloud import WordCloud, ClusterCloud
from textreinert import Reinert
-#from profile_segment import ProfileSegment
#from textcheckcorpus import checkcorpus
from openanalyse import OpenAnalyse
from corpus import Builder, SubBuilder
-#from sheet import MySheet
from checkinstall import CreateIraDirectory, CheckRPath, FindRPAthWin32, FindRPathNix, CheckRPackages, IsNew, UpgradeConf, CopyConf, RLibsAreInstalled
from chemins import RscriptsPath, ConstructConfigPath, ConstructDicoPath, ConstructGlobalPath, PathOut
from parse_factiva_xml import ImportFactiva
ConfigPath = ConstructConfigPath(UserConfigPath)
langues = {'french' : wx.LANGUAGE_FRENCH,
- 'english' : wx.LANGUAGE_ENGLISH,
- 'portuguese' : wx.LANGUAGE_PORTUGUESE,
- 'italian' : wx.LANGUAGE_ITALIAN,
- 'spanish' : wx.LANGUAGE_SPANISH}
+ 'english' : wx.LANGUAGE_ENGLISH,
+ 'portuguese' : wx.LANGUAGE_PORTUGUESE,
+ 'italian' : wx.LANGUAGE_ITALIAN,
+ 'spanish' : wx.LANGUAGE_SPANISH
+ }
code_langues = {'french' : 'fr_FR',
- 'english' : 'en',
- 'portuguese' : 'pt_PT',
- 'italian' : 'it_IT',
- 'spanish' : 'es_ES'
- }
+ 'english' : 'en',
+ 'portuguese' : 'pt_PT',
+ 'italian' : 'it_IT',
+ 'spanish' : 'es_ES'
+ }
#####################################################################
class IraFrame(wx.Frame):
#--------------------------------------------------------------------
self.statusbar = self.CreateStatusBar(2, wx.ST_SIZEGRIP)
self.statusbar.SetStatusWidths([-2, -3])
- self.statusbar.SetStatusText(u"Prêt", 0)
- self.statusbar.SetStatusText(u"Bienvenue", 1)
+ self.statusbar.SetStatusText(_(u"Ready"), 0)
+ self.statusbar.SetStatusText(_(u"Wellcome"), 1)
# min size for the frame itself isn't completely done.
# see the end up FrameManager::Update() for the test
self.tableau = Tableau(self,os.path.abspath(self.input_path[0]))
val = get_table_param(self, self.input_path[0])
if val == wx.ID_OK :
- self.tableau.make_content()
- OpenAnalyse(self, self.tableau.parametres)
- self.tree.OnItemAppend(self.tableau.parametres)
+ busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self)
+ wx.SafeYield()
+ try :
+ self.tableau.make_content()
+ OpenAnalyse(self, self.tableau.parametres)
+ self.tree.OnItemAppend(self.tableau.parametres)
+ del busy
+ except :
+ del busy
+ BugReport(self)
#self.tableau.show_tab()
def OnOpenAnalyse(self, event):
except:
BugReport(self)
- def SimiCluster(self, parametres = {}, fromprof = False, pathout = '', listactives = [], actives = [], tableau = None) :
- DoSimi(self, param = parametres, fromprof = fromprof, listactives = listactives, actives = actives, tableau = tableau)
+ def SimiCluster(self, parametres = {}, fromprof = False, tableau = None) :
+ self.analyse_matrix(DoSimi, parametres = parametres, analyse_type = 'simiclustermatrix', matrix = tableau)
# def OnSimi(self,evt):
# try :
from wx.lib.agw.fmresources import *
from chemins import ConstructPathOut, ChdTxtPathOut, FFF, ffr, PathOut, StatTxtPathOut, simipath
from ConfigParser import ConfigParser
-from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf, indices_simi, check_Rresult, progressbar, normpath_win32
+from functions import ReadProfileAsDico, GetTxtProfile, read_list_file, ReadList, exec_rcode, print_liste, BugReport, DoConf, indices_simi, check_Rresult, progressbar, normpath_win32, TGen
from ProfList import ProfListctrlPanel
from guiparam3d import param3d, simi3d
from PrintRScript import write_afc_graph, print_simi3d, PrintSimiScript
self.page = page
parametres = self.page.parametres
ira = wx.GetApp().GetTopWindow()
+ tgenpath = os.path.join(parametres['pathout'], 'tgen.csv')
self.page.tgens, etoiles = ReadList(parametres['tgenspec'], ira.syscoding, sep="\t")
+ tgen = TGen(path = tgenpath, encoding = parametres['encoding'])
+ tgen.read()
tgentab = False
gparent = None
for i in range(page.GetPageCount()) :
break
if tgentab :
self.page.tgentab.RefreshData(self.page.tgens)
+ self.page.tgentab.tgens = tgen.tgen
self.page.SetSelection(i)
else :
self.page.tgentab = ListForSpec(ira, gparent, self.page.tgens, etoiles[1:])
self.page.tgentab.tgen = True
+ self.page.tgentab.tgens = tgen.tgen
self.page.AddPage(self.page.tgentab, u'Tgens Specificities')
self.page.SetSelection(self.page.GetPageCount() - 1)
self.TabStat.parametres = parametres
self.ListPan = ListForSpec(ira, self, self.DictSpec, self.etoiles)
if os.path.exists(self.pathout['banalites.csv']) :
- self.listban = ListForSpec(ira, self, self.dictban, ['eff'] + self.etoiles)
+ self.listban = ListForSpec(ira, self, self.dictban, ['eff'] + self.etoiles, usefirst = True)
#self.ListPan2 = ListForSpec(sash.rightwin1, self, self.DictSpec, first)
self.ListPant = ListForSpec(ira, self, self.DictType, self.etoiles)
self.ListPanEff = ListForSpec(ira, self, self.DictEff, self.etoiles)
self.TabAFC.AddPage(self.tabAFCTGraph, 'AFC type')
self.TabStat.AddPage(self.TabAFC, 'AFC')
-
-
-
-
ira.nb.AddPage(self.TabStat, u'Spécificités')
self.ira = ira
self.panel_1.SetBackgroundColour('white')
self.deb = wx.StaticText(self.panel_1, -1, txt)
dendro_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
+ dendro_liste_img = wx.Image(os.path.join(self.ira.images_path,'but_dendro_liste.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
+ dendro_cloud_img= wx.Image(os.path.join(self.ira.images_path,'but_dendro_cloud.png'), wx.BITMAP_TYPE_ANY).ConvertToBitmap()
self.butdendro = wx.BitmapButton(self, -1, dendro_img)
- self.butdendrotexte = wx.BitmapButton(self, -1, dendro_img)
- self.butdendrocloud = wx.BitmapButton(self, -1, dendro_img)
+ self.butdendrotexte = wx.BitmapButton(self, -1, dendro_liste_img)
+ self.butdendrocloud = wx.BitmapButton(self, -1, dendro_cloud_img)
for i in range(0,len(list_graph)):
if os.path.exists(os.path.join(self.dirout,list_graph[i][0])) :
txt += """
load("%s")
source("%s")
+ if (is.null(debsup)) {
+ debsup <- debet
+ }
chistable <- chistabletot[1:(debsup-1),]
open_file_graph("%s", width=%i, height=%i, svg = %s)
plot.dendro.prof(tree.cut1$tree.cl, classes, chistable, nbbycl = 60, type.dendro="%s", bw=%s, lab=NULL)
txt += """
load("%s")
source("%s")
+ if (is.null(debsup)) {
+ debsup <- debet
+ }
chistable <- chistabletot[1:(debsup-1),]
open_file_graph("%s", width=%i, height=%i, svg=%s)
plot.dendro.cloud(tree.cut1$tree.cl, classes, chistable, nbbycl = 300, type.dendro="%s", bw=%s, lab=NULL)
tmpfile = tempfile.mktemp()
with open(tmpfile, 'w') as f :
f.write(txt)
+ busy = wx.BusyInfo(_("Please wait...").decode('utf8'), self.parent)
+ wx.SafeYield()
error = exec_rcode(self.ira.RPath, tmpfile, wait=True)
+ del busy
check_Rresult(self.ira, error)
self.list_graph.append([fileout, 'Dendrogramme CHD1 - %s' % type_dendro])
print_liste(self.dictpathout['liste_graph_chd'], self.list_graph)
#---------------------------------------------------------------------------
class ListForSpec(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.ColumnSorterMixin):
- def __init__(self, parent,gparent, dlist = {}, first = [], menu = True):
+ def __init__(self, parent,gparent, dlist = {}, first = [], usefirst = False, menu = True):
#def __init__(self, parent) :
wx.ListCtrl.__init__( self, parent, -1, style=wx.LC_REPORT|wx.LC_VIRTUAL|wx.LC_HRULES|wx.LC_VRULES)
self.parent=parent
self.dlist=dlist
self.first = first
self.tgen = False
- if 'etoiles' in dir(self.gparent) :
+ if 'etoiles' in dir(self.gparent) and not usefirst :
self.etoiles = self.gparent.etoiles
else :
self.etoiles = []
parametres = page.parametres
paneff = self.gparent.ListPanEff
panchi = self.gparent.ListPan
- #etoiles = self.gparent.etoiles
et = self.etoiles[ind]
-
- #if et.startswith(u'X.') :
- # et = et.replace(u'X.', u'*')
uces = corpus.getucesfrometoile(et)
self.la = [panchi.dlist[i][0] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
self.lchi = [panchi.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
- #lfreq = [paneff.dlist[i][ind+1] for i in range(0, len(panchi.dlist)) if panchi.dlist[i][ind+1] >= minind ]
if max(self.lchi) == float('inf') :
nchi = []
for val in self.lchi :
ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la)
items = dict([[i, '<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table><br>' % ntab2[i][0], ucestxt[i]])] for i in range(0,len(ucestxt))])
win = message(self, items, u"Segments de texte caractéristiques - %s" % self.first[ind], (900, 600))
- #win.html = '<html>\n' + '<br>'.join(['<br>'.join([ucis_txt[i], '<table bgcolor = #1BF0F7 border=0><tr><td><b>score : %.2f</b></td></tr></table>' % ntab2[i][0], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
- #win.HtmlPage.SetPage(win.html)
win.Show(True)
def OnPopupTwo(self, event):
corpus = page.corpus
else :
corpus = self.parent.parent.parent.corpus
- item=self.getColumnText(self.GetFirstSelected(), 0)
- uce_ok = corpus.getlemuces(item)
ira = wx.GetApp().GetTopWindow()
- ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item])
+ item=self.getColumnText(self.GetFirstSelected(), 0)
+ if not self.tgen :
+ uce_ok = corpus.getlemuces(item)
+ wordlist = [item]
+ else :
+ uce_ok = corpus.gettgenst(self.tgens[item])
+ wordlist = [val for val in self.tgens[item] if val in corpus.lems]
+ ucis_txt, ucestxt = doconcorde(corpus, uce_ok, wordlist)
items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
- win = message(ira, items, u"Concordancier - %s" % item, (800, 500))
- #win = message(ira, u"Concordancier", (800, 500))
- #win.html = ('<html>\n<h1>%s</h1>' % item) + '<br>'.join(['<br>'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
- #win.HtmlPage.SetPage(win.html)
+ win = message(ira, items, u"Concordancier - %s" % item, (800, 500), uceids = uce_ok)
win.Show(True)
def getinf(self, txt) :
WordCloudLayout(self.parent, corpus, self.conf)
elif self.conf['type'] == 'reinertmatrix' :
OpenCHDS(self.parent, corpus, self.conf, Alceste = False)
- elif self.conf['type'] == 'simimatrix' :
+ elif self.conf['type'] == 'simimatrix' or self.conf['type'] == 'simiclustermatrix':
SimiMatLayout(self.parent, corpus, self.conf)
elif self.conf['type'] == 'proto' :
ProtoLayout(self.parent, corpus, self.conf)
self.cmd = self.parametres.get('cmd', False)
self.dirout = self.parametres.get('pathout', False)
if self.fromprof:
- self.paramsimi = parametres
+ self.paramsimi = self.parametres
else :
self.paramsimi = {'coeff' : 0,
'layout' : 2,
#self.parametres['type'] = 'simimatrix'
if not self.pathout :
self.parametres['pathout'] = ConstructPathOut(self.parametres['pathout'], 'SimiMatrix')
- print self.parametres['pathout']
else :
self.parametres['pathout'] = self.dirout
self.pathout.createdir(self.parametres['pathout'])
self.ild['chi2'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'chi2.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
self.ild['reinertmatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'reinertmatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
self.ild['simimatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
+ self.ild['simiclustermatrix'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'simimatrix.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
self.ild['proto'] = self.il.Add(wx.Image(os.path.join(self.parent.images_path,'proto.png'), wx.BITMAP_TYPE_PNG).Scale(16,16).ConvertToBitmap())
self.SetImageList(self.il)
if select :
self.history.addtab(item)
self.SetItemBold(child, True)
+ self.SelectItem(child)
#dlg = wx.TextEntryDialog(self, "Please Enter The New Item Name", 'Item Naming', 'Python')