bnaug is a text augmentation tool for Bangla text.
Project description
bnaug (Bangla Text Augmentation)
bnaug is a text augmentation tool for Bangla text.
Installation
pip install bnaug
- Dependencies
- pytorch >=1.7.0
Necessary Model Links
Sentence Augmentation
Token Replacement
-
Mask generation based augmentation
from bnaug.sentence import TokenReplacement tokr = TokenReplacement() text = "আমি ঢাকায় বাস করি।" output = tokr.masking_based(text, sen_n=5)
-
Word2Vec based augmentation
from bnaug.sentence import TokenReplacement tokr = TokenReplacement() text = "আমি ঢাকায় বাস করি।" model = "msc/bangla_word2vec/bnwiki_word2vec.model" output = tokr.word2vec_based(text, model=model, sen_n=5, word_n=5) print(output)
-
Glove based augmentation
from bnaug.sentence import TokenReplacement tokr = TokenReplacement() text = "আমি ঢাকায় বাস করি।" vector = "msc/bn_glove.300d.txt" output = tokr.glove_based(text, vector_path=vector, sen_n=5, word_n=5) print(output)
Back Translation
Back translation based augmentation first translate Bangla sentence to English and then again translate the English to Bangla.
from bnaug.sentence import BackTranslation
bt = BackTranslation()
text = "বাংলা ভাষা আন্দোলন তদানীন্তন পূর্ব পাকিস্তানে সংঘটিত একটি সাংস্কৃতিক ও রাজনৈতিক আন্দোলন। "
output = bt.get_augmented_sentences(text)
print(output)
Text Generation
- Paraphrase generation
from bnaug.sentence import TextGeneration
tg = TextGeneration()
text = "বিমানটি যখন মাটিতে নামার জন্য এয়ারপোর্টের কাছাকাছি আসছে, তখন ল্যান্ডিং গিয়ারের খোপের ঢাকনাটি খুলে যায়।"
output = tg.parapharse_generation(text)
print(output)
Inspired from
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bnaug-1.0.0.tar.gz
(3.4 kB
view details)
Built Distribution
bnaug-1.0.0-py3-none-any.whl
(4.0 kB
view details)
File details
Details for the file bnaug-1.0.0.tar.gz
.
File metadata
- Download URL: bnaug-1.0.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b58f6381101de0ac493e8957ef0c8d143f2a5fa400990783ad4e3e3da6f18a0 |
|
MD5 | d60933a2fb20d332776a7ea53f99a0e2 |
|
BLAKE2b-256 | ed87d04f5dc49048743e64233565d0572c761bf3da408e627cd8b0c759f42369 |
File details
Details for the file bnaug-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: bnaug-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.7.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 955acf4e80970e46639c7af29d11cb67d551d1062844988492469cb29427c039 |
|
MD5 | 5035745b3929f1f5a364d83a7f099460 |
|
BLAKE2b-256 | 182fe8680e4aad6ee48299b5bee1ceda0b1b036c705cc82204cf79d184a7917a |