Skip to content

Commit 79d5d57

Browse files
committed
fix(lint): auto-fix comment periods with godot tool
Run godot -w to automatically add missing periods to comments
1 parent 837c0aa commit 79d5d57

File tree

15 files changed

+49
-49
lines changed

15 files changed

+49
-49
lines changed

llama3/cmd/llama3/decode.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ import (
1212
)
1313

1414
var (
15-
// Decode command flags
15+
// Decode command flags.
1616
decSkipSpecial bool
1717
)
1818

19-
// newDecodeCmd creates the decode subcommand
19+
// newDecodeCmd creates the decode subcommand.
2020
func newDecodeCmd() *cobra.Command {
2121
cmd := &cobra.Command{
2222
Use: "decode [token_ids...]",

llama3/cmd/llama3/encode.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ import (
1212
)
1313

1414
var (
15-
// Encode command flags
15+
// Encode command flags.
1616
encAddBOS bool
1717
encAddEOS bool
1818
encOutput string
1919
)
2020

21-
// newEncodeCmd creates the encode subcommand
21+
// newEncodeCmd creates the encode subcommand.
2222
func newEncodeCmd() *cobra.Command {
2323
cmd := &cobra.Command{
2424
Use: "encode [text]",

llama3/cmd/llama3/info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/spf13/cobra"
88
)
99

10-
// newInfoCmd creates the info subcommand
10+
// newInfoCmd creates the info subcommand.
1111
func newInfoCmd() *cobra.Command {
1212
cmd := &cobra.Command{
1313
Use: "info",

llama3/cmd/llama3/stream.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import (
99
)
1010

1111
var (
12-
// Stream command flags
12+
// Stream command flags.
1313
streamBufferSize int
1414
streamMaxBuffer int
1515
streamAddBOS bool
1616
streamAddEOS bool
1717
streamOutput string
1818
)
1919

20-
// newStreamCmd creates the stream subcommand
20+
// newStreamCmd creates the stream subcommand.
2121
func newStreamCmd() *cobra.Command {
2222
cmd := &cobra.Command{
2323
Use: "stream",

llama3/comparison_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,19 @@ import (
1111
"testing"
1212
)
1313

14-
// ComparisonTestCase represents a test case for comparing Go and JS implementations
14+
// ComparisonTestCase represents a test case for comparing Go and JS implementations.
1515
type ComparisonTestCase struct {
1616
Input string `json:"input"`
1717
Expected []int `json:"expected"`
1818
}
1919

20-
// toJSON converts a value to JSON string
20+
// toJSON converts a value to JSON string.
2121
func toJSON(v interface{}) string {
2222
b, _ := json.Marshal(v)
2323
return string(b)
2424
}
2525

26-
// generateTestVectors creates a JavaScript file to generate test vectors
26+
// generateTestVectors creates a JavaScript file to generate test vectors.
2727
func generateTestVectors(testCases []string) ([]ComparisonTestCase, error) {
2828
// Create temporary JS file
2929
tmpDir := os.TempDir()
@@ -62,7 +62,7 @@ console.log(JSON.stringify(results, null, 2));
6262
return results, nil
6363
}
6464

65-
// TestComparisonWithJS compares Go implementation with JavaScript implementation
65+
// TestComparisonWithJS compares Go implementation with JavaScript implementation.
6666
func TestComparisonWithJS(t *testing.T) {
6767
tokenizer, err := New()
6868
if err != nil || tokenizer.VocabSize() == 0 {
@@ -208,7 +208,7 @@ func TestComparisonWithJS(t *testing.T) {
208208
}
209209
}
210210

211-
// TestComparisonFromFile tests using test vectors from a file
211+
// TestComparisonFromFile tests using test vectors from a file.
212212
func TestComparisonFromFile(t *testing.T) {
213213
tokenizer, err := New()
214214
if err != nil || tokenizer.VocabSize() == 0 {
@@ -270,7 +270,7 @@ func TestComparisonFromFile(t *testing.T) {
270270
}
271271
}
272272

273-
// generateTestVectorFile creates a file with test vectors for future use
273+
// generateTestVectorFile creates a file with test vectors for future use.
274274
func generateTestVectorFile(filename string, count int) error {
275275
// Generate diverse test inputs
276276
var inputs []string

llama3/compatibility_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212
testutils "github.com/agentstation/tokenizer/llama3/internal/testing"
1313
)
1414

15-
// TestCompatibility runs comprehensive compatibility tests with 476 test cases
15+
// TestCompatibility runs comprehensive compatibility tests with 476 test cases.
1616
func TestCompatibility(t *testing.T) {
1717
tokenizer, err := New()
1818
if err != nil || tokenizer.VocabSize() == 0 {
@@ -96,7 +96,7 @@ func TestCompatibility(t *testing.T) {
9696
float64(totalPassed)*100/float64(totalPassed+totalFailed))
9797
}
9898

99-
// getJSTokenization gets tokenization results from JavaScript implementation
99+
// getJSTokenization gets tokenization results from JavaScript implementation.
100100
func getJSTokenization(inputs []string, jsPath string) ([][]int, error) {
101101
// Create temporary JS file
102102
tmpDir := os.TempDir()
@@ -134,7 +134,7 @@ console.log(JSON.stringify(results));
134134
return results, nil
135135
}
136136

137-
// compareTokens compares two token arrays
137+
// compareTokens compares two token arrays.
138138
func compareTokens(a, b []int) bool {
139139
if len(a) != len(b) {
140140
return false
@@ -147,7 +147,7 @@ func compareTokens(a, b []int) bool {
147147
return true
148148
}
149149

150-
// TestTokenizationProperties tests properties that should hold for all inputs
150+
// TestTokenizationProperties tests properties that should hold for all inputs.
151151
func TestTokenizationProperties(t *testing.T) {
152152
tokenizer, err := New()
153153
if err != nil || tokenizer.VocabSize() == 0 {
@@ -185,7 +185,7 @@ func TestTokenizationProperties(t *testing.T) {
185185
}
186186
}
187187

188-
// BenchmarkCases benchmarks various categories of inputs
188+
// BenchmarkCases benchmarks various categories of inputs.
189189
func BenchmarkCases(b *testing.B) {
190190
tokenizer, err := New()
191191
if err != nil || tokenizer.VocabSize() == 0 {

llama3/errors.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,22 @@ import (
55
"fmt"
66
)
77

8-
// Common errors
8+
// Common errors.
99
var (
10-
// ErrDataNotFound indicates that the tokenizer data files could not be found
10+
// ErrDataNotFound indicates that the tokenizer data files could not be found.
1111
ErrDataNotFound = errors.New("tokenizer data not found")
1212

13-
// ErrInvalidToken indicates an invalid token was provided
13+
// ErrInvalidToken indicates an invalid token was provided.
1414
ErrInvalidToken = errors.New("invalid token")
1515

16-
// ErrTokenNotFound indicates a token was not found in the vocabulary
16+
// ErrTokenNotFound indicates a token was not found in the vocabulary.
1717
ErrTokenNotFound = errors.New("token not found")
1818

19-
// ErrInvalidTokenID indicates an invalid token ID was provided
19+
// ErrInvalidTokenID indicates an invalid token ID was provided.
2020
ErrInvalidTokenID = errors.New("invalid token ID")
2121
)
2222

23-
// DataError represents an error related to tokenizer data loading or processing
23+
// DataError represents an error related to tokenizer data loading or processing.
2424
type DataError struct {
2525
Op string // Operation that failed
2626
Path string // File path if applicable
@@ -38,7 +38,7 @@ func (e *DataError) Unwrap() error {
3838
return e.Err
3939
}
4040

41-
// TokenError represents an error related to token operations
41+
// TokenError represents an error related to token operations.
4242
type TokenError struct {
4343
Token string // The token that caused the error
4444
TokenID int // The token ID if applicable
@@ -60,7 +60,7 @@ func (e *TokenError) Unwrap() error {
6060
return e.Err
6161
}
6262

63-
// ConfigError represents an error in tokenizer configuration
63+
// ConfigError represents an error in tokenizer configuration.
6464
type ConfigError struct {
6565
Field string // Configuration field that has an error
6666
Value any // The invalid value
@@ -77,22 +77,22 @@ func (e *ConfigError) Unwrap() error {
7777

7878
// Helper functions for creating errors
7979

80-
// NewDataError creates a new DataError
80+
// NewDataError creates a new DataError.
8181
func NewDataError(op, path string, err error) error {
8282
return &DataError{Op: op, Path: path, Err: err}
8383
}
8484

85-
// NewTokenError creates a new TokenError
85+
// NewTokenError creates a new TokenError.
8686
func NewTokenError(op, token string, err error) error {
8787
return &TokenError{Op: op, Token: token, Err: err}
8888
}
8989

90-
// NewTokenIDError creates a new TokenError with a token ID
90+
// NewTokenIDError creates a new TokenError with a token ID.
9191
func NewTokenIDError(op string, tokenID int, err error) error {
9292
return &TokenError{Op: op, TokenID: tokenID, Err: err}
9393
}
9494

95-
// NewConfigError creates a new ConfigError
95+
// NewConfigError creates a new ConfigError.
9696
func NewConfigError(field string, value any, err error) error {
9797
return &ConfigError{Field: field, Value: value, Err: err}
9898
}

llama3/internal/pretokenizer/state_machine_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ func TestCharacterClassification(t *testing.T) {
10701070
})
10711071
}
10721072

1073-
// Benchmark tests to ensure performance hasn't regressed
1073+
// Benchmark tests to ensure performance hasn't regressed.
10741074
func BenchmarkTokenizeLongText(b *testing.B) {
10751075
// Create a realistic long text
10761076
parts := []string{
@@ -1121,7 +1121,7 @@ func BenchmarkTokenizeWhitespaceHeavyTable(b *testing.B) {
11211121
}
11221122
}
11231123

1124-
// TestStateMachineJavaScriptCompatibility tests cases from JavaScript output
1124+
// TestStateMachineJavaScriptCompatibility tests cases from JavaScript output.
11251125
func TestStateMachineJavaScriptCompatibility(t *testing.T) {
11261126
testCases := []struct {
11271127
input string

llama3/internal/tokens/special.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
)
88

99
var (
10-
// SpecialTokenRegex matches Llama 3 special tokens
10+
// SpecialTokenRegex matches Llama 3 special tokens.
1111
SpecialTokenRegex = regexp.MustCompile(`<\|(?:begin_of_text|end_of_text|start_header_id|end_header_id|eot_id|eom_id|python_tag|finetune_right_pad_id|reserved_special_token_(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-3][0-9]|24[0-7]))\|>`)
1212

13-
// OptimisticSpecialTokenRegex matches any pattern that looks like a special token
13+
// OptimisticSpecialTokenRegex matches any pattern that looks like a special token.
1414
OptimisticSpecialTokenRegex = regexp.MustCompile(`<\|[a-zA-Z0-9_]+\|>`)
1515
)
1616

llama3/internal/vocabulary/decoder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
const (
10-
// bitsPerMergeID is the number of bits used to encode each merge ID
10+
// bitsPerMergeID is the number of bits used to encode each merge ID.
1111
bitsPerMergeID = 17
1212
)
1313

0 commit comments

Comments
 (0)