关于「工单根因聚类:一个月的售后消息由什么构成」,《零客服界面与自助修正状态机》给出的定量结论是什么?

结论:第一章用自写分词、Jaccard 相似度与单链聚类给工单分簇,阈值 0.30 时纯度 0.888,并说明簇必须由人命名才成为根因。

数据口径:在合成的一个月里,可自助类别合计只占 0.869,退款、付款与杂项必须留给人;把完成率与新咨询的不确定性抽样进去,消灭率九成区间为 0.468 到 0.601,要达到 0.9 需要统一完成率 1.086,算术上做不到。 书中参数为示意,全部计算由书中程序生成;本书是非个人化经营建议,不构成法律意见。

English version

对照数据表

下表数字由本章 Python 程序原样打印,可重新运行复现。 程序只用 Python 标准库与结论吻合的打印值: 0.30, 0.888

tickets 366  distinct token sets 66
thresh clusters singletons purity mixed largest
 0.15        7          0  0.623     2     232
 0.30       19          0  0.888     3      63
 0.50       26          0  0.967     1      39
top clusters at 0.30 (size, majority class, a member):
   63  not_received  'report not received email'
   58  progress      'where is my order now'
   36  not_received  'hello charged twice payment'
   28  not_received  'thanks paid but nothing in inbox'
   27  progress      'hi when will parcel'
   26  wrong_input   'hi birth data mistake correct'
查看完整验算程序
# Chapter 1. p12: Jaccard single-link clustering of the p11 month
# Own tokenizer, Jaccard similarity on word sets and single-link
# clustering by union-find at three thresholds. Purity is measured
# against the hidden root-cause class that the generator knows.
import random
import re
from collections import Counter

CLASSES = [
    ("not_received", 0.22, ["report not received email",
                            "no email arrived after payment",
                            "paid but nothing in inbox"]),
    ("wrong_input", 0.15, ["wrong birth time entered",
                           "typed wrong date need fix",
                           "birth data mistake correct"]),
    ("progress", 0.20, ["where is my order now",
                        "order status update",
                        "when will parcel arrive"]),
    ("repeat_chase", 0.12, ["asked yesterday no reply where order",
                            "second message still waiting",
                            "again asking status still nothing"]),
    ("link_expired", 0.08, ["download link expired",
                            "link not working cannot download",
                            "book link dead"]),
    ("refund", 0.06, ["want refund", "refund request order cancel",
                      "money back cancel order"]),
    ("content_q", 0.07, ["question about report meaning",
                         "what does section mean",
                         "explain chapter in report"]),
    ("payment", 0.05, ["charged twice payment",
                       "payment failed but money taken",
                       "card declined cannot pay"]),
    ("other", 0.05, ["change shipping address",
                     "invoice needed company",
                     "partnership question"]),
]
FILLER = ["hi", "please", "help", "urgent", "thanks", "today",
          "hello", "asap", "pls"]
STOP = set(FILLER) | {"is", "my", "in", "but", "the", "a", "will",
                      "does", "what", "about", "after", "no", "not"}


def month(rng, days=30, orders=100, p_ticket=0.12):
    out = []
    weights = [w for _, w, _ in CLASSES]
    for day in range(days):
        for _ in range(orders):
            if rng.random() >= p_ticket:
                continue
            k = rng.choices(range(len(CLASSES)), weights)[0]
            words = rng.choice(CLASSES[k][2]).split()
            if len(words) > 2 and rng.random() < 0.15:
                del words[rng.randrange(len(words))]
            if rng.random() < 0.5:
                words.insert(0, rng.choice(FILLER))
            out.append((day, CLASSES[k][0], " ".join(words)))
    return out


def tokens(text):
    return frozenset(w for w in re.findall(r"[a-z]+", text.lower())
                     if w not in STOP)


def jaccard(a, b):
    if not a and not b:
        return 1.0
    return len(a & b) / len(a | b)


def single_link(sets, t):
    parent = list(range(len(sets)))

    def find(i):
        while parent[i] != i:
            parent[i] = parent[parent[i]]
            i = parent[i]
        return i
    for i in range(len(sets)):
        for j in range(i + 1, len(sets)):
            if jaccard(sets[i], sets[j]) >= t:
                ri, rj = find(i), find(j)
                if ri != rj:
                    parent[max(ri, rj)] = min(ri, rj)
    return [find(i) for i in range(len(sets))]


tickets = month(random.Random(40101))
sets = [tokens(t[2]) for t in tickets]
labels = [t[1] for t in tickets]
n = len(tickets)
print("tickets {}  distinct token sets {}".format(n, len(set(sets))))
print("thresh clusters singletons purity mixed largest")
for t in (0.15, 0.3, 0.5):
    root = single_link(sets, t)
    groups = {}
    for i, r in enumerate(root):
        groups.setdefault(r, []).append(labels[i])
    pure = 0
    mixed = 0
    single = 0
    for g in groups.values():
        top = Counter(g).most_common(1)[0][1]
        pure += top
        if top < len(g):
            mixed += 1
        if len(g) == 1:
            single += 1
    big = max(len(g) for g in groups.values())
    print("{:>5.2f} {:>8} {:>10} {:>6.3f} {:>5} {:>7}".format(
        t, len(groups), single, pure / n, mixed, big))
root = single_link(sets, 0.3)
groups = {}
for i, r in enumerate(root):
    groups.setdefault(r, []).append(i)
order = sorted(groups.values(), key=lambda g: (-len(g), g[0]))
print("top clusters at 0.30 (size, majority class, a member):")
for g in order[:6]:
    maj = Counter(labels[i] for i in g).most_common(1)[0][0]
    print("  {:>3}  {:<13} '{}'".format(len(g), maj, tickets[g[0]][2]))

唯一数据源与引用

范雅福(Fan, Y.). (2026). 《日入百单零客服自愈界面、错填自助修正状态机与售后工单源头消灭母典》第 1 章「工单根因聚类:一个月的售后消息由什么构成」(版本 1.0.0). 5D Library. DOI 待发布

DOI 待发布 · 专著页正式发布后上线(本站暂无专著页) · 5DL-B-401 · v1.0.0 · CC-BY-NC-ND-4.0

BibTeX
@book{fan2026401,
  author    = {Fan, Yafu},
  title     = {Zero-Ticket Self-Repairing Order Interfaces, Self-Service Correction State Machines and Pre-Emptive Support Elimination},
  year      = {2026},
  publisher = {5D Library},
  edition   = {1.0.0},
  note      = {DOI pending}
}

本书其他章节结论