KoEDA
Easy Data Augmentation for Korean
This is a project that re-implemented Easy data augmentation and A Easier Data Augmentation, which were implemented for English, to fit Korean.
Prerequisites
- python >= 3.7
Installation
This repository is tested on Python 3.7 - 3.9.
KoEDA can be installed using pip as follows:
$ pip install koeda
Quick Start
- EDA
from koeda import EDA
eda = EDA(
morpheme_analyzer="Okt", alpha_sr=0.3, alpha_ri=0.3, alpha_rs=0.3, prob_rd=0.3
)
text = "아버지가 방에 들어가신다"
result = eda(text)
print(result)
# 아버지가 정실에 들어가신다
result = eda(text, p=(0.9, 0.9, 0.9, 0.9), repetition=2)
print(result)
# ['아버지가 객실 아빠 안방 방에 정실 들어가신다', '아버지가 탈의실 방 휴게실 에 안방 탈의실 들어가신다']
- AEDA
from koeda import AEDA
aeda = AEDA(
morpheme_analyzer="Okt", punc_ratio=0.3, punctuations=[".", ",", "!", "?", ";", ":"]
)
text = "어머니가 집을 나가신다"
result = aeda(text)
print(result)
# 어머니가 ! 집을 , 나가신다
result = aeda(text, p=0.9, repetition=2)
print(result)
# ['! 어머니가 ! 집 ; 을 ? 나가신다', '. 어머니 ? 가 . 집 , 을 , 나가신다']
Augmenters
- EasyDataAugmentation (EDA)
- AEasierDataAugmentation (AEDA)
- RandomDeletion (RD)
- RandomInsertion (RI)
- SynonymReplacement (SR)
- RandomSwap (RS)
There are two ways to load Augmenter.
The first is to use the full name.
from koeda import EasyDataAugmentation
The second is to use abbreviations.
from koeda import EDA
Usage
- EDA
augmenter = EDA(
morpheme_analyzer: str = None, # Default = "Okt"
alpha_sr: float = 0.1,
alpha_ri: float = 0.1,
alpha_rs: float = 0.1,
prob_rd: float = 0.1
)
result = augmenter(
data: Union[List[str], str],
p: List[float] = None, # Default = (0.1, 0.1, 0.1, 0.1)
repetition: int = 1
)
- AEDA
augmenter = AEDA(
morpheme_analyzer: str = None, # Default = "Okt"
punc_ratio: float = 0.3,
punctuations: List[str] = None # default = ('.', ',', '!', '?', ';', ':')
)
result = augmenter(
data: Union[List[str], str],
p: float = None, # Default = 0.3
repetition: int = 1
)
- The others (RD, RI, SR, RS)
augmenter = RD(
morpheme_analyzer: str = None,
)
augmenter = RI(
morpheme_analyzer: str = None,
stopword: bool = False
)
augmenter = SR(
morpheme_analyzer: str = None,
stopword: bool = False
)
augmenter = RS(
morpheme_analyzer: str = None,
)
result = augmenter(
data: Union[List[str], str],
p: float = 0.1,
repetition: int = 1
)
Reference
Easy Data Augmentation Paper
Easy Data Augmentation Repository
A Easier Data Augmentation Paper
A Easier Data Augmentation Repository
Korean WordNet
Metadata
Release files for koeda 0.0.4
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 |
|---|---|---|---|---|
| koeda-0.0.4.tar.gz | 546.0 kB | Without provenance | Details for koeda-0.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| koeda-0.0.4-py3-none-any.whl | Python 3 | none | any | Details for koeda-0.0.4-py3-none-any.whl |
Total release size: 1.1 MB
Release files / koeda-0.0.4.tar.gz
| Download URL | koeda-0.0.4.tar.gz |
|---|---|
| Size | 546.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a72e181deeaef54d3f73470839342e08a35914cec6be0f20bb43fe9900a88c16
|
|
BLAKE2b-256 checksum How to use checksums |
67accc078d92456599b20ec106ab68ebdd2de84f469e84ccd448e837815e9e2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
|
Release files / koeda-0.0.4-py3-none-any.whl
| Download URL | koeda-0.0.4-py3-none-any.whl |
|---|---|
| Size | 566.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
caee83576637a8e4fb79226e5936037b02ff9282089ae9d6f74e7a286568b474
|
|
BLAKE2b-256 checksum How to use checksums |
db4ccb7daad97e1e2a06b082cea42e93eb106374e439fd2c0e7d817fd0ff5ef3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.6
|
Security for koeda 0.0.4
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.