fake

package
v0.34.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Tokenizer

type Tokenizer struct {
	// TokensPerWord is the number of tokens per word (default 1).
	TokensPerWord int
	// FixedCount, if set, returns this count instead of counting.
	FixedCount int
	// Err, if set, is returned by CountTokens.
	Err error
}

Tokenizer is a fake tokenizer for testing. It counts tokens by splitting on whitespace.

func NewTokenizer

func NewTokenizer() *Tokenizer

NewTokenizer creates a new fake tokenizer with sensible defaults.

func (*Tokenizer) CountTokens

func (f *Tokenizer) CountTokens(_ context.Context, text string) (int, error)

CountTokens returns the token count for the given text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL