ViNLP
All tasks are trained on VLSP2013 and VLSP2016
Installation
To install ViNLP:
$ pip install ViNLP
Tutorials
- 1. Word Segmentation
- 2. Sentence Segmentation
- 3. POS Tagging
- 4. Chunking
- 5. Named Entity Recognition
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ViNLP-1.2.106.tar.gz | 4.2 MB | Without provenance | Details for ViNLP-1.2.106.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ViNLP-1.2.106-py3-none-any.whl | Python 3 | none | any | Details for ViNLP-1.2.106-py3-none-any.whl |
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
|
Security for ViNLP 1.2.106
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.