jiwer icon indicating copy to clipboard operation
jiwer copied to clipboard

Add option to split alignment output based on maximum character length

Open gerazov opened this issue 2 months ago • 0 comments

This would be useful for looking at alignments of long sentences, e.g.:

    out = jiwer.process_words(
        "This is a very long sentence that is much longer than the previous one or the one before that",
        "This is a very loong sentence that is not much longer than the previous one or one before that",
        )

    print(jiwer.visualize_alignment(out, max_chars=80))

Would output:

sentence 1
REF: This is a very  long sentence that is *** much longer than the previous one
HYP: This is a very loong sentence that is not much longer than the previous one
                        S                    I

REF: or the one before that
HYP: or *** one before that
          D

gerazov avatar May 06 '24 14:05 gerazov