aboutsummaryrefslogtreecommitdiffstats
path: root/skate/verify.go
diff options
context:
space:
mode:
Diffstat (limited to 'skate/verify.go')
-rw-r--r--skate/verify.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/skate/verify.go b/skate/verify.go
index 22f0a0d..5df0a7e 100644
--- a/skate/verify.go
+++ b/skate/verify.go
@@ -8,7 +8,6 @@
package skate
import (
- "bytes"
"fmt"
"regexp"
"strconv"
@@ -501,17 +500,17 @@ func authorSimilarityScore(s, t string) float64 {
// tokenNgrams are groups of n char-tokens per word-token in string, e.g. for
// n=2 and string "Anne K Lam", we would get ["an", "ne", "k", "la", "m"].
func tokenNgrams(s string, n int) (result []string) {
- var buf bytes.Buffer
+ var sb strings.Builder
for _, token := range tokenizeString(s) {
- buf.Reset()
+ sb.Reset()
for i, c := range token {
if i > 0 && i%n == 0 {
- result = append(result, buf.String())
- buf.Reset()
+ result = append(result, sb.String())
+ sb.Reset()
}
- buf.WriteRune(c) // XXX: skipping error handling
+ sb.WriteRune(c) // XXX: skipping error handling
}
- result = append(result, buf.String())
+ result = append(result, sb.String())
}
return
}