Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion build_mapping_multiuser.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@
"005": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER005/All_clips_19-01-2026"),
],
"006": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER006/user006_output_5-02-2026/clips"),
],
"007": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER007/user007_output_05-02-2026/chopped"),
],
"008": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER008/user008/user_008_06-02-2026/output_user008_06-02-2026"),
],
"009": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER009/User_009_06-02-2026/Clips"),
],
"010": [
Path(r"/mnt/9a528fe4-4fe8-4dff-9a0c-8b1a3cf3d7ba/ISL_DATA_USER010/User010_06-02-2026/Clips"),
],
}

VIDEO_EXTS = {".mp4", ".mpg", ".mov", ".mkv", ".avi", ".webm"}
Expand Down Expand Up @@ -53,9 +68,25 @@ def word_from_collected_filename(filename: str) -> str:
"""
stem = Path(filename).stem.lower()

# remove common prefixes like user001_, u001_, etc.
# remove common prefixes like user001_, u001_
stem = re.sub(r"^(user|u)\d{1,3}[_-]*", "", stem)

# CASE 1: word__session123__clip001 → word
m = re.match(r"([a-z]+)__", stem)
if m:
return m.group(1)

# CASE 2: something_word.mp4 → word (for user007)
m = re.search(r"_([a-z]+)$", stem)
if m:
return m.group(1)

# CASE 3: word__000001.mp4 → word (user009/010)
m = re.match(r"([a-z]+)__", stem)
if m:
return m.group(1)

# CASE 4: fallback → first letters at start
m = re.match(r"([a-z]+)", stem)
return m.group(1) if m else ""

Expand Down