- torchaudio.functional.edit_distance(seq1: Sequence, seq2: Sequence) int [source]¶
Calculate the word level edit (Levenshtein) distance between two sequences.
The function computes an edit distance allowing deletion, insertion and substitution. The result is an integer.
For most applications, the two input sequences should be the same type. If two strings are given, the output is the edit distance between the two strings (character edit distance). If two lists of strings are given, the output is the edit distance between sentences (word edit distance). Users may want to normalize the output by the length of the reference sequence.
seq1 (Sequence) – the first sequence to compare.
seq2 (Sequence) – the second sequence to compare.
The distance between the first and second sequences.
- Return type:
- Tutorials using
ASR Inference with CTC DecoderASR Inference with CTC Decoder