langcheck.augment.ja#

langcheck.augment.ja.synonym(instances: list[str] | str, *, num_perturbations: int = 1, **kwargs) list[str][source]#

Applies a text perturbation to each string in instances (usually a list of prompts) where some words are replaced with synonyms.

Parameters:
  • instances – A single string or a list of strings to be augmented.

  • num_perturbations – The number of perturbed instances to generate for each string in instances

  • aug_p – Percentage of words with synonymous which will be augmented. Defaults to 0.8.

Returns:

A list of perturbed instances.

Note

This function requires sudachidict_core and sudachipy to be installed in your environment. Please refer to the official instructions to install them.