Skip to main content

Mutamorhpic testing tool for text-based machine learning problems.

Project description

Mutatest

Mutamorphic-test is a python3 package that provides of a two different kinds of word mutators for sentences, meaning that the original sentence will be transformed by this mutators.

How to install it

In order to install the latest version use the python3 installer pip3.

pip3 install mutamorphic-test 

How to use it

In order to use the package we need to import the mutators first with the statement:

from mutatest.mutators import ReplacementMutator,DopoutMutator

Once we have them imported we can use them. We have to create an instance of the classes in order to use them.

We can specify how many words we want them to modify, how many variants of the sentence shall be created and, in the case of the replacement, which strategy shall be used to select the words to be changed.

For the two mutators we need the following parameters (we can also use the default values):

ReplacementMutator(num_replacements: int = 1, num_variants: int = 5, selection_strategy: str = "random")
DropoutMutator(num_dropouts: int = 1, num_variants: int = 1)

Once we have our mutator we can perform mutation on a sentence in the following way:

mutated_sentence=mutator.mutate(sentence,random_seed=42)

A full example of how this package can be used would be the following:

from mutatest.mutators import ReplacementMutator

mutator=ReplacementMutator()
sentence="This is an example sentence"

mutated_sentence=mutator.mutate(sentence,random_seed=42)

print(mutated_sentence)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mutamorphic-test-1.2.1.tar.gz (8.2 kB view details)

Uploaded Source

File details

Details for the file mutamorphic-test-1.2.1.tar.gz.

File metadata

  • Download URL: mutamorphic-test-1.2.1.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for mutamorphic-test-1.2.1.tar.gz
Algorithm Hash digest
SHA256 67aed9e919c2924cc6fa12010329e7589e5b5a59510a908fd79ecf41acbcee7d
MD5 2097fd9bb59096cf651af40128a0b64b
BLAKE2b-256 ba90f7f32fdab3ea959b0b116f96aa9535eabccfb011f59ff61d419b4cc321d9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page