> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akria.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 第1组：数据层基础 | Data Layer Basics

> 测试你对原始数据、数据摄入等基础概念的掌握程度

<a href="quiz" className="text-emerald-600 hover:underline text-sm">← 返回选单</a>

## 📝 词汇测验

export const QuizRunner = () => {
  const questions = [
    {
        "q": "以下哪个词代表'原始数据'？",
        "o": [
            "Refined",
            "Raw",
            "Cooked",
            "Final"
        ],
        "a": "Raw",
        "h": "未处理的最初数据。"
    },
    {
        "q": "'Ingest' 在数据处理中是指：",
        "o": [
            "导出",
            "摄入/采集",
            "删除",
            "加密"
        ],
        "a": "摄入/采集",
        "h": "把数据写入系统。"
    },
    {
        "q": "'Normalized' 数据的含义是：",
        "o": [
            "异常的",
            "标准化",
            "随机的",
            "备份的"
        ],
        "a": "标准化",
        "h": "清洗并统一口径。"
    },
    {
        "q": "'Source' 表示：",
        "o": [
            "目的地",
            "来源",
            "中转站",
            "存储"
        ],
        "a": "来源",
        "h": "数据来自哪里。"
    },
    {
        "q": "'Event' 翻译为：",
        "o": [
            "计划",
            "事件",
            "任务",
            "告警"
        ],
        "a": "事件",
        "h": "一条独立的信息或事实。"
    },
    {
        "q": "'Processed' 表示：",
        "o": [
            "待处理",
            "已处理",
            "处理失败",
            "取消处理"
        ],
        "a": "已处理",
        "h": "经过分析加工。"
    },
    {
        "q": "'Feature' 在数据挖掘中是：",
        "o": [
            "外观",
            "特征",
            "功能",
            "补丁"
        ],
        "a": "特征",
        "h": "可计算的关键信息。"
    },
    {
        "q": "'Embedding' 在 AI 领域常指：",
        "o": [
            "嵌入/向量",
            "删除",
            "解压缩",
            "路由"
        ],
        "a": "嵌入/向量",
        "h": "AI 可理解的数值表示。"
    },
    {
        "q": "'Candidate' 信号是指：",
        "o": [
            "最终信号",
            "候选信号",
            "错误信号",
            "过期信号"
        ],
        "a": "候选信号",
        "h": "待审核的信号。"
    },
    {
        "q": "'Evidence' 指的是：",
        "o": [
            "想法",
            "证据",
            "假设",
            "后果"
        ],
        "a": "证据",
        "h": "支撑结论的信息。"
    }
];

  const [idx, setIdx] = React.useState(0);
  const [scr, setScr] = React.useState(0);
  const [fin, setFin] = React.useState(false);
  const [sel, setSel] = React.useState(null);
  const [ok, setOk] = React.useState(null);
  const [ready, setReady] = React.useState(false);
  const [sq, setSq] = React.useState([]);

  React.useEffect(() => {
    setReady(true);
    setSq(questions.map(q => ({ ...q, o: [...q.o].sort(() => Math.random() - 0.5) })));
  }, []);

  const onAnswer = (o) => {
    if (sel) return;
    setSel(o);
    const isOk = o === questions[idx].a;
    setOk(isOk);
    if (isOk) setScr(scr + 1);
    setTimeout(() => {
      if (idx + 1 < questions.length) {
        setIdx(idx + 1);
        setSel(null);
        setOk(null);
      } else {
        setFin(true);
      }
    }, 1500);
  };

  if (!ready) return <div className="p-10 text-center opacity-50">Loading...</div>;

  if (fin) {
    return (
      <div className="p-10 rounded-2xl bg-white dark:bg-gray-900 border text-center shadow-xl">
        <div className="text-2xl font-bold text-emerald-600 mb-4">测试完成！</div>
        <div className="text-lg mb-8">得分: {scr} / {questions.length}</div>
        <div className="flex gap-4 justify-center">
            <button className="bg-emerald-600 hover:bg-emerald-700 text-white px-8 py-3 rounded-lg font-bold transition-all" onClick={() => {setIdx(0);setScr(0);setFin(false);setSel(null);setOk(null);}}>重新开始</button>
            <a href="quiz" className="bg-gray-100 hover:bg-gray-200 text-gray-700 px-8 py-3 rounded-lg font-bold transition-all no-underline">返回选单</a>
        </div>
      </div>
    );
  }

  const curr = sq[idx];
  if (!curr) return null;

  return (
    <div className="p-6 rounded-2xl bg-white dark:bg-gray-900 border shadow-lg">
      <div className="mb-4 text-xs opacity-50 font-mono text-right">进度: {idx + 1} / {questions.length}</div>
      
      <div className="h-1 bg-gray-100 rounded-full mb-6 overflow-hidden">
        <div className="h-full bg-emerald-500 transition-all duration-300" style={{width: ((idx + 1) / questions.length * 100) + '%'}}></div>
      </div>

      <div className="text-xl font-bold mb-8 text-gray-900 dark:text-gray-100">{curr.q}</div>
      
      <div className="space-y-3">
        {curr.o.map((o, i) => (
          <button 
            key={i} 
            className={"w-full text-left p-4 rounded-xl border-2 transition-all font-medium " + (sel === o ? (ok ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-700 dark:text-emerald-400" : "bg-red-50 dark:bg-red-900/20 border-red-500 text-red-700 dark:text-red-400") : (sel && o === curr.a ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-700 dark:text-emerald-400 opacity-80" : "bg-gray-50 dark:bg-gray-800 border-gray-100 dark:border-gray-700 hover:border-emerald-500 hover:shadow-md text-gray-700 dark:text-gray-300"))}
            onClick={() => onAnswer(o)}
          >
            {o}
          </button>
        ))}
      </div>
      
      {sel && (
        <div className={"mt-6 p-4 rounded-lg border-l-4 " + (ok ? "bg-emerald-50 dark:bg-emerald-900/20 border-emerald-500 text-emerald-800 dark:text-emerald-300" : "bg-red-50 dark:bg-red-900/20 border-red-500 text-red-800 dark:text-red-300")}>
          <div className="font-bold flex items-center gap-2">
            {ok ? "✅ 正确!" : "❌ 错误"}
            <span className="font-normal opacity-70 text-sm ml-auto">正确答案: {curr.a}</span>
          </div>
          <div className="text-sm opacity-80 mt-2">💡 提示: {curr.h}</div>
        </div>
      )}
    </div>
  );
};

<QuizRunner />
