Datasets:
Tasks:
Text Classification
Modalities:
Text
Languages:
Chinese
Size:
10K<n<100K
Libraries:
Datasets
License:
File size: 12,645 Bytes
b17fc71 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | <!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>中文情感数据集 · 可视化概览</title>
<script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.3/dist/chart.umd.min.js"></script>
<style>
:root {
--bg: #f5f7fb;
--card: #ffffff;
--border: #e2e8f0;
--text: #1e293b;
--muted: #64748b;
--sadness: #6366f1;
--joy: #f59e0b;
--love: #ec4899;
--anger: #ef4444;
--fear: #8b5cf6;
--surprise: #10b981;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "PingFang SC","Microsoft YaHei",sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
header {
background: linear-gradient(135deg, #3b5bdb 0%, #845ef7 100%);
color: #fff; padding: 2.5rem 2rem 2rem;
text-align: center;
}
header h1 { font-size: 2rem; font-weight: 700; margin-bottom: .5rem; }
header p { font-size: 1rem; opacity: .85; }
.badge { display: inline-block; background: rgba(255,255,255,.2); border-radius: 999px; padding: .2rem .8rem; font-size: .8rem; margin: .2rem; }
main { max-width: 1100px; margin: 0 auto; padding: 2rem 1rem; }
/* ── 统计卡片 ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(160px,1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card {
background: var(--card); border-radius: 12px; border: 1px solid var(--border);
padding: 1.25rem; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.stat-card .num { font-size: 2rem; font-weight: 700; }
.stat-card .label { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
/* ── 区块卡片 ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.card h2 { font-size: 1.1rem; font-weight: 600; margin-bottom: 1.25rem; color: var(--text); }
/* ── 图表布局 ── */
.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
@media(max-width:700px){ .chart-row { grid-template-columns: 1fr; } }
canvas { max-height: 280px; }
/* ── 标签分布 bar ── */
.dist-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(300px,1fr)); gap: 1rem; }
.dist-item { display: flex; align-items: center; gap: .75rem; }
.dist-item .em { font-size: 1.2rem; }
.dist-item .info { flex: 1; }
.dist-item .info .name { font-size: .9rem; font-weight: 500; margin-bottom: .25rem; }
.bar-wrap { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.dist-item .info .nums { font-size: .78rem; color: var(--muted); margin-top: .2rem; }
/* ── 样例 ── */
.example-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.tab-btn {
padding: .4rem 1rem; border-radius: 999px; border: 1.5px solid var(--border);
background: transparent; cursor: pointer; font-size: .85rem; font-family: inherit;
transition: all .2s;
}
.tab-btn.active { color: #fff; border-color: transparent; }
.example-list { display: none; }
.example-list.show { display: block; }
.ex-item {
display: flex; align-items: flex-start; gap: .75rem;
padding: .75rem 0; border-bottom: 1px dashed var(--border);
}
.ex-item:last-child { border-bottom: none; }
.ex-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; margin-top: .35rem; }
.ex-text { font-size: .9rem; line-height: 1.6; }
/* ── 文件格式表 ── */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th,td { padding: .65rem 1rem; border: 1px solid var(--border); text-align: left; }
th { background: #f8fafc; font-weight: 600; }
code { background: #f1f5f9; padding: .1rem .4rem; border-radius: 4px; font-size: .82rem; font-family: monospace; }
footer { text-align: center; padding: 2rem; font-size: .8rem; color: var(--muted); }
</style>
</head>
<body>
<header>
<h1>🇨🇳 中文情感数据集</h1>
<p>Chinese Emotion Dataset · 参照 dair-ai/emotion 格式构建</p>
<div style="margin-top:.8rem">
<span class="badge">6 种情感</span>
<span class="badge">20,000 条数据</span>
<span class="badge">3 个划分</span>
<span class="badge">CSV / JSONL / JSON</span>
</div>
</header>
<main>
<!-- 统计卡片 -->
<div class="stat-grid">
<div class="stat-card"><div class="num" style="color:#3b5bdb">20,000</div><div class="label">总样本数</div></div>
<div class="stat-card"><div class="num" style="color:#3b5bdb">16,000</div><div class="label">训练集</div></div>
<div class="stat-card"><div class="num" style="color:#3b5bdb">2,000</div><div class="label">验证集</div></div>
<div class="stat-card"><div class="num" style="color:#3b5bdb">2,000</div><div class="label">测试集</div></div>
<div class="stat-card"><div class="num" style="color:#3b5bdb">6</div><div class="label">情感类别</div></div>
<div class="stat-card"><div class="num" style="color:#3b5bdb">3</div><div class="label">文件格式</div></div>
</div>
<!-- 图表 -->
<div class="chart-row">
<div class="card">
<h2>📊 情感类别分布(训练集)</h2>
<canvas id="barChart"></canvas>
</div>
<div class="card">
<h2>🍕 各类别占比(训练集)</h2>
<canvas id="pieChart"></canvas>
</div>
</div>
<!-- 标签详情 -->
<div class="card">
<h2>🏷️ 各情感标签详情</h2>
<div class="dist-grid" id="distGrid"></div>
</div>
<!-- 样例数据 -->
<div class="card">
<h2>💬 样例数据</h2>
<div class="example-tabs" id="exTabs"></div>
<div id="exLists"></div>
</div>
<!-- 数据格式 -->
<div class="card">
<h2>📁 数据格式说明</h2>
<table>
<thead><tr><th>字段名</th><th>类型</th><th>说明</th><th>示例值</th></tr></thead>
<tbody>
<tr><td><code>text</code></td><td>string</td><td>中文短文本</td><td>今天心情好极了</td></tr>
<tr><td><code>label</code></td><td>int (0–5)</td><td>情感编号</td><td>1</td></tr>
<tr><td><code>label_name</code></td><td>string</td><td>英文情感名</td><td>joy</td></tr>
<tr><td><code>label_cn</code></td><td>string</td><td>中文情感名</td><td>快乐</td></tr>
</tbody>
</table>
<p style="margin-top:1rem;font-size:.85rem;color:var(--muted)">提供 <code>train.csv</code> / <code>train.jsonl</code> / <code>train.json</code> 三种格式,验证集和测试集同理。</p>
</div>
</main>
<footer>Chinese Emotion Dataset · MIT License · 参照 dair-ai/emotion 构建</footer>
<script>
const LABELS = [
{ id: 0, cn: "悲伤", en: "sadness", em: "😢", color: "#6366f1", train: 3200, val: 400, test: 400 },
{ id: 1, cn: "快乐", en: "joy", em: "😄", color: "#f59e0b", train: 4000, val: 500, test: 500 },
{ id: 2, cn: "爱", en: "love", em: "❤️", color: "#ec4899", train: 1600, val: 200, test: 200 },
{ id: 3, cn: "愤怒", en: "anger", em: "😡", color: "#ef4444", train: 2000, val: 250, test: 250 },
{ id: 4, cn: "恐惧", en: "fear", em: "😨", color: "#8b5cf6", train: 2400, val: 300, test: 300 },
{ id: 5, cn: "惊讶", en: "surprise",em: "😲", color: "#10b981", train: 2800, val: 350, test: 350 },
];
const EXAMPLES = {
"悲伤": [
"那个熟悉的拥抱再也不会有了",
"最近,悲伤像雾一样弥漫在我心里散不去",
"泪水流尽了,却还是感觉不到任何轻松",
"这段时间真的太煎熬了,每天都很难熬",
"这种痛苦,只有经历过的人才能理解"
],
"快乐": [
"美食加上好心情,今天完美",
"阳光正好,风景美极了,心情棒棒哒",
"今天的心情好极了,整个人都充满了活力",
"最喜欢这种阳光灿烂的日子",
"今天的小确幸好多,感谢生活"
],
"爱": [
"每次看到你,我的心就变得很柔软",
"想把你捧在手心里,好好珍惜",
"我愿意为你改变,因为你值得我付出最好的自己",
"每次看见你,心里就涌出一股暖意",
"爱你,是我每天最重要的事情"
],
"愤怒": [
"简直无法理解这种行为,太令人气愤了",
"这件事简直让我目瞪口呆,气到无语",
"这件事真的让我怒不可遏,太过分了",
"这件事让我彻夜难眠,气得要命",
"每次想到这件事就气得发抖"
],
"恐惧": [
"明明想要逃跑,双腿却不听使唤",
"在那一刻,我感到了从未有过的巨大恐惧",
"一个人面对这件事,感觉无依无靠,特别害怕",
"一个人面对这些,我真的很害怕",
"心跳加速、手心出汗,整个人都慌了"
],
"惊讶": [
"每次以为已经习惯了,还是会被新的事情惊到",
"这件事发展得太快了,让我措手不及",
"明明有心理准备,还是被惊到了",
"这一幕实在太出人意料,连我都愣住了",
"太意外了,完全打了我一个措手不及"
]
};
// ── 柱状图 ──
const barCtx = document.getElementById("barChart").getContext("2d");
new Chart(barCtx, {
type: "bar",
data: {
labels: LABELS.map(l => `${l.em} ${l.cn}`),
datasets: [{
label: "训练集数量",
data: LABELS.map(l => l.train),
backgroundColor: LABELS.map(l => l.color + "cc"),
borderColor: LABELS.map(l => l.color),
borderWidth: 1.5,
borderRadius: 6,
}]
},
options: {
responsive: true, maintainAspectRatio: true,
plugins: { legend: { display: false } },
scales: {
y: { beginAtZero: true, grid: { color: "#f1f5f9" } },
x: { grid: { display: false } }
}
}
});
// ── 饼图 ──
const pieCtx = document.getElementById("pieChart").getContext("2d");
new Chart(pieCtx, {
type: "doughnut",
data: {
labels: LABELS.map(l => `${l.em} ${l.cn}`),
datasets: [{
data: LABELS.map(l => l.train),
backgroundColor: LABELS.map(l => l.color + "cc"),
borderColor: LABELS.map(l => l.color),
borderWidth: 1.5,
}]
},
options: {
responsive: true, maintainAspectRatio: true,
plugins: { legend: { position: "bottom", labels: { padding: 10, font: { size: 12 } } } }
}
});
// ── 标签详情条 ──
const maxTrain = Math.max(...LABELS.map(l => l.train));
const distGrid = document.getElementById("distGrid");
LABELS.forEach(l => {
const pct = ((l.train / 16000) * 100).toFixed(1);
const barW = (l.train / maxTrain * 100).toFixed(1);
distGrid.innerHTML += `
<div class="dist-item">
<div class="em">${l.em}</div>
<div class="info">
<div class="name">${l.cn} <small style="color:var(--muted)">/ ${l.en}</small></div>
<div class="bar-wrap"><div class="bar-fill" style="width:${barW}%;background:${l.color}"></div></div>
<div class="nums">训练 ${l.train.toLocaleString()} · 验证 ${l.val} · 测试 ${l.test} · 占比 ${pct}%</div>
</div>
</div>`;
});
// ── 样例数据标签页 ──
const exTabs = document.getElementById("exTabs");
const exLists = document.getElementById("exLists");
let firstTab = true;
LABELS.forEach(l => {
const btn = document.createElement("button");
btn.className = "tab-btn" + (firstTab ? " active" : "");
btn.textContent = `${l.em} ${l.cn}`;
btn.dataset.label = l.cn;
if (firstTab) btn.style.cssText = `background:${l.color};color:#fff;border-color:${l.color}`;
btn.addEventListener("click", () => {
document.querySelectorAll(".tab-btn").forEach(b => {
b.classList.remove("active");
b.style.background = "";
b.style.color = "";
b.style.borderColor = "";
});
btn.classList.add("active");
btn.style.cssText = `background:${l.color};color:#fff;border-color:${l.color}`;
document.querySelectorAll(".example-list").forEach(el => el.classList.remove("show"));
document.getElementById("ex-" + l.cn).classList.add("show");
});
exTabs.appendChild(btn);
const list = document.createElement("div");
list.className = "example-list" + (firstTab ? " show" : "");
list.id = "ex-" + l.cn;
(EXAMPLES[l.cn] || []).forEach(text => {
list.innerHTML += `
<div class="ex-item">
<div class="ex-dot" style="background:${l.color}"></div>
<div class="ex-text">${text}</div>
</div>`;
});
exLists.appendChild(list);
firstTab = false;
});
</script>
</body>
</html>
|