-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Forced-Alignment-and-Vowel-Extraction/whi…
…sper-timestamped Migrate to whisper-timestamp
- Loading branch information
Showing
5 changed files
with
72 additions
and
29 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
openai-whisper @ git+https://github.com/openai/whisper.git@b38a1f20f4b23f3f3099af2c3e0ca95627276ddf | ||
whisperx @ git+https://github.com/m-bain/whisperx.git@49e0130e4e0c0d99d60715d76e65a71826a97109 | ||
whisper_timestamped | ||
GPUtil | ||
psutil | ||
textgrid |
1 change: 1 addition & 0 deletions
1
tests/data/TestAudio_SnoopDogg_85SouthMedia_WhisperTimestampSegments.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,44 @@ | ||
import math | ||
import json | ||
import numpy.testing as nptest | ||
import pytest | ||
import textgrid | ||
import warnings | ||
|
||
import formatter | ||
|
||
class TestFormatter(): | ||
Format = formatter.Formatter() | ||
|
||
def test_to_TextGrid(self): | ||
for input_fname, ex_fname in self.provide_to_TextGrid(): | ||
for input_fname, by_phrase in self.provide_to_TextGrid(): | ||
with open(input_fname) as f: | ||
case = json.load(f) | ||
observed = self.Format.to_TextGrid(case) | ||
observed = self.Format.to_TextGrid(case, by_phrase=by_phrase) | ||
|
||
expected = textgrid.TextGrid() | ||
expected.read(ex_fname) | ||
assert observed.maxTime is not None | ||
assert len(observed.tiers) > 0 | ||
|
||
nptest.assert_array_equal(observed,expected) | ||
def test_no_speaker_warning(self): | ||
for input_fname in self.provide_no_speaker_warning(): | ||
with open(input_fname) as f: | ||
case = json.load(f) | ||
with pytest.warns(UserWarning, match="No speaker for segment") as record: | ||
_ = self.Format.to_TextGrid(case, by_phrase=False) | ||
|
||
def provide_to_TextGrid(self): | ||
return [ | ||
( | ||
'tests/data/TestAudio_SnoopDogg_85SouthMedia_segments.json', | ||
'tests/data/TestAudio_SnoopDogg_85SouthMedia.TextGrid' | ||
'tests/data/TestAudio_SnoopDogg_85SouthMedia_WhisperTimestampSegments.json', | ||
True | ||
), | ||
( | ||
'tests/data/TestAudio_SnoopDogg_85SouthMedia_WhisperTimestampSegments.json', | ||
False | ||
), | ||
] | ||
|
||
def provide_no_speaker_warning(self): | ||
return [ | ||
'tests/data/TestAudio_SnoopDogg_85SouthMedia.json', | ||
] |