Download tests/test_speech_evaluation.py from wzender/mathly: direct link, hf CLI and curl.
- Browser
- Download file 918 Bytes
-
https://huggingface.co/spaces/wzender/mathly/resolve/main/tests/test_speech_evaluation.py
- Command line
-
hf download hf://spaces/wzender/mathly/tests/test_speech_evaluation.py
-
curl -L -o test_speech_evaluation.py https://huggingface.co/spaces/wzender/mathly/resolve/main/tests/test_speech_evaluation.py
918 Bytes
| from app.speech_evaluation import SpeechEvaluationService | |
| class FakeScorer: | |
| def __init__(self, result): | |
| self.result = result | |
| def score(self, *_args, **_kwargs): | |
| return dict(self.result) | |
| def test_uncertain_recognition_is_not_counted_as_a_mistake(): | |
| service = SpeechEvaluationService(FakeScorer({"score": 20, "unrelated": True})) | |
| result = service.evaluate([], {"variants": []}) | |
| assert result["outcome"] == "uncertain" | |
| assert result["counts_as_attempt"] is False | |
| def test_low_score_is_not_mislabelled_as_grammar_or_pronunciation(): | |
| weak = SpeechEvaluationService(FakeScorer({"score": 60, "unrelated": False})).evaluate([], {}) | |
| good = SpeechEvaluationService(FakeScorer({"score": 90, "unrelated": False})).evaluate([], {}) | |
| assert weak["outcome"] == "needs_work" and weak["error_kind"] == "undetermined" | |
| assert good["outcome"] == "correct" and good["correct"] | |