Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, zone=(0.2, 0.8), coverage=1.,
color='white', noises=None, name='Noise_Aug', noise_factor=0.01, verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if noise_factor != 0.01:
print(WarningMessage.DEPRECATED.format('noise_factor', '0.0.12', ''))
self.model = self.get_model(zone, coverage, color, noises)
def __init__(self, zone=(0.2, 0.8), coverage=1., duration=None,
factor=(0.5, 2),
speed_range=(0.5, 2), name='Speed_Aug', verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if speed_range != (0.5, 2):
print(WarningMessage.DEPRECATED.format('speed_range', '0.0.12', 'factor'))
factor = speed_range
self.model = self.get_model(zone, coverage, duration, factor)
def __init__(self, sampling_rate=None, zone=(0.2, 0.8), coverage=1.,
duration=(0.2, 0.8),
mask_range=(0.2, 0.8), mask_factor=2, mask_with_noise=True,
name='Mask_Aug', verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if mask_range != (0.2, 0.8):
print(WarningMessage.DEPRECATED.format('mask_range', '0.0.12', 'zone'))
zone = mask_range
if mask_factor != 2:
print(WarningMessage.DEPRECATED.format('mask_factor', '0.0.12', 'duration'))
duration = mask_factor
self.model = self.get_model(sampling_rate, zone, coverage, duration, mask_with_noise)
def __init__(self, sampling_rate, zone=(0.2, 0.8), coverage=1., duration=None,
factor=(-10, 10), pitch_range=(-10, 10), name='Pitch_Aug', verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if pitch_range != (-10, 10):
print(WarningMessage.DEPRECATED.format('pitch_range', '0.0.12', 'factor'))
factor = pitch_range
self.model = self.get_model(sampling_rate, zone, coverage, duration, factor)
def __init__(self, model_path='.', action=Action.SUBSTITUTE,
name='TfIdf_Aug', aug_min=1, aug_max=10, aug_p=0.3, top_k=5, aug_n=None, stopwords=None,
tokenizer=None, reverse_tokenizer=None, verbose=0):
super().__init__(
action=action, name=name, aug_p=aug_p, aug_min=aug_min, aug_max=aug_max, stopwords=stopwords,
tokenizer=tokenizer, reverse_tokenizer=reverse_tokenizer, device='cpu', verbose=verbose)
self.model_path = model_path
self.top_k = top_k
if aug_n is not None:
print(WarningMessage.DEPRECATED.format('aug_n', '0.11.0', 'top_k'))
self.top_k = aug_n
self.model = self.get_model(force_reload=False)
def __init__(self, sampling_rate=None, zone=(0.2, 0.8), coverage=0.1, duration=None,
crop_range=(0.2, 0.8), crop_factor=2, name='Crop_Aug', verbose=0):
super().__init__(
action=Action.DELETE, name=name, device='cpu', verbose=verbose)
self.model = self.get_model(sampling_rate, zone, coverage, duration)
if crop_range != (0.2, 0.8):
print(WarningMessage.DEPRECATED.format('crop_range', '0.0.12', 'zone'))
if crop_factor != 2:
print(WarningMessage.DEPRECATED.format('crop_factor', '0.0.12', 'temperature'))
def __init__(self, sampling_rate, duration=3, direction='random',
shift_max=3, shift_direction='both',
name='Shift_Aug', verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if shift_direction != 'both':
print(WarningMessage.DEPRECATED.format('shift_direction', '0.0.12', 'direction'))
direction = shift_direction
if shift_max != 3:
print(WarningMessage.DEPRECATED.format('shift_max', '0.0.12', 'duration'))
duration = shift_max
self.model = self.get_model(sampling_rate, duration, direction)
def __init__(self, sampling_rate=None, zone=(0.2, 0.8), coverage=1.,
duration=(0.2, 0.8),
mask_range=(0.2, 0.8), mask_factor=2, mask_with_noise=True,
name='Mask_Aug', verbose=0):
super().__init__(
action=Action.SUBSTITUTE, name=name, device='cpu', verbose=verbose)
if mask_range != (0.2, 0.8):
print(WarningMessage.DEPRECATED.format('mask_range', '0.0.12', 'zone'))
zone = mask_range
if mask_factor != 2:
print(WarningMessage.DEPRECATED.format('mask_factor', '0.0.12', 'duration'))
duration = mask_factor
self.model = self.get_model(sampling_rate, zone, coverage, duration, mask_with_noise)