DANGDOCAO commited on
Commit
a46228d
·
verified ·
1 Parent(s): 106e48b

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +239 -0
README.md ADDED
@@ -0,0 +1,239 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ configs:
21
+ - config_name: default
22
+ data_files:
23
+ - split: train
24
+ path: 40k_train.json
25
+ ---
26
+ # HVU_QA
27
+
28
+ **HVU_QA** is an open-source Vietnamese Question-Context-Answer (QCA) corpus, accompanied by supporting tools, created to facilitate the development of FAQ-style question generation and question answering systems, particularly for low-resource language settings. The dataset was developed by a research team at Hung Vuong University, Phu Tho, Vietnam, led by Dr. Ha Nguyen, Deputy Head of the Department of Engineering Technology. HVU_QA was constructed using a fully automated data-building pipeline that combines web crawling from reliable sources, semantic tag-based extraction, and AI-assisted filtering, helping ensure high factual accuracy, consistent structure, and practical usability for real-world applications.
29
+
30
+ ## 📋 Dataset Description
31
+
32
+ - **Language:** Vietnamese
33
+ - **Format:** SQuAD-style JSON
34
+ - **Total samples:** 40,000 QCA triples (full corpus released)
35
+ - **Domains covered:** Social services, labor law, administrative processes, and other public service topics.
36
+ - **Structure of each sample:**
37
+ - **Question:** Generated or extracted question
38
+ - **Context:** Supporting text passage from which the answer is derived
39
+ - **Answer:** Answer span within the context
40
+
41
+ ## ⚙️ Creation Pipeline
42
+
43
+ The dataset was built using a 5-stage automated process:
44
+ 1. **Selecting relevant QA websites** from trusted sources.
45
+ 2. **Automated data crawling** to collect raw QA webpages.
46
+ 3. **Extraction via semantic tags** to obtain clean Question-Context-Answer triples.
47
+ 4. **AI-assisted filtering** to remove noisy or factually inconsistent samples.
48
+ 5. **Final canonicalization and deduplication** to eliminate redundancy and maintain corpus diversity.
49
+
50
+ ## 📊 Quality Evaluation
51
+ A fine-tuned `vit5-base` model trained on HVU_QA achieved:
52
+
53
+ | Metric | Score |
54
+ |-------------------------|----------------|
55
+ | BLEU | 89.1 |
56
+ | Semantic similarity | 91.5% (cos ≥ 0.8) |
57
+ | Human grammar score | 4.58 / 5 |
58
+ | Human usefulness score | 4.29 / 5 |
59
+
60
+ These results confirm that HVU_QA is a high-quality resource for developing robust FAQ-style question generation models.
61
+
62
+ ## 📁 Project Structure
63
+ ```text
64
+ HVU_QA/
65
+ ├── backend/
66
+ │ ├── __init__.py
67
+ │ └── app.py
68
+ ├── frontend/
69
+ │ ├── HVU.png
70
+ │ ├── index.html
71
+ │ ├── app.js
72
+ │ └── style.css
73
+ ├── t5-viet-qg-finetuned/
74
+ ├── fine_tune_qg.py
75
+ ├── generate_question.py
76
+ ├── HVU_QA_tool.py
77
+ ├── main.py
78
+ ├── 40k_train.json
79
+ ├── requirements.txt
80
+ └── README.md
81
+ ```
82
+ ## 📁 Vietnamese Question Generation Toolkit
83
+
84
+ This repository includes four main entry points:
85
+
86
+ * `main.py`: starts the local Flask web application with the current `backend/` and `frontend/`.
87
+ * `fine_tune_qg.py`: fine-tunes the Vietnamese T5-based question generation model using `40k_train.json`.
88
+ * `generate_question.py`: command-line script for generating questions from a Vietnamese passage.
89
+ * `HVU_QA_tool.py`: one-file launcher that can prepare a standalone runtime, install missing dependencies, download the model from Hugging Face, and launch the web app automatically.
90
+
91
+ ## 🛠️ Requirements
92
+
93
+ * Python 3.10+
94
+ * `pip`
95
+ * Optional: NVIDIA GPU with CUDA for faster inference
96
+
97
+ ### 📦 Install Required Libraries
98
+
99
+ For running the full repository locally:
100
+
101
+ ```bash
102
+ python -m venv venv
103
+
104
+ # Windows
105
+ venv\Scripts\activate
106
+
107
+ # macOS / Linux
108
+ source venv/bin/activate
109
+
110
+ python -m pip install --upgrade pip
111
+ python -m pip install -r requirements.txt
112
+ ```
113
+
114
+ If you want to use NVIDIA GPU, install the PyTorch build that matches your CUDA setup from [pytorch.org](https://pytorch.org) before installing the remaining requirements.
115
+
116
+ `HVU_QA_tool.py` can also create its own virtual environment, prepare a standalone runtime, and sync the model automatically, so the manual installation steps above are mainly for direct repo usage.
117
+
118
+ ### 📥 Load Dataset from Hugging Face Hub
119
+ ```python
120
+ from datasets import load_dataset
121
+
122
+ ds = load_dataset("DANGDOCAO/GeneratingQuestions", split="train")
123
+ print(ds[0])
124
+ ```
125
+ ## 📚 Usage
126
+
127
+ * Run the local web interface for question generation.
128
+ * Generate questions from the command line.
129
+ * Fine-tune or evaluate the Vietnamese question generation model.
130
+
131
+ ### 🔹 Run the web app
132
+
133
+ ```bash
134
+ python main.py
135
+ ```
136
+
137
+ Open `http://127.0.0.1:5000` in your browser.
138
+
139
+ ### 🔹 Launch with `HVU_QA_tool.py`
140
+
141
+ ```bash
142
+ python HVU_QA_tool.py
143
+ ```
144
+
145
+ This launcher is useful when you want the project to set itself up automatically. It can detect the local repo, prepare a standalone runtime when needed, install missing dependencies, download the model, and then start the web application.
146
+
147
+ ### 🔹 Fine-tuning
148
+
149
+ ```bash
150
+ python fine_tune_qg.py
151
+ ```
152
+
153
+ This will:
154
+
155
+ 1. Load the dataset from `40k_train.json`.
156
+ 2. Fine-tune `VietAI/vit5-base`.
157
+ 3. Save the trained model into `t5-viet-qg-finetuned/`.
158
+
159
+ *(Or download the pre-trained model: [t5-viet-qg-finetuned](https://huggingface.co/datasets/DANGDOCAO/GeneratingQuestions/tree/main).)*
160
+
161
+ ### 🔹 Generating Questions
162
+ ```bash
163
+ python generate_question.py
164
+ ```
165
+
166
+ **Example:**
167
+ ```
168
+ Input passage:
169
+ Cà phê sữa đá là một loại đồ uống nổi tiếng ở Việt Nam
170
+ (Iced milk coffee is a famous drink in Vietnam)
171
+
172
+ Number of questions: 5
173
+ ```
174
+ **Output:**
175
+ ```
176
+ 1. Loại cà phê nào nổi tiếng ở Việt Nam?
177
+ (What type of coffee is famous in Vietnam?)
178
+ 2. Tại sao cà phê sữa đá lại phổ biến?
179
+ (Why is iced milk coffee popular?)
180
+ 3. Cà phê sữa đá bao gồm những nguyên liệu gì?
181
+ (What ingredients are included in iced milk coffee?)
182
+ 4. Cà phê sữa đá có nguồn gốc từ đâu?
183
+ (Where does iced milk coffee originate from?)
184
+ 5. Cà phê sữa đá Việt Nam được pha chế như thế nào?
185
+ (How is Vietnamese iced milk coffee prepared?)
186
+ ```
187
+ **You can adjust** in `generate_question.py`:
188
+
189
+ * `--model_dir`, `--num_questions`, `--max_source_length`, `--max_new_tokens`, `--device`, `GENERATION_PASSES`, `no_repeat_ngram_size`, `repetition_penalty`
190
+
191
+ ## 📌 Citation
192
+ If you use **HVU_QA** in your research, please cite:
193
+
194
+ ```bibtex
195
+ @inproceedings{nguyen2025method,
196
+ author = {Ha Nguyen and Phuc Le and Dang Do and Cuong Nguyen and Chung Mai},
197
+ title = {A Method for Building QA Corpora for Low-Resource Languages},
198
+ booktitle = {Proceedings of the 2025 International Symposium on Information and Communication Technology (SOICT 2025)},
199
+ year = {2025},
200
+ publisher = {Springer},
201
+ series = {Communications in Computer and Information Science (CCIS)},
202
+ address = {Nha Trang, Vietnam},
203
+ note = {To appear}
204
+ }
205
+ ```
206
+ ## ❤️ Support / Funding
207
+
208
+ If you find **HVU_QA** useful, please consider supporting our work.
209
+ Your contributions help us maintain the dataset, improve quality, and release new versions (cleaning, expansion, benchmarks, and tools).
210
+
211
+ ### 🇻🇳 Donate via VietQR (scan to support)
212
+ This **VietQR / NAPAS 247** code can be scanned by Vietnamese banking apps and some international payment apps that support QR bank transfers.
213
+
214
+ <img src="QRtk.jpg" alt="VietQR Support" width="320"/>
215
+
216
+ - 🏦 **Bank:** VietinBank (Vietnam)
217
+ - 👤 **Account name:** NGUYEN TIEN HA
218
+ - 💳 **Account number:** 103004492490
219
+ - 📍 **Branch:** VietinBank CN PHU THO - HOI SO
220
+
221
+ ### 🌍 International Support (Quick card payment)
222
+ If you are outside Vietnam, you can support this project via **Buy Me a Coffee**
223
+ (no PayPal account needed - pay directly with a credit/debit card):
224
+ - BuyMeACoffee: https://buymeacoffee.com/hanguyen0408
225
+
226
+ ### 🌍 International Support (PayPal)
227
+ If you prefer PayPal, you can also support us here:
228
+ - PayPal.me: https://paypal.me/HaNguyen0408
229
+
230
+ ### ✨ Other ways to support
231
+ - ⭐ Star this repository / dataset on Hugging Face
232
+ - 📌 Cite our paper if you use it in your research
233
+ - 🐛 Open issues / pull requests to improve the dataset and tools
234
+
235
+ ## 📬 Contact / Maintainers
236
+ For questions, feedback, collaborations, or issue reports related to HVU_QA, please contact:
237
+ Dr. Ha Nguyen (Project Lead)
238
+ Hung Vuong University, Phu Tho, Vietnam
239
+ Email: nguyentienha@hvu.edu.vn