<commit_before>package mapreduce;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
 
public class MediaMapper extends Mapper<LongWritable, Text, Text, DoubleWritable> {
	private Text word = new Text();
	private DoubleWritable count = new DoubleWritable();
	
	@Override
	protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException{
		Configuration conf = context.getConfiguration();
		String dado = conf.get("dado");
		String agregador = conf.get("agregador");
		
		String balde = value.toString();
		if(balde.charAt(0) != 'S'){
			String texto = "";
			int i = 0;
			while(i < 6){
				texto += balde.charAt(i);
				i++;
			}	
			word.set(texto);
			
			i= 24;
			texto = "";
			while(i < 30){
				if(balde.charAt(i) != ' '){
					texto += balde.charAt(i);
				}
				i++;
			}	
			count.set(Double.parseDouble(texto));
			try {
				context.write(word, count);
			} 
			catch (NumberFormatException e) {
				
			}
		}
	}
}<commit_msg>Primeiro teste de utilizacao de dado e agregador.<commit_after>package mapreduce;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import java.io.IOException;
 
public class MediaMapper extends Mapper<LongWritable, Text, Text, DoubleWritable> {
	private Text word = new Text();
	private DoubleWritable count = new DoubleWritable();
	
	@Override
	protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException{
		Configuration conf = context.getConfiguration();
		String dado = conf.get("dado");
		String agregador = conf.get("agregador");
		int iniAgregador = 0;
		int fimAgregador = 0;
		int iniDado = 0;
		int fimDado = 0;
		
		if(agregador.equals("Ano")){
			iniAgregador = 15;
			fimAgregador = 18;
		}
		
		if(dado.equals("Temperatura")){
			iniDado = 25;
			fimDado = 30;
		}
		
		
		String balde = value.toString();
		if(balde.charAt(0) != 'S'){
			String valor = "";
			
			while(iniAgregador < fimAgregador){
				valor += balde.charAt(iniAgregador);
				iniAgregador++;
			}	
			word.set(valor);
			
			valor = "";
			while(iniDado < fimDado){
				if(balde.charAt(iniDado) != ' '){
					valor += balde.charAt(iniDado);
				}
				iniDado++;
			}
			count.set(Double.parseDouble(valor));
			
			try {
				context.write(word, count);
			} 
			catch (NumberFormatException e) {
				
			}
		}
	}
}
{'fraction_non_alphanumeric': 0.13360778443113772, 'fraction_numerical': 0.0074850299401197605, 'mean_word_length': 3.55366269165247, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3603858', 'n_tokens_mistral': 1104, 'n_tokens_neox': 918, 'n_words': 194}