<!DOCTYPE html>
    <html lang="vi" xmlns="http://www.w3.org/1999/xhtml" prefix="og: http://ogp.me/ns#">
    <head>
<title>Mô hình PhoBERT &#40;phần 2&#41;</title>
<meta name="description" content="Mô hình PhoBERT &#40;phần 2&#41; - Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;fira.bdu.edu.vn&#x002F;index.php&#x002F;savefile&#x002F;sinh-vien-nghien-cuu-khoa-hoc&#x002F;mo-hinh-phobert-phan-2-606.html">
<meta name="author" content="Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương">
<meta name="copyright" content="Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương [fit@bdu.edu.vn]">
<meta name="robots" content="noindex, follow">
<meta name="googlebot" content="noindex, follow">
<meta name="msnbot" content="noindex, follow">
<meta name="generator" content="NukeViet v4.5">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="Mô hình PhoBERT &#40;phần 2&#41;">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;fira.bdu.edu.vn&#x002F;index.php&#x002F;savefile&#x002F;sinh-vien-nghien-cuu-khoa-hoc&#x002F;mo-hinh-phobert-phan-2-606.html">
<meta property="og:site_name" content="Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương">
<meta property="og:url" content="https://fira.bdu.edu.vn/index.php/savefile/sinh-vien-nghien-cuu-khoa-hoc/mo-hinh-phobert-phan-2-606.html">
<link rel="shortcut icon" href="https://fira.bdu.edu.vn/uploads/favicon.ico">
<link rel="canonical" href="https://fira.bdu.edu.vn/index.php/savefile/sinh-vien-nghien-cuu-khoa-hoc/mo-hinh-phobert-phan-2-606.html">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/" title="Tin Tức" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/sinh-vien/" title="Tin Tức - SINH VIÊN" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/doan-hoi/" title="Tin Tức - Đoàn – Hội" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoat-dong-doan-hoi/" title="Tin Tức - Hoạt động" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/cau-lac-bo/" title="Tin Tức - Câu lạc bộ" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoat-dong-clb/" title="Tin Tức - Hoat động" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoat-dong-cong-dong/" title="Tin Tức - Hoạt động cộng đồng" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/bieu-mau-do-an-tot-nghiep/" title="Tin Tức - BIỂU MẪU ĐỒ ÁN TỐT NGHIỆP" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoat-dong-ngoai-khoa/" title="Tin Tức - Hoạt động ngoại khóa" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoc-bong/" title="Tin Tức - Học bổng" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/lich-hoc/" title="Tin Tức - Lịch học" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/lich-thi/" title="Tin Tức - Lịch thi" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/thong-bao-chung/" title="Tin Tức - Thông báo chung" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/doanh-nghiep-tuyen-dung/" title="Tin Tức - Doanh nghiệp tuyển dụng" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/thong-tin/" title="Tin Tức - THÔNG TIN" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/thong-bao/" title="Tin Tức - Thông báo" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/tin-tuc/" title="Tin Tức - Tin tức" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/ht-quoc-te/" title="Tin Tức - Hợp tác quốc tế" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/ht-trong-nuoc/" title="Tin Tức - Hợp tác trong nước" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/gioi-thieu/" title="Tin Tức - GIỚI THIỆU" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/chuong-trinh-dao-tao/" title="Tin Tức - Chương trình đào tạo" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/de-cuong-chi-tiet/" title="Tin Tức - Đề cương chi tiết" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/giang-vien/" title="Tin Tức - GIẢNG VIÊN" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/quy-trinh-bieu-mau/" title="Tin Tức - QUY TRÌNH - BIỂU MẪU" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/quy-trinh-quy-che-dao-tao/" title="Tin Tức - Quy trình, quy chế đào tạo" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/nghien-cuu-khoa-hoc/" title="Tin Tức - NGHIÊN CỨU KHOA HỌC" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/giang-vien-nghien-cuu-khoa-hoc/" title="Tin Tức - Giảng viên nghiên cứu khoa học" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/sinh-vien-nghien-cuu-khoa-hoc/" title="Tin Tức - SINH VIÊN NGHIÊN CỨU KHOA HỌC" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/hoi-thao-hoi-nghi/" title="Tin Tức - Hội thảo hội nghị" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/cong-bo-khoa-hoc/" title="Tin Tức - Công bố khoa học" type="application/rss+xml">
<link rel="alternate" href="https://fira.bdu.edu.vn/index.php/rss/dao-tao/" title="Tin Tức - ĐÀO TẠO" type="application/rss+xml">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/assets/css/font-awesome.min.css" type="text/css">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/themes/default/css/bootstrap.min.css" type="text/css">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/themes/default/css/style.css" type="text/css">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/themes/default/css/style.responsive.css" type="text/css">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/themes/default/css/news.css" type="text/css">
<link rel="preload" as="style" href="https://fira.bdu.edu.vn/themes/default/css/custom.css" type="text/css">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/assets/js/jquery/jquery.min.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/assets/js/language/vi.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/assets/js/global.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/themes/default/js/news.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/themes/default/js/main.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/themes/default/js/custom.js" type="text/javascript">
<link rel="preload" as="script" href="https://fira.bdu.edu.vn/themes/default/js/bootstrap.min.js" type="text/javascript">
<link rel="stylesheet" href="https://fira.bdu.edu.vn/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://fira.bdu.edu.vn/themes/default/css/bootstrap.min.css">
<link rel="stylesheet" href="https://fira.bdu.edu.vn/themes/default/css/style.css">
<link rel="stylesheet" href="https://fira.bdu.edu.vn/themes/default/css/style.responsive.css">
<link rel="StyleSheet" href="https://fira.bdu.edu.vn/themes/default/css/news.css">
<link rel="stylesheet" href="https://fira.bdu.edu.vn/themes/default/css/custom.css">
<style>
	body{background: #fff;}
</style>
    </head>
    <body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương</h2>
		<p class="pull-right"><a title="Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương" href="https://fira.bdu.edu.vn/">https://fira.bdu.edu.vn</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>Mô hình PhoBERT &#40;phần 2&#41;</h1>
		<ul class="list-inline">
			<li>Chủ nhật - 04/05/2025 21:45</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
		</div>
		<div id="bodytext" class="clearfix">
			<span style="font-size:16px;">1️⃣&nbsp;<strong>So sánh và đánh giá giữa Doc2Vec và PhoBERT</strong><br />
Cả hai mô hình Doc2Vec và PhoBERT đều là những phương pháp mạnh mẽ trong học biểu diễn văn bản, nhưng chúng có những đặc điểm khác nhau trong cách tiếp cận và ứng dụng:<br />
Bảng so sánh Doc2Vec và PhoBERT</span>
<div style="text-align: center;">&nbsp;</div>

<table class="Table" style="border-collapse:collapse; border:none" width="602">
	<tbody>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:34px; border-top:1px solid black; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Tiêu chí</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:34px; border-top:1px solid black; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Doc2Vec</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:34px; border-top:1px solid black; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">PhoBERT</span></b></span></span></span></td>
		</tr>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Cách tiếp cận</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Học biểu diễn văn bản dựa trên phân tích ngữ cảnh trong tập dữ liệu</span></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Dựa trên mô hình Transformer, tận dụng cơ chế tự chú ý (self-attention)</span></span></span></span></td>
		</tr>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:71px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Mức độ biểu diễn</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:71px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Biểu diễn đoạn văn bản dưới dạng vector cố định, không nhạy với ngữ cảnh rộng</span></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:71px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Biểu diễn động, có thể thay đổi tùy vào ngữ cảnh của từ/câu trong đoạn văn</span></span></span></span></td>
		</tr>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Khả năng nắm bắt ngữ nghĩa</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Hạn chế, không thể hiểu rõ nghĩa của từ dựa trên vị trí xuất hiện</span></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Hiểu rõ ngữ cảnh và mối quan hệ giữa các từ trong câu</span></span></span></span></td>
		</tr>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Hiệu suất trên tiếng Việt</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Khá tốt, nhưng bị hạn chế bởi dữ liệu huấn luyện</span></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Rất tốt, được huấn luyện chuyên biệt cho tiếng Việt</span></span></span></span></td>
		</tr>
		<tr>
			<td style="border-bottom:1px solid black; width:112px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:1px solid black" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><b><span style="line-height:150%">Ứng dụng</span></b></span></span></span></td>
			<td style="border-bottom:1px solid black; width:245px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Phù hợp cho phân loại văn bản, truy vấn tài liệu</span></span></span></span></td>
			<td style="border-bottom:1px solid black; width:244px; padding:7px 7px 7px 7px; height:52px; border-top:none; border-right:1px solid black; border-left:none" valign="top"><span style="font-size:16px;"><span style="line-height:150%"><span style="font-family:&#039;Times New Roman&#039;,serif"><span style="line-height:150%">Phù hợp cho nhiều tác vụ NLP như phân loại, tóm tắt, nhận diện thực thể</span></span></span></span></td>
		</tr>
	</tbody>
</table>
<br />
<span style="font-size:16px;">Dựa trên bảng so sánh trên, nhóm thấy PhoBERT là mô hình phù hợp hơn cho bài toán khai thác thông tin trong tiếng Việt vì:<br />
●&nbsp;&nbsp; &nbsp;Hiểu ngữ cảnh tốt hơn: Nhờ cơ chế tự chú ý, PhoBERT có thể nắm bắt mối quan hệ giữa các từ và câu trong văn bản, giúp nâng cao hiệu suất tìm kiếm và truy vấn thông tin.<br />
●&nbsp;&nbsp; &nbsp;Tối ưu hóa cho tiếng Việt: Được huấn luyện trên tập dữ liệu tiếng Việt lớn, PhoBERT có lợi thế hơn so với Doc2Vec trong việc xử lý ngôn ngữ tự nhiên.<br />
●&nbsp;&nbsp; &nbsp;Tính linh hoạt cao: Có thể áp dụng vào nhiều bài toán khác nhau trong khai thác thông tin, bao gồm tìm kiếm tài liệu, phân loại văn bản, và tóm tắt thông tin.<br />
Vì vậy, trong phạm vi bài tiểu luận này, PhoBERT được lựa chọn làm mô hình chính để triển khai hệ thống thử nghiệm và đánh giá hiệu suất trong bài toán khai thác thông tin.<br />
2️⃣<strong> Chuẩn bị dữ liệu</strong><br />
✔️&nbsp;&nbsp; &nbsp;Thu thập dữ liệu văn bản tiếng Việt từ VnExpress<br />
Trong phần này, nhóm tiến hành thu thập dữ liệu văn bản từ trang tin tức VnExpress, một trong những nguồn tin uy tín và phong phú tại Việt Nam. Dữ liệu thu thập sẽ được sử dụng để huấn luyện và đánh giá hiệu suất của mô hình học biểu diễn văn bản PhoBERT.<br />
✔️&nbsp;&nbsp; &nbsp;Phương pháp thu thập dữ liệu<br />
Dữ liệu được thu thập bằng cách xây dựng một web crawler sử dụng thư viện requests và BeautifulSoup để trích xuất nội dung từ các bài báo thuộc các chuyên mục khác nhau<br />
✔️&nbsp;&nbsp; &nbsp;Quy trình crawl dữ liệu<br />
✔️&nbsp;&nbsp; &nbsp;Xác định các chuyên mục cần thu thập dữ liệu<br />
➖&nbsp;&nbsp; &nbsp;Danh sách URL của các chuyên mục trên VnExpress được định nghĩa trong tập tin crawl_vnexpress.py.<br />
➖&nbsp;&nbsp; &nbsp;Mỗi chuyên mục sẽ được quét 3 trang đầu tiên để lấy danh sách các bài viết.<br />
✔️&nbsp;&nbsp; &nbsp;Lấy danh sách bài viết từ mỗi chuyên mục<br />
➖&nbsp;&nbsp; &nbsp;Crawler gửi request đến URL chuyên mục và phân tích HTML để lấy danh sách đường dẫn các bài báo.<br />
➖&nbsp;&nbsp; &nbsp;Đảm bảo chỉ thu thập các đường dẫn hợp lệ, tránh các liên kết không liên quan.</span>

<div class="image-center"><img alt="vnexpress" height="310" src="https://fira.bdu.edu.vn/uploads/news/2025_05/vnexpress.png" width="605" /></div>
<br />
<br />
<span style="font-size:16px;">✔️&nbsp;&nbsp; &nbsp;Trích xuất nội dung bài viết<br />
➖&nbsp;&nbsp; &nbsp;Mở từng bài viết, lấy tiêu đề và nội dung từ các thẻ HTML phù hợp (&lt;h1&gt; cho tiêu đề, &lt;p&gt; cho nội dung).<br />
➖&nbsp;&nbsp; &nbsp;Kết hợp các đoạn văn bản để tạo thành một tệp văn bản chứa nội dung bài báo.<br />
✔️&nbsp;&nbsp; &nbsp;Lưu trữ dữ liệu<br />
➖&nbsp;&nbsp; &nbsp;Dữ liệu được lưu theo chuyên mục, mỗi bài báo được lưu dưới dạng một tệp .txt.<br />
➖&nbsp;&nbsp; &nbsp;Tên tệp được chuẩn hóa để tránh ký tự đặc biệt và đảm bảo không bị trùng lặp.</span>

<div class="image-center"><img alt="vnexpress 2" height="555" src="https://fira.bdu.edu.vn/uploads/news/2025_05/vnexpress-2.png" width="580" /></div>
&nbsp;

<div class="image-center"><img alt="vnexpress 3" height="646" src="https://fira.bdu.edu.vn/uploads/news/2025_05/vnexpress-3.png" width="600" /></div>
<br />
<span style="font-size:16px;">✔️&nbsp;&nbsp; &nbsp;Kết quả thu thập dữ liệu<br />
Sau khi thực hiện quá trình này, chúng tôi thu thập được một lượng lớn bài báo từ VnExpress, giúp tạo tập dữ liệu huấn luyện cho các mô hình học biểu diễn văn bản. Dữ liệu thu thập được sử dụng để đánh giá hiệu suất của PhoBERT trong bài toán khai thác thông tin.<br />
3️⃣<strong> Chuyển đổi dữ liệu văn bản sang vector</strong><br />
Sau khi thu thập dữ liệu văn bản tiếng Việt từ VnExpress, bước tiếp theo là chuyển đổi các bài viết này thành dạng vector số để phục vụ cho các bài toán khai thác thông tin. Trong bài tiểu luận này, chúng tôi sử dụng mô hình PhoBERT để học biểu diễn văn bản.<br />
✔️&nbsp;&nbsp; &nbsp;Quy trình chuyển đổi văn bản sang vector<br />
✔️&nbsp;&nbsp; &nbsp;Tải mô hình PhoBERT và tokenizer<br />
▪️&nbsp;&nbsp; &nbsp;PhoBERT là một biến thể của BERT được huấn luyện đặc biệt cho tiếng Việt.<br />
▪️&nbsp;&nbsp; &nbsp;Mô hình này có khả năng chuyển đổi văn bản thành một chuỗi vector số có ý nghĩa ngữ nghĩa.<br />
✔️&nbsp;&nbsp; &nbsp;Đọc và tiền xử lý dữ liệu<br />
▪️&nbsp;&nbsp; &nbsp;Các bài báo đã thu thập được lưu dưới dạng tệp .txt trong các thư mục theo từng chủ đề.<br />
▪️&nbsp;&nbsp; &nbsp;Chương trình duyệt qua các thư mục, đọc nội dung của từng bài viết và lưu vào danh sách để xử lý.<br />
✔️&nbsp;&nbsp; &nbsp;Mã hóa văn bản thành vector sử dụng PhoBERT<br />
▪️&nbsp;&nbsp; &nbsp;Sử dụng tokenizer để chuyển đổi văn bản thành dạng token phù hợp với PhoBERT.<br />
▪️&nbsp;&nbsp; &nbsp;Đầu vào sau khi được mã hóa sẽ được đưa vào mô hình PhoBERT để trích xuất đặc trưng (embedding).<br />
▪️&nbsp;&nbsp; &nbsp;Vector biểu diễn của văn bản được tính bằng cách lấy trung bình trên tất cả các token trong câu.<br />
✔️&nbsp;&nbsp; &nbsp;Lưu trữ kết quả<br />
▪️&nbsp;&nbsp; &nbsp;Sau khi mã hóa toàn bộ văn bản thành vector, kết quả được lưu vào tệp.npy để phục vụ cho các bước tiếp theo, bao gồm tìm kiếm và truy hồi thông tin.</span>

<div class="image-center"><img alt="Picture4" height="133" src="https://fira.bdu.edu.vn/uploads/news/2025_05/picture4.png" width="602" /></div>

<div class="image-center"><img alt="Picture5" height="526" src="https://fira.bdu.edu.vn/uploads/news/2025_05/picture5.png" width="1379" /></div>
<br />
<span style="font-size:16px;">4️⃣ <strong>Kiểm tra độ tương đồng của từ khóa tìm kiếm</strong><br />
Sau khi dữ liệu văn bản đã được thu thập và chuyển đổi sang dạng vector bằng PhoBERT, bước tiếp theo là xây dựng một hệ thống truy vấn để tìm kiếm các tài liệu liên quan dựa trên độ tương đồng ngữ nghĩa.<br />
✔️&nbsp;&nbsp; &nbsp;Cách thức hoạt động<br />
✔️&nbsp;&nbsp; &nbsp;Nạp mô hình PhoBERT: API sử dụng mô hình PhoBERT (vinai/phobert-base) để mã hóa từ khóa tìm kiếm thành vector.<br />
▪️&nbsp;&nbsp; &nbsp;Nạp tập dữ liệu vector hóa<br />
▪️&nbsp;&nbsp; &nbsp;Tải danh sách vector văn bản từ file document_vectors.npy.<br />
▪️&nbsp;&nbsp; &nbsp;Tải danh sách thông tin tài liệu từ document_index.npy.<br />
✔️&nbsp;&nbsp; &nbsp;Xử lý truy vấn<br />
▪️&nbsp;&nbsp; &nbsp;Người dùng nhập từ khóa tìm kiếm.<br />
▪️&nbsp;&nbsp; &nbsp;Từ khóa này được chuyển thành vector bằng PhoBERT.<br />
▪️&nbsp;&nbsp; &nbsp;Hệ thống tính toán độ tương đồng giữa vector truy vấn và các vector tài liệu đã lưu bằng cosine similarity.<br />
▪️&nbsp;&nbsp; &nbsp;Sắp xếp tài liệu theo độ tương đồng giảm dần và trả về kết quả.<br />
✔️&nbsp;&nbsp; &nbsp;Trả về kết quả<br />
▪️&nbsp;&nbsp; &nbsp;Kết quả trả về là danh sách các tài liệu phù hợp với truy vấn, bao gồm:<br />
▪️&nbsp;&nbsp; &nbsp;Chủ đề (chude).<br />
▪️&nbsp;&nbsp; &nbsp;Tên tệp tài liệu (filename).<br />
▪️&nbsp;&nbsp; &nbsp;Điểm số độ tương đồng (score).</span>

<div class="image-center"><img alt="Picture6" height="268" src="https://fira.bdu.edu.vn/uploads/news/2025_05/picture6.png" width="602" /></div>
<br />
<span style="font-size:16px;"><strong>TÀI LIỆU THAM KHẢO</strong><br />
&#91;1&#93; Le, Q., &amp; Mikolov, T., &quot;Distributed representations of sentences and documents,&quot; in ICML, 2014.<br />
&#91;2&#93; Nguyen, D. Q., &amp; Nguyen, A. T., &quot;Nguyen, D. Q., &amp; Nguyen, A. T.,&quot; in<br />
Findings of the Association for Computational Linguistics: EMNLP, 2020.<br />
https://github.com/VinAIResearch/PhoBERT<br />
https://huggingface.co/vinai/phobert-base</span>

<div style="text-align: right;"><strong><em>Khánh Tùng - Khoa CNTT, Robot &amp; Trí tuệ nhân tạo.</em></strong></div>
		</div>
				<div id="author">
						<p>
				<strong>Tác giả:</strong>
				<a href="https://fira.bdu.edu.vn/index.php/author/admin-fira/">admin_fira</a>
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://fira.bdu.edu.vn/index.php/savefile/sinh-vien-nghien-cuu-khoa-hoc/mo-hinh-phobert-phan-2-606.html" title="Mô hình PhoBERT &#40;phần 2&#41;">https://fira.bdu.edu.vn/index.php/savefile/sinh-vien-nghien-cuu-khoa-hoc/mo-hinh-phobert-phan-2-606.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; Khoa CNTT, Robot và Trí tuệ nhân tạo || Trường Đại học Bình Dương
		</div>
		<div id="contact">
			<a href="mailto:fit@bdu.edu.vn">fit@bdu.edu.vn</a>
		</div>
	</div>
</div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://fira.bdu.edu.vn/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<script src="https://fira.bdu.edu.vn/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=-4,nv_my_abbr="EDT",nv_cookie_prefix="nv4",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=1,nv_recaptcha_ver=2,nv_recaptcha_sitekey="",nv_recaptcha_type="image";</script>
<script src="https://fira.bdu.edu.vn/assets/js/language/vi.js"></script>
<script src="https://fira.bdu.edu.vn/assets/js/global.js"></script>
<script src="https://fira.bdu.edu.vn/themes/default/js/news.js"></script>
<script src="https://fira.bdu.edu.vn/themes/default/js/main.js"></script>
<script src="https://fira.bdu.edu.vn/themes/default/js/custom.js"></script>
<script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "Organization",
            "url": "https://fira.bdu.edu.vn",
            "logo": "https://fira.bdu.edu.vn/uploads/logo_khoacntt.png"
        }
        </script>
<script src="https://fira.bdu.edu.vn/themes/default/js/bootstrap.min.js"></script>
</body>
</html>