go : use range over int
This commit is contained in:
parent
601fac8e3d
commit
21bd348a37
|
|
@ -334,7 +334,7 @@ func toSegment(ctx *whisper.Context, n int) Segment {
|
|||
|
||||
func toTokens(ctx *whisper.Context, n int) []Token {
|
||||
result := make([]Token, ctx.Whisper_full_n_tokens(n))
|
||||
for i := 0; i < len(result); i++ {
|
||||
for i := range result {
|
||||
data := ctx.Whisper_full_get_token_data(n, i)
|
||||
|
||||
result[i] = Token{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ func Test_Whisper_001(t *testing.T) {
|
|||
// Print out tokens
|
||||
num_segments := ctx.Whisper_full_n_segments()
|
||||
assert.GreaterOrEqual(num_segments, 1)
|
||||
for i := 0; i < num_segments; i++ {
|
||||
for i := range num_segments {
|
||||
str := ctx.Whisper_full_get_segment_text(i)
|
||||
assert.NotEmpty(str)
|
||||
t0 := time.Duration(ctx.Whisper_full_get_segment_t0(i)) * time.Millisecond
|
||||
|
|
|
|||
Loading…
Reference in New Issue