Textmentations

Latest version: v1.4.0

Safety actively analyzes 702641 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

1.4.0

Breaking Changes
- **Refactor of Augmentation Classes**:
- Refactored several augmentation-related functions for improved structure and readability.

New Functionalities
- **Kiwipiepy Integration**:
- Integrated `kiwipiepy` as a morpheme analyzer to improve morphological analysis capabilities.

Major Changes
- Improved `insert_synonyms` to allow inserting synonyms before target words.
- Converted `get_random_synonym` to `choose_synonym` for clarity.
- Added a `seed` parameter to functions to ensure consistent results when a seed is provided.
- Simplified the seed-fixing mechanism to use `random.random(seed)` for reproducibility.

Minor Changes
- Updated the upper version bound of `albumentations` to 1.4.18.

1.3.2

Bugfixes

- Bugfix in `ContextualInsertion`. Resolved an issue where mask tokens [MASK] were inserted, but no predictions were made to replace them. Now correctly inserts the mask tokens and replaces them with predicted values.

1.3.1

New augmentations

- [ContextualInsertion](https://github.com/Jaesu26/textmentations/blob/v1.3.1/textmentations/augmentations/generation/transforms.py#L67) - Randomly inserts mask tokens in the input text and fills them with language model predictions. (34 by Jaesu26)

- [ContextualReplacement](https://github.com/Jaesu26/textmentations/blob/v1.3.1/textmentations/augmentations/generation/transforms.py#L128) - Randomly replaces words in the input text with mask tokens and fills them with language model predictions. (34 by Jaesu26)

Changes

- Updated the upper version bound of albumentations to 1.4.16.

1.3.0

New augmentations

- [IterativeMaskFilling](https://github.com/Jaesu26/textmentations/blob/v1.3.0/textmentations/augmentations/generation/transforms.py#L67) - Iteratively masks words in a randomly selected sentence and replaces them with language model predictions. (33 by Jaesu26)

Breaking changes

Refactor of Augmentation Classes

- The `BackTranslation` class has been moved from `textmentations/augmentations/transforms.py` to `textmentations/augmentations/generation/transforms.py`.
- All other augmentation classes previously located in `textmentations/augmentations/transforms.py` have been relocated to `textmentations/augmentations/modification/transforms.py`.
- Despite these internal changes, the existing import style remains compatible. You can still use:

python
import textmentations as T
rs = T.RandomSwap()


Dependency Updates

- Added `torch>=2.3.1` as a required dependency.
- Added `transformers>=4.30.0` as a required dependency.


Minor changes

- Added examples to the docstrings of augmentation classes.
- Updated the upper version bound of albumentations to 1.4.15.

1.2.5

Changes

- Deprecated `n_times` in `RandomSwap`, use `alpha` instead. alpha parameter can be float type. If a `float`, it is the number of times to repeat the word-swapping process is calculated as `N = alpha * L`, where `L` is the length of the text.
- Added license, readme, third-party-licenses to the package.

Deprecations

RandomSwap

- Old way:
python
RandomSwap(n_times=3)


- New way:
python
RandomSwap(alpha=3)

1.2.4

Changes

- Speedup in augmentations except for BackTranslation.
- Refactoring type hints to use built-in generic types. This change prepares the codebase for Python 3.9+ compatibility, where the use of built-in generic types is standard.
- Converted lower bound of typing-extension's version to 4.9.0.

Bugfixes

- Bugfix in `BackTranslation`. Now use `deep-translator` package instead of `googletrans` package.

Page 1 of 3

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.