Skip to content

Commit

Permalink
docs: improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
thde committed Mar 14, 2023
1 parent 03141cb commit 58c09a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dictionary.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Dictionary struct {
counter map[string]map[string]int
}

// Add adds words to a Dictionary.
// Add words to a Dictionary.
func (w *Dictionary) Add(words ...string) *Dictionary {
if w.PrefixLength == 0 {
w.PrefixLength = defaultPrefixLength
Expand All @@ -35,7 +35,7 @@ func (w *Dictionary) Add(words ...string) *Dictionary {
return w
}

// Read reads from an io.Reader and adds those words to a Dictionary.
// Read from an io.Reader and adds those words to a Dictionary.
// Lines prefixed with # are skipped.
func (w *Dictionary) Read(in io.Reader) *Dictionary {
scanner := bufio.NewScanner(in)
Expand All @@ -52,7 +52,7 @@ func (w *Dictionary) Read(in io.Reader) *Dictionary {
return w
}

// Calculare returns a new Generator based on the words added
// Generator returns a new Generator based on the words added
// to the dictionary.
func (w *Dictionary) Generator() Generator {
m := map[string]map[string]float32{}
Expand All @@ -75,7 +75,7 @@ func (w *Dictionary) Generator() Generator {
return Generator{Probabilities: m}
}

// count counts the amount of occurencies of a suffix
// count the amount of occurencies of a suffix
func (w *Dictionary) count(substr string) {
prefix := substr[:len(substr)-1]
suffix := substr[len(substr)-1:]
Expand Down
1 change: 1 addition & 0 deletions generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

const (
// MaxSequencesDefault contains the default for Generator.MaxSequences
MaxSequencesDefault = 2

prefix = "^"
Expand Down

0 comments on commit 58c09a4

Please sign in to comment.