1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

string cloning; fix foo.str += 's'

This commit is contained in:
Alexander Medvednikov
2019-12-12 04:09:31 +03:00
parent e182274fe7
commit 576618d8cc
6 changed files with 34 additions and 23 deletions

View File

@ -45,7 +45,8 @@ pub fn dice_coefficient(s1, s2 string) f32 {
mut first_bigrams := map[string]int
for i := 0; i < a.len-1; i++ {
bigram := a[i..i+2]
q := if bigram in first_bigrams { first_bigrams[bigram]+1 } else { 1 }
q := if bigram in first_bigrams {
first_bigrams[bigram]+1 } else { 1 }
first_bigrams[bigram] = q
}
mut intersection_size := 0