MCPcopy Create free account
hub / github.com/astercloud/aster / tokenCount

Function tokenCount

pkg/memory/bridge.go:99–105  ·  view source on GitHub ↗

tokenCount 通过空格粗略估算 token 数量,用于简单过滤。

(text string)

Source from the content-addressed store, hash-verified

97
98// tokenCount 通过空格粗略估算 token 数量,用于简单过滤。
99func tokenCount(text string) int {
100 text = strings.TrimSpace(text)
101 if text == "" {
102 return 0
103 }
104 return len(strings.Fields(text))
105}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected