mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-18 18:08:07 +03:00
Improve scoring
This commit is contained in:
parent
c1d9b37dbc
commit
cbf7160054
@ -83,8 +83,8 @@ pub struct StreamingDiff {
|
||||
impl StreamingDiff {
|
||||
const INSERTION_SCORE: f64 = -1.;
|
||||
const DELETION_SCORE: f64 = -5.;
|
||||
const EQUALITY_BASE: f64 = 2.;
|
||||
const MAX_EQUALITY_EXPONENT: i32 = 32;
|
||||
const EQUALITY_BASE: f64 = 1.4;
|
||||
const MAX_EQUALITY_EXPONENT: i32 = 64;
|
||||
|
||||
pub fn new(old: String) -> Self {
|
||||
let old = old.chars().collect::<Vec<_>>();
|
||||
@ -120,7 +120,7 @@ impl StreamingDiff {
|
||||
if self.old[i - 1] == ' ' {
|
||||
self.scores.get(i - 1, j - 1)
|
||||
} else {
|
||||
let exponent = cmp::min(equal_run as i32 / 3, Self::MAX_EQUALITY_EXPONENT);
|
||||
let exponent = cmp::min(equal_run as i32, Self::MAX_EQUALITY_EXPONENT);
|
||||
self.scores.get(i - 1, j - 1) + Self::EQUALITY_BASE.powi(exponent)
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user