Fix checking whether lines were found
This commit is contained in:
@@ -37,8 +37,8 @@ for idx, line in enumerate(lines):
|
||||
continue
|
||||
|
||||
while idx < len(lines) - 1:
|
||||
next_line = lines[idx+1]
|
||||
if len(next_line.strip()) == 0:
|
||||
next_line = lines[idx+1].strip()
|
||||
if len(next_line) == 0:
|
||||
break
|
||||
# Skip wryly lines
|
||||
if next_line.startswith('('):
|
||||
@@ -49,6 +49,7 @@ for idx, line in enumerate(lines):
|
||||
# TODO this is experimental:
|
||||
# Put each part of the line in the map, so we can try to catch partial parts!
|
||||
partials = re.split('|'.join(re_punc_list), next_line)
|
||||
partials = [x for x in filter(lambda s: len(s) > 0, partials)]
|
||||
if len(partials) > 1:
|
||||
for part in partials:
|
||||
part = part.strip()
|
||||
@@ -57,7 +58,8 @@ for idx, line in enumerate(lines):
|
||||
idx += 1
|
||||
|
||||
map = fmap.map
|
||||
print(map)
|
||||
## This is a lot to print!
|
||||
# print(map)
|
||||
|
||||
for audio_filename in audio_filenames:
|
||||
result = None
|
||||
@@ -69,7 +71,6 @@ for audio_filename in audio_filenames:
|
||||
with open(f'{audio_filename}.json', 'w') as f:
|
||||
json.dump(result, f)
|
||||
|
||||
print(result['segments'])
|
||||
for segment in result['segments']:
|
||||
match = fmap.best_match(segment['text'])
|
||||
if match is None: continue
|
||||
|
||||
Reference in New Issue
Block a user