Skip to main content

ViNLP

Upload Python Package

All tasks are trained on VLSP2013 and VLSP2016

Installation

To install ViNLP:

$ pip install ViNLP

Tutorials

1. Word Segmentation

Usage

>>> from ViNLP import word_tokenize
>>> sentence = 'Hà Nội test nhanh SARS-CoV-2 cho hành khách từ TP.HCM đến sân bay Nội Bài'

>>> word_tokenize(sentence)
['Hà_Nội', 'test', 'nhanh', 'SARS-CoV-2', 'cho', 'hành_khách', 'từ', 'TP.HCM', 'đến', 'sân_bay', 'Nội_Bài']

2. Sentence Segmentation

Usage

>>> from ViNLP import sent_tokenize
>>> sentences = 'Trung tâm Y tế TP Thủ Đức cho hay trước đó khi xác định được các trường hợp F0 tại công ty nói trên, các F1, F2 đã được cách ly theo quy định. Nhà xưởng nơi phát hiện ca F0 tạm thời đóng cửa. Ngày 9-7, ngành y tế tiếp tục lấy mẫu xét nghiệm tại công ty để truy tìm các ca dương tính.'

>>> sent_tokenize(sentence)
['Trung tâm Y tế TP Thủ Đức cho hay trước đó khi xác định được các trường hợp F0 tại công ty nói trên , các F1 , F2 đã được cách ly theo quy định .',
'Nhà xưởng nơi phát hiện ca F0 tạm thời đóng cửa .',
'Ngày 9-7 , ngành y tế tiếp tục lấy mẫu xét nghiệm tại công ty để truy tìm các ca dương tính .']

3. POS Tagging

Usage

>>> from ViNLP import pos_tag
>>> sentence = 'Bộ Y tế công bố kế hoạch phân bổ vaccine COVID-19 đợt 5, TP.HCM nhiều nhất'
>>> pos_tag(sentence)
[('Bộ', 'N'),
 ('Y_tế', 'N'),
 ('công_bố', 'V'),
 ('kế_hoạch', 'N'),
 ('phân_bổ', 'V'),
 ('vaccine', 'N'),
 ('COVID-19', 'V'),
 ('đợt', 'N'),
 ('5', 'M'),
 (',', 'CH'),
 ('TP.HCM', 'Ny'),
 ('nhiều', 'A'),
 ('nhất', 'R')]

4. Chunking

Usage

>>> from ViNLP import chunk
>>> sentence = 'Tổng thống Nga Putin tuyên bố sẵn sàng tiếp tục đối thoại với Mỹ'
>>> chunk(sentence)
[('Tổng_thống', 'N', 'B-NP'),
 ('Nga', 'Np', 'B-NP'),
 ('Putin', 'Np', 'I-NP'),
 ('tuyên_bố', 'V', 'B-VP'),
 ('sẵn_sàng', 'A', 'B-AP'),
 ('tiếp_tục', 'V', 'B-VP'),
 ('đối_thoại', 'V', 'B-VP'),
 ('với', 'E', 'B-PP'),
 ('Mỹ', 'Np', 'B-NP')]

5. Named Entity Recognition

Usage

>>> from ViNLP import ner
>>> sentence = 'Hậu thượng đỉnh, Tổng thống Putin nói ông Biden khác xa truyền thông miêu tả'
>>> ner(sentence)
[('Hậu', 'N', 'B-NP', 'O'),
 ('thượng_đỉnh', 'N', 'B-NP', 'O'),
 (',', 'CH', 'O', 'O'),
 ('Tổng_thống', 'N', 'B-NP', 'O'),
 ('Putin', 'Np', 'B-NP', 'B-PER'),
 ('nói', 'V', 'B-VP', 'O'),
 ('ông', 'Nc', 'B-NP', 'O'),
 ('Biden', 'Np', 'B-NP', 'B-PER'),
 ('khác', 'A', 'B-AP', 'O'),
 ('xa', 'A', 'B-AP', 'O'),
 ('truyền_thông', 'N', 'B-NP', 'O'),
 ('miêu_tả', 'V', 'B-VP', 'O')]

Metadata

Release files for ViNLP 1.2.106

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ViNLP 1.2.106
File Size Uploaded
ViNLP-1.2.106.tar.gz 4.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for ViNLP 1.2.106
File Interpreter ABI Platform
ViNLP-1.2.106-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 MB

Release files / ViNLP-1.2.106.tar.gz

Download URL ViNLP-1.2.106.tar.gz
Size 4.2 MB
Tags Source
SHA-256 checksum
How to use checksums
d4f755557f8078d5b1a94ece45a00531c967b18e6d42391648a68f075346d572
BLAKE2b-256 checksum
How to use checksums
ff58900ca67c8998038e9a4ed75dcf331a60dde36de89341fcb54d5a0722e7f9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / ViNLP-1.2.106-py3-none-any.whl

Download URL ViNLP-1.2.106-py3-none-any.whl
Size 4.2 MB
Tags Python 3
SHA-256 checksum
How to use checksums
30b8d14ac2dc559aa43af9014920f795ace3a1f32d0aaf42d0d54ddb2342ec53
BLAKE2b-256 checksum
How to use checksums
8cc82d59767d76576c39d2ce90733b31ceff248620d13e9a6eca2b289ef89a24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

1.2.106 This release

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page