augly.utils package

Submodules

augly.utils.base_paths module

augly.utils.constants module

augly.utils.constants.EMOJI_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/augly/checkouts/latest/augly/assets/twemojis/smileys/smiling_face_with_heart_eyes.png'

All font assets used in AugLy come from Google Noto fonts: https://www.google.com/get/noto/ Noto is a trademark of Google Inc. Noto fonts are open source. All Noto fonts are published under the SIL Open Font License, Version 1.1

augly.utils.constants.IMG_MASK_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/augly/checkouts/latest/augly/assets/masks/dfdc_mask.png'

All emoji assets used in AugLy come from Twemoji: https://twemoji.twitter.com/ Copyright 2020 Twitter, Inc and other contributors. Code licensed under the MIT License: http://opensource.org/licenses/MIT Graphics licensed under CC-BY 4.0: https://creativecommons.org/licenses/by/4.0/

augly.utils.constants.MISSPELLING_DICTIONARY_PATH = '/home/docs/checkouts/readthedocs.org/user_builds/augly/checkouts/latest/augly/assets/text/misspelling.json'

Text fairness augmentation assets: the feminine & masculine word lists were provided to us by Adina Williams and are the same ones used in Dinan et al., 2020 (https://arxiv.org/pdf/2005.00614.pdf), which aggregated such word lists from Zhao et al., 2018b, 2019 (https://aclanthology.org/D18-1521.pdf) and Hoyle et al., 2019 (https://aclanthology.org/P19-1167.pdf). We constructed the gendered words mapping file from the feminine & masculine word lists for ease of use with the swap_gendered_words augmentation to avoid having to re-compute the mapping

Module contents

class augly.utils.Segment(start, end)

Bases: NamedTuple

end: float

Alias for field number 1

start: float

Alias for field number 0

augly.utils.compute_time_crop_segments(src_segment, dst_segment, speed_factor, crop_start, crop_end, new_src_segments, new_dst_segments)

Calculates how the given matching pair src_segment & dst_segment change given a temporal crop starting at crop_start & ending at crop_end. We can use the same logic here for multiple transforms, by setting the crop_start & crop_end depending on the transform kwargs.

Doesn’t return anything, but appends the new matching segments in the dst video corresponding to the pair passed in to new_src_segments & new_dst_segments, if the segment pair still matches in the dst video. If the passed in segment pair is cropped out as a result of this temporal crop, nothing will be appended to the lists, since the segment pair doesn’t exist in the dst video.

Return type

None

augly.utils.is_audio_file(filename)
Return type

bool

augly.utils.is_image_file(filename)
Return type

bool

augly.utils.is_video_file(filename)
Return type

bool

augly.utils.validate_audio_path(audio_path)
Return type

None

augly.utils.validate_image_path(image_path)
Return type

None

augly.utils.validate_output_path(output_path)
Return type

None

augly.utils.validate_path(file_path)
Return type

None

augly.utils.validate_rgb_color(color)
Return type

None

augly.utils.validate_video_path(video_path)
Return type

None