You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
fromtypingimportAnyfrompydanticimport (
BaseModel,
BaseSettings,
Field,
ValidationError,
validator,
)
# TODO: Fix typing for Punctuation rules# TODO: Add validatorsclassSplitByGap(BaseModel):
""" Split (in-place) any segment into multiple segments where the duration in between two words > [max_gap] """max_gap: float=Field(
...,
description="The point between any two words greater than this value (seconds) will be split."
)
lock: bool=Field(
...,
description="Whether to prevent future splits from altering changes made by this function."
)
classSplitByPunctuation(BaseModel):
""" Split (in-place) any segment into multiple segments where the duration in between two words > [max_gap] """punctuation: list[Any] =Field(
...,
description="Punctuation(s) to split segments by."
)
lock: bool=Field(
...,
description="Whether to prevent future splits from altering changes made by this function."
)
classSplitByLength(BaseModel):
""" Split (in-place) any segment into multiple segments where the duration in between two words > [max_gap] """max_chars: int=Field(
...,
description="Maximum number of characters allowed in segment."
)
max_words: int=Field(
...,
description="Maximum number of words allowed in segment."
)
force_len: bool=Field(
...,
description="Maintain a relatively constant length for each segment"
)
lock: bool=Field(
...,
description="Whether to prevent future splits/merges from altering changes made by this function."
)
classMergeByGap(BaseModel):
""" Merge (in-place) any pair of adjacent segments if the duration in between the pair <= [min_gap] """min_gap: float=Field(
...,
description="Any gaps below or equal to this value (seconds) will be merged."
)
max_words: int=Field(
...,
description="Maximum number of words allowed."
)
is_sum_max: bool=Field(
...,
description="Whether [max_words] and [max_chars] are applied to the merged segment ""instead of the individual segments to be merged."
)
lock: bool=Field(
...,
description="Whether to prevent future splits/merges from altering changes made by this function."
)
classMergeByPunctuation(BaseModel):
""" Merge (in-place) any two segments that has specified punctuation(s) inbetween them """punctuation: list[Any] =Field(
...,
description="Punctuation(s) to split segments by."
)
max_chars: int=Field(
...,
description="Maximum number of characters allowed in segment."
)
max_words: int=Field(
...,
description="Maximum number of words allowed."
)
is_sum_max: bool=Field(
...,
description="Whether [max_words] and [max_chars] are applied to the merged segment ""instead of the individual segments to be merged."
)
lock: bool=Field(
...,
description="Whether to prevent future splits/merges from altering changes made by this function."
)
classMergeAllSegments(BaseModel):
""" Merge all segments into one segment. """enabled: bool=Field(
...,
description="Whether to merge all segments into one"
)
# @validator("extension_whitelist", each_item=True)# def check_are_file_extensions(cls, v):# if not v.startswith("."):# raise ValueError(f"{v} is not a valid file extension")# return v
7f47697acfbf85e6fdf9dd38bfde5808b3329a44
The text was updated successfully, but these errors were encountered:
Add validators
def check_are_file_extensions(cls, v):
if not v.startswith("."):
raise ValueError(f"{v} is not a valid file extension")
return v
squawk/squawk/settings/regrouping_rules.py
Line 12 in ccbf1fa
7f47697acfbf85e6fdf9dd38bfde5808b3329a44
The text was updated successfully, but these errors were encountered: