MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / get_prompt_from_filename

Function get_prompt_from_filename

mbench/utils.py:8–30  ·  view source on GitHub ↗

Extract prompt from video filename by removing extensions and special characters Args: filename: Video filename Returns: Extracted prompt string

(filename: str)

Source from the content-addressed store, hash-verified

6
7
8def get_prompt_from_filename(filename: str) -> str:
9 """
10 Extract prompt from video filename by removing extensions and special characters
11
12 Args:
13 filename: Video filename
14
15 Returns:
16 Extracted prompt string
17 """
18 # Remove file extension
19 name = Path(filename).stem
20
21 # Remove common suffixes like "-0", "-1", etc.
22 name = re.sub(r'-\d+$', '', name)
23
24 # Replace underscores and hyphens with spaces
25 name = re.sub(r'[_-]', ' ', name)
26
27 # Clean up multiple spaces
28 name = re.sub(r'\s+', ' ', name).strip()
29
30 return name.lower()
31
32
33def save_json(data: Union[Dict, List], filepath: str) -> None:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected