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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Gera_uri_stem_distintos.pyimport stringimport os.pathimport timeprint time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())print 'Gera uri-stem distintos...'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()arqin = diretorio + '\Trabalho\uri_stem.log'arqout = diretorio + '\Trabalho\uri_stem_distintos.log'saida = open(arqout, 'w')total = 0gravado = 0repetido = 0lista = []print ' 'print 'arqin: ', arqinprint 'arqout: ', arqoutprint ' 'if os.path.isfile(arqin):entrada = open(arqin)for line in entrada:total = total + 1if total % 50000 == 0:print totallista.append(line)print 'Inicio sort...'lista.sort()lista.reverse()print 'Fim sort...'dado1 = lista.pop()saida.write(dado1)gravado = gravado + 1while 1:try:dado2 = lista.pop()while dado1 == dado2:dado2 = lista.pop()repetido = repetido + 1saida.write(dado2)gravado = gravado + 1dado1 = dado2183

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

Saved successfully!

Ooh no, something went wrong!