Last active
November 26, 2023 10:55
-
-
Save LewisGet/18f3184482a8331879eb6c6148472bf1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import os | |
files = glob.glob("kit-wav2vec2-label-16k/*.wav") | |
files_mapping = [] | |
for name in files: | |
_name = name.split(os.sep) | |
_sources, name = _name[len(_name) - 1].split("__") | |
sources = [] | |
is_negative = False | |
for v in _sources.split("-"): | |
if v == "": | |
is_negative = True | |
continue | |
if is_negative: | |
sources.append(float(v) * -1) | |
is_negative = False | |
else: | |
sources.append(float(v)) | |
files_mapping.append([sources, name]) | |
""" | |
a, b = 0.8, 2 | |
c, d = 0.8, 2 | |
e, f = 0.6, 0.5 | |
find(a, b, c, d, e, f) | |
""" | |
def find(a, b, c, d, e, f): | |
if a > b: | |
a, b = b, a | |
if c > d: | |
c, d = d, c | |
if e > f: | |
e, f = f, e | |
match_list = [] | |
for mapping in files_mapping: | |
if mapping[0][0] > a and mapping[0][0] < b: | |
if mapping[0][1] > c and mapping[0][1] < d: | |
if mapping[0][2] > e and mapping[0][2] < f: | |
match_list.append(mapping) | |
return match_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment