'nr' : [wx.NewId(),wx.NewId(),u"Formes non reconnues"],
}
self.parent=parent
- self.keys=self.parent.parent.keys
+ self.keys=self.parent.keys
self.listlabel=[]
self.listspin=[]
self.listbutton=[]
#self.Bind(wx.EVT_BUTTON, self.OnApply, self.button_val)
- self.dico=self.parent.parent.parent.lexique#'dictionnaires/lexique.txt')
+ self.dico=self.parent.parent.lexique#'dictionnaires/lexique.txt')
self.__set_properties()
self.__do_layout()
lems = corpus.getlems()
rep = []
for forme in lems[word].formes :
- rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq])
+ rep.append([corpus.getforme(forme).forme, corpus.getforme(forme).freq])
rep.sort(key = itemgetter(1), reverse = True)
win = message(self, u"Formes associées", (300, 200))
win.html = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
item = self.getColumnText(self.GetFirstSelected(), 0)
uce_ok = corpus.getlemuces(item)
ucis_txt, ucestxt = doconcorde(corpus, uce_ok, [item])
- win = message(self, u"Concordancier", (750, 600))
- 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)
+ items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
+ win = message(self, items, u"Concordancier - %s" % item, (800, 500))
+ #win = message(self, u"Concordancier", (750, 600))
+ #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.Show(True)
chd.result<-Rchdquest("%s","%s","%s", nbt = nbt, mincl = mincl)
n1 <- chd.result$n1
classeuce1 <- chd.result$cuce1
- """ % (DicoPath['mat01'], DicoPath['listeuce1'], DicoPath['uce'])
+ """ % (DicoPath['mat01.csv'], DicoPath['listeuce1'], DicoPath['uce'])
txt += """
tree_tot1 <- make_tree_tot(chd.result$chd)
if self.parametres['type_graph'] == 1 :
graphnb = 1
type = 'nplot'
- dirout = os.path.dirname(self.pathout['mat01'])
+ dirout = os.path.dirname(self.pathout['mat01.csv'])
while os.path.exists(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png')):
graphnb +=1
self.filename = ffr(os.path.join(dirout,'graph_simi_'+str(graphnb)+'.png'))
if self.parametres['type_graph'] == 3 :
graphnb = 1
type = 'web'
- dirout = os.path.dirname(self.pathout['mat01'])
+ dirout = os.path.dirname(self.pathout['mat01.csv'])
while os.path.exists(os.path.join(dirout,'web_'+str(graphnb))):
graphnb +=1
self.filename = ffr(os.path.join(dirout,'web_'+str(graphnb)))
if self.parametres['type_graph'] == 4 :
graphnb = 1
type = 'rglweb'
- dirout = os.path.dirname(self.pathout['mat01'])
+ dirout = os.path.dirname(self.pathout['mat01.csv'])
while os.path.exists(os.path.join(dirout,'webrgl_'+str(graphnb))):
graphnb +=1
self.filename = ffr(os.path.join(dirout,'webrgl_'+str(graphnb)))
self.sources([self.analyse.parent.RscriptsPath['Rgraph'], self.analyse.parent.RscriptsPath['prototypical.R']])
self.packages(['wordcloud'])
txt = """
+ errorn <- function(x) {
+ qnorm(0.975)*sd(x)/sqrt(lenght(n))
+ }
+ errort <- function(x) {
+ qt(0.975,df=lenght(x)-1)*sd(x)/sqrt(lenght(x))
+ }
mat <- read.csv2("%s", header = FALSE, row.names=1, sep='\t', quote='"', dec='.')
open_file_graph("%s",height=800, width=1000)
prototypical(mat, mfreq = %s, mrank = %s, cloud = FALSE, cexrange=c(1,2.4), cexalpha= c(0.4, 1))
self.packages(['rgexf'])
txt = """
"""
-
+
+class TgenSpecScript(PrintRScript):
+ def make_script(self):
+ self.packages(['textometry'])
+ txt = """
+ tgen <- read.csv2("%s", row.names = 1, sep = '\\t')
+ """ % self.parametres['tgeneff']
+ txt += """
+ tot <- tgen[nrow(tgen), ]
+ result <- NULL
+ tgen <- tgen[-nrow(tgen),]
+ for (i in 1:nrow(tgen)) {
+ mat <- rbind(tgen[i,], tot - tgen[i,])
+ specmat <- specificities(mat)
+ result <- rbind(result, specmat[1,])
+ }
+ colnames(result) <- colnames(tgen)
+ row.names(result) <- rownames(tgen)
+ write.table(result, file = "%s", sep='\\t', col.names = NA)
+ """ % self.pathout['tgenspec.csv']
+ self.add(txt)
+
act = {}
tableau.chi = {}
tableau.lchi = self.lchi
- tableau.parametre['fromprof'] = True
+ tableau.parametres['fromprof'] = True
for i, val in enumerate(self.la) :
act[val] = [self.lfreq[i]]
tableau.chi[val] = [self.lchi[i]]
nuces = [val[1] for val in ntab2]
dlg.Update(3, u'concordancier...')
ucis_txt, ucestxt = doconcorde(corpus, nuces, self.la, uci = uci)
+ 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))])
dlg.Update(4, u'texte...')
- win = message(self, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 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 = message(self, items, u"Segments de texte caractéristiques - Classe %i" % self.cl, (750, 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)
dlg.Destroy()
win.Show(True)
ucef += list(set(corpus.getlemucis(word)).intersection(uces))
uci = True
ucis_txt, ucestxt = doconcorde(corpus, ucef, ListWord, uci = uci)
- win = message(self, title, size=(750, 600))
- win.html = ('<html>\n<h1>%s</h1>' % ' '.join(ListWord)) + '<br>'.join(['<br>'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
- win.HtmlPage.SetPage(win.html)
+ items = dict([[i, '<br><br>'.join([ucis_txt[i], ucestxt[i]])] for i in range(0,len(ucestxt))])
+ win = message(self, items, title, (800, 500))
+ #win = message(self, title, size=(750, 600))
+ #win.html = ('<html>\n<h1>%s</h1>' % ' '.join(ListWord)) + '<br>'.join(['<br>'.join([ucis_txt[i], ucestxt[i]]) for i in range(0,len(ucestxt))]) + '\n</html>'
+ #win.HtmlPage.SetPage(win.html)
return win
def OnPopupTwo(self, event):
- corpus = self.Source.corpus
- uces = corpus.lc[self.cl-1]
- win = self.make_concord(uces, "Concordancier - Classe %i" % self.cl)
- win.Show(True)
+ if 'corpus' in dir(self.Source) :
+ corpus = self.Source.corpus
+ uces = corpus.lc[self.cl-1]
+ win = self.make_concord(uces, "Concordancier - Classe %i" % self.cl)
+ win.Show(True)
def OnPopupThree(self, event):
corpus = self.Source.corpus
nb = len(ucef)
rep.append([corpus.getforme(forme).forme, nb])
rep.sort(key = itemgetter(1), reverse = True)
- win = message(self, u"Formes associées", wx.Size(300, 200))
- win.html = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
- win.HtmlPage.SetPage(win.html)
+ #win = message(self, u"Formes associées", wx.Size(300, 200))
+ items = dict([[i, '\t:\t'.join([str(val) for val in forme])] for i, forme in enumerate(rep)])
+ win = message(self, items, u"Formes associées", (300, 200))
+ #win.html = '<html>\n' + '<br>'.join([' : '.join([str(val) for val in forme]) for forme in rep]) + '\n</html>'
+ #win.HtmlPage.SetPage(win.html)
win.Show(True)
}
###############################################################################
+getwordcloudcoord <- function(words,freq,scale=c(4,.5),min.freq=3,max.words=Inf,random.order=TRUE,random.color=FALSE,
+ rot.per=.1,colors="black",ordered.colors=FALSE,use.r.layout=FALSE,fixed.asp=TRUE,...) {
+ tails <- "g|j|p|q|y"
+ last <- 1
+
+ overlap <- function(x1, y1, sw1, sh1) {
+ if(!use.r.layout)
+ return(.overlap(x1,y1,sw1,sh1,boxes))
+ s <- 0
+ if (length(boxes) == 0)
+ return(FALSE)
+ for (i in c(last,1:length(boxes))) {
+ bnds <- boxes[[i]]
+ x2 <- bnds[1]
+ y2 <- bnds[2]
+ sw2 <- bnds[3]
+ sh2 <- bnds[4]
+ if (x1 < x2)
+ overlap <- x1 + sw1 > x2-s
+ else
+ overlap <- x2 + sw2 > x1-s
+
+ if (y1 < y2)
+ overlap <- overlap && (y1 + sh1 > y2-s)
+ else
+ overlap <- overlap && (y2 + sh2 > y1-s)
+ if(overlap){
+ last <<- i
+ return(TRUE)
+ }
+ }
+ FALSE
+ }
+
+ ord <- rank(-freq, ties.method = "random")
+ words <- words[ord<=max.words]
+ freq <- freq[ord<=max.words]
+
+
+ ord <- order(freq,decreasing=TRUE)
+ words <- words[ord]
+ freq <- freq[ord]
+ words <- words[freq>=min.freq]
+ freq <- freq[freq>=min.freq]
+ if (ordered.colors) {
+ colors <- colors[ord][freq>=min.freq]
+ }
+
+ thetaStep <- .1
+ rStep <- .05
+ plot.new()
+
+ normedFreq <- freq/max(freq)
+ size <- (scale[1]-scale[2])*normedFreq + scale[2]
+ boxes <- list()
+ toplot <- NULL
+
+
+ for(i in 1:length(words)){
+ rotWord <- runif(1)<rot.per
+ r <-0
+ theta <- runif(1,0,2*pi)
+ x1<-.5
+ y1<-.5
+ wid <- strwidth(words[i],cex=size[i],...)
+ ht <- strheight(words[i],cex=size[i],...)
+ #mind your ps and qs
+ if(grepl(tails,words[i]))
+ ht <- ht + ht*.2
+ if(rotWord){
+ tmp <- ht
+ ht <- wid
+ wid <- tmp
+ }
+ isOverlaped <- TRUE
+ while(isOverlaped){
+ if(!overlap(x1-.5*wid,y1-.5*ht,wid,ht) &&
+ x1-.5*wid>0 && y1-.5*ht>0 &&
+ x1+.5*wid<1 && y1+.5*ht<1){
+ toplot <- rbind(toplot, c(x1,y1,size[i], i))
+ boxes[[length(boxes)+1]] <- c(x1-.5*wid,y1-.5*ht,wid,ht)
+ isOverlaped <- FALSE
+ }else{
+ if(r>sqrt(.5)){
+ warning(paste(words[i],
+ "could not be fit on page. It will not be plotted."))
+ isOverlaped <- FALSE
+ }
+ theta <- theta+thetaStep
+ r <- r + rStep*thetaStep/(2*pi)
+ x1 <- .5+r*cos(theta)
+ y1 <- .5+r*sin(theta)
+ }
+ }
+ }
+ toplot <- cbind(toplot,norm.vec(freq[toplot[,4]], 1, 50))
+ row.names(toplot) <- words[toplot[,4]]
+ toplot <- toplot[,-4]
+ return(toplot)
+}
+
make_tree_tot <- function (chd) {
library(ape)
lf<-chd$list_fille
tochange <- apply(rgbs, 2, is.yellow)
tochange <- which(tochange)
if (length(tochange)) {
- gr.col <- grey.colors(length(tochange))
+ gr.col <- grey.colors(length(tochange), start = 0.5)
}
compt <- 1
for (val in tochange) {
if (is.null(cex.txt))
text(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, offset=0)
else
+ #require(wordcloud)
+ #textplot(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, cex = cex.txt, xlim=xminmax, ylim = yminmax)
text(toplot[,1],toplot[,2],rownames(toplot),col=cl.color, cex = cex.txt, offset=0)
if (!cmd) {
vec.mat <- matrix(1, nrow = 3, ncol = length(sum.cl))
vec.mat[2,] <- 2
vec.mat[3,] <- 3:(length(sum.cl)+2)
- layout(matrix(vec.mat, nrow=3, ncol=length(sum.cl)),heights=c(1,1,6))
+ layout(matrix(vec.mat, nrow=3, ncol=length(sum.cl)),heights=c(2,1,6))
if (! bw) {
col <- rainbow(length(sum.cl))[as.numeric(tree$tip.label)]
col <- del.yellow(col)
} else {
tree[[2]]<-paste('classe ',tree[[2]])
}
- par(mar=c(1,1,0,1))
+ par(mar=c(2,1,0,1))
plot.phylo(tree,label.offset=0, tip.col=col, type=type.dendro, direction = 'downwards', srt=90, adj = 0.5, cex = 1.4, y.lim=c(-0.3,tree$Nnode))
par(mar=c(0,0,0,0))
d <- barplot(-sum.cl[tree.order], col=col, names.arg='', axes=FALSE, axisname=FALSE)
col <- t(sapply(col, col2rgb, alpha=TRUE))
write.gexf(nodes, edges, output=fileout, nodesAtt=nodesatt, nodesVizAtt=list(color=col,position=lo))
}
+
+
+graph.to.file <- function(grah.simi, nodesfile = NULL, edgesfile = NULL, community = FALSE, color = NULL, sweight = NULL) {
+ require(igraph)
+ g <- graph.simi$graph
+ V(g)$weight <- graph.simi$eff
+ V(g)$x <- graph.simi$layout[,1]
+ V(g)$y <- graph.simi$layout[,2]
+ if (ncol(graph.simi$layout) == 3) {
+ V(g)$z <- graph.simi$layout[,3]
+ }
+ if (community) {
+ member <- graph.simi$communities$membership
+ col <- rainbow(max(member))
+ v.colors <- col[member]
+ v.colors <- col2rgb(v.colors)
+ V(g)$r <- v.colors[1,]
+ V(g)$g <- v.colors[2,]
+ V(g)$b <- v.colors[3,]
+ }
+ if (!is.null(color)) {
+ v.colors <- col2rgb(color)
+ V(g)$r <- v.colors[1,]
+ V(g)$g <- v.colors[2,]
+ V(g)$b <- v.colors[3,]
+ }
+ if (!is.null(sweight)) {
+ V(g)$sweight <- sweight
+ }
+ df <- get.data.frame(g, what='both')
+ if (!is.null(nodesfile)) {
+ write.table(df$vertices, nodesfile, sep='\t')
+ }
+ if (!is.null(edgesfile)) {
+ write.table(df$edges, edgesfile, sep='\t')
+ }
+ if (is.null(edgesfile) & is.null(nodesfile)) {
+ df
+ }
+}
#Author: Pierre Ratinaud
#Copyright (c) 20011 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
#fichier genere par IRaMuTeq
#Author: Pierre Ratinaud
#Copyright (c) 2008-2009 Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
fille<-function(classe,classeuce) {
listfm<-unique(unlist(classeuce[classeuce[,classe%/%2]==classe,]))
mtext(paste('<', mfreq, ' Fréquences ', '>=', mfreq, sep = ' '), side=2, line=1, cex=1, col="red", outer=TRUE)
mtext(paste('<=', mrank, ' Rangs ', '>', mrank, sep = ' '), side=3, line=1, cex=1, col="red", outer=TRUE)
}
+
+intervalle.freq <- function(x, SX=NULL) {
+ errorn <- (x/SX) + (1.96 * sqrt(((x/SX) * (1-(x/SX))/SX)))
+ print(errorn)
+}
w<-E(g.toplot)$weight
tovire <- which(w<=seuil)
g.toplot <- delete.edges(g.toplot,(tovire))
- for (i in 0:(length(V(g.toplot)))) {
+ for (i in 1:(length(V(g.toplot)))) {
if (length(neighbors(g.toplot,i))==0) {
vec<-append(vec,i)
}
g.toplot <- delete.vertices(g.toplot,vec)
v.label <- V(g.toplot)$name
if (!is.logical(vec)) mat.eff <- mat.eff[-(vec)]
- }
+ } else {
+ vec <- NULL
+ }
if (!is.null(minmaxeff[1])) {
eff<-norm.vec(mat.eff,minmaxeff[1],minmaxeff[2])
com <- NULL
}
- out <- list(graph = g.toplot, mat.eff = mat.eff, eff = eff, mat = mat.simi, v.label = v.label, we.width = we.width, we.label=we.label, label.cex = label.cex, layout = lo, communities = com, halo = halo)
+ out <- list(graph = g.toplot, mat.eff = mat.eff, eff = eff, mat = mat.simi, v.label = v.label, we.width = we.width, we.label=we.label, label.cex = label.cex, layout = lo, communities = com, halo = halo, elim=vec)
}
plot.simi <- function(graph.simi, p.type = 'tkplot',filename=NULL, communities = NULL, vertex.col = 'red', edge.col = 'black', edge.label = TRUE, vertex.label=TRUE, vertex.label.color = 'black', vertex.label.cex= NULL, vertex.size=NULL, leg=NULL, width = 800, height = 800, alpha = 0.1, cexalpha = FALSE, movie = NULL, svg = FALSE) {
}
par(pch=' ')
if (is.null(graph.simi$com)) {
- plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo)#, rescale = FALSE)
+ plot(g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, edge.curved=FALSE)#, rescale = FALSE)
} else {
if (graph.simi$halo) {
mark.groups <- communities(graph.simi$com)
} else {
mark.groups <- NULL
}
- plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups)
+ plot(com, g.toplot,vertex.label='', edge.width=we.width, vertex.size=vertex.size, vertex.color=vertex.col, vertex.label.color='white', edge.label=we.label, edge.label.cex=cex, edge.color=edge.col, vertex.label.cex = 0, layout=lo, mark.groups = mark.groups, edge.curved=FALSE)
}
#txt.layout <- lo
txt.layout <- layout.norm(lo, -1, 1, -1, 1, -1, 1)
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2013 Pierre Ratinaud
-#Lisense: GNU GPL
+#License: GNU GPL
import logging
import os
-from time import time
from uuid import uuid4
from time import time, sleep
from openanalyse import OpenAnalyse
+
class AnalyseMatrix :
def __init__(self, ira, tableau, parametres = None, dlg = False) :
self.tableau = tableau
+ if self.tableau.csvtable is None :
+ self.tableau.open()
self.ira = ira
self.parent = ira
self.dlg = dlg
self.parametres = parametres
self.val = False
+ self.parametres['pathout'] = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout']).mkdirout()
if not 'pathout' in self.parametres :
- self.pathout = PathOut(tableau.parametres['filename'], analyse_type = parametres['type'], dirout = parametres['pathout'])
+ self.pathout = PathOut(tableau.parametres['originalpath'], analyse_type = self.parametres['type'], dirout = tableau.parametres['pathout'])
else :
- self.pathout = PathOut(filename = tableau.parametres['filename'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
+ self.pathout = PathOut(filename = tableau.parametres['originalpath'], dirout = self.parametres['pathout'], analyse_type = self.parametres['type'])
- self.parametres['pathout'] = self.pathout.dirout
+ #self.parametres['pathout'] = self.pathout.dirout
self.parametres['uuid'] = str(uuid4())
self.parametres['name'] = os.path.split(self.parametres['pathout'])[1]
self.parametres['encoding'] = self.ira.syscoding
-
- self.t1 = time()
- result_analyse = self.doanalyse()
+ self.parametres['matrix'] = self.tableau.parametres['uuid']
+ self.tableau.pathout.dirout = self.parametres['pathout']
+ self.doparametres(dlg = dlg)
+ if self.parametres is not None :
+ self.t1 = time()
+ if not os.path.exists(self.parametres['pathout']) :
+ self.pathout.createdir(self.parametres['pathout'])
+ result_analyse = self.doanalyse()
+ else :
+ result_analyse = False
if result_analyse is None :
self.time = time() - self.t1
minutes, seconds = divmod(self.time, 60)
self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds)
self.parametres['ira'] = self.pathout['Analyse.ira']
DoConf().makeoptions([self.parametres['type']], [self.parametres], self.pathout['Analyse.ira'])
- self.ira.history.addMatrix(self.parametres)
+ self.ira.history.addMatrixAnalyse(self.parametres)
if dlg :
dlg.Destroy()
OpenAnalyse(self.parent, self.parametres['ira'])
- #self.ira.tree.AddAnalyse(self.parametres)
+ self.ira.tree.AddMatAnalyse(self.parametres)
self.val = 5100
else :
self.val = False
def doanalyse(self) :
pass
+ def doparametres(self, dlg = None):
+ pass
+
def doR(self, Rscript, wait = False, dlg = None, message = '') :
#log.info('R code...')
pid = exec_rcode(self.ira.RPath, Rscript, wait = wait)
# copyright : 2012-2013 (c) Pierre Ratinaud
import logging
-from chemins import PathOut, ChdTxtPathOut
-from functions import exec_rcode, check_Rresult, DoConf, print_liste
+from chemins import PathOut
+from functions import exec_rcode, check_Rresult, DoConf, ReadDicoAsDico
+from shutil import copy
from time import time, sleep
from uuid import uuid4
import os
-from PrintRScript import RchdTxt, AlcesteTxtProf
-from OptionAlceste import OptionAlc
-from layout import PrintRapport
from openanalyse import OpenAnalyse
from dialog import StatDialog
self.parametres['type'] = parametres['type']
self.parametres['encoding'] = self.ira.syscoding
self.t1 = time()
- self.corpus.make_lems(lem=self.parametres['lem'])
+ if not self.parametres.get('dictionary', False) :
+ self.corpus.make_lems(lem=self.parametres['lem'])
+ else :
+ dico = ReadDicoAsDico(self.parametres['dictionary'])
+ self.corpus.make_lems_from_dict(dico, dolem=self.parametres['lem'])
+ dictname = os.path.basename(self.parametres['dictionary'])
+ dictpath = os.path.join(self.pathout.dirout, dictname)
+ copy(self.parametres['dictionary'], dictpath)
+ self.parametres['dictionary'] = dictpath
self.corpus.parse_active(gramact, gramsup)
result_analyse = self.doanalyse()
if result_analyse is None :
def lemparam(self) :
if self.dlg and self.lemdial:
- dial = StatDialog(self, self.parent)
+ dial = StatDialog(self.parent, self.keys)
dial.CenterOnParent()
val = dial.ShowModal()
if val == 5100 :
else :
lem = 0
self.parametres['lem'] = lem
+ if dial.radio_dictchoice.GetSelection() == 1 :
+ self.parametres['dictionary'] = dial.dictpath.GetValue()
dial.Destroy()
return self.parametres
else :
-class Alceste(AnalyseText) :
- def doanalyse(self) :
- self.parametres['type'] = 'alceste'
- self.pathout.basefiles(ChdTxtPathOut)
- self.actives, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 1)
- self.parametres['eff_min_forme'] = lim
- self.parametres['nbactives'] = len(self.actives)
- uci = False
- if self.parametres['classif_mode'] == 0 :
- lenuc1, lenuc2 = self.corpus.make_and_write_sparse_matrix_from_uc(self.actives, self.parametres['tailleuc1'], self.parametres['tailleuc2'], self.pathout['TableUc1'], self.pathout['TableUc2'], self.pathout['listeuce1'], self.pathout['listeuce2'])
- self.parametres['lenuc1'] = lenuc1
- self.parametres['lenuc2'] = lenuc2
- elif self.parametres['classif_mode'] == 1 :
- self.corpus.make_and_write_sparse_matrix_from_uces(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1'])
- elif self.parametres['classif_mode'] == 2 :
- self.corpus.make_and_write_sparse_matrix_from_uci(self.actives, self.pathout['TableUc1'], self.pathout['listeuce1'])
- uci = True
- Rscript = self.printRscript()
- self.doR(Rscript, dlg=self.dlg, message='CHD...')
-
- self.corpus.make_ucecl_from_R(self.pathout['uce'])
- self.corpus.make_and_write_profile(self.actives, self.corpus.lc, self.pathout['Contout'], uci = uci)
- self.sup, lim = self.corpus.make_actives_nb(self.parametres['max_actives'], 2)
- self.corpus.make_and_write_profile(self.sup, self.corpus.lc, self.pathout['ContSupOut'], uci = uci)
- self.corpus.make_and_write_profile_et(self.corpus.lc, self.pathout['ContEtOut'], uci = uci)
- self.clnb = len(self.corpus.lc)
- self.parametres['clnb'] = self.clnb
- Rscript = self.printRscript2()
- self.doR(Rscript, dlg=self.dlg, message='profils et A.F.C. ...')
- self.time = time() - self.t1
- minutes, seconds = divmod(self.time, 60)
- hours, minutes = divmod(minutes, 60)
- self.parametres['time'] = '%.0fh %.0fm %.0fs' % (hours, minutes, seconds)
- self.print_graph_files()
- def preferences(self) :
- parametres = DoConf(self.parent.ConfigPath['alceste']).getoptions('ALCESTE')
- parametres['corpus'] = self.corpus
- parametres['pathout'] = self.pathout
- self.dial = OptionAlc(self.parent, parametres)
- self.dial.CenterOnParent()
- self.dialok = self.dial.ShowModal()
- if self.dialok == 5100 :
- parametres['classif_mode'] = self.dial.radio_box_2.GetSelection()
- parametres['tailleuc1'] = self.dial.spin_ctrl_1.GetValue()
- parametres['tailleuc2'] = self.dial.spin_ctrl_2.GetValue()
- parametres['mincl'] = self.dial.spin_ctrl_4.GetValue()
- parametres['minforme'] = self.dial.spin_ctrl_5.GetValue()
- parametres['nbcl_p1'] = self.dial.spin_nbcl.GetValue()
- parametres['max_actives'] = self.dial.spin_max_actives.GetValue()
- parametres['corpus'] = ''
- parametres['svdmethod'] = self.dial.svdmethod[self.dial.choicesvd.GetSelection()]
- parametres['pathout'] = self.pathout.dirout
- parametres['mode.patate'] = self.dial.check_patate.GetValue()
- DoConf(self.parent.ConfigPath['alceste']).makeoptions(['ALCESTE'], [parametres])
- self.dial.Destroy()
- print parametres
- return parametres
- else :
- self.dial.Destroy()
- return None
-
- def printRscript(self) :
- RchdTxt(self.pathout, self.parent.RscriptsPath, self.parametres['mincl'], self.parametres['classif_mode'], nbt=self.parametres['nbcl_p1'] - 1, svdmethod=self.parametres['svdmethod'], libsvdc=self.parent.pref.getboolean('iramuteq', 'libsvdc'), libsvdc_path=self.parent.pref.get('iramuteq', 'libsvdc_path'), R_max_mem=False, mode_patate=self.parametres['mode.patate'])
- return self.pathout['Rchdtxt']
-
- def printRscript2(self) :
- AlcesteTxtProf(self.pathout, self.parent.RscriptsPath, self.clnb, 0.9)
- return self.pathout['RTxtProfGraph']
-
- def print_graph_files(self) :
- mess_afc = u"La position des points n'est peut être pas exacte"
- afc_graph_list = [[os.path.basename(self.pathout['AFC2DL_OUT']), u'Variables actives - coordonnées - 30 points par classes - facteurs 1 / 2 - %s' % mess_afc],
- [os.path.basename(self.pathout['AFC2DSL_OUT']), u'variables supplémentaires - coordonnées - 30 points par classes - facteurs 1 / 2 - %s' % mess_afc],
- [os.path.basename(self.pathout['AFC2DEL_OUT']), u'Variables illustratives - Coordonnées - 30 points par classes - facteur 1 / 2 - %s' % mess_afc],
- [os.path.basename(self.pathout['AFC2DCL_OUT']), u'Classes - Coordonnées - facteur 1 / 2']]
- chd_graph_list = [[os.path.basename(self.pathout['dendro1']), u'dendrogramme à partir de chd1']]
- if self.parametres['classif_mode'] == 0 :
- chd_graph_list.append([os.path.basename(self.pathout['dendro2']), u'dendrogramme à partir de chd2'])
- chd_graph_list.append([os.path.basename(self.pathout['arbre1']), u'chd1'])
- if self.parametres['classif_mode'] == 0 :
- chd_graph_list.append([os.path.basename(self.pathout['arbre2']), u'chd2'])
- print_liste(self.pathout['liste_graph_afc'], afc_graph_list)
- print_liste(self.pathout['liste_graph_chd'], chd_graph_list)
- PrintRapport(self, self.corpus, self.parametres)
# keys = {'art_def' : 2,
else :
ConfigPath = AppliPath
DictConfigPath = {
- 'alceste': os.path.join(ConfigPath, 'alceste.cfg'),
+ 'reinert': os.path.join(ConfigPath, 'reinert.cfg'),
'key': os.path.join(ConfigPath, 'key.cfg'),
'path': os.path.join(ConfigPath, 'path.cfg'),
'preferences' : os.path.join(ConfigPath, 'iramuteq.cfg'),
'corpus' : os.path.join(ConfigPath, 'corpus.cfg'),
'stat' : os.path.join(ConfigPath, 'stat.cfg'),
'simitxt' : os.path.join(ConfigPath, 'simitxt.cfg'),
+ 'matrix' : os.path.join(ConfigPath, 'matrix.cfg'),
}
return DictConfigPath
from operator import itemgetter
from uuid import uuid4
from chemins import PathOut
-from dialog import CorpusPref
+from dialog import CorpusPref, SubTextFromMetaDial
from colors import colors
import datetime
lem = word
self.formes[word] = Word(word, gramtype, len(self.formes), lem)
self.idformesuces[self.formes[word].ident] = {self.ucis[-1].uces[-1].ident : 1}
+
+ def add_word_from_forme(self, word, stident):
+ if word.forme in self.formes :
+ self.formes[word.forme].freq += 1
+ if self.formes[word.forme].ident in self.idformesuces :
+ if stident in self.idformesuces[self.formes[word.forme].ident] :
+ self.idformesuces[self.formes[word.forme].ident][stident] += 1
+ else :
+ self.idformesuces[self.formes[word.forme].ident][stident] = 1
+ else :
+ self.idformesuces[self.formes[word.forme].ident] = {stident: 1}
+ else :
+ self.formes[word.forme] = word
+ self.formes[word.forme].ident = len(self.formes)
+ self.formes[word.forme].freq = 1
+ self.idformesuces[self.formes[word.forme].ident] = {stident : 1}
def conn_all(self):
"""connect corpus to db"""
self.lems[self.formes[forme].lem] = Lem(self, self.formes[forme])
else :
self.lems = dict([[forme, Lem(self, self.formes[forme])] for forme in self.formes])
+
+ def make_lems_from_dict(self, dictionnaire, dolem = True) :
+ log.info('make lems from dict')
+ self.lems = {}
+ for forme in self.formes :
+ if self.formes[forme].forme in dictionnaire :
+ lem = dictionnaire[forme][0]
+ gram = dictionnaire[forme][1]
+ elif forme.isdigit() :
+ gram = u'num'
+ lem = forme
+ else :
+ gram = u'nr'
+ lem = forme
+ self.formes[forme].lem = lem
+ self.formes[forme].gram = gram
+ if dolem :
+ if self.formes[forme].lem in self.lems :
+ if self.formes[forme].ident not in self.lems[self.formes[forme].lem].formes :
+ self.lems[self.formes[forme].lem].add_forme(self.formes[forme])
+ else :
+ self.lems[self.formes[forme].lem] = Lem(self, self.formes[forme])
+ else :
+ self.lems[forme] = Lem(self, self.formes[forme])
def make_idformes(self) :
self.idformes = dict([[self.formes[forme].ident, self.formes[forme]] for forme in self.formes])
tab.insert(0, [''] + etoiles)
return tab
+ def make_tgen_table(self, tgen, etoiles, tot = None):
+ lclasses = [self.getucesfrometoile(etoile) for etoile in etoiles]
+ sets = [set(cl) for cl in lclasses]
+ totoccurrences = dict([[val, 0] for val in etoiles])
+ if tot is None :
+ for forme in self.formes :
+ formeuceeff = self.getformeuceseff(forme)
+ for i, classe in enumerate(lclasses) :
+ concern = sets[i].intersection(formeuceeff.keys())
+ if len(concern) :
+ totoccurrences[etoiles[i]] += sum([formeuceeff[uce] for uce in concern])
+ #tgenoccurrences = dict([[val, 0] for val in etoiles])
+ tgenoccurrences = {}
+ for t in tgen.tgen :
+ tgenoccurrences[t] = dict([[val, 0] for val in etoiles])
+ for lem in tgen[t] :
+ lemuceeff = self.getlemuceseff(lem)
+ for i, classe in enumerate(lclasses) :
+ concern = sets[i].intersection(lemuceeff.keys())
+ if len(concern) :
+ tgenoccurrences[t][etoiles[i]] += sum([lemuceeff[uce] for uce in concern])
+ return tgenoccurrences, totoccurrences
+
def make_efftype_from_etoiles(self, etoiles) :
dtype = {}
etuces = [[] for et in etoiles]
for uci in self.ucis :
etoiles.update(uci.etoiles[1:])
return list(etoiles)
+
+ def make_themes(self):
+ themes = set([])
+ for uci in self.ucis :
+ themes.update(uci.paras)
+ return list(themes)
def make_etoiles_dict(self) :
etoiles = [et for uci in self.ucis for et in uci.etoiles[1:]]
listlem.sort()
with open(fileout, 'w') as f :
f.write('\n'.join(['\t'.join(lem) for lem in listlem]).encode(syscoding))
-
-
+
class MakeUciStat :
pourhapaxocc = (float(hapaxnb) / self.corpus.parametres['occurrences']) * 100
self.corpus.parametres['hapax'] = '%i - %.2f %% des formes - %.2f %% des occurrences' % (hapaxnb, pourhapaxf, pourhapaxocc)
+class BuildSubCorpus(BuildCorpus):
+ def __init__(self, corpus, parametres, dlg = None) :
+ log.info('begin subcorpus...')
+ self.dlg = dlg
+ self.ori = corpus
+ self.infile = None
+ self.corpus = Corpus(self, corpus.parametres)
+ self.last = 0
+ self.encoding = corpus.parametres['encoding']
+ self.corpus.parametres['corpus_name'] = parametres['corpus_name']
+ self.corpus.pathout = PathOut(filename = corpus.parametres['originalpath'], dirout = parametres['pathout'])
+ self.corpus.pathout.createdir(parametres['pathout'])
+ self.corpus.parametres['pathout'] = parametres['pathout']
+ self.corpus.parametres['meta'] = parametres.get('meta', False)
+ self.corpus.parametres['uuid'] = str(uuid4())
+ if parametres.get('frommeta', False) :
+ print 'make subtexts'
+ self.corpus.ucis = [uci for uci in self.ori.ucis if set(parametres['meta']).intersection(uci.etoiles) != set()]
+ elif parametres.get('fromtheme', False) :
+ print 'make subtexts from theme'
+ idpara = 0
+ for uci in self.ori.ucis :
+ if uci.paras != [] :
+ newuce = []
+ newpara = []
+ for et in uci.paras :
+ if et in parametres['meta'] :
+ newuce += [uce for uce in uci.uces if uce.para == idpara]
+ newpara.append(et)
+ idpara += 1
+ if newuce != [] :
+ uci.uces = newuce
+ uci.paras = newpara
+ self.corpus.ucis.append(uci)
+ else :
+ idpara += 1
+ elif parametres.get('fromcluster', False) :
+ pass
+ #create database
+ self.connect()
+ self.dobuild()
+
+ def read_corpus(self, infile = None):
+ self.olduceid = [uce.ident for uci in self.corpus.ucis for uce in uci.uces]
+ ident_uci = 0
+ ident_uce = 0
+ ident_para = -1
+ lastpara = -1
+ newuceident = {}
+ print 'redo text, para and st ident'
+ for uci in self.corpus.ucis :
+ uci.ident = ident_uci
+ ident_uci += 1
+ for uce in uci.uces :
+ uce.uci = uci.ident
+ if uce.para != lastpara :
+ ident_para += 1
+ lastpara = uce.para
+ uce.para = ident_para
+ else :
+ uce.para = ident_para
+ newuceident[uce.ident] = ident_uce
+ uce.ident = ident_uce
+ ident_uce += 1
+ print 'backup st text and forms'
+ for row in self.ori.getconcorde(self.olduceid) :
+ self.c.execute('INSERT INTO uces VALUES(?,?);', (`newuceident[row[0]]`, row[1]))
+ for word in row[1].split() :
+ self.corpus.add_word_from_forme(self.ori.formes[word], newuceident[row[0]])
+ self.backup_uce()
+ print 'done'
class BuildFromAlceste(BuildCorpus) :
def read_corpus(self, infile) :
def doanalyse(self) :
return BuildFromAlceste(self.parent.filename, self.parametres, self.parent.lexique, self.parent.expressions, dlg = self.dlg).corpus
+class SubBuilder :
+ def __init__(self, parent, corpus, parametres = None, dlg = None):
+ self.parent = parent
+ self.ori = corpus
+ self.dlg = dlg
+ corpus_name = 'Sub' + corpus.parametres['corpus_name']
+ parametres['corpus_name'] = corpus_name
+ if parametres.get('frommeta', False) :
+ parametres['meta'] = corpus.make_etoiles()
+ elif parametres.get('fromtheme', False) :
+ parametres['meta'] = corpus.make_themes()
+ parametres['meta'].sort()
+ dial = SubTextFromMetaDial(parent, parametres)
+ self.res = dial.ShowModal()
+ if self.res == 5100 :
+ if dial.subcorpusname.GetValue() != '' :
+ corpus_name = ''.join([l for l in dial.subcorpusname.GetValue() if l.isalnum() or l in ['_']])
+ if corpus_name != '' :
+ parametres['corpus_name'] = corpus_name
+ else :
+ parametres['corpus_name'] = 'Sub' + corpus.parametres['corpus_name']
+ pathout = os.path.join(corpus.parametres['pathout'], parametres['corpus_name'])
+ i = 1
+ while os.path.exists(pathout + '_%i' % i) :
+ i += 1
+ parametres['pathout'] = pathout + '_%i' % i
+ meta = dial.m_listBox1.GetSelections()
+ parametres['meta'] = [parametres['meta'][val] for val in meta]
+ self.parametres = parametres
+ dial.Destroy()
+ else :
+ dial.Destroy()
+
+ def doanalyse(self):
+ return BuildSubCorpus(self.ori, parametres = self.parametres, dlg = self.dlg).corpus
if __name__ == '__main__' :
t1 = time()
else :
self.EndModal(wx.ID_CANCEL)
-
-class StatDialog(wx.Dialog):
- def __init__(self, parent, *args, **kwds):
- kwds['style'] = wx.DEFAULT_DIALOG_STYLE
- wx.Dialog.__init__(self, *args, **kwds)
+class StatDialog ( wx.Dialog ):
+
+ def __init__( self, parent, keys ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Settings", pos = wx.DefaultPosition, size = wx.Size( -1,-1 ), style = wx.DEFAULT_DIALOG_STYLE )
+
self.fileout = ""
self.parent = parent
- self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
- self.radio_lem = wx.RadioBox(self, -1, u"", choices=['oui', 'non'], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
- #txt = u"""Fréquence minimum d'une forme
-#analysée (0 = non utilisé)"""
- #self.label_8 = wx.StaticText(self, -1, txt)
- #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
- #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, initial=1500)
- self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
- self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
-
- #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
- #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
- self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
- self.__do_layout()
- self.__set_properties()
-
- def __do_layout(self) :
- first = wx.BoxSizer(wx.VERTICAL)
- sizer = wx.FlexGridSizer(0,2,0,0)
- sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
- #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
- #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
- first.Add(sizer, 0, wx.ALL, 5)
- btnsizer = wx.StdDialogButtonSizer()
- btn = wx.Button(self, wx.ID_CANCEL)
- btnsizer.AddButton(btn)
- btn_ok = wx.Button(self, wx.ID_OK)
- btn_ok.SetDefault()
- btnsizer.AddButton(btn_ok)
- btnsizer.Realize()
- first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
- self.SetSizer(first)
- first.Fit(self)
-
- def __set_properties(self) :
- self.SetTitle(_(u"Settings").decode('utf8'))
+ self.keys = keys
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ gSizer1 = wx.GridSizer( 0, 2, 0, 0 )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Lemmatization", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ gSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ radio_lemChoices = [ u"yes", u"no" ]
+ self.radio_lem = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_lemChoices, 1, wx.RA_SPECIFY_COLS )
+ self.radio_lem.SetSelection( 0 )
+ gSizer1.Add( self.radio_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Keys properties", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ gSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.button_5 = wx.Button( self, wx.ID_PREFERENCES, u"properties", wx.DefaultPosition, wx.DefaultSize, 0 )
+ gSizer1.Add( self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ gSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ radio_dictchoiceChoices = [ u"indexation", u"other" ]
+ self.radio_dictchoice = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, radio_dictchoiceChoices, 1, wx.RA_SPECIFY_COLS )
+ self.radio_dictchoice.SetSelection( 0 )
+ gSizer1.Add( self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+
+ bSizer1.Add( gSizer1, 1, wx.EXPAND, 5 )
+
+ self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
+ bSizer1.Add( self.dictpath, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+ self.dictpath.Enable(False)
- def OnKeys(self, evt):
- dial = AlcOptFrame(self, self.parent.parent)
+ m_sdbSizer1 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
+ self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+ m_sdbSizer1.Realize();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.button_5.Bind( wx.EVT_BUTTON, self.OnKeys )
+ self.radio_dictchoice.Bind( wx.EVT_RADIOBOX, self.OnOther )
+
+ def __del__( self ):
+ pass
+
+
+ # Virtual event handlers, overide them in your derived class
+ def OnKeys( self, event ):
+ dial = AlcOptFrame(self, self.parent)
dial.CenterOnParent()
dial.ShowModal()
for i in range(0,len(dial.listlabel)):
dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
- DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
+ DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.ConfigPath['key'])
dial.Destroy()
+
+ def OnOther( self, event ):
+ if self.radio_dictchoice.GetSelection() :
+ self.dictpath.Enable(True)
+ else :
+ self.dictpath.Enable(False)
+
+# class StatDialog(wx.Dialog):
+# def __init__(self, parent, *args, **kwds):
+# kwds['style'] = wx.DEFAULT_DIALOG_STYLE
+# wx.Dialog.__init__(self, *args, **kwds)
+# self.fileout = ""
+# self.parent = parent
+# self.label_lem = wx.StaticText(self, -1, _(u"Lemmatization").decode('utf8'))
+# self.radio_lem = wx.RadioBox(self, -1, u"", choices=[_(u'oui').decode('utf8'), _(u'non').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
+# #txt = u"""Fréquence minimum d'une forme
+# #analysée (0 = non utilisé)"""
+# #self.label_8 = wx.StaticText(self, -1, txt)
+# #self.spin_ctrl_5 = wx.SpinCtrl(self, -1, "",size = (100,30), min=0, max=1000, initial=0)
+# #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, initial=1500)
+# self.label_4 = wx.StaticText(self, -1, _(u"Keys settings").decode('utf8'))
+# self.button_5 = wx.Button(self, wx.ID_PREFERENCES, "")
+# self.labeldictchoice = wx.StaticText(self, -1, _(u"Dictionary").decode('utf8'))
+# self.radio_dictchoice = wx.RadioBox(self, -1, u"", choices=[_(u'indexation').decode('utf8'), _(u'other').decode('utf8')], majorDimension=0, style=wx.RA_SPECIFY_ROWS)
+# #self.labeldictpath = wx.StaticText(self, -1, _(u"Path").decode('utf8'))
+# self.dictpath = filebrowse.FileBrowseButton(self, -1, size=(350, -1), labelText = _(u"Path").decode('utf8'), fileMode = 2, fileMask = '*')
+# self.dictpath.Enable(False)
+# #self.Bind(wx.EVT_CHECKBOX, self.OnCheckUce, self.check_uce)
+# #self.Bind(wx.EVT_SPINCTRL, self.OnSpin, self.spin_ctrl_5)
+# self.Bind(wx.EVT_BUTTON, self.OnKeys, self.button_5)
+# self.Bind(wx.EVT_RADIOBOX, self.OnOther, self.radio_dictchoice)
+# self.__do_layout()
+# self.__set_properties()
+#
+# def __do_layout(self) :
+# first = wx.BoxSizer(wx.VERTICAL)
+# sizer = wx.FlexGridSizer(0,2,0,0)
+# sizer.Add(self.label_lem, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.radio_lem, 0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.txt_exp, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.exp, 0, wx.ALIGN_RIGHT, 5)
+# #sizer.Add(self.label_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.check_uce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_occuce, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_ctrl_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_8, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_ctrl_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.label_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.spin_max_actives, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.label_4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.button_5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(self.labeldictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.radio_dictchoice, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(self.labeldictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(self.dictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# sizer.Add(wx.StaticLine(self),0, wx.ALIGN_LEFT, 5)
+# #sizer.Add(box2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
+# first.Add(sizer, 0, wx.ALL, 5)
+# btnsizer = wx.StdDialogButtonSizer()
+# btn = wx.Button(self, wx.ID_CANCEL)
+# btnsizer.AddButton(btn)
+# btn_ok = wx.Button(self, wx.ID_OK)
+# btn_ok.SetDefault()
+# btnsizer.AddButton(btn_ok)
+# btnsizer.Realize()
+# first.Add(btnsizer, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_RIGHT, 5)
+# self.SetSizer(first)
+# first.Fit(self)
+#
+# def __set_properties(self) :
+# self.SetTitle(_(u"Settings").decode('utf8'))
+#
+# def OnKeys(self, evt):
+# dial = AlcOptFrame(self, self.parent.parent)
+# dial.CenterOnParent()
+# dial.ShowModal()
+# for i in range(0,len(dial.listlabel)):
+# dial.keys[dial.listcle[i]] = dial.listspin[i].GetValue()
+# DoConf().makeoptions(['KEY'], [dial.keys], outfile = self.parent.parent.ConfigPath['key'])
+# dial.Destroy()
+#
+# def OnOther(self, evt):
+# if self.radio_dictchoice.GetSelection() :
+# self.dictpath.Enable(True)
+# else :
+# self.dictpath.Enable(False)
class PrefUCECarac(wx.Dialog):
def __init__(self, parent, *args, **kwds):
class PrefQuestAlc ( wx.Dialog ):
- def __init__( self, parent, sim = False):
+ def __init__( self, parent, tableau, sim = False):
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = _(u"Clustering").decode('utf8'), pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
#---------------------------------------------------------------
#self.content = parent.content[:]
- self.header = parent.tableau.get_colnames()
+ self.header = tableau.get_colnames()
labels = [val for val in self.header]
self.labels_tot = labels
self.varsup = []
class ChiDialog(wx.Dialog):
def __init__(
- self, parent, ID, title, optionchi, size=wx.DefaultSize, pos=wx.DefaultPosition,
+ self, parent, ID, title, optionchi, tableau, size=wx.DefaultSize, pos=wx.DefaultPosition,
style=wx.DEFAULT_DIALOG_STYLE
):
self.parent = parent
self.optionchi = optionchi
self.chiopt = False
+ self.tableau = tableau
#self.Filename=parent.filename
#self.content=parent.content[:]
- self.headers=parent.tableau.get_colnames()
+ self.headers=self.tableau.get_colnames()
LABELLIST=[]
for i in self.headers:
self.txtpath = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Path").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.txtpath.Wrap( -1 )
fgSizer1.Add( self.txtpath, 0, wx.ALL, 5 )
+
+ self.m_staticText18 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Corpus' name", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText18.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText18, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+ self.corpusname = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 200,-1 ), 0 )
+ fgSizer1.Add( self.corpusname, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
self.m_staticText1 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Characters set").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText1.Wrap( -1 )
fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
self.lang_choices.SetSelection( 0 )
fgSizer1.Add( self.lang_choices, 0, wx.ALL, 5 )
+ self.m_staticText19 = wx.StaticText( self.m_panel1, wx.ID_ANY, u"Dictionary", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText19.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText19, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ bSizer2 = wx.BoxSizer( wx.HORIZONTAL )
+
+ fgSizer5 = wx.FlexGridSizer( 2, 2, 0, 0 )
+ fgSizer5.SetFlexibleDirection( wx.BOTH )
+ fgSizer5.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.radio_default_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Default", wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer5.Add( self.radio_default_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.defaultdictpath = wx.TextCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.Size( 300,-1 ), wx.TE_READONLY )
+ self.defaultdictpath.Enable( False )
+
+ fgSizer5.Add( self.defaultdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.radio_other_dict = wx.RadioButton( self.m_panel1, wx.ID_ANY, u"Other", wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer5.Add( self.radio_other_dict, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.otherdictpath = wx.FilePickerCtrl( self.m_panel1, wx.ID_ANY, wx.EmptyString, u"Select a file", u"*.*", wx.DefaultPosition, wx.Size( 300,-1 ), wx.FLP_DEFAULT_STYLE )
+ fgSizer5.Add( self.otherdictpath, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer2.Add( fgSizer5, 1, wx.EXPAND, 5 )
+
+
+ fgSizer1.Add( bSizer2, 1, wx.EXPAND, 5 )
+
self.m_staticText3 = wx.StaticText( self.m_panel1, wx.ID_ANY, _(u"Output folder").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
self.m_staticText3.Wrap( -1 )
fgSizer1.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+ # Connect Events
self.Bind(wx.EVT_BUTTON, self.OnChangeDir, self.m_button1)
+ self.lang_choices.Bind( wx.EVT_CHOICE, self.OnChangeLangage )
+ self.radio_other_dict.Bind( wx.EVT_RADIOBUTTON, self.changedictchoice )
+
self.setparametres(parametres)
self.SetSizer( bSizer1 )
self.Layout()
else :
parametres[val] = 0
return parametres
+
+ def OnChangeLangage(self, evt):
+ pass
+
+ def changedictchoice(self, evt):
+ pass
+
+
+class ConcordList(wx.HtmlListBox):
+ def __init__(self, parent, concord):
+ self.concord = concord
+ #self.script_status = dict()
+ wx.HtmlListBox.__init__(self, parent, -1, size = (900, 600))
+ self.SetItemCount(len(concord))
+ #self.Bind(wx.EVT_LISTBOX, self.RefreshMe)
+ #self.Bind(wx.EVT_LISTBOX_DCLICK, self.Download)
+
+ def OnGetItem(self, index):
+ return self.concord[index] + '<br>'
class message(wx.Dialog):
- def __init__(self, parent, title, size, save = True):
- wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE )
+ def __init__(self, parent, items, title, size, save = True):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = title, pos = wx.DefaultPosition, size = size, style = wx.DEFAULT_DIALOG_STYLE|wx.STAY_ON_TOP )
self.save = save
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
self.html = ""
- self.HtmlPage=wx.html.HtmlWindow(self, -1)
- self.HtmlPage.SetMinSize( size )
- if "gtk2" in wx.PlatformInfo:
- self.HtmlPage.SetStandardFonts()
- self.HtmlPage.SetFonts('Courier','Courier')
+ #self.HtmlPage=wx.html.HtmlWindow(self, -1)
+ self.HtmlPage = ConcordList(self, items)
+ #self.HtmlPage.SetMinSize( size )
+ #if "gtk2" in wx.PlatformInfo:
+ # self.HtmlPage.SetStandardFonts()
+ #self.HtmlPage.SetFonts('Courier','Courier')
self.button_1 = wx.Button(self, wx.ID_CANCEL)
def OnCloseWindow(self, event):
self.Destroy()
+
+
class ExtractDialog ( wx.Dialog ):
def __init__( self, parent, option ):
self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
self.extractformat.SetSelection( 0 )
fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ if option == 'them' :
+ self.m_staticText4 = wx.StaticText( self, wx.ID_ANY, _(u"thematics (one by line, with the -*)").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText4.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText4, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.txtmods = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE )
+ self.txtmods.SetMinSize( wx.Size( 200,150 ) )
+
+ fgSizer1.Add( self.txtmods, 0, wx.ALL|wx.EXPAND, 5 )
+
+ #self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, _(u"Extraction type").decode('utf8'), wx.DefaultPosition, wx.DefaultSize, 0 )
+ #self.m_staticText5.Wrap( -1 )
+ #fgSizer1.Add( self.m_staticText5, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ #extractformatChoices = [ _(u"Only one file").decode('utf8'), _(u"One file by thematic").decode('utf8') ]
+ #self.extractformat = wx.RadioBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, extractformatChoices, 1, wx.RA_SPECIFY_COLS )
+ #self.extractformat.SetSelection( 0 )
+ #fgSizer1.Add( self.extractformat, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
fgSizer1.AddSpacer( ( 0, 0), 1, wx.EXPAND, 5 )
parametres['onefile'] = True
else :
parametres['onefile'] = False
- parametres['encodeout'] = locale.getpreferredencoding()
+ if self.option == 'them' :
+ parametres['them'] = self.txtmods.GetValue().splitlines()
+ # if self.extractformat.GetSelection() == 0 :
+ # parametres['onefile'] = True
+ # else :
+ # parametres['onefile'] = False
+ parametres['encodeout'] = le[self.encodage.GetSelection()]
return parametres
def __del__( self ):
def __del__( self ):
pass
+
+
+class SubTextFromMetaDial ( wx.Dialog ):
+
+ def __init__( self, parent, parametres ):
+ wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Subcorpus from metadata", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_DIALOG_STYLE )
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"SubCorpus Name", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.subcorpusname = wx.TextCtrl( self, wx.ID_ANY, parametres['corpus_name'], wx.DefaultPosition, wx.Size( 300,-1 ), 0 )
+ fgSizer1.Add( self.subcorpusname, 0, wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Select one or more metadata", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_listBox1Choices = parametres['meta']
+ self.m_listBox1 = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.Size( -1,-1 ), m_listBox1Choices, wx.LB_HSCROLL|wx.LB_MULTIPLE )
+ self.m_listBox1.SetMinSize( wx.Size( -1,200 ) )
+ self.m_listBox1.SetMaxSize( wx.Size( -1,500 ) )
+
+ fgSizer1.Add( self.m_listBox1, 0, wx.ALL|wx.EXPAND, 5 )
+
+
+ bSizer1.Add( fgSizer1, 1, wx.EXPAND, 5 )
+
+ m_sdbSizer1 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer1OK = wx.Button( self, wx.ID_OK )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1OK )
+ self.m_sdbSizer1Cancel = wx.Button( self, wx.ID_CANCEL )
+ m_sdbSizer1.AddButton( self.m_sdbSizer1Cancel )
+ m_sdbSizer1.Realize();
+
+ bSizer1.Add( m_sdbSizer1, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+ bSizer1.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ def __del__( self ):
+ pass
+
+
+
+
+
# -*- coding: utf-8 -*-
#Author: Pierre Ratinaud
#Copyright (c) 2011, Pierre Ratinaud
-#Lisense: GNU/GPL
+#License: GNU/GPL
import codecs
indices_simi = [u'cooccurrence' ,'pourcentage de cooccurrence',u'Russel',u'Jaccard', 'Kulczynski1', 'Kulczynski2', 'Mountford', 'Fager', 'simple matching', 'Hamman', 'Faith', 'Tanimoto', 'Dice', 'Phi', 'Stiles', 'Michael', 'Mozley', 'Yule', 'Yule2', 'Ochiai', 'Simpson', 'Braun-Blanquet','Chi-squared', 'Phi-squared', 'Tschuprow', 'Cramer', 'Pearson', 'binomial']
+class TGen :
+ def __init__(self, path = None, encoding = 'utf8'):
+ self.path = path
+ self.tgen = {}
+ self.encoding = encoding
+
+ def __getitem__(self, key):
+ return self.tgen[key]
+
+ def read(self, path):
+ with codecs.open(path, 'r', self.encoding) as f :
+ tgen = f.read()
+ tgen = [line.split('\t') for line in tgen.splitlines()]
+ tgen = dict([[line[0], line[1:]] for line in tgen])
+ self.tgen = tgen
+ self.path = path
+
+ def write(self, path = None):
+ if path is None :
+ path = self.path
+ with open(path, 'w') as f :
+ f.write('\n'.join(['\t'.join([val] + self.tgen[val]) for val in self.tgen]))
+
+ def writetable(self, pathout, tgens, totocc):
+ etoiles = totocc.keys()
+ with open(pathout, 'w') as f :
+ line = '\t'.join([u'tgens'] + etoiles) + '\n'
+ f.write(line.encode(self.encoding))
+ for t in tgens :
+ line = '\t'.join([t] + [`tgens[t][et]` for et in etoiles]) + '\n'
+ f.write(line.encode(self.encoding))
+ i = 0
+ totname = 'total'
+ while totname + `i` in tgens :
+ i += 1
+ totname = totname + `i`
+ line = '\t'.join([totname] + [`totocc[et]` for et in etoiles])
+ f.write(line.encode(self.encoding))
+
class History :
def __init__(self, filein, syscoding = 'utf8') :
self.filein = filein
self.syscoding = syscoding
self.corpora = {}
self.openedcorpus = {}
+ self.openedmatrix = {}
self.orph = []
self.analyses = {}
self.history = []
self.corpus = dict([[corpus['uuid'], corpus] for corpus in self.history])
self.analyses = dict([[analyse['uuid'], analyse] for corpus in self.history for analyse in corpus.get('analyses', [])])
self.matrixanalyse = dict([[mat['uuid'], mat] for mat in self.matrix])
+ self.ordermatrix = dict([[matrix['uuid'], i] for i, matrix in enumerate(self.matrix)])
d.close()
def write(self) :
self.read()
def addMatrix(self, analyse) :
- tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type']}
- tosave['name'] = analyse['name']
+ tosave = analyse
+ #tosave['matrix_name'] = analyse['matrix_name']
+ tosave['analyses'] = []
self.matrix.append(tosave)
self.write()
self.read()
+ def addMatrixAnalyse(self, analyse) :
+ tosave = {'uuid' : analyse['uuid'], 'ira': analyse['ira'], 'type' : analyse['type'], 'matrix' : analyse['matrix']}
+ tosave['name'] = analyse['name']
+ if tosave['matrix'] in self.ordermatrix :
+ self.matrix[self.ordermatrix[tosave['matrix']]]['analyses'].append(tosave)
+ self.write()
+ self.read()
+
def addmultiple(self, analyses) :
log.info('add multiple')
for analyse in analyses :
for corpus in corpustodel :
print 'cleaning :', corpus['corpus_name']
self.delete(corpus, corpus = True)
+ anatodel = [analyse for corpus in self.history for analyse in corpus.get('analyses', []) if not os.path.exists(analyse.get('ira', '/'))]
+ for analyse in anatodel :
+ print 'cleaning :', analyse['name']
+ self.delete(analyse)
def __str__(self) :
return str(self.history)
def ReadDicoAsDico(dicopath):
with codecs.open(dicopath, 'r', 'UTF8') as f:
content = f.readlines()
- dico = {}
- for line in content :
- if line[0] != u'':
- line = line.rstrip('\n\r').replace(u'\n', '').replace('"', '').split('\t')
- dico[line[0]] = line[1:]
- return dico
+ lines = [line.rstrip('\n\r').replace(u'\n', '').replace('"', '').split('\t') for line in content if line != u'']
+ return dict([[line[0], line[1:]] for line in lines])
def ReadLexique(parent, lang = 'french', filein = None):
if lang != 'other' :
else :
parent.lexique = {}
-def ReadList(filein, encoding = sys.getdefaultencoding()):
+def ReadList(filein, encoding = sys.getdefaultencoding(), sep = ';'):
#file = open(filein)
- file = codecs.open(filein, 'r', encoding)
- content = file.readlines()
- file.close()
+ with codecs.open(filein, 'r', encoding) as f :
+ content = f.read()
+ content = [line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.').split(sep) for line in content.splitlines()]
+ #file = codecs.open(filein, 'r', encoding)
+ #content = file.readlines()
+ #file.close()
first = content.pop(0)
- first = first.replace('\n', '').replace('\r','').replace('\"', '').split(';')
+ #first = first.replace('\n', '').replace('\r','').replace('\"', '').split(sep)
dict = {}
i = 0
for line in content:
- line = line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.')
- line = line.split(';')
+ #line = line.replace('\n', '').replace('\r','').replace('\"', '').replace(',', '.')
+ #line = line.split(';')
nline = [line[0]]
for val in line[1:]:
if val == u'NA' :
ucis_txt = []
listmot = [corpus.getlems()[lem].formes for lem in mots]
listmot = [corpus.getforme(fid).forme for lem in listmot for fid in lem]
- mothtml = ['<font color=red><b>'+mot+'</b></font>' for mot in listmot]
+ mothtml = ['<font color=red><b>%s</b></font>' % mot for mot in listmot]
dmots = dict(zip(listmot, mothtml))
for uce in uces :
ucetxt = ucestxt1[uce].split()
ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[corpus.getucefromid(uce).uci].etoiles) + '</b></p>')
else :
ucis_txt.append('<p><b>' + ' '.join(corpus.ucis[uce].etoiles) + '</b></p>')
- ucestxt.append(ucetxt)
+ ucestxt.append(ucetxt)
return ucis_txt, ucestxt
from copy import copy
import dialog
from listlex import *
+from vitemspicker import VItemsPicker, EVT_IP_SELECTION_CHANGED, IP_SORT_CHOICES, IP_SORT_SELECTED, IP_REMOVE_FROM_CHOICES
from functions import treat_var_mod
dlg.CenterOnParent()
val = dlg.ShowModal()
if val == wx.ID_OK:
- self.tableau.parametre['colsep'] = dlg.colsep[dlg.choice3.GetSelection()]
- self.tableau.parametre['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()]
- if self.tableau.parametre['colsep'] == 'tabulation' :
- self.tableau.parametre['colsep'] = '\t'
- self.tableau.parametre['filetype'] = 'csv'
- else :
- dlg.Destroy()
+ self.tableau.parametres['colsep'] = dlg.colsep[dlg.choice3.GetSelection()]
+ self.tableau.parametres['txtsep'] = dlg.txtsep[dlg.choice4.GetSelection()]
+ if self.tableau.parametres['colsep'] == 'tabulation' :
+ self.tableau.parametres['colsep'] = '\t'
+ self.tableau.parametres['filetype'] = 'csv'
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)
dlg.CenterOnParent()
val = dlg.ShowModal()
if val == wx.ID_OK:
- self.tableau.parametre['colsep'] = ';'
- self.tableau.parametre['txtsep'] = '\"'
- self.tableau.parametre['encodage'] = sys.getdefaultencoding()
- self.tableau.parametre['sheetnb'] = dlg.spin1.GetValue()
- self.tableau.parametre['filetype'] = 'xls'
- else :
- dlg.Destroy()
+ self.tableau.parametres['colsep'] = ';'
+ self.tableau.parametres['txtsep'] = '\"'
+ self.tableau.parametres['encodage'] = sys.getdefaultencoding()
+ self.tableau.parametres['sheetnb'] = dlg.spin1.GetValue()
+ self.tableau.parametres['filetype'] = 'xls'
elif getfileextension(filename) == '.ods':
dlg = dialog.FileOptionDialog(self, -1, _(u"File format").decode('utf8'), sep=False, size=(350, 200),
style=wx.DEFAULT_DIALOG_STYLE)
dlg.CenterOnParent()
val = dlg.ShowModal()
if val == wx.ID_OK:
- self.tableau.parametre['colsep'] = ';'
- self.tableau.parametre['txtsep'] = '\"'
- self.tableau.parametre['filetype'] = 'ods'
- else :
- dlg.Destroy()
+ self.tableau.parametres['colsep'] = ';'
+ self.tableau.parametres['txtsep'] = '\"'
+ self.tableau.parametres['filetype'] = 'ods'
else :
val = False
if val == wx.ID_OK:
self.tableau.firstcolisrownames = True
else:
self.tableau.firstcolisrownames = False
- dlg.Destroy()
+ dlg.Destroy()
+ return val
def getPage(ira) :
if '_mgr' in dir(ira) :
param['stars'] = self.parametres['stars']
self.parametres.update(param)
+class CreateTgenDialog ( wx.Frame ):
+
+ def __init__( self, parent, lemlist, tgen = None, tgens = None ):
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u'Tgen Creator', pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP )
+
+ self.tgens = tgens
+ self.edit = False
+ self.parent = parent
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer2 = wx.BoxSizer( wx.VERTICAL )
+
+ fgSizer3 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer3.SetFlexibleDirection( wx.BOTH )
+ fgSizer3.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Name", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText3.Wrap( -1 )
+ fgSizer3.Add( self.m_staticText3, 0, wx.ALIGN_CENTER_VERTICAL|wx.ALIGN_LEFT|wx.ALL, 5 )
+
+ self.m_textCtrl1 = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_textCtrl1.SetMinSize( wx.Size( 250,-1 ) )
+
+
+ fgSizer3.Add( self.m_textCtrl1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer2.Add( fgSizer3, 1, wx.ALIGN_CENTER_HORIZONTAL, 5 )
+
+ self.ip = VItemsPicker(self,-1, lemlist,'Forms', 'Selected')
+ self.ip._source.SetMinSize( wx.Size( 250, 400 ) )
+
+ bSizer2.Add( self.ip, 0, wx.ALL, 5 )
+
+ m_sdbSizer3 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer3OK = wx.Button( self, wx.ID_OK )
+ m_sdbSizer3.AddButton( self.m_sdbSizer3OK )
+ self.m_sdbSizer3Cancel = wx.Button( self, wx.ID_CANCEL )
+ m_sdbSizer3.AddButton( self.m_sdbSizer3Cancel )
+ m_sdbSizer3.Realize();
+
+ bSizer2.Add( m_sdbSizer3, 1, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer2 )
+ self.Layout()
+ bSizer2.Fit( self )
+
+ self.Centre( wx.BOTH )
+
+ self.m_textCtrl1.Bind( wx.EVT_TEXT, self.OnTextEnter )
+ self.ip.Bind(EVT_IP_SELECTION_CHANGED, self.OnSelectionChange)
+ self.m_sdbSizer3OK.Bind(wx.EVT_BUTTON, self.OnClose)
+ self.m_sdbSizer3Cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
+
+ #self.ip.SetItems(lemlist)
+ self.m_sdbSizer3OK.Enable(False)
+
+ if tgen is not None :
+ self.m_textCtrl1.SetValue(tgen)
+ self.ip._destData = dict([[i,[word,'']] for i, word in enumerate(tgens[tgen])])
+ self.ip._SetDestItems()
+ #self.ip.SetSelections(tgens[tgen])
+ self.m_sdbSizer3OK.Enable(True)
+ self.edit = True
+ else :
+ self.edit = False
+
+ def __del__( self ):
+ pass
+
+ def OnTextEnter(self, evt):
+ if self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens and self.ip.GetSelections() != []:
+ self.m_sdbSizer3OK.Enable(True)
+ else :
+ self.m_sdbSizer3OK.Enable(False)
+ if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
+ self.m_sdbSizer3OK.Enable(True)
+
+ def OnSelectionChange(self, evt):
+ if self.ip.GetSelections() != [] and self.m_textCtrl1.GetValue() != '' and self.m_textCtrl1.GetValue() not in self.tgens :
+ self.m_sdbSizer3OK.Enable(True)
+ else :
+ self.m_sdbSizer3OK.Enable(False)
+ if self.m_textCtrl1.GetValue() != '' and self.ip.GetSelections() and self.edit:
+ self.m_sdbSizer3OK.Enable(True)
+
+ def OnClose(self, evt):
+ self.Close()
+
+ def OnCancel(self, evt):
+ self.Destroy()
+
+class TGenFrame ( wx.Frame ):
+
+ def __init__( self, parent, corpus, Tgen ):
+ wx.Frame.__init__ ( self, parent, id = wx.ID_ANY, title = u"Tgen", pos = wx.DefaultPosition, size = wx.Size( 473,434 ), style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP )
+
+ self.Tgen = Tgen
+ self.parent = parent
+ self.corpus = corpus
+ self.activetgen = None
+
+ self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
+
+ bSizer1 = wx.BoxSizer( wx.VERTICAL )
+
+ fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer1.SetFlexibleDirection( wx.BOTH )
+ fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.m_staticText1 = wx.StaticText( self, wx.ID_ANY, u"Tgen", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText1.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText1, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Content", wx.DefaultPosition, wx.DefaultSize, 0 )
+ self.m_staticText2.Wrap( -1 )
+ fgSizer1.Add( self.m_staticText2, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ tgensChoices = Tgen.tgen.keys()
+ self.tgens = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgensChoices, 0 )
+ self.tgens.SetMinSize( wx.Size( 200,250 ) )
+
+ fgSizer1.Add( self.tgens, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ tgencontentChoices = []
+ self.tgencontent = wx.ListBox( self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, tgencontentChoices, 0|wx.VSCROLL )
+ self.tgencontent.SetMinSize( wx.Size( 200,250 ) )
+
+ fgSizer1.Add( self.tgencontent, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ fgSizer2 = wx.FlexGridSizer( 0, 2, 0, 0 )
+ fgSizer2.SetFlexibleDirection( wx.BOTH )
+ fgSizer2.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
+
+ self.but_new = wx.Button( self, wx.ID_ANY, u"New...", wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer2.Add( self.but_new, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ self.but_del = wx.Button( self, wx.ID_ANY, u"Delete", wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer2.Add( self.but_del, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ fgSizer1.Add( fgSizer2, 1, wx.EXPAND, 5 )
+
+ self.but_edit = wx.Button( self, wx.ID_ANY, u"Edit", wx.DefaultPosition, wx.DefaultSize, 0 )
+ fgSizer1.Add( self.but_edit, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+
+ bSizer1.Add( fgSizer1, 1, wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL|wx.ALL, 5 )
+
+ m_sdbSizer2 = wx.StdDialogButtonSizer()
+ self.m_sdbSizer2OK = wx.Button( self, wx.ID_OK )
+ m_sdbSizer2.AddButton( self.m_sdbSizer2OK )
+ #self.m_sdbSizer2Cancel = wx.Button( self, wx.ID_CANCEL )
+ #m_sdbSizer2.AddButton( self.m_sdbSizer2Cancel )
+ m_sdbSizer2.Realize();
+
+ bSizer1.Add( m_sdbSizer2, 0, wx.EXPAND, 5 )
+
+
+ self.SetSizer( bSizer1 )
+ self.Layout()
+
+ self.Centre( wx.BOTH )
+
+ # Connect Events
+ self.tgens.Bind( wx.EVT_LISTBOX, self.GetContent )
+ self.but_new.Bind( wx.EVT_BUTTON, self.OnNewTgen )
+ self.but_del.Bind( wx.EVT_BUTTON, self.OnDeleteTgen )
+ self.but_edit.Bind( wx.EVT_BUTTON, self.OnEditTgen )
+ self.m_sdbSizer2OK.Bind( wx.EVT_BUTTON, self.OnOK )
+
+ def __del__( self ):
+ pass
+
+ def GetContent( self, event ):
+ tgen = event.GetString()
+ if tgen != '' :
+ self.tgencontent.Clear()
+ for word in self.Tgen[tgen] :
+ self.tgencontent.Append(word)
+
+ def OnNewTgen( self, event, tgen = None ):
+ if tgen is None :
+ self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgens = self.Tgen.tgen)
+ else :
+ self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
+ self.activetgen = tgen
+ self.dial.Show()
+ self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
+
+ def OnDeleteTgen( self, event ):
+ if self.tgens.GetSelection() != -1 :
+ tgens = self.tgens.GetItems()
+ del self.Tgen.tgen[tgens[self.tgens.GetSelection()]]
+ self.Tgen.write()
+ self.tgens.Clear()
+ self.tgencontent.Clear()
+ for val in self.Tgen.tgen :
+ self.tgens.Append(val)
+ event.Skip()
+
+ def OnEditTgen( self, event ):
+ if self.tgens.GetSelection() != -1 :
+ tgens = self.tgens.GetItems()
+ tgen = tgens[self.tgens.GetSelection()]
+ self.activetgen = tgen
+ self.dial = CreateTgenDialog(self, dict([[i, [lem, self.corpus.lems[lem].freq]] for i, lem in enumerate(self.corpus.lems.keys())]), tgen = tgen, tgens = self.Tgen.tgen)
+ self.dial.Bind(wx.EVT_CLOSE, self.OnDialClose)
+ self.dial.m_textCtrl1.Enable(False)
+ self.dial.ip._source.selected = dict(zip(self.Tgen.tgen[tgen], self.Tgen.tgen[tgen]))
+ self.dial.Show()
+ event.Skip()
+
+ def OnOK(self, evt):
+ self.Destroy()
+
+ def OnDialClose(self, evt):
+ if self.dial.edit :
+ del self.Tgen.tgen[self.activetgen]
+ self.tgens.Clear()
+ self.tgencontent.Clear()
+ for val in self.Tgen.tgen :
+ self.tgens.Append(val)
+ self.Tgen.tgen[self.dial.m_textCtrl1.GetValue()] = self.dial.ip.GetSelections()
+ self.Tgen.write()
+ self.tgens.Append(self.dial.m_textCtrl1.GetValue())
+ self.dial.Destroy()
+ evt.Skip()
height="400"
id="svg2"
version="1.1"
- inkscape:version="0.48.3.1 r9886"
+ inkscape:version="0.48.4 r9939"
sodipodi:docname="splash.svg"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
<defs
id="defs4">
<linearGradient
+ id="linearGradient5278">
+ <stop
+ style="stop-color:#31ed11;stop-opacity:1;"
+ offset="0"
+ id="stop5280" />
+ <stop
+ style="stop-color:#f3f20f;stop-opacity:1;"
+ offset="1"
+ id="stop5282" />
+ </linearGradient>
+ <linearGradient
+ osb:paint="gradient"
+ id="linearGradient5268">
+ <stop
+ style="stop-color:#1daf1a;stop-opacity:1;"
+ offset="0"
+ id="stop5270" />
+ <stop
+ id="stop5272"
+ offset="1"
+ style="stop-color:#236b19;stop-opacity:1;" />
+ </linearGradient>
+ <linearGradient
id="linearGradient5500">
<stop
id="stop5502"
id="linearGradient5474"
osb:paint="solid">
<stop
- style="stop-color:#22f86b;stop-opacity:1;"
+ style="stop-color:#f5e422;stop-opacity:1;"
offset="0"
id="stop5476" />
</linearGradient>
width="260" />
</pattern>
<linearGradient
- id="linearGradient3854">
+ id="linearGradient3854"
+ osb:paint="gradient">
<stop
id="stop3856"
offset="0"
- style="stop-color:#474b79;stop-opacity:1;" />
+ style="stop-color:#ecde0c;stop-opacity:1;" />
<stop
- style="stop-color:#489b97;stop-opacity:0.99248123;"
+ style="stop-color:#3ee327;stop-opacity:1;"
offset="1"
id="stop3801" />
</linearGradient>
</linearGradient>
<linearGradient
inkscape:collect="always"
- xlink:href="#linearGradient3836"
- id="linearGradient5496"
- x1="22.284641"
+ xlink:href="#linearGradient3854"
+ id="linearGradient5288"
+ x1="17.39444"
y1="852.94373"
- x2="483.92432"
+ x2="482.60556"
y2="852.94373"
- gradientUnits="userSpaceOnUse"
- gradientTransform="matrix(1.0077364,0,0,1,-3.7438314,0)" />
+ gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
- xlink:href="#linearGradient5500"
- id="linearGradient5498"
- x1="5.122551"
+ xlink:href="#linearGradient5278"
+ id="linearGradient5294"
+ x1="3.9517059"
y1="852.02026"
- x2="497.21915"
+ x2="496.04828"
y2="852.02026"
gradientUnits="userSpaceOnUse" />
</defs>
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="1.4"
- inkscape:cx="213.60775"
- inkscape:cy="156.61747"
+ inkscape:cx="240.01838"
+ inkscape:cy="170.0922"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
- inkscape:window-width="1018"
- inkscape:window-height="1030"
- inkscape:window-x="0"
- inkscape:window-y="18"
- inkscape:window-maximized="0" />
+ inkscape:window-width="1631"
+ inkscape:window-height="1026"
+ inkscape:window-x="49"
+ inkscape:window-y="24"
+ inkscape:window-maximized="1"
+ showguides="true"
+ inkscape:guide-bbox="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid5286" />
+ </sodipodi:namedview>
<metadata
id="metadata7">
<rdf:RDF>
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
+ <dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
id="layer1"
transform="translate(0,-652.36218)">
<rect
- style="fill:url(#linearGradient5498);fill-opacity:1.0;fill-rule:nonzero;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ style="fill:url(#linearGradient5294);fill-opacity:1.0;fill-rule:nonzero;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2995"
width="492.09659"
height="392.21405"
- x="5.122551"
+ x="3.9517059"
y="655.91327"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100" />
<rect
- style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
+ style="fill:#da1515;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0"
id="rect2997"
width="470.48599"
height="369.93991"
- x="16.284966"
+ x="14.757004"
y="667.79523"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100" />
<rect
- style="fill:url(#linearGradient5496);fill-opacity:1;fill-rule:nonzero;stroke:none"
+ style="fill:url(#linearGradient5288);fill-opacity:1;fill-rule:nonzero;stroke:none"
id="rect2999"
width="465.21112"
height="364.96094"
- x="18.713213"
+ x="17.39444"
y="670.46326"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
<flowRoot
xml:space="preserve"
id="flowRoot2985"
- style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- transform="matrix(1.0448226,0,0,1.1117284,-2.8815227,685.09285)"
+ style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#e91616;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
+ transform="matrix(1.0448226,0,0,1.1117284,-2.6868848,685.09285)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="81.822365"
x="31.31473"
y="15.13188"
- style="fill:#ffffff" /></flowRegion><flowPara
+ style="fill:#e91616;fill-opacity:1" /></flowRegion><flowPara
id="flowPara2991"
- style="font-size:72px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;font-family:Purisa;-inkscape-font-specification:Purisa Bold">IRaMuTeQ</flowPara></flowRoot> <flowRoot
+ style="font-size:72px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#e91616;fill-opacity:1;font-family:Purisa;-inkscape-font-specification:Purisa Bold">IRaMuTeQ</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3005"
- style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
- transform="translate(68.762161,722.33755)"
+ style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#240c0c;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+ transform="translate(66.443125,722.33755)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="24.243656"
x="91.923882"
y="176.75629"
- style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans" /></flowRegion><flowPara
+ style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#240c0c;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill-opacity:1" /></flowRegion><flowPara
id="flowPara3011">Laboratoire LERASS</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3013"
- style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
- transform="translate(45.110235,694.61528)"
+ style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#201111;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
+ transform="translate(43.084063,694.61528)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="25.253817"
x="166.67517"
y="246.45682"
- style="fill:#ffffff" /></flowRegion><flowPara
+ style="fill:#201111;fill-opacity:1" /></flowRegion><flowPara
id="flowPara3019"
- style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:FreeSans;-inkscape-font-specification:FreeSans">REPERE</flowPara></flowRoot> <flowRoot
+ style="font-size:20px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill:#201111;fill-opacity:1">REPERE</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3021"
- style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
- transform="translate(86.771593,672.81034)"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#210f0f;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+ transform="translate(83.841813,672.81034)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="18.18276"
x="109.09647"
y="318.17764"
- style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans" /></flowRegion><flowPara
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#210f0f;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill-opacity:1" /></flowRegion><flowPara
id="flowPara3029">Licence GNU GPL</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3033"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
- transform="translate(49.915894,767.51957)"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:middle;fill:#1d0e0e;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+ transform="translate(51.419563,767.51957)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="16.162449"
x="109.09647"
y="248.47711"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans" /></flowRegion><flowPara
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:center;line-height:125%;writing-mode:lr-tb;text-anchor:middle;fill:#1d0e0e;font-family:FreeSans;-inkscape-font-specification:FreeSans;fill-opacity:1" /></flowRegion><flowPara
id="flowPara3039">(c) 2008-2013 Pierre Ratinaud</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3041"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
- transform="translate(62.629458,659.43325)"
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#1a1b20;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans"
+ transform="translate(67.515625,659.43325)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="16.162449"
x="135.36044"
y="129.27911"
- style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;font-family:FreeSans;-inkscape-font-specification:FreeSans" /></flowRegion><flowPara
+ style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#1a1b20;fill-opacity:1;font-family:FreeSans;-inkscape-font-specification:FreeSans" /></flowRegion><flowPara
id="flowPara3047">www.iramuteq.org</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3860"
- style="font-size:14px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;font-family:gargi;-inkscape-font-specification:gargi Medium"
- transform="translate(76.843383,705.72695)"
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#1c1010;fill-opacity:1;stroke:none;font-family:gargi;-inkscape-font-specification:gargi Medium"
+ transform="translate(73.529297,703.58409)"
inkscape:export-filename="/home/pierre/workspace/iramuteq/images/splash.png"
inkscape:export-xdpi="100"
inkscape:export-ydpi="100"><flowRegion
height="19.192894"
x="110.10663"
y="146.45171"
- style="font-size:14px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ffffff;font-family:gargi;-inkscape-font-specification:gargi Medium" /></flowRegion><flowPara
+ style="font-size:14px;font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#1c1010;fill-opacity:1;font-family:gargi;-inkscape-font-specification:gargi Medium" /></flowRegion><flowPara
id="flowPara3866">Version 0.6 alpha 4</flowPara></flowRoot> <flowRoot
xml:space="preserve"
id="flowRoot3868"
pass
def endElement(self, name) :
- if name == 's' :
+ if name == 's' or name == 'w' :
self.printsent()
if name == 'p' :
self.printsent()
#self.fileout.write(content.encode('utf8'))
def text2stars(self, attrs) :
- stars = ['_'.join(val).replace(' ', '_').replace("'", '_') for val in attrs.items()]
+ stars = ['_'.join(val).replace(' ', '_').replace("'", '_').replace('/','').replace('.','').replace(';', '').replace(':', '').replace(u'·','') for val in attrs.items()]
stars = [''.join([u'*', val]) for val in stars]
stars = u'**** ' + ' '.join(stars)
self.fileout.write(stars.encode(self.encodage_out))
for f in files :
parser.parse(open(f, 'r'))
fout.write('\n\n')
+ print 'done'
#TXM2IRA(infiledir, fileout)
#from textchdalc import AnalyseAlceste
#from textdist import PamTxt
#from textafcuci import AfcUci
-from analysetxt import Alceste
-from corpus import Corpus, copycorpus, BuildFromAlceste
+from textreinert import Reinert
+from corpus import Corpus, copycorpus, BuildFromAlceste, BuildSubCorpus
from textaslexico import Lexico
from textstat import Stat
from tools import SubCorpus
pathout = os.path.dirname(os.path.dirname(os.path.abspath(options.read)))
self.corpus = corpus
print self.corpus
+ corpus.parametres['pathout'] = '/home/pierre/fac/etudiant/verdier/corpus20_corpus_2/test2'
+ BuildSubCorpus(corpus, parametres = {'fromthem' : True, 'theme' : [u'-*thématique_idéal']})
if corpus is not None :
corpus.conn_all()
# ucisize = corpus.getucisize()
# ucisize = [`val` for val in ucisize]
#uciet = [uci.etoiles[1:] for uci in corpus.ucis]
- uceet = [corpus.ucis[uce.uci].etoiles[1:] for uci in corpus.ucis for uce in uci.uces]
- print uceet[0:10]
- for line in uceet :
- print '\t'.join(line)
+ #uceet = [corpus.ucis[uce.uci].etoiles[1:] for uci in corpus.ucis for uce in uci.uces]
+ #print uceet[0:10]
+ #for line in uceet :
+ # print '\t'.join(line)
#res = zip(uciet, ucisize)
# res = [uciet[i] + [ucisize[i]] for i, val in enumerate(uciet)]
# print res[0:10]
#corpus.read_corpus()
#corpus.parse_active(gramact, gramsup)
config['type'] = 'alceste'
- self.Text = Alceste(self, corpus, parametres = config)
+ self.Text = Reinert(self, corpus, parametres = config)
# self.Text = AnalyseAlceste(self, cmd = True, big = True)
#self.Text = AnalyseAlceste(self, cmd = True)
elif options.type_analyse == 'pam' :