Documentation
Our WebsiteOur Github
  • 👋Welcome to Infinitode Documentation
  • AI Documentation
  • API Documentation
    • Basic Math API Documentation (#Experimental)
    • BMI Calculator API Documentation
    • Character Counter API Documentation
    • Chemical Equation Balancer API Documentation
    • Color Generator API Documentation
    • Date Difference Calculator API Documentation
    • Dungen API Documentation
    • Dungen Dev API Documentation
    • Factorial Calculator API Documentation
    • Fantasy Name Generator API Documentation
    • Fibonacci Sequence Generator API Documentation
    • GCD Calculator API Documentation
    • Hash API Documentation
    • Helix PSA API Documentation
    • LCM Calculator API Documentation
    • Leap Year Checker API Documentation
    • Lorem API Documentation
    • Molar Mass Calculator API Documentation (#Experimental)
    • MycoNom API Documentation
    • Name Generator API Documentation
    • Palindrome Checker API Documentation
    • Password Generator API Documentation
    • Password Strength Detector API Documentation
    • Periodic Table API Documentation
    • Prime Number Checker API Documentation
    • Quadratic Equation Solver API Documentation
    • Random Facts Generator API Documentation
    • Random Quotes Generator API Documentation
    • Roman Numeral Converter API Documentation
    • Simple Interest Calculator API Documentation
    • Slugify API Documentation
    • Text Case Converter API Documentation
    • Unit Converter API Documentation
    • Username Generator API Documentation
    • UUID Generator API Documentation
    • Vowel Counter API Documentation
  • Package Documentation
    • BlurJS Package Documentation
      • BlurJS Usage Examples
      • BlurJS Reference Documentation
    • CodeSafe Package Documentation
      • CodeSafe Reference
        • CodeSafe Functions
    • DeepDefend Package Documentation
      • DeepDefend Reference
        • Attacks Functions
        • Defenses Functions
    • DupliPy Package Documentation
      • DupliPy Reference
        • Formatting Functions
        • Replication Functions
        • Similarity Functions
        • Text Analysis Functions
    • FuncProfiler Package Documentation
      • FuncProfiler Reference
        • FuncProfiler Functions
    • Hued Package Documentation
      • Hued Reference
        • Analysis Functions
        • Colors Functions
        • Conversions Functions
        • Palettes Functions
    • LocalSiteMap Package Documentation
      • LocalSiteMap Reference
        • LocalSiteMap Functions
    • PyAutoPlot Package Documentation
      • PyAutoPlot Reference
        • PyAutoPlot Functions
    • PyWebScrapr Package Documentation
      • PyWebScrapr Reference
        • PyWebScrapr Functions
    • ValX Package Documentation
      • ValX Reference
        • ValX Functions
Powered by GitBook
On this page
  • Replace word with synonym
  • Augment text with synonyms
  • Load text file
  • Augment file with synonyms
  • Insert random word
  • Delete random word
  • Insert synonym
  • Paraphrase
  • Flip horizontal
  • Flip vertical
  • Rotate
  • Random rotation
  • Resize
  • Crop
  • Random crop
  • Shuffle words
  • Random flip
  • Random color jitter
  • Noise overlay

Was this helpful?

  1. Package Documentation
  2. DupliPy Package Documentation
  3. DupliPy Reference

Replication Functions

PreviousFormatting FunctionsNextSimilarity Functions

Last updated 4 months ago

Was this helpful?

Available functions:

  • (word): Replace the given word with a synonym.

  • (text, augmentation_factor, probability, progress=True): Augment the input text by replacing words with synonyms.

  • (filepath): Load the contents of a text file.

  • (file_path, augmentation_factor, probability, progress=True): Augment a text file by replacing words with synonyms.

  • (text, word): Insert a random word into the input text.

  • (text): Delete a random word from the input text.

  • (text, word): Insert a synonym of the given word into the input text.

  • (text): Paraphrase the input text.

  • (image): Flip the input image horizontally.

  • (image): Flip the input image vertically.

  • (image, angle): Rotate the input image by a specified angle.

  • (image, max_angle): Randomly rotate the input image by an angle within the specified range.

  • (image, size): Resize the input image to the specified size.

  • (image, box): Crop the input image to the specified rectangular region.

  • (image, size): Randomly crop a region from the input image.

  • (text): Randomly shuffle the order of words in each sentence.

  • (image, horizontal, vertical): Randomly flip the input image horizontally and/or vertically.

  • (image, brightness, contrast, saturation, hue): Randomly adjust the brightness, contrast, saturation, and hue of the input image.

  • (image, noise_factor, noise_type, grain_factor): Overlay noise on the input image.


Replace word with synonym

Replace the given word with a synonym.

Params:
- `word` (str): The input word to replace with a synonym.

Returns:
- `str`: The synonym for the word.

Augment text with synonyms

Augment the input text by replacing words with synonyms.

Parameters:
- `text` (str): The input text to be augmented.
- `augmentation_factor` (int): The number of times to augment the text.
- `probability` (float): The probability of replacing a random word with a synonym.
- `progress` (bool): Whether or not to return current progress during augmentation.

Returns:
- `list`: A list of augmented text.

Load text file

Load the contents of a text file.

Parameters:
- `file_path` (str): The path to the target input data.

Returns:
- `str`: The read text from the file.

Augment file with synonyms

Augment a text file by replacing words with synonyms.

Parameters:
- `file_path` (str): The path to the target input data.
- `augmentation_factor` (int): The number of times to augment the data.
- `probability` (float): The probability of replacing a random word with its synonym.
- `progress` (bool): Whether or not to print the current progress during augmentation.

Returns:
- `list`: A list of augmented text.

Insert random word

Insert a random word into the input text.

Parameters:
- `text` (str): The input text for word insertion.
- `word` (str): The word to be inserted into the text.

Returns:
- `str`: The text with the randomly inserted word.

Delete random word

Delete a random word from the input text.

Parameters:
- `text` (str): The input text for word deletion.

Returns:
- `str`: The text with a randomly deleted word.

Insert synonym

Insert a synonym of the given word into the input text.

Parameters:
- `text` (str): The input text for synonym insertion.
- `word` (str): The word for which a synonym will be inserted.

Returns:
- `str`: The text with a synonym of the word inserted.

Paraphrase

Paraphrase the input text.

Parameters:
- `text` (str): The input text to be paraphrased.

Returns:
- `str`: The paraphrased text.

Flip horizontal

Flip the input image horizontally.

Parameters:
- `image` (PIL.Image.Image): The input image to be flipped.

Returns:
- `PIL.Image.Image`: The horizontally flipped image.

Flip vertical

Flip the input image vertically.

Parameters:
- `image` (PIL.Image.Image): The input image to be flipped.

Returns:
- `PIL.Image.Image`: The vertically flipped image.

Rotate

Rotate the input image by a specified angle.

Parameters:
- `image` (PIL.Image.Image): The input image to be rotated.
- `angle` (float): The angle of rotation in degrees.

Returns:
- `PIL.Image.Image`: The rotated image.

Random rotation

Randomly rotate the input image by an angle within the specified range.

Parameters:
- `image` (PIL.Image.Image): The input image to be randomly rotated.
- `max_angle` (float, optional): The maximum absolute angle of rotation in degrees. Default is 30.

Returns:
- `PIL.Image.Image`: The randomly rotated image.

Resize

Resize the input image to the specified size.

Parameters:
- `image` (PIL.Image.Image): The input image to be resized.
- `size` (tuple): The new size in the format (width, height).

Returns:
- `PIL.Image.Image`: The resized image.

Crop

Crop the input image to the specified rectangular region.

Parameters:
- `image` (PIL.Image.Image): The input image to be cropped.
- `box` (tuple): A tuple (left, upper, right, lower) specifying the region to crop.

Returns:
- `PIL.Image.Image`: The cropped image.

Random crop

Randomly crop a region from the input image.

Parameters:
- `image` (PIL.Image.Image): The input image from which to extract the random crop.
- `size` (tuple): The size of the output crop in the format (width, height).

Returns:
- `PIL.Image.Image`: The randomly cropped image region.

Shuffle words

This function takes a list of sentences and randomly shuffles the order of words in each sentence, creating variations for text augmentation or diversity.

Parameters:
- `text` (list of str): List of sentences where each sentence's words needs to be shuffled.

Returns:
- `list of str`: List of sentences with randomly shuffled words.

Random flip

This function randomly flips an input image horizontally, vertically, or even both.

Parameters:
- `image` (PIL.Image.Image): The input image to be flipped.
- `horizontal` (bool): Whether to flip the image horizontally.
- `vertical` (bool): Whether to flip the image vertically.

Returns:
- `PIL.Image.Image`: The randomly flipped image.

Random color jitter

This function takes an input image and randomly adjusts the brightness, contrast, saturation, and hue.

Parameters:
- `image` (PIL.Image.Image): The input image to be color-jittered.
- `brightness` (float): The maximum factor to adjust brightness.
- `contrast` (float): The maximum factor to adjust contrast.
- `saturation` (float): The maximum factor to adjust saturation.
- `hue` (float): The maximum factor to adjust hue.

Returns:
- `PIL.Image.Image`: The color-jittered image.

Noise overlay

This function overlays noise onto the input image.

Parameters:
- `image` (PIL.Image.Image): The input image to overlay noise on.
- `noise_factor` (float): The factor to control the intensity of the noise (0.0 to 1.0).
- `noise_type` (str): The type of noise to overlay ("gaussian", "salt_and_pepper"). Defaults to "gaussian".
    - `grain_factor` (float): The factor to control the graininess of the noise (0.0 to 1.0). Defaults to 0.0.

Returns:
- `PIL.Image.Image`: The image with overlaid noise.
replace_word_with_synonym
augment_text_with_synonyms
load_text_file
augment_file_with_synonyms
insert_random_word
delete_random_word
insert_synonym
paraphrase
flip_horizontal
flip_vertical
rotate
random_rotation
resize
crop
random_crop
shuffle_words
random_flip
random_color_jitter
noise_overlay