def prepararArquivo(self, arquivo): if (self.comQuebraLinha): stringArquivo = Util.lerArquivo(arquivo) else: # Se (comQuebraLinha = False), le o arquivo sem considerar as quebras de linha (LF, CR) stringArquivo = Util.lerArquivoSemQuebraLinha(arquivo) # Se (comComentariosELiterais = False), retira os comentarios e literais da string if not (self.comComentariosELiterais): stringArquivo = self.removerComentarios(stringArquivo) stringArquivo = self.removerLiterais(stringArquivo) #print stringArquivo # Separa o arquivo em n-grams nGrams = self.separarEmNGrams(stringArquivo) return nGrams
def recuperarNGrams(self, arquivoNGrams): return Util.lerArquivo(arquivoNGrams)