[ai-completion] ML-3769 use relaxed match as a secondary metric in reports

GitOrigin-RevId: a627b2db311d143beff96c388f0b67505910dbdb
This commit is contained in:
Oleg Taratukhin
2024-09-30 13:45:26 +02:00
committed by intellij-monorepo-bot
parent 5df70be0ba
commit 28f446816d
2 changed files with 4 additions and 4 deletions

View File

@@ -90,7 +90,7 @@ abstract class BaseRelaxedMetric(showByDefault: Boolean) : LineSimularityMetric(
override fun computeExpected(lookup: Lookup, expectedText: String): Double = RelaxedSimilarityUtils.RelaxedResult.MULTI.weight override fun computeExpected(lookup: Lookup, expectedText: String): Double = RelaxedSimilarityUtils.RelaxedResult.MULTI.weight
} }
class RelaxedExactMatchOnlyAlphanum(showByDefault: Boolean) : BaseRelaxedMetric(showByDefault) { class RelaxedExactMatchOnlyAlphanum(showByDefault: Boolean = false) : BaseRelaxedMetric(showByDefault) {
override val name: String = "Relaxed alphanumeric-only exact match" override val name: String = "Relaxed alphanumeric-only exact match"
override val description: String = override val description: String =
"Checks that for any the suggested lines of the completion, at least one of the lines from middle matches it." "Checks that for any the suggested lines of the completion, at least one of the lines from middle matches it."
@@ -101,7 +101,7 @@ class RelaxedExactMatchOnlyAlphanum(showByDefault: Boolean) : BaseRelaxedMetric(
/** /**
* Note that the default threshold value is picked experimenatlly. * Note that the default threshold value is picked experimenatlly.
*/ */
class RelaxedEditDistanceOnlyAlphanum(showByDefault: Boolean, threshold: Double = 0.767) : BaseRelaxedMetric(showByDefault) { class RelaxedEditDistanceOnlyAlphanum(showByDefault: Boolean = false, threshold: Double = 0.767) : BaseRelaxedMetric(showByDefault) {
override val name: String = "Relaxed alphanumeric-only edit distance" override val name: String = "Relaxed alphanumeric-only edit distance"
override val description: String = override val description: String =
"Checks that for any the suggested lines of the completion, there is a line from middle that has a normalized edit distance less than $threshold." "Checks that for any the suggested lines of the completion, there is a line from middle that has a normalized edit distance less than $threshold."

View File

@@ -2,9 +2,9 @@
package com.intellij.cce.report package com.intellij.cce.report
import com.intellij.cce.core.Session import com.intellij.cce.core.Session
import com.intellij.cce.metric.CharFScore
import com.intellij.cce.metric.CharFScoreFirstLine import com.intellij.cce.metric.CharFScoreFirstLine
import com.intellij.cce.metric.Metric import com.intellij.cce.metric.Metric
import com.intellij.cce.metric.RelaxedExactMatchOnlyAlphanum
import com.intellij.cce.metric.TotalLatencyMetric import com.intellij.cce.metric.TotalLatencyMetric
import com.intellij.cce.workspace.storages.FeaturesStorage import com.intellij.cce.workspace.storages.FeaturesStorage
import kotlinx.html.* import kotlinx.html.*
@@ -56,6 +56,6 @@ class MultiLineFileReportGenerator(
private val PRIMARY_METRIC = CharFScoreFirstLine() private val PRIMARY_METRIC = CharFScoreFirstLine()
private const val PRIMARY_COLORING_SCALER = 120 private const val PRIMARY_COLORING_SCALER = 120
private val SECONDARY_METRIC = CharFScore() private val SECONDARY_METRIC = RelaxedExactMatchOnlyAlphanum()
} }
} }