diff --git a/meeteval/wer/wer/time_constrained.py b/meeteval/wer/wer/time_constrained.py index 7137de25..ecb0960d 100644 --- a/meeteval/wer/wer/time_constrained.py +++ b/meeteval/wer/wer/time_constrained.py @@ -367,7 +367,7 @@ def get_pseudo_word_level_timings(t: SegLST, strategy: str) -> SegLST: - `'none`' or `None`: Do not estimate word-level timings but assume that the provided timings are already given on a word level. - >>> from IPython.lib.pretty import pprint + >>> from paderbox.utils.pretty import pprint >>> from meeteval.io.seglst import SegLST >>> s = SegLST([{'words': 'abc b', 'start_time': 0, 'end_time': 4}, {'words': 'c d e f', 'start_time': 4, 'end_time': 8}]) >>> pprint(get_pseudo_word_level_timings(s, 'full_segment')) @@ -499,18 +499,28 @@ def sort_and_validate(segments: SegLST, sort, pseudo_word_level_timing, name, wa pseudo_word_level_timing: name: + >>> from paderbox.utils.pretty import pprint >>> segments = SegLST([{'words': 'c d', 'start_time': 1, 'end_time': 3}, {'words': 'a b', 'start_time': 0, 'end_time': 3}]) >>> sort_and_validate(segments, True, 'character_based', 'test') Traceback (most recent call last): ... ValueError: The order of word-level timings contradicts the segment-level order in test: 2 of 4 times. Consider setting sort to False or "segment" or "word". - >>> sort_and_validate(segments, False, 'character_based', 'test') - SegLST(segments=[{'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}, {'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}]) - >>> sort_and_validate(segments, 'segment', 'character_based', 'test') - SegLST(segments=[{'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}, {'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}]) - >>> sort_and_validate(segments, 'word', 'character_based', 'test') - SegLST(segments=[{'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, {'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}, {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}]) + >>> pprint(sort_and_validate(segments, False, 'character_based', 'test')) + SegLST([{'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, + {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}, + {'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, + {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}]) + >>> pprint(sort_and_validate(segments, 'segment', 'character_based', 'test')) + SegLST([{'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, + {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}, + {'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, + {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}]) + >>> pprint(sort_and_validate(segments, 'word', 'character_based', 'test')) + SegLST([{'words': 'a', 'start_time': 0.0, 'end_time': 1.5}, + {'words': 'c', 'start_time': 1.0, 'end_time': 2.0}, + {'words': 'b', 'start_time': 1.5, 'end_time': 3.0}, + {'words': 'd', 'start_time': 2.0, 'end_time': 3.0}]) """ if sort not in (True, False, 'segment', 'word'): raise ValueError( diff --git a/setup.py b/setup.py index b8de181f..044638e4 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ 'hypothesis', 'coverage', 'pytest-cov', - 'ipython', # IPython.lib.pretty.pprint + 'paderbox', # paderbox.utils.pretty.pprint *extras_require['cli'], ] extras_require['all'] = [ @@ -118,6 +118,7 @@ packages=find_packages(exclude=['contrib', 'docs', 'tests*']), install_requires=[ 'kaldialign', + 'numpy', 'scipy', # scipy.optimize.linear_sum_assignment "typing_extensions; python_version<'3.8'", # Missing Literal in py37 "cached_property; python_version<'3.8'", # Missing functools.cached_property in py37