MCPcopy Index your code
hub / github.com/huichen/sego / tokenToSlice

Function tokenToSlice

utils.go:73–87  ·  view source on GitHub ↗
(token *Token)

Source from the content-addressed store, hash-verified

71}
72
73func tokenToSlice(token *Token) (output []string) {
74 hasOnlyTerminalToken := true
75 for _, s := range token.segments {
76 if len(s.token.segments) > 1 {
77 hasOnlyTerminalToken = false
78 }
79 }
80 if !hasOnlyTerminalToken {
81 for _, s := range token.segments {
82 output = append(output, tokenToSlice(s.token)...)
83 }
84 }
85 output = append(output, textSliceToString(token.text))
86 return output
87}
88
89// 将多个字元拼接一个字符串输出
90func textSliceToString(text []Text) string {

Callers 1

SegmentsToSliceFunction · 0.85

Calls 1

textSliceToStringFunction · 0.85

Tested by

no test coverage detected