DANGDOCAO commited on
Commit
f2663db
·
verified ·
1 Parent(s): 0f0e926
Files changed (1) hide show
  1. HVU_QA/README.md +93 -225
HVU_QA/README.md CHANGED
@@ -1,88 +1,59 @@
1
- # HVU_QA
2
-
3
- **HVU_QA** is a project dedicated to sharing datasets and tools for **Question Generation Processing (NLP)**, developed and maintained by the research team at **Hung Vuong University (HVU), Phu Tho, Vietnam**.
4
- This project is supported by **Hung Vuong University, Phu Tho, Vietnam**, with the aim of advancing research and applications in low-resource language processing, particularly for the Vietnamese language.
5
-
6
- ---
7
-
8
- ## 📚 Overview
9
-
10
- This repository enables you to:
11
-
12
- 1. Fine-tune the [VietAI/vit5-base](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions) model on your own GQ dataset.
13
- 2. Generate multiple, diverse questions given a user-provided text passage (context).
14
-
15
  ---
16
-
17
- ## 📁 Datasets
18
-
19
- * Built following the **SQuAD v2.0 standard**, ensuring compatibility with NLP pipelines.
20
- * Includes tens of thousands of high-quality **Question–Context–Answer triples (QCA)**.
21
- * Suitable for both **training** and **evaluation**.
22
-
23
- ---
24
-
25
- ## 📁 Vietnamese Question Generation Tool
26
-
27
- A **command-line tool** for:
28
-
29
- * **Fine-tuning** a question generation model.
30
- * **Automatically generating questions** from Vietnamese text.
31
-
32
- Built on **Hugging Face Transformers (VietAI/vit5-base)** and **PyTorch**.
33
-
34
- ---
35
-
36
- ## Features
37
-
38
- * Fine-tune a question generation model with SQuAD v2.0 format data.
39
- * Generate diverse and creative questions from text passages.
40
- * Flexible generation parameters (`top-k`, `top-p`, `temperature`, etc.).
41
- * Simple command-line usage.
42
- * GPU support if available.
43
-
44
- ---
45
-
46
- ## 📊 Evaluation Results
47
-
48
- We conducted both **manual evaluation** (500 samples) and **automatic evaluation** (1,000 samples).
49
-
50
- | Evaluation Type | Precision | Recall | F1-Score |
51
- |------------------|-----------|--------|----------|
52
- | Automatic (1000) | 0.85 | 0.83 | 0.84 |
53
- | Manual (500) | 0.88 | 0.86 | 0.87 |
54
-
55
- ➡️ The model generates diverse, grammatically correct, and contextually appropriate questions.
56
-
57
  ---
 
58
 
59
- ## Creation Process
60
 
61
- The dataset was built using a **4-stage automated pipeline**:
62
 
63
- 1. Select relevant QA websites from trusted sources.
64
- 2. Automatic crawling to collect raw QA pages.
65
- 3. Semantic tag extraction to obtain clean Question–Context–Answer triples.
66
- 4. AI-assisted filtering to remove noisy or inconsistent samples.
 
 
 
 
67
 
68
- ---
69
 
70
- ## 📝 Quality Evaluation
 
 
 
 
71
 
72
- A fine-tuned model trained on **HVU_QA (VietAI/vit5-base)** achieved:
 
73
 
74
- * **BLEU Score**: 90.61
75
- * **Semantic similarity**: 97.0% (cosine ≥ 0.8)
76
- * **Human evaluation**:
77
- * Grammar: **4.58 / 5**
78
- * Usefulness: **4.29 / 5**
 
79
 
80
- ➡️ These results confirm that **HVU_QA is a high-quality resource** for developing robust FAQ-style question generation models.
81
-
82
- ---
83
-
84
- ## 📂 Project Structure
85
 
 
86
  ```
87
  .HVU_QA
88
  ├── t5-viet-qg-finetuned/
@@ -91,9 +62,7 @@ A fine-tuned model trained on **HVU_QA (VietAI/vit5-base)** achieved:
91
  ├── 39k_train.json
92
  └── README.md
93
  ```
94
- > All data files are UTF-8 encoded and ready for use in NLP pipelines.
95
-
96
- ---
97
 
98
  ## 🛠️ Requirements
99
 
@@ -101,185 +70,84 @@ A fine-tuned model trained on **HVU_QA (VietAI/vit5-base)** achieved:
101
  * PyTorch >= 1.9
