Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _apply_test_on(self, cases):
for gt, h, correct_measures in cases:
measures = jiwer.compute_measures(truth=gt, hypothesis=h)
self.assertDictAlmostEqual(measures, correct_measures, delta=1e-16)
self._apply_test_on(cases)
ground_truth = [
"i like monthy python",
"what do you mean african or european swallow",
]
hypothesis = ["i like", "python", "what you mean", "or swallow"]
x = jiwer.compute_measures(ground_truth, hypothesis)
# is equivalent to
ground_truth = (
"i like monthy python what do you mean african or european swallow"
)
hypothesis = "i like python what you mean or swallow"
y = jiwer.compute_measures(ground_truth, hypothesis)
self.assertDictAlmostEqual(x, y, delta=1e-9)
),
(
"i am a short ground truth",
"i am a considerably longer and very much incorrect hypothesis",
_m(7 / 6, 0.7, 0.85),
),
]
self._apply_test_on(cases)
ground_truth = [
"i like monthy python",
"what do you mean african or european swallow",
]
hypothesis = ["i like", "python", "what you mean", "or swallow"]
x = jiwer.compute_measures(ground_truth, hypothesis)
# is equivalent to
ground_truth = (
"i like monthy python what do you mean african or european swallow"
)
hypothesis = "i like python what you mean or swallow"
y = jiwer.compute_measures(ground_truth, hypothesis)
self.assertDictAlmostEqual(x, y, delta=1e-9)