chiyingliu commited on
Commit
13dc82f
·
verified ·
1 Parent(s): be64932

Dataset card

Browse files
Files changed (1) hide show
  1. README.md +163 -0
README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - zh
5
+ size_categories:
6
+ - 10K<n<100K
7
+ tags:
8
+ - daoism
9
+ - taoism
10
+ - chinese-religion
11
+ - rag
12
+ - retrieval
13
+ - dingren-daoxue
14
+ - lius-cc
15
+ pretty_name: Daoism Knowledge RAG (鼎稔道學館館藏)
16
+ ---
17
+
18
+ # Daoism Knowledge RAG
19
+
20
+ **鼎稔道學館(Dingren Daoxue Lab)館藏知識庫**——專為 RAG(Retrieval-Augmented Generation)優化的道教知識結構化資料集,95,919 條目。
21
+
22
+ ## Overview
23
+
24
+ This dataset is the curated knowledge base behind [Dingren Daoxue Lab (鼎稔道學館)](https://lius.cc), released under Apache 2.0 to enable open-source RAG with the [`Daoism-Qwen3.5-9B`](https://huggingface.co/lius-cc/Daoism-Qwen3.5-9B) model.
25
+
26
+ It covers eight categories of Daoist knowledge:
27
+
28
+ | Type | Count | Content |
29
+ |------|-------|---------|
30
+ | concept | ~32,700 | 神學概念、宇宙論、修煉名相 |
31
+ | scripture | ~23,000 | 經文、戒律、科儀文獻 |
32
+ | deity | ~12,000 | 神祇、仙真、神格體系 |
33
+ | ritual | ~11,000 | 科儀、法事、節慶 |
34
+ | location | ~9,600 | 道觀、聖地、宮廟 |
35
+ | person | ~5,800 | 道士、學者、傳承者 |
36
+ | sect | ~1,278 | 流派、宗派 |
37
+ | custom | ~198 | 旗艦學術專題 |
38
+
39
+ ## Schema
40
+
41
+ Each row in `train.jsonl`:
42
+ ```json
43
+ {
44
+ "id": "ckm...",
45
+ "name": "城隍",
46
+ "type": "deity",
47
+ "slug": "deity/cheng_huang_ye",
48
+ "url": "https://lius.cc/n/deity/cheng_huang_ye",
49
+ "summary": "城隍,亦稱城隍爺、城隍神,為中國道教與民間信仰中極具代表性的地方守護神與司法神...",
50
+ "content": "## 起源與演變\n\n城隍信仰最初源於古代對城池守護神的祭祀..."
51
+ }
52
+ ```
53
+
54
+ - `name`: 條目主名(繁體中文)
55
+ - `type`: concept / scripture / deity / ritual / location / person / sect / custom
56
+ - `slug`: lius.cc 上的 URL slug
57
+ - `url`: 原始條目 URL(可作為 RAG 引用)
58
+ - `summary`: 200-500 字摘要
59
+ - `content`: 完整內容(平均 2-3 KB,部分至 30 KB)
60
+
61
+ ## Quick Start (RAG with Daoism-Qwen3.5-9B)
62
+
63
+ ```python
64
+ from datasets import load_dataset
65
+ from sentence_transformers import SentenceTransformer
66
+ import faiss
67
+ import numpy as np
68
+ from openai import OpenAI
69
+
70
+ # 1. 載入資料
71
+ ds = load_dataset("lius-cc/daoism-knowledge-rag", split="train")
72
+ print(f"Loaded {len(ds)} entries")
73
+
74
+ # 2. Embed (bge-m3 多語言效果最好)
75
+ encoder = SentenceTransformer("BAAI/bge-m3")
76
+ embeddings = encoder.encode(
77
+ [f"{x['name']}:{x['summary']}" for x in ds],
78
+ batch_size=64,
79
+ show_progress_bar=True,
80
+ )
81
+
82
+ # 3. FAISS index
83
+ index = faiss.IndexFlatIP(embeddings.shape[1])
84
+ faiss.normalize_L2(embeddings)
85
+ index.add(embeddings)
86
+
87
+ # 4. Query
88
+ def retrieve(query, k=5):
89
+ q_emb = encoder.encode([query])
90
+ faiss.normalize_L2(q_emb)
91
+ _, ids = index.search(q_emb, k)
92
+ return [ds[int(i)] for i in ids[0]]
93
+
94
+ # 5. Call Daoism LLM with retrieved context
95
+ client = OpenAI(base_url="http://localhost:8000/v1", api_key="dummy")
96
+
97
+ def ask(question):
98
+ hits = retrieve(question, k=5)
99
+ context = "\n\n---\n\n".join(
100
+ f"### {h['name']}\n{h['summary']}\n\n{h['content'][:1500]}"
101
+ for h in hits
102
+ )
103
+ response = client.chat.completions.create(
104
+ model="Daoism-Qwen3.5-9B",
105
+ messages=[
106
+ {"role": "system", "content": f"你是道教智慧 AI。請以下列館藏資料為基礎回答:\n\n{context}"},
107
+ {"role": "user", "content": question},
108
+ ],
109
+ max_tokens=2048,
110
+ )
111
+ return response.choices[0].message.content
112
+
113
+ print(ask("城隍信仰與道教有什麼關係?"))
114
+ ```
115
+
116
+ ## Alternative: Use lius.cc RAG API (no local indexing needed)
117
+
118
+ If you don't want to build your own FAISS index, use our public RAG endpoint (rate limit 30 req/min):
119
+
120
+ ```python
121
+ import requests
122
+
123
+ def retrieve(query, n=5):
124
+ r = requests.post(
125
+ "https://lius.cc/api/llm-rag",
126
+ json={"q": query, "n": n},
127
+ timeout=10,
128
+ )
129
+ return r.json()["hits"]
130
+ ```
131
+
132
+ ## Licensing & Attribution
133
+
134
+ - **License**: Apache 2.0
135
+ - **Source**: [Dingren Daoxue Lab](https://lius.cc) by Liu Chi-Ying (Daoist priest, 2026)
136
+ - **Citation**: please cite as below
137
+
138
+ ```bibtex
139
+ @dataset{daoism-knowledge-rag-2026,
140
+ author = {Liu, Chi-Ying and Dingren Daoxue Lab},
141
+ title = {Daoism Knowledge RAG: Curated Taoist Knowledge Base for Retrieval-Augmented Generation},
142
+ year = {2026},
143
+ publisher = {HuggingFace},
144
+ url = {https://huggingface.co/datasets/lius-cc/daoism-knowledge-rag},
145
+ }
146
+ ```
147
+
148
+ ## Related
149
+
150
+ - 🤖 **Model**: [`lius-cc/Daoism-Qwen3.5-9B`](https://huggingface.co/lius-cc/Daoism-Qwen3.5-9B) (fp16) / [GGUF](https://huggingface.co/lius-cc/Daoism-Qwen3.5-9B-GGUF)
151
+ - 🌐 **Live Demo**: [demo.lius.cc](https://demo.lius.cc) (uses this dataset via RAG)
152
+ - 📚 **Deployment Guide**: [lius.cc/llm](https://lius.cc/llm)
153
+
154
+ ## Limitations
155
+
156
+ - All content is in Traditional Chinese (Taiwan)
157
+ - Some entries refer to internal lius.cc `[[wiki-link]]` syntax; treat as plain text in your RAG
158
+ - Coverage focuses on **正一道、閭山派、台灣民間信仰**; mainland Quanzhen tradition less represented
159
+ - Some concept entries may overlap; deduplicate by `name` if needed for your use case
160
+
161
+ ## Disclaimer
162
+
163
+ This dataset is for research and educational purposes. Religious practices should not be undertaken solely based on AI-retrieved content; consult qualified Daoist priests for ceremonial guidance.