102
  * Transformers >= 4.30
103
  * scikit-learn
104
- * Fine-tuned model (download at: [link](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main))
105
-
106
- ---
107
-
108
- ## ⚙️ Setup
109
-
110
- ### 🛠️ Step 1: Download and Extract
111
 
112
- 1. Download `HVU_QA.zip`
113
- 2. Extract into a folder, e.g.:
114
-
115
- ```
116
- D:\your\HVU_QA
117
- ```
118
-
119
- ### 🛠️ Step 2: Add to Environment Path (if needed)
120
-
121
- 1. Open **System Properties → Environment Variables**
122
- 2. Select `Path` → **Edit** → **New**
123
- 3. Add the path, e.g.:
124
-
125
- ```
126
- D:\your\HVU_QA
127
- ```
128
-
129
- ### 🛠️ Step 3: Open in Visual Studio Code
130
-
131
- ```
132
- File > Open Folder > D:\HVU_QA
133
- ```
134
-
135
- ### 🛠️ Step 4: Install Required Libraries
136
-
137
- Open **Terminal** and run:
138
-
139
- #### Windows (PowerShell)
140
-
141
- **Required only**
142
-
143
- ```powershell
144
- python -m pip install --upgrade pip
145
- pip install torch transformers datasets scikit-learn sentencepiece safetensors
146
- ```
147
-
148
- **Required + Optional**
149
-
150
- ```powershell
151
- python -m pip install --upgrade pip
152
- pip install torch transformers datasets scikit-learn sentencepiece safetensors accelerate tensorboard evaluate sacrebleu rouge-score nltk
153
- ```
154
-
155
- #### Linux / macOS (bash/zsh)
156
-
157
- **Required only**
158
 
159
  ```bash
160
- python3 -m pip install --upgrade pip
161
- pip install torch transformers datasets scikit-learn sentencepiece safetensors
162
  ```
163
 
164
- **Required + Optional**
165
-
166
- ```bash
167
- python3 -m pip install --upgrade pip
168
- pip install torch transformers datasets scikit-learn sentencepiece safetensors accelerate tensorboard evaluate sacrebleu rouge-score nltk
169
- ```
170
-
171
- ✅ Verify installation:
172
-
173
- * Windows (PowerShell)
174
-
175
- ```powershell
176
- python -c "import torch, transformers, datasets, sklearn, sentencepiece, safetensors, accelerate, tensorboard, evaluate, sacrebleu, rouge_score, nltk; print('✅ All dependencies installed correctly!')"
177
- ```
178
 
179
- * Linux/macOS
 
 
180
 
181
- ```bash
182
- python3 -c "import torch, transformers, datasets, sklearn, sentencepiece, safetensors, accelerate, tensorboard, evaluate, sacrebleu, rouge_score, nltk; print('✅ All dependencies installed correctly!')"
183
  ```
184
-
185
- ---
186
-
187
- ## Usage
188
 
189
  * Train and evaluate a question generation model.
190
  * Develop Vietnamese NLP tools.
191
  * Conduct linguistic research.
192
 
193
- ### Training (Fine-tuning)
194
-
195
- When you run `fine_tune_qg.py`, the script will:
196
-
197
- 1. Load the dataset from **`3939k_train.json`**
198
- 2. Fine-tune the `VietAI/vit5-base` model
199
- 3. Save the trained model into a new folder named **`t5-viet-qg-finetuned/`**
200
-
201
- Run:
202
 
203
  ```bash
204
  python fine_tune_qg.py
205
  ```
206
 
207
- ### Generating Questions
208
 
 
 
 
 
 
 
 
209
  ```bash
210
  python generate_question.py
211
  ```
212
 
213
  **Example:**
