<commit_before>/*
 * Copyright 2006-2010 <NAME>, Sr.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.exoprax.assay.input;

import java.io.BufferedReader;
import java.io.IOException;

import org.exoprax.assay.Assay;
import org.exoprax.assay.AssayInput;

public class TabSeparatedValuesInput implements AssayInput {
	
    private Assay assay;
    
    private BufferedReader bufferedReader;

    public TabSeparatedValuesInput() {
    	super();
    }
    
	public void setBufferedReader(final BufferedReader bufferedReader) {
		this.bufferedReader = bufferedReader;
	}

	public void setAssay(final Assay assay) {
		this.assay = assay;
	}

	public void run() {
		try {
			final String [] columnNames = bufferedReader.readLine().split("\t");
			
			for (int i = 0; i < columnNames.length; ++i) {
				assay.addAttribute(columnNames[i], "TEXT");
			}
			
			while (true) {
				final String line = bufferedReader.readLine();
				
				if (line == null) {
					break;
				}
				
				final String [] columnValues = line.split("\t");
				
				final int columnCount = (columnNames.length > columnValues.length) ? columnValues.length : columnNames.length;
				
				for (int i = 0; i < columnCount; ++i) {
					assay.addAttributeValue(columnNames[i], columnValues[i]);
				}
			}
		}
		catch (final IOException e) {
			throw new RuntimeException("IOException while reading Tab Separated Values input", e);
		}
	}

}<commit_msg>Accept IntelliJ suggestion to make this "for each", but added "final" myself.<commit_after>/*
 * Copyright 2006-2010 <NAME>, Sr.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *     http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

package org.exoprax.assay.input;

import java.io.BufferedReader;
import java.io.IOException;

import org.exoprax.assay.Assay;
import org.exoprax.assay.AssayInput;

public class TabSeparatedValuesInput implements AssayInput {
	
    private Assay assay;
    
    private BufferedReader bufferedReader;

    public TabSeparatedValuesInput() {
    	super();
    }
    
	public void setBufferedReader(final BufferedReader bufferedReader) {
		this.bufferedReader = bufferedReader;
	}

	public void setAssay(final Assay assay) {
		this.assay = assay;
	}

	public void run() {
		try {
			final String [] columnNames = bufferedReader.readLine().split("\t");

            for (final String columnName : columnNames) {
                assay.addAttribute(columnName, "TEXT");
            }
			
			while (true) {
				final String line = bufferedReader.readLine();
				
				if (line == null) {
					break;
				}
				
				final String [] columnValues = line.split("\t");
				
				final int columnCount = (columnNames.length > columnValues.length) ? columnValues.length : columnNames.length;
				
				for (int i = 0; i < columnCount; ++i) {
					assay.addAttributeValue(columnNames[i], columnValues[i]);
				}
			}
		}
		catch (final IOException e) {
			throw new RuntimeException("IOException while reading Tab Separated Values input", e);
		}
	}

}
{'fraction_non_alphanumeric': 0.09904474610356963, 'fraction_numerical': 0.006787330316742082, 'mean_word_length': 3.278494623655914, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3835235', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1110, 'n_words': 373}