Elron commited on
Commit
eacb42c
1 Parent(s): 527a33e

Upload split_utils.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. split_utils.py +2 -2
split_utils.py CHANGED
@@ -31,12 +31,12 @@ def parse_random_mix_string(input_str):
31
  {'dale': 0.9, 'oren': 0.7, 'mike': 1.0}
32
  """
33
  if not re.fullmatch(
34
- r"(([a-zA-Z]+\[\d*\.?\d*%?\]|[a-zA-Z]+)\+)*([a-zA-Z]+\[\d*\.?\d*%?\]|[a-zA-Z]+)",
35
  input_str,
36
  ):
37
  raise ValueError(f"Invalid input format for split '{input_str}'")
38
 
39
- pattern = re.compile(r"([a-zA-Z]+)(\[\d*\.?\d*%?\])?")
40
  matches = pattern.findall(input_str)
41
 
42
  return {
 
31
  {'dale': 0.9, 'oren': 0.7, 'mike': 1.0}
32
  """
33
  if not re.fullmatch(
34
+ r"((\w+\[\d*\.?\d*%?\]|\w+)\+)*(\w+\[\d*\.?\d*%?\]|\w+)",
35
  input_str,
36
  ):
37
  raise ValueError(f"Invalid input format for split '{input_str}'")
38
 
39
+ pattern = re.compile(r"(\w+)(\[\d*\.?\d*%?\])?")
40
  matches = pattern.findall(input_str)
41
 
42
  return {