Tổng quan về Underthesea

# **Giới thiệu thư viện Underthesea – bộ công cụ mã nguồn mở xử lý ngôn ngữ tự nhiên tiếng Việt**
## **Mở đầu**
Underthesea là một toolkit hỗ trợ cho việc nghiên cứu và phát triển xử lý ngôn ngữ tự nhiên tiếng Việt. Underthesea ra đời vào tháng 3 năm 2017, trong bối cảnh ở Việt Nam đã có một số toolkit khá tốt như vn.vitk, pyvi, nhưng vẫn thiếu một toolkit hoàn chỉnh, mã nguồn mở, dễ dàng cài đặt và sử dụng như các sản phẩm tương đương đối với tiếng Anh như nltk, polyglot, spacy.
Trong bài viết này chúng ta sẽ tìm hiểu sơ qua về Underthesea và một số cách sử dụng của nó.## **Underthesea** là : 1.  **Một bộ công cụ NLP tiếng Việt** <br>Underthesea là một mã nguồn mở bằng Python bao gồm các bộ dữ liệu (data sets) và các hướng dẫn hỗ trợ nghiên cứu và phát triển trong xử lý ngôn ngữ tự nhiên tiếng Việt ([Vietnamese Natural Language Processing](https://github.com/undertheseanlp/underthesea)). Nó cung cấp các API cực kỳ dễ dàng để áp dụng các mô hình pretrained NLP cho văn bản tiếng Việt, chẳng hạn như phân đoạn từ, gắn thẻ một phần giọng nói(PoS), nhận dạng thực thể có tên (NER), phân loại văn bản và phân tích cú pháp phụ thuộc.
2. **Một thư viện Pytorch** <br>Underthesea được hỗ trợ bởi một trong những thư viên học sâu phổ biến nhất, [Pytorch](https://pytorch.org/), giúp nó dễ dàng train các mô hình học sâu và thử nghiệp các phương pháp tiếp cận mới bằng cách sử dụng các Module và Class của Underthesea
3. **Một phần mềm mã nguồn mở** <br>Underthesea được công bố theo giấy phép GNU General Public License v3.0. Các quyền của giấy phép này có điều kiện là cung cấp mã nguồn hoàn chỉnh của các tác phẩm được cấp phép và sửa đổi, bao gồm các tác phẩm lớn hơn sử dụng tác phẩm được cấp phép, theo cùng một giấy phép.
### **Cài đặt**
Để cài đặt underthesea :“`$ pip install underthesea“`
### **Hướng dẫn**
1. **Phân đoạn câu** (Sentence Segmentation)“`>>> from underthesea import sent_tokenize>>> text = ‘Taylor cho biết lúc đầu cô cảm thấy ngại với cô bạn thân Amanda nhưng rồi mọi thứ trôi qua nhanh chóng. Amanda cũng thoải mái với mối quan hệ này.’
>>> sent_tokenize(text)[  “Taylor cho biết lúc đầu cô cảm thấy ngại với cô bạn thân Amanda nhưng rồi mọi thứ trôi qua nhanh chóng.”,  “Amanda cũng thoải mái với mối quan hệ này.”]“`
2. **Phân đoạn từ** (Word Segmentation)“`>>> from underthesea import word_tokenize>>> sentence = ‘Chàng trai 9X Quảng Trị khởi nghiệp từ nấm sò’
>>> word_tokenize(sentence)[‘Chàng trai’, ‘9X’, ‘Quảng Trị’, ‘khởi nghiệp’, ‘từ’, ‘nấm’, ‘sò’]
>>> word_tokenize(sentence, format=”text”)’Chàng_trai 9X Quảng_Trị khởi_nghiệp từ nấm sò’“`
3. **Gán nhãn POS**“`>>> from underthesea import pos_tag>>> pos_tag(‘Chợ thịt chó nổi tiếng ở Sài Gòn bị truy quét’)[(‘Chợ’, ‘N’), (‘thịt’, ‘N’), (‘chó’, ‘N’), (‘nổi tiếng’, ‘A’), (‘ở’, ‘E’), (‘Sài Gòn’, ‘Np’), (‘bị’, ‘V’), (‘truy quét’, ‘V’)]“`
4. **Chunking**“`>>> from underthesea import chunk>>> text = ‘Bác sĩ bây giờ có thể thản nhiên báo tin bệnh nhân bị ung thư?’>>> chunk(text)[(‘Bác sĩ’, ‘N’, ‘B-NP’), (‘bây giờ’, ‘P’, ‘I-NP’), (‘có thể’, ‘R’, ‘B-VP’), (‘thản nhiên’, ‘V’, ‘I-VP’), (‘báo tin’, ‘N’, ‘B-NP’), (‘bệnh nhân’, ‘N’, ‘I-NP’), (‘bị’, ‘V’, ‘B-VP’), (‘ung thư’, ‘N’, ‘I-VP’), (‘?’, ‘CH’, ‘O’)]“`
5. **Phân tích cú pháp phụ thuộc**“`>>> from underthesea import dependency_parse>>> text = ‘Tối 29/11, Việt Nam thêm 2 ca mắc Covid-19’>>> dependency_parse(text)[(‘Tối’, 5, ‘obl:tmod’), (’29/11′, 1, ‘flat:date’), (‘,’, 1, ‘punct’), (‘Việt Nam’, 5, ‘nsubj’), (‘thêm’, 0, ‘root’), (‘2’, 7, ‘nummod’), (‘ca’, 5, ‘obj’), (‘mắc’, 7, ‘nmod’), (‘Covid-19’, 8, ‘nummod’)]“`
6. **Gán nhãn thực thể có tên** (Named Entity Recognition)“`>>> from underthesea import ner>>> text = ‘Chưa tiết lộ lịch trình tới Việt Nam của Tổng thống Mỹ Donald Trump’>>> ner(text)[(‘Chưa’, ‘R’, ‘O’, ‘O’), (‘tiết lộ’, ‘V’, ‘B-VP’, ‘O’), (‘lịch trình’, ‘V’, ‘B-VP’, ‘O’), (‘tới’, ‘E’, ‘B-PP’, ‘O’), (‘Việt Nam’, ‘Np’, ‘B-NP’, ‘B-LOC’), (‘của’, ‘E’, ‘B-PP’, ‘O’), (‘Tổng thống’, ‘N’, ‘B-NP’, ‘O’), (‘Mỹ’, ‘Np’, ‘B-NP’, ‘B-LOC’), (‘Donald’, ‘Np’, ‘B-NP’, ‘B-PER’), (‘Trump’, ‘Np’, ‘B-NP’, ‘I-PER’)]“`
7. **Phân loại văn bản**“`>>> from underthesea import classify
>>> classify(‘HLV đầu tiên ở Premier League bị sa thải sau 4 vòng đấu’)[‘The thao’]
>>> classify(‘Hội đồng tư vấn kinh doanh Asean vinh danh giải thưởng quốc tế’)[‘Kinh doanh’]
>> classify(‘Lãi suất từ BIDV rất ưu đãi’, domain=’bank’)[‘INTEREST_RATE’]“`
8. **Phân tích cảm xúc**“`>>> from underthesea import sentiment
>>> sentiment(‘hàng kém chất lg,chăn đắp lên dính lông lá khắp người. thất vọng’)negative>>> sentiment(‘Sản phẩm hơi nhỏ so với tưởng tượng nhưng chất lượng tốt, đóng gói cẩn thận.’)positive
>>> sentiment(‘Đky qua đường link ở bài viết này từ thứ 6 mà giờ chưa thấy ai lhe hết’, domain=’bank’)[‘CUSTOMER_SUPPORT#negative’]>>> sentiment(‘Xem lại vẫn thấy xúc động và tự hào về BIDV của mình’, domain=’bank’)[‘TRADEMARK#positive’]“`
9. Tài nguyên NLP tiếng Việt
Danh sách tài nguyên
“`$ underthesea list-data| Name                | Type        | License | Year | Directory                    ||———————+————-+———+——+——————————|| UIT_ABSA_RESTAURANT | Sentiment   | Open    | 2021 | datasets/UIT_ABSA_RESTAURANT || UIT_ABSA_HOTEL      | Sentiment   | Open    | 2021 | datasets/UIT_ABSA_HOTEL      || SE_Vietnamese-UBS   | Sentiment   | Open    | 2020 | datasets/SE_Vietnamese-UBS   || CP_Vietnamese-UNC   | Plaintext   | Open    | 2020 | datasets/CP_Vietnamese-UNC   || DI_Vietnamese-UVD   | Dictionary  | Open    | 2020 | datasets/DI_Vietnamese-UVD   || UTS2017-BANK        | Categorized | Open    | 2017 | datasets/UTS2017-BANK        || VNTQ_SMALL          | Plaintext   | Open    | 2012 | datasets/LTA                 || VNTQ_BIG            | Plaintext   | Open    | 2012 | datasets/LTA                 || VNESES              | Plaintext   | Open    | 2012 | datasets/LTA                 || VNTC                | Categorized | Open    | 2007 | datasets/VNTC                |
$ underthesea list-data –all“`
Download tài nguyên
“`$ underthesea download-data VNTC100%|██████████| 74846806/74846806 [00:09<00:00, 8243779.16B/s]Resource VNTC is downloaded in ~/.underthesea/datasets/VNTC folder“`
### Các tính năng sắp ra mắt– Dịch máy- Chuyển văn bản thành giọng nói- Nhận dạng giọng nói tự động
### **Kết bài**
Với Underthesea, chúng ta có thể dễ dàng cài đặt, sử dụng và tiết kiệm được lượng lớn thời gian thay vì phải gán nhãn bằng tay. Underthesea cũng là thư viện đắc lực hỗ trợ xử lý dữ liệu đầu vào cho rất nhiều bài toán khác. <br>Cảm ơn các bạn đã giành thời gian đọc. <br>Tham khảo: [https://pypi.org/project/underthesea/](https://pypi.org/project/underthesea/)


Posted

in

by

Tags:

Comments

24 responses to “Tổng quan về Underthesea”

  1. トレーダーペカチュウ Avatar

    The principle goal is to supply the finest high quality wines that give the pleasure of a grape selection and its terroir.

  2. 日経平均株価は大発会でいくらでしたか Avatar

    To attain actual reduction in losses of life on both aspect of a battle, diplomacy should keep up with the forward-wanting pace the Army has set with its Future Fight Techniques.

  3. ローツェの株価のレーティングは Avatar

    So buying round — and continuing to shop round as part of your yearly routine — can supply better variations in premium value than you might assume.

  4. ドクターイエロー jr東海 Avatar

    You may get some attention-grabbing answers for a few of them.

  5. スティッチ 意味 Avatar

    Sidney Gilbert Pennells, OBE, Principal, Commonwealth Relations Office.

  6. パレモ 株価 Avatar

    The weight of your hair will pull the curls down and make them into lovely spirals.

  7. 投資信託 移管 楽天 Avatar

    Prince William, Duke of Cambridge, is second in line to the British throne after his father, Prince Charles.

  8. 情報共有 英語 メール Avatar

    Because what is using hundreds of thousands of dollars in your bank account if you do not even understand how to make use of or spend it?

  9. 地層 運搬とは Avatar

    Match the pearl shade the the gown color.

  10. 広島 地下街 Avatar

    Decide your favorite one.

  11. 思す思ふ Avatar

    Get a pet gate and use it to block off the room where the pet food and water bowl is stored.

  12. マッククーポンアプリ Avatar

    Most budgeting software is connected on to your checking account and works essentially like a wise checkbook that routinely balances and suggests methods to avoid wasting cash.

  13. 欠点を なくす Avatar

    Frederick Coutts, Normal of the Salvation Army.

  14. iphonex まだ使える Avatar

    Whereas the researchers lack cryogenically preserved tissue, they have been able to collect pores and skin and bone tissues from museums and zoos.

  15. ニュースジャパン 大島 Avatar

    Among the occasion administration companies of Kolkata are additionally the leading Travel Agent in Kolkata; it helps them to earn some extra income by the travel companies.

  16. 腰椎すべり症 原因 Avatar

    Nature therapy and ecotherapy have proven remarkable therapeutic benefits, providing people with a healing tool to enhance their psychological properly-being.

  17. 国からお金を借りる方法 Avatar

    Have a Storyteller Scavenger Hunt in your individual yard.

  18. 中田島砂丘 営業時間 Avatar

    As a self-proclaimed “shopaholic,” it was quite refreshing to give my cash a “job” with a goal each week, instead of mindlessly spending it on non-necessities.

  19. 相談に乗る 短文 Avatar

    The secret Historical past of Star Wars (3.Zero ed.).

  20. auじぶん銀行 紹介 Avatar

    Investments in NSC could be made by NRIs topic to certain terms and situations.

  21. サンデンリテールシステム 株価 Avatar

    The romantic goth coloration palette typically includes shades of black, wine pink, and midnight blue.

  22. ストックホルム症候群 ラプンツェル Avatar

    FINRA will change column names and the order in which the columns are displayed in the obtain recordsdata.

  23. カバー付き金利平価 Avatar

    Too many things in every single place make a room look cluttered.

  24. 子どものしつけ いつから Avatar

    Commuting employees often discover it difficult to eat breakfast at house or pack a lunch.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: