What is this?
baikalnlpy is the python 3 library for baikal NLP.
Baikal NLP is a Korean NLP, which provides tokenizing, POS tagging for Korean.
How to install
pip3 install baikalnlpy
How to get baikal NLP
- Go to https://license.baikal.ai/.
- With registration, for the first time, you can get a free license for 3 months.
- If you are a student or a researcher, you can get also a free license for 1 year, which is able to renew after 1 year.
- Or use docker image.
docker pull baikalai/baikal-nlp:v1.7.3
How to use
import sys
import google.protobuf.text_format as tf
from baikalnlpy import Tagger
# If you have your own localhost baikal NLP.
my_tagger = Tagger('localhost')
# or if you have your own baikal NLP which is running on 10.8.3.211:15656.
my_tagger = Tagger('10.8.3.211', 15656)
# or with smaller public cloud instance, it may be slow. It is free.
tagger = Tagger()
# print results.
res = tagger.tags(["안녕하세요.", "반가워요!"])
# get protobuf message.
m = res.msg()
tf.PrintMessage(m, out=sys.stdout, as_utf8=True)
print(tf.MessageToString(m, as_utf8=True))
print(f'length of sentences is {len(m.sentences)}')
## output : 2
print(f'length of tokens in sentences[0] is {len(m.sentences[0].tokens)}')
print(f'length of morphemes of first token in sentences[0] is {len(m.sentences[0].tokens[0].morphemes)}')
print(f'lemma of first token in sentences[0] is {m.sentences[0].tokens[0].lemma}')
print(f'first morph of first token in sentences[0] is {m.sentences[0].tokens[0].morphemes[0]}')
print(f'tag of first morph of first token in sentences[0] is {m.sentences[0].tokens[0].morphemes[0].tag}')
# print number
# get json object
jo = res.as_json()
print(jo)
# get tuple of pos tagging.
pa = res.pos()
print(pa)
# another methods
ma = res.morphs()
print(ma)
na = res.nouns()
print(na)
va = res.verbs()
print(va)
# custom dictionary
cust_dic = tagger.custom_dict("my")
cust_dic.copy_np_set({'내고유명사', '우리집고유명사'})
cust_dic.copy_cp_set({'코로나19'})
cust_dic.copy_cp_caret_set({'코로나^백신', '"독감^백신'})
cust_dic.update()
# laod prev custom dict
cust_dict2 = tagger.custom_dict("my")
cust_dict2.load()
tagger.set_domain('my')
tagger.pos('코로나19는 언제 끝날까요?')
Metadata
Release files for baikalnlpy 1.1.0
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 |
|---|---|---|---|---|
| baikalnlpy-1.1.0.tar.gz | 10.6 kB | Without provenance | Details for baikalnlpy-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| baikalnlpy-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for baikalnlpy-1.1.0-py3-none-any.whl |
Total release size: 22.2 kB
Release files / baikalnlpy-1.1.0.tar.gz
| Download URL | baikalnlpy-1.1.0.tar.gz |
|---|---|
| Size | 10.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ac65b54945babb25b7562abc0e25017a5eed2c053be8041247e0e1dbdd384144
|
|
BLAKE2b-256 checksum How to use checksums |
01c73f191e7d9647bfbe3d05b3d97f5c6c1e90b30089fc70d49edcda54a5aff6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.7.13 Darwin/21.6.0
|
Release files / baikalnlpy-1.1.0-py3-none-any.whl
| Download URL | baikalnlpy-1.1.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
71aec4938394680e03b278c61d3f78e6137e95fd0cba19d3eb58a4124d205f80
|
|
BLAKE2b-256 checksum How to use checksums |
d29c7baf0bec3dad846ad1535c803a8e0ce2f2fe018e0dcd484f9aeedea825b6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.14 CPython/3.7.13 Darwin/21.6.0
|
Security for baikalnlpy 1.1.0
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.