落地 synastry/star/ask API 与 H5 页面,补齐 cece-frontend-re complete-design 证据文档,并加入 Android 模拟器截图抓取脚本。 Co-authored-by: Cursor <cursoragent@cursor.com>
43 lines
982 B
Go
43 lines
982 B
Go
// Package scale holds exploration-test scoring helpers.
|
|
package scale
|
|
|
|
// ScoreMajority picks the most frequent answer key and maps to a label set.
|
|
func ScoreMajority(answers map[string]string, labels map[string]string, defaultLabel string) (styleKey, label string) {
|
|
counts := map[string]int{}
|
|
for _, v := range answers {
|
|
counts[v]++
|
|
}
|
|
best, bestN := "", -1
|
|
for k, n := range counts {
|
|
if n > bestN {
|
|
best, bestN = k, n
|
|
}
|
|
}
|
|
if best == "" {
|
|
return "", defaultLabel
|
|
}
|
|
label = labels[best]
|
|
if label == "" {
|
|
label = defaultLabel
|
|
}
|
|
return best, label
|
|
}
|
|
|
|
// CommunicationLabels for communication-style scale.
|
|
func CommunicationLabels() map[string]string {
|
|
return map[string]string{
|
|
"A": "理性澄清型",
|
|
"B": "感受连接型",
|
|
"C": "节奏尊重型",
|
|
}
|
|
}
|
|
|
|
// EmotionLabels for emotion-pattern scale.
|
|
func EmotionLabels() map[string]string {
|
|
return map[string]string{
|
|
"A": "觉察表达型",
|
|
"B": "安抚稳定型",
|
|
"C": "行动调节型",
|
|
}
|
|
}
|