Skip to content

Commit

Permalink
Fix some golint problems
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-nicola committed Dec 11, 2020
1 parent a278316 commit d41a37f
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion models/bpemodel/word.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func NewWord() *Word {
return &w
}

// NewWord returns a new empty Word with the given capacity.
// NewWordWithCapacity returns a new empty Word with the given capacity.
func NewWordWithCapacity(capacity int) *Word {
w := make(Word, 0, capacity)
return &w
Expand Down
2 changes: 1 addition & 1 deletion models/wordpiecemodel/wordpiecemodel.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (m *WordPieceModel) Tokenize(sequence string) ([]models.Token, error) {
if len(subStr) > 0 {
end -= len(string(subStr[len(subStr)-1]))
} else {
end -= 1
end--
}
}

Expand Down
4 changes: 2 additions & 2 deletions pretokenizedstring/pretokenizedstring.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (p *PreTokenizedString) Normalize(
return nil
}

// Normalize tokenizes all the splits that do not have attached Split.Tokens,
// Tokenize tokenizes all the splits that do not have attached Split.Tokens,
// using the provided tokenization function.
func (p *PreTokenizedString) Tokenize(
tokenize func(ns *normalizedstring.NormalizedString) ([]models.Token, error),
Expand Down Expand Up @@ -133,7 +133,7 @@ func (p *PreTokenizedString) GetOriginalByteSplits() []OriginalByteSplit {
return result
}

// GetOriginalByteSplits returns a list of NormalizedByteSplit.
// GetNormalizedByteSplits returns a list of NormalizedByteSplit.
func (p *PreTokenizedString) GetNormalizedByteSplits() []NormalizedByteSplit {
result := make([]NormalizedByteSplit, len(p.splits))
offset := 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func New(
}
}

// DefaultByteLevelPreTokenizer returns a new ByteLevelPreTokenizer, using
// NewDefault returns a new ByteLevelPreTokenizer, using
// DefaultSplittingRegexp, and enabling prefix space insertion.
func NewDefault() *ByteLevelPreTokenizer {
return New(DefaultSplittingRegexp, true, true)
Expand Down
2 changes: 1 addition & 1 deletion strutils/strutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type BytesToRuneOffsetConverter struct {
func NewBytesToRuneOffsetConverter(sequence string) *BytesToRuneOffsetConverter {
mapping := make([]int, 0, len(sequence))
for runeIndex, r := range sequence {
for _ = range []byte(string(r)) {
for range []byte(string(r)) {
mapping = append(mapping, runeIndex)
}
}
Expand Down

0 comments on commit d41a37f

Please sign in to comment.