Metric

Metric

class openspeech.metrics.CharacterErrorRate(tokenizer)[source]

Computes the Character Error Rate, defined as the edit distance between the two provided sentences after tokenizing to characters.

metric(s1: str, s2: str) → Tuple[float, int][source]

Computes the Character Error Rate, defined as the edit distance between the two provided sentences after tokenizing to characters.

Args: s1, s2

s1 (string): space-separated sentence s2 (string): space-separated sentence

Returns: dist, length
  • dist: distance between target & y_hat

  • length: length of target sequence

class openspeech.metrics.ErrorRate(tokenizer)[source]

Provides inteface of error rate calcuation.

Note

Do not use this class directly, use one of the sub classes.

class openspeech.metrics.WordErrorRate(tokenizer)[source]

Computes the Word Error Rate, defined as the edit distance between the two provided sentences after tokenizing to words.

metric(s1: str, s2: str) → Tuple[float, int][source]

Computes the Word Error Rate, defined as the edit distance between the two provided sentences after tokenizing to words.

Args: s1, s2

s1 (string): space-separated sentence s2 (string): space-separated sentence

Returns: dist, length
  • dist: distance between target & y_hat

  • length: length of target sequence