Skip to content

Commit

Permalink
Remove option for different initializations for greedy ORC WER
Browse files Browse the repository at this point in the history
  • Loading branch information
thequilo committed Aug 26, 2024
1 parent 6998d7d commit ee533dd
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 25 deletions.
13 changes: 0 additions & 13 deletions meeteval/wer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ def greedy_orcwer(
regex=None,
reference_sort='segment_if_available',
hypothesis_sort='segment_if_available',
assignment_initialization='cp',
uem=None,
partial=False,
normalizer=None,
Expand All @@ -203,7 +202,6 @@ def greedy_orcwer(
uem=uem,
partial=partial,
normalizer=normalizer,
assignment_initialization=assignment_initialization,
)
_save_results(results, hypothesis, per_reco_out, average_out)

Expand Down Expand Up @@ -551,17 +549,6 @@ def add_argument(self, command_parser, name, p):
'- lower,rm(.?!,): Lowercase the transcript and remove punctuations (.,?!).',
choices=[None, 'lower,rm(.?!,)'],
)
elif name == 'assignment_initialization':
command_parser.add_argument(
'--assignment-initialization',
choices=['cp', 'random', 'constant'],
help='Specifies how the greedy search should be initialized.\n'
'Choices:\n'
'- cp: Use the assignment from the cpWER. Ensures fast convergence when the speaker labels '
'are already somewhat correct. Requires speaker/stream labels in both, reference and hypothesis.\n'
'- random: Initializes the assignment randomly. This is not deterministic.\n'
'- constant: Initializes the label for all segments to 0.'
)
elif name == 'partial':
command_parser.add_argument(
'--partial',
Expand Down
2 changes: 0 additions & 2 deletions meeteval/wer/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ def greedy_orcwer(
regex=None,
reference_sort='segment_if_available',
hypothesis_sort='segment_if_available',
assignment_initialization='cp',
uem=None,
partial=False,
normalizer=None,
Expand All @@ -142,7 +141,6 @@ def greedy_orcwer(
reference, hypothesis, partial=partial,
reference_sort=reference_sort,
hypothesis_sort=hypothesis_sort,
assignment_initialization=assignment_initialization,
)
return results

Expand Down
6 changes: 1 addition & 5 deletions meeteval/wer/wer/orc.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,6 @@ def greedy_orc_word_error_rate(
hypothesis: 'SegLST',
reference_sort='segment_if_available',
hypothesis_sort='segment_if_available',
*,
assignment_initialization='cp',
):
"""
# All correct on a single channel
Expand Down Expand Up @@ -355,7 +353,7 @@ def matching(reference, hypothesis):
distance, assignment = greedy_combination_matching(
reference.T['words'],
[[w for words in stream.T['words'] for w in words] for stream in hypothesis.values()],
initial_assignment=initialize_assignment(reference, hypothesis, initialization=assignment_initialization),
initial_assignment=initialize_assignment(reference, hypothesis, initialization='cp'),
)
return distance, assignment

Expand Down Expand Up @@ -394,7 +392,6 @@ def greedy_orc_word_error_rate_multifile(
partial=False,
reference_sort='segment_if_available',
hypothesis_sort='segment_if_available',
assignment_initialization='cp',
) -> 'dict[str, OrcErrorRate]':
"""
Computes the ORC WER for each example in the reference and hypothesis files.
Expand All @@ -408,7 +405,6 @@ def greedy_orc_word_error_rate_multifile(
greedy_orc_word_error_rate,
reference_sort=reference_sort,
hypothesis_sort=hypothesis_sort,
assignment_initialization=assignment_initialization,
), reference, hypothesis,
partial=partial
)
5 changes: 0 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,6 @@ def test_burn_greedy_orc():
# Test sort option. Only test the ones that are available for ORC
run('python -m meeteval.wer greedy_orcwer -h hyp.stm -r ref.stm --reference-sort "segment" --hypothesis-sort "false"')

# Test assignment initialization
run(f'meeteval-wer greedy_orcwer -h hyp.stm -r ref.stm --assignment-initialization random')
run(f'meeteval-wer greedy_orcwer -h hyp.stm -r ref.stm --assignment-initialization constant')



def test_burn_mimo():
run(f'python -m meeteval.wer mimower -h hyp.stm -r ref.stm')
Expand Down

0 comments on commit ee533dd

Please sign in to comment.