Improve scoring

Antonio Scandurra created

Change summary

crates/ai/src/streaming_diff.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Detailed changes

crates/ai/src/streaming_diff.rs 🔗

@@ -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 {