214
-
215
  ```
216
  Input passage:
217
- Iced milk coffee (Cà phê sữa đá) is a famous drink in Vietnam.
 
218
 
219
  Number of questions: 5
220
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
221
 
222
- Output:
223
-
224
- 1. What type of coffee is famous in Vietnam?
225
- 2. Why is iced milk coffee popular?
226
- 3. What ingredients are included in iced milk coffee?
227
- 4. Where does iced milk coffee originate from?
228
- 5. How is Vietnamese iced milk coffee prepared?
229
-
230
- ---
231
-
232
- ## ⚙️ Generation Settings
233
-
234
- In `generate_question.py`, you can adjust:
235
-
236
- * `top_k`, `top_p`, `temperature`, `no_repeat_ngram_size`, `repetition_penalty`
237
-
238
- ---
239
-
240
- ## 🤝 Contribution
241
-
242
- We welcome contributions:
243
-
244
- * Open issues
245
- * Submit pull requests
246
- * Suggest improvements or add datasets
247
-
248
- ---
249
-
250
- ## 📄 Citation
251
-
252
- If you use this repository or datasets in research, please cite:
253
-
254
- **Ha Nguyen-Tien, Phuc Le-Hong, Dang Do-Cao, Cuong Nguyen-Hung, Chung Mai-Van. 2025. A Method to Build QA Corpora for Low-Resource Languages. Proceedings of KSE 2025. ACM TALLIP.**
255
 
256
- ### 📚 BibTeX
 
257
 
258
  ```bibtex
259
- @inproceedings{nguyen2025hvuqa,
260
- title={A Method to Build QA Corpora for Low-Resource Languages},
261
- author={Ha Nguyen-Tien and Phuc Le-Hong and Dang Do-Cao and Cuong Nguyen-Hung and Chung Mai-Van},
262
- booktitle={Proceedings of KSE 2025},
263
- year={2025}
 
 
 
 
264
  }
265
- ```
266
-
267
- ---
268
-
269
- ## 📬 Contact
270
-
271
- * **Ha Nguyen-Tien** (Corresponding author)
272
- 📧 [nguyentienha@hvu.edu.vn](mailto:nguyentienha@hvu.edu.vn)
273
-
274
- * **Phuc Le-Hong**
275
- 📧 [Lehongphuc20021408@gmail.com](mailto:Lehongphuc20021408@gmail.com)
276
-
277
- * **Dang Do-Cao**
278
- 📧 [docaodang532001@gmail.com](mailto:docaodang532001@gmail.com)
279
-
280
- 📍 Faculty of Engineering and Technology, Hung Vuong University, Phu Tho, Vietnam
281
- 🌐 [https://hvu.edu.vn](https://hvu.edu.vn)
282
-
283
- ---
284
-
285
- *This repository is part of our ongoing effort to support Vietnamese NLP and make language technology more accessible for low-resource and underrepresented languages.*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ task_categories:
4
+ - question-answering
5
+ - text-generation
6
+ - table-question-answering
7
+ - sentence-similarity
8
+ - feature-extraction
9
+ language:
10
+ - vi
11
+ tags:
12
+ - question-generation
13
+ - nlp
14
+ - faq
15
+ - low-resource
16
+ - code
17
+ pretty_name: HVU_QA
18
+ size_categories:
19
+ - 10K<n<100K
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  ---
21
+ # HVU_QA
22
 
23
+ **HVU_QA** is an open-source Vietnamese Question–Context–Answer (QCA) corpus and supporting tools for building FAQ-style question generation systems in low-resource languages. The dataset was created using a fully automated pipeline that combines web crawling from trustworthy sources, semantic tag-based extraction, and AI-assisted filtering to ensure high factual accuracy.
24
 
25
+ ## 📋 Dataset Description
26
 
27
+ - **Language:** Vietnamese
28
+ - **Format:** SQuAD-style JSON
29
+ - **Total samples:** 3939,000 QCA triples (full corpus released)
30
+ - **Domains covered:** Social services, labor law, administrative processes, and other public service topics.
31
+ - **Structure of each sample:**
32
+ - **Question:** Generated or extracted question
33
+ - **Context:** Supporting text passage from which the answer is derived
34
+ - **Answer:** Answer span within the context
35
 
36
+ ## ⚙️ Creation Pipeline
37
 
38
+ The dataset was built using a 4-stage automated process:
39
+ 1. **Selecting relevant QA websites** from trusted sources.
40
+ 2. **Automated data crawling** to collect raw QA webpages.
41
+ 3. **Extraction via semantic tags** to obtain clean Question–Context–Answer triples.
42
+ 4. **AI-assisted filtering** to remove noisy or factually inconsistent samples.
43
 
44
+ ## 📊 Quality Evaluation
45
+ A fine-tuned `vit5-base` model trained on HVU_QA achieved:
46
 
47
+ | Metric | Score |
48
+ |-------------------------|----------------|
49
+ | BLEU | 89.1 |
50
+ | Semantic similarity | 91.5% (cos ≥ 0.8) |
51
+ | Human grammar score | 4.58 / 5 |
52
+ | Human usefulness score | 4.29 / 5 |
53
 
54
+ These results confirm that HVU_QA is a high-quality resource for developing robust FAQ-style question generation models.
 
 
 
 
55
 
56
+ ## 📁 Dataset Structure
57
  ```
