jiwer icon indicating copy to clipboard operation
jiwer copied to clipboard

[CLI] Allow CER calculation with global alignement

Open lutangar opened this issue 1 year ago • 0 comments

Instead of forbidding the -g flag usage when the --cer option is used, would that make sense to use the cer_contiguous transformation strategy in process_characters instead ?

Something like the following instead of current behavior :

# [...]
    if compute_cer:
          out = jiwer.process_characters(
              reference_sentences,
              hypothesis_sentences,
          )
          if global_alignment:
              out = jiwer.process_characters(
                  reference_sentences,
                  hypothesis_sentences,
                  reference_transform=jiwer.cer_contiguous,
                  hypothesis_transform=jiwer.cer_contiguous,
              )
          else:
              out = jiwer.process_characters(
                  reference_sentences,
                  hypothesis_sentences,
              )
# [...]

lutangar avatar Apr 29 '24 09:04 lutangar