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

caching modules: almost there

This commit is contained in:
Alexander Medvednikov
2019-10-07 01:31:01 +03:00
parent dbd72ee828
commit a9a73d9315
15 changed files with 209 additions and 161 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.substr(i, i+2)
first_bigrams[bigram] = 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
for i := 0; i < b.len-1; i++ {