12.07.2015 Views

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

METODOLOGIA DE MINERAÇÃO DE DADOS PARA ANÁLISE DO ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Gera_navegacao_total_memoria.pyimport stringimport os.pathimport timeprint time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())print 'Gera navegacao total por ip+agente distinto...'print '----------------------------------------------'#le arquivo de configuracao (diretorio de trabalho)arqconf = 'Configuracao.txt'entradaconf = open(arqconf)if os.path.isfile(arqconf):for line in entradaconf:diretorio = line[0:len(line)-1]breakelse:print 'Arquivo de configuracao nao encontrado...'entradaconf.close()total = 0gravado = 0arqin = diretorio + '\Trabalho\\emagrecendo_sem_robots.log'arqout1 = diretorio + '\Trabalho\\navegacao_total.log'saida1 = open(arqout1, 'w')arqout2 = diretorio + '\Trabalho\\uri_stem.log'saida2 = open(arqout2, 'w')index = ['/2004/index.htm','/2004/index.shtml/','/index.htm'] #sinonimos de '/2004/index.shtml'tabela = []print ' 'print 'arqin: ', arqinprint ' 'print 'arqout1: ', arqout1print 'arqout2: ', arqout2print ' '#carrega o log todo em memoriaif os.path.isfile(arqin):entrada = open(arqin)for line in entrada:total = total + 1if total % 50000 == 0:print totalrec = string.splitfields(line, ' ')if rec[4] in index:rec[4] = '/2004/index.shtml'if rec[5] '-' and string.count(rec[4], '/2004/asp/') > 0:#print rec[4], rec[5]saida2.write(rec[4] + '?' + rec[5] + '\n')else:saida2.write(rec[4] + '\n')temp = rec[8] + ' ' + rec[9] + ' ' + rec[0] + ' ' + rec[1] + ' ' + rec[4]181

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!