MCPcopy Create free account
hub / github.com/codechenx/FastTableViewer / scoreSeparator

Method scoreSeparator

sepDector.go:171–200  ·  view source on GitHub ↗

Score separator quality (higher is better)

(sep rune, count int)

Source from the content-addressed store, hash-verified

169
170// Score separator quality (higher is better)
171func (sd *sepDetecor) scoreSeparator(sep rune, count int) int {
172 score := 0
173
174 // Prefer common separators
175 switch sep {
176 case ',':
177 score += 1000 // Highest priority
178 case '\t':
179 score += 900
180 case '|':
181 score += 800
182 case ';':
183 score += 700
184 case ':':
185 score += 600
186 case ' ':
187 score += 100 // Lowest priority (can be ambiguous)
188 default:
189 score += 500 // Moderate priority for other chars
190 }
191
192 // Prefer separators with reasonable column counts (2-100)
193 if count >= 2 && count <= 100 {
194 score += count * 10
195 } else if count > 100 {
196 score -= 100 // Penalize too many columns
197 }
198
199 return score
200}
201
202// remove duplication item in []rune
203func uniqueChar(intSlice []rune) []rune {

Callers 2

detectBestSeparatorMethod · 0.95
TestScoreSeparatorFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestScoreSeparatorFunction · 0.76