<commit_before>package de.maibornwolff.codecharta.importer.codemaat

import de.maibornwolff.codecharta.model.*
import java.util.*
import java.util.regex.Pattern

class CSVRow(private val row: Array<String?>, private val header: CSVHeader, private val pathSeparator: Char) {

    init {
        if (row.size <= header.pathColumn.size) {
            throw IllegalArgumentException(
                    "Row " + Arrays.toString(row) + " has no column containing the file path. Should be in one of " + header.pathColumn + " columns.")
        }
    }

    fun asEdge(): Edge {
        val rootNode = "/root/"
        val fromNodeName = rootNode + allColumns.get("entity")
        val toNodeName = rootNode + allColumns.get("coupled")

        return Edge(fromNodeName, toNodeName, attributes)
    }

    private val allColumns: Map<String, String> =
            header.columnNumbers
                    .filter { validAttributeValue(it) }
                    .associateBy(
                            { header.getColumnName(it) },
                            { row[it]!! }
                    )

    private val attributes: Map<String, String> =
            header.columnNumbers
                    .filter { validAttributeValue(it) && isAttributeColumn(it) }
                    .associateBy(
                            { header.getColumnName(it) },
                            { row[it]!! }
                    )

    private fun validAttributeValue(i: Int) =
            i < row.size
                    && row[i] != null

    private fun isAttributeColumn(i: Int) =
            header.pathColumn.filter { pathColumnIndex -> i == pathColumnIndex }.isEmpty()


}<commit_msg>Fix type cast for edge-attributes<commit_after>package de.maibornwolff.codecharta.importer.codemaat

import de.maibornwolff.codecharta.model.*
import java.util.*

class CSVRow(private val row: Array<String?>, private val header: CSVHeader, private val pathSeparator: Char) {

    init {
        if (row.size <= header.pathColumn.size) {
            throw IllegalArgumentException(
                    "Row " + Arrays.toString(row) + " has no column containing the file path. Should be in one of " + header.pathColumn + " columns.")
        }
    }

    fun asEdge(): Edge {
        val rootNode = "/root/"
        val fromNodeName = rootNode + allColumns.get("entity")
        val toNodeName = rootNode + allColumns.get("coupled")

        return Edge(fromNodeName, toNodeName, attributes)
    }

    private val allColumns: Map<String, String> =
            header.columnNumbers
                    .filter { validAttributeValue(it) }
                    .associateBy(
                            { header.getColumnName(it) },
                            { row[it]!! }
                    )

    private val attributes: Map<String, Int> =
            header.columnNumbers
                    .filter { validAttributeValue(it) && isAttributeColumn(it) }
                    .associateBy(
                            { header.getColumnName(it) },
                            { row[it]!!.toInt() }
                    )

    private fun validAttributeValue(i: Int) =
            i < row.size && row[i] != null

    private fun isAttributeColumn(i: Int) =
            header.pathColumn.filter { pathColumnIndex -> i == pathColumnIndex }.isEmpty()


}
{'fraction_non_alphanumeric': 0.10271084337349398, 'fraction_numerical': 0.0, 'mean_word_length': 1.7767558528428093, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 11, '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': '539777', 'n_tokens_mistral': 907, 'n_tokens_neox': 866, 'n_words': 204}