1. Trang chủ
  2. » Luận Văn - Báo Cáo

Nén dữ liệu tiếng việt sử dụng phương pháp mã hóa số học

54 10 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

ĐẠI HỌC THÁI NGUYÊN TRƯỜNG ĐẠI HỌC CNTT & TRUYỀN THÔNG HÀ DIỆU THÚY NÉN DỮ LIỆU TIẾNG VIỆT SỬ DỤNG PHƯƠNG PHÁP MÃ HÓA SỐ HỌC Chuyên ngành: Khoa học máy tính Mã số: 60 48 01 TĨM TẮT LUẬN VĂN THẠC SĨ KHOA HỌC MÁY TÍNH Thái Nguyên – 2013 Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ Cơng trình hồn thành TRƯỜNG ĐẠI HỌC CNTT & TRUYỀN THÔNG Người hướng dẫn khoa học: PGS.TS Nguyễn Hữu Điển Phản biện 1: TS Lê Quang Minh Phản biện 2: TS Trần Đức Sự Luận văn bảo vệ trước Hội đồng chấm luận văn họp tại: Trường Đại học Công nghệ thông tin & Truyền thông Vào hồi 11 00 ngày 09 tháng 11 năm 2013 Có thể tìm hiểu luận văn tại: - Trung tâm học liệu Đại học Thái Nguyên - Thư viện trường Đại học CNTT & Truyền thông Thái Nguyên ii Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ MỞ ĐẦU Đặt vấn đề Nén liệu kỹ thuật quan trọng nhiều lĩnh vực khác Chính nhờ có kỹ thuật nén liệu mà ngày có phương tiện truyền thơng đại phục vụ cho sống truyền hình cáp, truyền hình số, điện thoại, internet, hệ thống lưu trữ, văn nhiều khía cạnh khác Do kỹ thuật nén liệu ngày quan tâm phát triển nhiều Tiếng Việt ngôn ngữ thuộc hệ thống chữ Latinh, sử dụng nhiều dấu kèm với nguyên âm, bảng chữ tiếng Anh, tiếng Việt cịn có thêm ký tự: Sáu nguyên âm a, e, i, o, u, y với dấu (sắc, huyền, hỏi, ngã, nặng) tổ hợp thành 30 ký tự Sáu nguyên âm ă, â, ê, ô, ơ, với sáu dấu (sắc, huyền, hỏi, ngã, nặng, không dấu) tổ hợp thành 36 ký tự Một phụ âm đặc biệt đ Vậy cần thêm (30 + 36 +1) x = 134 ký tự cho tiếng Việt Với bảng mã ASCII bit sử dụng phổ biến máy tính, mã hóa 256 ký tự Tuy nhiên, ký tự có mã từ đến 127 chuẩn hóa thuộc diện “cấm vi phạm” 128 chỗ (mã từ 128 đến 255) “tự do” Vậy xây dựng ứng với mã sử dụng hết vùng tự mà thiếu 134 – 128 = chỗ Hiện sử dụng chuẩn Unicode để lưu trữ ký tự tiếng Việt Như biết chuẩn Unicode chuẩn 2byte, lưu trữ văn tiếng Việt hệ thống lưu trữ xẩy tình trạng dư thừa liệu Điều dẫn đến việc lưu trữ xử lý lãng tài ngun hệ Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ thống, truyền tải đường truyền mạng chiếm băng thông nhiều Từ u cầu thực tế địi hỏi phải loại bỏ dư thừa liệu trước lưu trữ xử lý Chính em chọn đề tài “Nén liệu tiếng Việt sử dụng thuật tốn mã hóa số học” Đối tượng phạm vi nghiên cứu - Các chuẩn lưu trữ tiếng Việt (Unicode, TCVN3, VNI-Vindows…) - Các phương pháp kỹ thuật nén liệu - Các phần mềm nén liệu Hướng nghiên cứu đề tài - Nghiên cứu phương pháp nén liệu nén bảo toàn liệu (lossless data compression) nén mát liệu (lossy data compression) - Nghiên cứu kỹ thuật nén liệu như: kỹ thuật xử lý lặp lại xâu (RLE), mã hóa Huffman, kỹ thuật nén LZW (Lempel - Zip Welch)… - Nghiên cứu kỹ thuật nén bảo toàn liệu Arithmetic Coding (Phương pháp mã hóa số học) - Cài đặt thực nghiệm việc nén liệu Arithmetic Coding - Phân tích, so sánh đánh giá kết thực nghiệm với kỹ thuật nén liệu (văn tiếng Việt) khác Số hóa trung tâm học lieäu http://lrc.tnu.edu.vn/ Phương pháp nghiên cứu - Nghiên cứu tài liệu kỹ thuật mã hóa nén liệu - Tìm hiểu chuẩn tiếng Việt Việt Nam - Khảo sát thực tế phần mềm nén liệu việc nén văn tiếng Việt - Phân tích, đánh giá kỹ thuật (thuật tốn) nén liệu - Cài đặt kỹ thuật nén Arithmetic Coding - Triển khai thử nghiệm loại liệu văn tiếng Việt Ý nghĩa khoa học ý nghĩa thực tiễn đề tài - Nghiên cứu hoàn thiện kỹ thuật nén bảo toàn liệu cho văn tiếng Việt - Xây dựng ứng dụng nén liệu cho văn tiếng Việt Soá hóa trung tâm học liệu http://lrc.tnu.edu.vn/ Chương 1: TỔNG QUAN VỀ NÉN DỮ LIỆU 1.1 Tổng quan nén liệu 1.1.1 Sơ lược nén liệu 1.1.1.1 Khái niệm nén liệu Nén liệu q trình làm giảm lượng thơng tin “dư thừa” liệu gốc vậy, lượng thông tin thu sau nén thường nhỏ so với liệu gốc nhiều 1.1.1.2 Nguyên tắc nén liệu Thông thường, hầu hết tập tin máy tính có nhiều thông tin dư thừa, việc thực nén tập tin thực chất mã hoá lại tập tin để loại bỏ thơng tin dư thừa Nhìn chung khơng thể có phương pháp nén tổng qt cho kết tốt tất loại tập tin khơng ta áp dụng n lần phương pháp nén để đạt tập tin nhỏ tuỳ ý Kỹ thuật nén tập tin thường áp dụng cho tập tin văn (Trong có số kí tự có xác suất xuất nhiều kí tự khác), tập tin ảnh bitmap (Mà có mảng lớn đồng nhất), tập tin dùng để biểu diễn âm dạng số hố tín hiệu tương tự (analog signal) khác (Các tín hiệu có mẫu lặp lại nhiều lần) Ðối với tập tin nhị phân tập tin chương trình sau nén khơng tiết kiệm nhiều Ngoài ra, số trường hợp để nâng cao hệ số nén người ta bỏ bớt số thông tin tập tin 1.1.2 Các phương pháp nén liệu 1.1.2.1 Nén bảo toàn liệu Đó mơ hình nén liệu mà cho phép người sử dụng bảo tồn thơng tin suốt q trình nén Điều giải thích sau: Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ Giả sử ta có liệu nguồn A liệu nén A' Sau ta giải nén A' tập A'' mà tập A'' hồn tồn giống với tập A ban đầu giải nén Thông thường, kỹ thuật áp dụng với loại liệu văn độ xác văn 1.1.2.2 Nén hao hụt liệu Trong kỹ thuật nén, bên cạnh nén bảo tồn người ta cịn đưa khái niệm nén khơng bảo tồn (hay cịn gọi nén hao hụt liệu) Nén khơng bảo tồn mơ hình nén liệu mà tính bảo tồn liệu khơng coi trọng Nó có nghĩa ta có tập liệu A, tập nén A' sau giải nén ta thu tập A'' khác tập A ban đầu Kỹ thuật thường áp dụng cho việc nén liệu loại tệp ảnh nói chung khơng ảnh hưởng nhiều đến hình dạng ảnh 1.2 Các kỹ thuật nén liệu văn 1.2.1 Xử lý lặp lại xâu ký tự (Run – Length Encoding) Mục đích thuật tốn tìm ký tự lặp lại nhiều lần số lần lặp lại ký tự đó, thay cụm lặp lại biểu diễn nhỏ gọn Có thể biểu diễn rút gọn dạng cặp ký hiệu (r,s,l) với s ký hiệu dãy ký tự nằm bảng chữ cái, r l ký hiệu không xuất bảng chữ cái, tùy trường hợp mà r l lại có ý nghĩa khác Ví dụ: Cho chuỗi đầu vào MMMMMMM (chữ M lặp lại lần), chuỗi thay (r,7,M) hay viết tắt r7M r với ý nghĩa ký hiệu cho việc xuất lặp lại (repeating) đòi hỏi chữ r không xuất bảng chữ đầu vào Cho chuỗi đầu vào ABCDEFG (không xuất lặp lại) chuỗi thay (n,7,ABCDEFGH), hay viết tắt n7ABCDEFG n Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ với ý nghĩa ký hiệu cho việc không xuất lặp lại (non-repeating), chữ n không xuất bảng chữ đầu vào Thuật toán hiệu liệu đầu vào gồm nhiều ký tự bị lặp lại liên tiếp Ký tự đầu vào dạng chữ bảng chữ cái, bit 0, nhị phân; thông số màu điểm ảnh, khối hợp thành liệu kiểu âm Trên thực tế, thuật tốn cịn áp dụng ngày nay: thuật toán HDC (hardware data compression), sử dụng ổ băng kết nối với hệ thống máy tính IBM, thuật tốn tương tự dùng chuẩn SNA (System network architecture) IBM 1.2.2 Mã hóa Huffman 1.2.2.1 Mã Huffman tĩnh * Nguyên lý: Nguyên lý phương pháp Huffman mã hoá bytes tệp liệu nguồn biến nhị phân Nó tạo mã độ dài biến thiên tập hợp bits Đây phương pháp nén kiểu thống kê, ký tự xuất nhiều có mã ngắn Mã Huffman có tính chất quan trọng: mã ký hiệu phần đầu mã ký hiệu khác Nếu ký hiệu mã hoá tổ hợp nhị phân 101 tổ hợp 10110 mã ký hiệu khác tệp nguồn Do giải mã cần phải đọc bit gặp mã ký hiệu * Thuật tốn: Việc xây dựng mã hoá Huffman tiến hành thuật toán khác với thuật toán Fano - Shannon Nếu Fano - Shannon xây dựng từ xuống cách chia đơi gán cho Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ phần bít, cơng việc kết thúc khơng thể tiến hành phân chia tiếp Huffman lại thiết kế từ lên, cơng việc kết thúc điểm gốc Ví dụ : Cho mơ hình nguồn có trạng thái tần suất tương ứng sau: (A, 0.2); (E, 0.3); (I, 0.1), (0 0,2); (U, 0.1); (Ơ, 0.1) ta có: Ký tự Tần xuất Mã A 0.2 10 E 0.3 01 I 0.1 001 O 0.2 11 U 0.1 0000 Ô 0.1 0001 01 0 1 u e a o i ô Bước1: Nhóm chữ có tần suất nhỏ tạo chữ kép Sau lần nhóm số chữ c -> 0.3 e -> 0.3 e -> 0.3 {a, 0} -> 0.4 {{{u, ô},:} a -> 0.2 a -> 0.2 {{u,ô},i} -> 0.3 e -> 0.3 {a, o{ -> o -> 0.2 o -> 0.2 a -> 0.2 i -> 0.1 {u,ô} -> 0.2 u -> 0.1 i -> 0.1 {{u, ô}, i} -> 0.3 o -> 0.2 ô -> 0.1 Bước 2: Tạo phân nhánh ngược với q trình nhóm từ nhánh trái có mã 0, nhánh phải mã Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ {{{{u, ơ}, 1}, e}, {a, o}} {{{u, ô}, i}, e} {a, o} 10 {{{ u, ô}, i}, e a o {u, ô} i u ô Vậy mã ký tự là: u -> 0000; e -> 01 ô -> 0001; a -> 10 i -> 001; o -> 11 Thuật tốn nén: Bước 1: Tìm hai ký tự có trọng số nhỏ ghép lại làm một, trọng số ký tự tổng trọng số hai ký tự đem ghép Bước 2: Trong số lượng ký tự danh sách lớn thực bước một, khơng thực bước ba Bước ba: Tách ký tự cuối tạo nhị phân với qui ước bên trái mã 0, bên phải mã Thuật toán giải nén: Bước 1: Đọc bit tập tin nén duyệt nhị phân xác định hết Lấy ký tự ghi tệp giải nén Bước 2: Trong chưa hết tập tin nén thực bước một, ngược lại thực bước ba Bước 3: Kết thúc thuật tốn Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 38 Thời gian nén giải nén, mơ hình từ xấp xỉ với thời gian nén giải nén phương pháp nén gzip Điều chứng tỏ nén số học dùng mơ hình từ mang lại tỷ số tốt Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 39 KẾT LUẬN Hiện nén số liệu vấn đề mẽ người sử dụng máy tính, tất máy cài đặt vài tiện ích nén cho người sử dụng Tuy nhiên để có hiểu biết chế làm việc q trình nén chưa có tài liệu tiếng Việt đề cập đến Do việc tiếp cận công nghệ nén thời gian ngắn, kinh nghiệm lập trình thân cịn yếu cịn gặp nhiều khó khăn việc dịch tài liệu nước ngồi nên khơng tránh khỏi số sai sót Thêm vào hiểu biết cá nhân tất khía cạnh chưa thật sâu sắc, nên đề tài chưa hồn chỉnh cần có cải tiến khác để nâng cao hiệu suất Rất mong góp ý thầy cơ, anh chị trước bạn để em hồn thành luận văn tốt Để nâng cao tỷ số nén chương trình cần lựa chọn cấu trúc liệu tối ưu để xây dựng mơ hình bậc cao kết thực nghiệm thực mơ hình bậc khơng Do với mơ hình bậc cao kết mang lại có lẽ tốt Cải tiến thao tác đọc ghi tệp mức bít để nâng cao tốc độ v.v Chương trình cần phát triển để phát huy tác dụng với tất loại tập tin (văn bản, hình ảnh, âm thanh, tập tin nhị phân, ) Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 40 TÀI LIỆU THAM KHẢO Tài liệu tiếng Việt Đỗ Ngọc Anh (2006), Nén ảnh sử dụng biến đổi Wavelet ứng dụng dịch vụ liệu đa phương tiện tự động”, Luận văn thạc sỹ khoa học-Đại học Bách Khoa Hà Nội Phạm Văn Ất (2006), Kỹ thuật lập trình C sở nâng cao, NXB Giao thông vận tải, Hà Nội Nguyễn Hữu Điển (2004), Một số vấn đề thuật toán, NXB Giáo dục Tài liệu tiếng Anh: Maxime Crochemore, Thierry Lecroq (2010), Text data compression algorithms, Chapman & Hall/CRC Darrel R.Hankerson, Greg A.Haris, Peter D.Johnson, Introduction to Information theory and compression, Chapman&Hall/CRC Ida Mengyi Pu (2006), Fundamental Data Compression, Elsevier, Burlington Amir Said (2004), Introduction to arithmetic coding – Theory and Practice, Imaging system Laboratory Khalid Sayood (2006), Introduction to Data compression, Elsevier Tài liệu Internet: http://wikipedia.org 10 http://en.wikibooks.org 11 http://unikey.org 12 http://www.vnnic.vn/tenmientiengviet Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 41 MỤC LỤC MỞ ĐẦU 1 Đặt vấn đề Đối tượng phạm vi nghiên cứu Hướng nghiên cứu đề tài Phương pháp nghiên cứu Ý nghĩa khoa học ý nghĩa thực tiễn đề tài Chương 1: TỔNG QUAN VỀ NÉN DỮ LIỆU 1.1 Tổng quan nén liệu 1.1.1 Sơ lược nén liệu 1.1.1.1 Khái niệm nén liệu 1.1.1.2 Nguyên tắc nén liệu 1.1.2 Các phương pháp nén liệu 1.1.2.1 Nén bảo toàn liệu 1.1.2.2 Nén hao hụt liệu 1.2 Các kỹ thuật nén liệu văn 1.2.1 Xử lý lặp lại xâu ký tự (Run – Length Encoding) 1.2.2 Mã hóa Huffman 1.2.2.1 Mã Huffman tĩnh 1.2.2.2 Thuật toán Huffman động 1.2.3 Thuật toán LZW 12 1.2.4 Phương pháp mã hóa số học (Arithmetic Coding) 14 1.2.5 Mã hóa kiểu từ điển 16 1.2.5.1 Từ điển tĩnh 17 1.2.5.2 Từ điển động 18 Chương 2: NGHIÊN CỨU KỸ THUẬT NÉN VĂN BẢN TIẾNG VIỆT SỬ DỤNG KỸ THUẬT MÃ HÓA SỐ HỌC 21 2.1 Các bảng mã tiếng Việt 21 2.1.1 Chuẩn lưu trữ Unicode 21 2.1.1.1.Kho chữ 21 2.1.1.2 Bảng mã 22 2.1.1.3 Phông chữ Unicode 26 2.1.2 Chuẩn lưu trữ tiếng Việt TCVN3 26 2.1.3 Chuẩn lưu trữ VNI-Windows 26 2.2 Kỹ thuật mã hóa số học 27 2.3 Phân tích thuật tốn mã hóa số học 28 2.2.1 Nén liệu văn tiếng Việt 28 2.2.2 Giải nén liệu văn tiếng Việt 31 2.2.3 Những hạn chế 32 Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 42 Chương 3: XÂY DỰNG ỨNG DỤNG NÉN DỮ LIỆU CHO VĂN BẢN TIẾNG VIỆT 34 3.1 Bài toán nén liệu văn tiếng Việt 34 3.2 Xây dựng ứng dụng 34 3.2.1 Cài đặt thuật toán nén liệu văn tiếng Việt 34 3.2.2 Cài đặt thuật toán giải nén liệu văn tiếng Việt 35 3.3 Triển khai thử nghiệm 35 3.4 Đánh giá 37 Bảng so sánh giải nén 37 KẾT LUẬN 39 Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 43 PHỤ LỤC using using using using using using using using using using System; System.Collections.Generic; System.ComponentModel; System.Data; System.Drawing; System.Linq; System.Text; System.Windows.Forms; System.IO; ACLib; namespace ArithmeticCoder { public partial class frmArithmeticCoder : Form { //Khởi tạo form public frmArithmeticCoder() { InitializeComponent(); } //Sự kiện click button để chọn file đầu vào private void browseSourceButton_Click(object sender, EventArgs e) { //Mở file dialog sourceOpenFileDialog.ShowDialog(); } private void sourceOpenFileDialog_FileOk(object sender, CancelEventArgs e) { //gán đường dẫn file cho TextBox sourceText.Text = sourceOpenFileDialog.FileName; } //Sự kiện click button để chọn file đầu private void browseTargetButton_Click(object sender, EventArgs e) { //Mở file dialog targetOpenFileDialog.ShowDialog(); } private void targetOpenFileDialog_FileOk(object sender, CancelEventArgs e) { //gán đường dẫn file cho TextBox targetText.Text = targetOpenFileDialog.FileName; } // Sự kiện chọn nút mã hóa liệu private void encodeButton_Click(object sender, EventArgs e) { AbstractModel model = new ModelOrder0(); //Khai báo biến lấy thông tin file đầu vào, đầu FileInfo sourceFile, targetFile; //Khai báo biến lấy cấu trúc file đầu vào, đầu FileStream sourceStream, targetStream; try Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 44 { //Đọc file đầu vào sourceFile = new FileInfo(sourceText.Text); sourceStream = sourceFile.OpenRead(); } catch (Exception openSourceException) { MessageBox.Show("Lỗi 1! Không thể đọc file đầu vào"); return; } try { //Ghi file kết targetFile = new FileInfo(targetText.Text); targetStream = targetFile.OpenWrite(); } catch (Exception openTargetException) { MessageBox.Show("Lỗi 2! Không thể mở file đầu để ghi!"); return; } // Thông tin độ lớn file đầu vào sourceFileSizeValueText.Text = sourceFile.Length.ToString(); sourceStream.Seek(0, SeekOrigin.Begin); byte[] writtenBytes = Encoding.Default.GetBytes(Program.g_Signature); targetStream.Write(writtenBytes, 0, 4); DateTime firstTime = DateTime.Now; // Chức nén model.Process(sourceStream, targetStream, ModeE.MODE_ENCODE); // Đo thời gian nén DateTime secondTime = DateTime.Now; TimeSpan duration = secondTime - firstTime; // Đóng file sourceStream.Close(); targetStream.Close(); // Thông tin độ lớn file đầu targetFileSizeValueText.Text = targetFile.Length.ToString(); compressionRatioValueText.Text = ((double)sourceFile.Length / (double)targetFile.Length).ToString(); timeValueText.Text = duration.TotalMilliseconds.ToString(); MessageBox.Show("Mã hóa (nén) thành cơng!"); } // Sự kiện chọn nút mã hóa liệu, tương tự mã hóa private void decodeButton_Click(object sender, EventArgs e) { AbstractModel model = new ModelOrder0(); FileInfo sourceFile, targetFile; FileStream sourceStream, targetStream; Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 45 try { sourceFile = new FileInfo(sourceText.Text); sourceStream = sourceFile.OpenRead(); } catch (Exception openSourceException) { MessageBox.Show("Lỗi 1! Không thể mở file đầu vào để đọc!"); return; } try { targetFile = new FileInfo(targetText.Text); targetStream = targetFile.OpenWrite(); } catch (Exception openTargetException) { MessageBox.Show("Lỗi 2! Không thể mở file đầu để ghi!"); return; } sourceFileSizeValueText.Text = sourceFile.Length.ToString(); byte[] readBytes = new byte[4]; sourceStream.Read(readBytes, 0, 4); string signature = Encoding.Default.GetString(readBytes); if (signature != Program.g_Signature) { MessageBox.Show("Lỗi 3! nén không hợp lệ!"); return; } DateTime firstTime = DateTime.Now; model.Process(sourceStream, targetStream, ModeE.MODE_DECODE); DateTime secondTime = DateTime.Now; TimeSpan duration = secondTime - firstTime; sourceStream.Close(); targetStream.Close(); targetFileSizeValueText.Text = targetFile.Length.ToString(); compressionRatioValueText.Text = ((double)targetFile.Length / (double)sourceFile.Length).ToString(); timeValueText.Text = duration.TotalMilliseconds.ToString(); MessageBox.Show("Giải mã (giải nén) thành cơng!"); } } Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 46 } namespace ArithmeticCoder { partial class frmArithmeticCoder { /// /// Required designer variable /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - not modify /// the contents of this method with the code editor /// private void InitializeComponent() { this.sourceOpenFileDialog = new System.Windows.Forms.OpenFileDialog(); this.sourceLabel = new System.Windows.Forms.Label(); this.targetLabel = new System.Windows.Forms.Label(); this.sourceText = new System.Windows.Forms.TextBox(); this.targetText = new System.Windows.Forms.TextBox(); this.browseSourceButton = new System.Windows.Forms.Button(); this.browseTargetButton = new System.Windows.Forms.Button(); this.targetOpenFileDialog = new System.Windows.Forms.OpenFileDialog(); this.encodeButton = new System.Windows.Forms.Button(); this.decodeButton = new System.Windows.Forms.Button(); this.sourceFileSizeLabel = new System.Windows.Forms.Label(); this.targetFileSizeLabel = new System.Windows.Forms.Label(); this.infoGroupBox = new System.Windows.Forms.GroupBox(); this.timeValueText = new System.Windows.Forms.TextBox(); this.compressionRatioValueText = new System.Windows.Forms.TextBox(); this.targetFileSizeValueText = new System.Windows.Forms.TextBox(); this.sourceFileSizeValueText = new System.Windows.Forms.TextBox(); this.timeLabel = new System.Windows.Forms.Label(); this.compressionRatioLabel = new System.Windows.Forms.Label(); this.infoGroupBox.SuspendLayout(); this.SuspendLayout(); Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 47 // // sourceOpenFileDialog // this.sourceOpenFileDialog.FileName = "openFileDialog1"; this.sourceOpenFileDialog.SupportMultiDottedExtensions = true; this.sourceOpenFileDialog.Title = "Browse the Source File"; this.sourceOpenFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.sourceOpenFileDialog_FileOk ); // // sourceLabel // this.sourceLabel.AutoSize = true; this.sourceLabel.Location = new System.Drawing.Point(11, 96); this.sourceLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.sourceLabel.Name = "sourceLabel"; this.sourceLabel.Size = new System.Drawing.Size(69, 13); this.sourceLabel.TabIndex = 0; this.sourceLabel.Text = "File đầu vào:"; // // targetLabel // this.targetLabel.AutoSize = true; this.targetLabel.Location = new System.Drawing.Point(11, 124); this.targetLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.targetLabel.Name = "targetLabel"; this.targetLabel.Size = new System.Drawing.Size(60, 13); this.targetLabel.TabIndex = 1; this.targetLabel.Text = "File đầu ra:"; // // sourceText // this.sourceText.Location = new System.Drawing.Point(108, 93); this.sourceText.Margin = new System.Windows.Forms.Padding(2); this.sourceText.Name = "sourceText"; this.sourceText.Size = new System.Drawing.Size(401, 20); this.sourceText.TabIndex = 2; // // targetText // this.targetText.Location = new System.Drawing.Point(108, 121); this.targetText.Margin = new System.Windows.Forms.Padding(2); this.targetText.Name = "targetText"; this.targetText.Size = new System.Drawing.Size(401, 20); this.targetText.TabIndex = 3; // // browseSourceButton // this.browseSourceButton.Location = new System.Drawing.Point(513, 93); this.browseSourceButton.Margin = new System.Windows.Forms.Padding(2); this.browseSourceButton.Name = "browseSourceButton"; Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 48 this.browseSourceButton.Size = new System.Drawing.Size(109, 22); this.browseSourceButton.TabIndex = 4; this.browseSourceButton.Text = "Mở"; this.browseSourceButton.UseVisualStyleBackColor = true; this.browseSourceButton.Click += new System.EventHandler(this.browseSourceButton_Click); // // browseTargetButton // this.browseTargetButton.Location = new System.Drawing.Point(513, 121); this.browseTargetButton.Margin = new System.Windows.Forms.Padding(2); this.browseTargetButton.Name = "browseTargetButton"; this.browseTargetButton.Size = new System.Drawing.Size(109, 21); this.browseTargetButton.TabIndex = 5; this.browseTargetButton.Text = "Mở"; this.browseTargetButton.UseVisualStyleBackColor = true; this.browseTargetButton.Click += new System.EventHandler(this.browseTargetButton_Click); // // targetOpenFileDialog // this.targetOpenFileDialog.CheckFileExists = false; this.targetOpenFileDialog.CheckPathExists = false; this.targetOpenFileDialog.DefaultExt = "ac"; this.targetOpenFileDialog.FileName = "openFileDialog1"; this.targetOpenFileDialog.SupportMultiDottedExtensions = true; this.targetOpenFileDialog.Title = "Select Destination File"; this.targetOpenFileDialog.FileOk += new System.ComponentModel.CancelEventHandler(this.targetOpenFileDialog_FileOk ); // // encodeButton // this.encodeButton.Location = new System.Drawing.Point(496, 152); this.encodeButton.Margin = new System.Windows.Forms.Padding(2); this.encodeButton.Name = "encodeButton"; this.encodeButton.Size = new System.Drawing.Size(50, 34); this.encodeButton.TabIndex = 6; this.encodeButton.Text = "Nén"; this.encodeButton.UseVisualStyleBackColor = true; this.encodeButton.Click += new System.EventHandler(this.encodeButton_Click); // // decodeButton // this.decodeButton.Location = new System.Drawing.Point(550, 152); this.decodeButton.Margin = new System.Windows.Forms.Padding(2); this.decodeButton.Name = "decodeButton"; this.decodeButton.Size = new System.Drawing.Size(72, 34); this.decodeButton.TabIndex = 7; Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 49 this.decodeButton.Text = "Giải nén"; this.decodeButton.UseVisualStyleBackColor = true; this.decodeButton.Click += new System.EventHandler(this.decodeButton_Click); // // sourceFileSizeLabel // this.sourceFileSizeLabel.AutoSize = true; this.sourceFileSizeLabel.Location = new System.Drawing.Point(11, 22); this.sourceFileSizeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.sourceFileSizeLabel.Name = "sourceFileSizeLabel"; this.sourceFileSizeLabel.Size = new System.Drawing.Size(157, 13); this.sourceFileSizeLabel.TabIndex = 8; this.sourceFileSizeLabel.Text = "Kích thước file đầu vào (Bytes):"; // // targetFileSizeLabel // this.targetFileSizeLabel.AutoSize = true; this.targetFileSizeLabel.Location = new System.Drawing.Point(11, 46); this.targetFileSizeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.targetFileSizeLabel.Name = "targetFileSizeLabel"; this.targetFileSizeLabel.Size = new System.Drawing.Size(148, 13); this.targetFileSizeLabel.TabIndex = 9; this.targetFileSizeLabel.Text = "Kích thước file đầu (Bytes):"; // // infoGroupBox // this.infoGroupBox.Controls.Add(this.timeValueText); this.infoGroupBox.Controls.Add(this.compressionRatioValueText); this.infoGroupBox.Controls.Add(this.targetFileSizeValueText); this.infoGroupBox.Controls.Add(this.sourceFileSizeValueText); this.infoGroupBox.Controls.Add(this.timeLabel); this.infoGroupBox.Controls.Add(this.compressionRatioLabel); this.infoGroupBox.Controls.Add(this.sourceFileSizeLabel); this.infoGroupBox.Controls.Add(this.targetFileSizeLabel); this.infoGroupBox.Location = new System.Drawing.Point(14, 10); this.infoGroupBox.Margin = new System.Windows.Forms.Padding(2); this.infoGroupBox.Name = "infoGroupBox"; this.infoGroupBox.Padding = new System.Windows.Forms.Padding(2); this.infoGroupBox.Size = new System.Drawing.Size(608, 77); this.infoGroupBox.TabIndex = 10; this.infoGroupBox.TabStop = false; this.infoGroupBox.Text = "Thông tin"; // // timeValueText // Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 50 this.timeValueText.Location = new System.Drawing.Point(457, 43); this.timeValueText.Margin = new System.Windows.Forms.Padding(2); this.timeValueText.Name = "timeValueText"; this.timeValueText.ReadOnly = true; this.timeValueText.Size = new System.Drawing.Size(134, 20); this.timeValueText.TabIndex = 18; // // compressionRatioValueText // this.compressionRatioValueText.Location = new System.Drawing.Point(457, 19); this.compressionRatioValueText.Margin = new System.Windows.Forms.Padding(2); this.compressionRatioValueText.Name = "compressionRatioValueText"; this.compressionRatioValueText.ReadOnly = true; this.compressionRatioValueText.Size = new System.Drawing.Size(134, 20); this.compressionRatioValueText.TabIndex = 17; // // targetFileSizeValueText // this.targetFileSizeValueText.Location = new System.Drawing.Point(172, 46); this.targetFileSizeValueText.Margin = new System.Windows.Forms.Padding(2); this.targetFileSizeValueText.Name = "targetFileSizeValueText"; this.targetFileSizeValueText.ReadOnly = true; this.targetFileSizeValueText.Size = new System.Drawing.Size(134, 20); this.targetFileSizeValueText.TabIndex = 16; // // sourceFileSizeValueText // this.sourceFileSizeValueText.Location = new System.Drawing.Point(172, 22); this.sourceFileSizeValueText.Margin = new System.Windows.Forms.Padding(2); this.sourceFileSizeValueText.Name = "sourceFileSizeValueText"; this.sourceFileSizeValueText.ReadOnly = true; this.sourceFileSizeValueText.Size = new System.Drawing.Size(134, 20); this.sourceFileSizeValueText.TabIndex = 11; // // timeLabel // this.timeLabel.AutoSize = true; this.timeLabel.Location = new System.Drawing.Point(355, 43); this.timeLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.timeLabel.Name = "timeLabel"; this.timeLabel.Size = new System.Drawing.Size(76, 13); this.timeLabel.TabIndex = 13; this.timeLabel.Text = "Thời gian (ms):"; // Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 51 // compressionRatioLabel // this.compressionRatioLabel.AutoSize = true; this.compressionRatioLabel.Location = new System.Drawing.Point(355, 19); this.compressionRatioLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0); this.compressionRatioLabel.Name = "compressionRatioLabel"; this.compressionRatioLabel.Size = new System.Drawing.Size(98, 13); this.compressionRatioLabel.TabIndex = 12; this.compressionRatioLabel.Text = "Compression Ratio:"; // // frmArithmeticCoder // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(633, 200); this.Controls.Add(this.infoGroupBox); this.Controls.Add(this.decodeButton); this.Controls.Add(this.encodeButton); this.Controls.Add(this.browseTargetButton); this.Controls.Add(this.browseSourceButton); this.Controls.Add(this.targetText); this.Controls.Add(this.sourceText); this.Controls.Add(this.targetLabel); this.Controls.Add(this.sourceLabel); this.Margin = new System.Windows.Forms.Padding(2); this.MaximizeBox = false; this.Name = "frmArithmeticCoder"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Mã hóa số học"; this.infoGroupBox.ResumeLayout(false); this.infoGroupBox.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); } #endregion private private private private private private private private private private private private private private private private private System.Windows.Forms.OpenFileDialog sourceOpenFileDialog; System.Windows.Forms.Label sourceLabel; System.Windows.Forms.Label targetLabel; System.Windows.Forms.TextBox sourceText; System.Windows.Forms.TextBox targetText; System.Windows.Forms.Button browseSourceButton; System.Windows.Forms.Button browseTargetButton; System.Windows.Forms.OpenFileDialog targetOpenFileDialog; System.Windows.Forms.Button encodeButton; System.Windows.Forms.Button decodeButton; System.Windows.Forms.Label sourceFileSizeLabel; System.Windows.Forms.Label targetFileSizeLabel; System.Windows.Forms.GroupBox infoGroupBox; System.Windows.Forms.Label timeLabel; System.Windows.Forms.Label compressionRatioLabel; System.Windows.Forms.TextBox sourceFileSizeValueText; System.Windows.Forms.TextBox timeValueText; Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ 52 private System.Windows.Forms.TextBox compressionRatioValueText; private System.Windows.Forms.TextBox targetFileSizeValueText; } using using using using using using System; System.Collections.Generic; System.Linq; System.Windows.Forms; System.IO; ACLib; namespace ArithmeticCoder { static class Program { /// /// The main entry point for the application /// public const string g_Signature = "ACMC"; //Hàm gọi form chạy chương trình [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new frmArithmeticCoder()); } } } Số hóa trung tâm học liệu http://lrc.tnu.edu.vn/ ... Kỹ thuật mã hóa số học - Nguyên tắc mã hóa: Mã hóa Số học khơng thay kí hiệu đầu vào từ mã riêng biệt mà thay luồng ký hiệu đầu vào từ mã đầu Đầu mã hóa Số học số lớn nhỏ Mã hóa Số học bắt đầu... sở lý luận kỹ thuật nén mã hóa số học Đã triển khai cài đặt thử nghiệm chương trình nén văn tiếng Việt phương pháp mã hóa số học So với phương pháp nén khác chưa phải phương pháp tối ưu File so... ứng dụng nén liệu cho văn tiếng Việt Soá hóa trung tâm học liệu http://lrc.tnu.edu.vn/ Chương 1: TỔNG QUAN VỀ NÉN DỮ LIỆU 1.1 Tổng quan nén liệu 1.1.1 Sơ lược nén liệu 1.1.1.1 Khái niệm nén liệu

Ngày đăng: 24/03/2021, 17:35

Xem thêm:

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w