Skip to content

Commit

Permalink
refactor: format
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Feb 23, 2024
1 parent 6a2eda6 commit da7c828
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (w *Dictionary) count(substr string) {
w.counter[prefix] = map[string]int{}
}

w.counter[prefix][suffix] += 1
w.counter[prefix][suffix]++
}

// splitToLength splits a string to substrings of length.
Expand Down
4 changes: 3 additions & 1 deletion generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,18 @@ func (g Generator) Word() string {
if len(characters) > g.MaxSequences {
characters = characters[1:]
}

var nextAccumedProbs map[string]float32
n := 0
for {
str := strings.Join(characters[n:], "")
nextAccumedProbs = g.Probabilities[str]
n += 1
n++
if nextAccumedProbs != nil || n >= len(characters) {
break
}
}

nextCharacter := ""
r := random.Float32()
probability := float32(0)
Expand Down

0 comments on commit da7c828

Please sign in to comment.