58
  .HVU_QA
59
  ├── t5-viet-qg-finetuned/
 
62
  ├── 39k_train.json
63
  └── README.md
64
  ```
65
+ ## 📁 Vietnamese Question Generation Tool
 
 
66
 
67
  ## 🛠️ Requirements
68
 
 
70
  * PyTorch >= 1.9
71
  * Transformers >= 4.30
72
  * scikit-learn
 
 
 
 
 
 
 
73
 
74
+ ### 📦 Install Required Libraries
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ```bash
77
+ pip install datasets transformers sentencepiece safetensors accelerate evaluate sacrebleu rouge-score nltk scikit-learn
 
78
  ```
79
 
80
+ *(Install PyTorch separately from [pytorch.org](https://pytorch.org) if not installed yet.)*
 
 
 
 
 
 
 
 
 
 
 
 
 
81
 
82
+ ### 📥 Load Dataset from Hugging Face Hub
83
+ ```python
84
+ from datasets import load_dataset
85
 
86
+ ds = load_dataset("DANGDOCAO/GeneratingQuestions", split="train")
87
+ print(ds[0])
88
  ```
89
+ ## 📚 Usage
 
 
 
90
 
91
  * Train and evaluate a question generation model.
92
  * Develop Vietnamese NLP tools.
93
  * Conduct linguistic research.
94
 
95
+ ### 🔹 Fine-tuning
 
 
 
 
 
 
 
 
96
 
97
  ```bash
98
  python fine_tune_qg.py
99
  ```
100
 
101
+ This will:
102
 
103
+ 1. Load the dataset from `39k_train.json`.
104
+ 2. Fine-tune `VietAI/vit5-base`.
105
+ 3. Save the trained model into `t5-viet-qg-finetuned/`.
106
+
107
+ *(Or download the pre-trained model: [t5-viet-qg-finetuned](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main).)*
108
+
109
+ ### 🔹 Generating Questions
110
  ```bash
111
  python generate_question.py
112
  ```
113
 
114
  **Example:**
 
115
  ```
116
  Input passage:
117
+ Cà phê sữa đá một loại đồ uống nổi tiếng ở Việt Nam.
118
+ (Iced milk coffee is a famous drink in Vietnam.)
119
 
120
  Number of questions: 5
121
  ```
122
+ **Output:**
123
+ ```
124
+ 1. Loại cà phê nào nổi tiếng ở Việt Nam?
125
+ (What type of coffee is famous in Vietnam?)
126
+ 2. Tại sao cà phê sữa đá lại phổ biến?
127
+ (Why is iced milk coffee popular?)
128
+ 3. Cà phê sữa đá bao gồm những nguyên liệu gì?
129
+ (What ingredients are included in iced milk coffee?)
130
+ 4. Cà phê sữa đá có nguồn gốc từ đâu?
131
+ (Where does iced milk coffee originate from?)
132
+ 5. Cà phê sữa đá Việt Nam được pha chế như thế nào?
133
+ (How is Vietnamese iced milk coffee prepared?)
134
+ ```
135
+ **You can adjust** in `generate_question.py`:
136
 
137
+ - `top_k`, `top_p`, `temperature`, `no_repeat_ngram_size`, `repetition_penalty`
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
138
 
139
+ ## 📌 Citation
140
+ If you use **HVU_QA** in your research, please cite:
141
 
142
  ```bibtex
143
+ @inproceedings{nguyen2025method,
144
+ author = {Ha Nguyen and Phuc Le and Dang Do and Cuong Nguyen and Chung Mai},
145
+ title = {A Method for Building QA Corpora for Low-Resource Languages},
146
+ booktitle = {Proceedings of the 2025 International Symposium on Information and Communication Technology (SOICT 2025)},
147
+ year = {2025},
148
+ publisher = {Springer},
149
+ series = {Communications in Computer and Information Science (CCIS)},
150
+ address = {Nha Trang, Vietnam},
151
+ note = {To appear}
152
  }
153
+ ```