<commit_before>package com.strumenta.kolasu.validation

data class Result<C>(val issues: List<Issue>, val root: C?) {
    val lexicalErrors
        get() = issues.filter { it.type == IssueType.LEXICAL }.toList()
    val correct: Boolean
        get() = issues.isEmpty()

    companion object {
        fun <C> exception(errorType: IssueType, e: Throwable): Result<C> {
            val errors = listOf(
                Issue(
                    type = errorType,
                    message = e.message ?: e.javaClass.simpleName,
                    position = null
                )
            )
            return Result(errors, null)
        }
    }
}<commit_msg>add projections of issues in Result<commit_after>package com.strumenta.kolasu.validation

data class Result<C>(val issues: List<Issue>, val root: C?) {
    val lexicalIssues
        get() = issues.filter { it.type == IssueType.LEXICAL }.toList()
    val syntacticIssues
        get() = issues.filter { it.type == IssueType.SYNTACTIC }.toList()
    val semanticIssues
        get() = issues.filter { it.type == IssueType.SEMANTIC }.toList()
    val errors
        get() = issues.filter { it.severity == IssueSeverity.ERROR }.toList()
    val warnings
        get() = issues.filter { it.severity == IssueSeverity.WARNING }.toList()
    val correct: Boolean
        get() = issues.isEmpty()

    companion object {
        fun <C> exception(errorType: IssueType, e: Throwable): Result<C> {
            val errors = listOf(
                Issue(
                    type = errorType,
                    message = e.message ?: e.javaClass.simpleName,
                    position = null
                )
            )
            return Result(errors, null)
        }
    }
}
{'fraction_non_alphanumeric': 0.1103448275862069, 'fraction_numerical': 0.0, 'mean_word_length': 1.8540983606557377, 'pattern_counts': {'":': 0, '<': 11, '<?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': '3226533', 'n_tokens_mistral': 505, 'n_tokens_neox': 483, 'n_words': 123}