Spaces:
Running
Running
Update basis.py
Browse files
basis.py
CHANGED
|
@@ -9,7 +9,7 @@ class ScoreBasis:
|
|
| 9 |
def windowed_scoring(self, audios, score_rate):
|
| 10 |
raise NotImplementedError(f'In {self.name}, windowed_scoring is not yet implemented')
|
| 11 |
|
| 12 |
-
def scoring(self, data, window=None, score_rate=None):
|
| 13 |
""" calling the `windowed_scoring` function that should be specialised
|
| 14 |
depending on the score."""
|
| 15 |
|
|
@@ -40,6 +40,12 @@ class ScoreBasis:
|
|
| 40 |
result[t] = result_t
|
| 41 |
else:
|
| 42 |
result = self.windowed_scoring(audios, score_rate)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
return result
|
| 44 |
|
| 45 |
|
|
|
|
| 9 |
def windowed_scoring(self, audios, score_rate):
|
| 10 |
raise NotImplementedError(f'In {self.name}, windowed_scoring is not yet implemented')
|
| 11 |
|
| 12 |
+
def scoring(self, data, window=None, score_rate=None, round_digits=None):
|
| 13 |
""" calling the `windowed_scoring` function that should be specialised
|
| 14 |
depending on the score."""
|
| 15 |
|
|
|
|
| 40 |
result[t] = result_t
|
| 41 |
else:
|
| 42 |
result = self.windowed_scoring(audios, score_rate)
|
| 43 |
+
|
| 44 |
+
if round_digits is not None:
|
| 45 |
+
if isinstance(result, dict):
|
| 46 |
+
for key in result:
|
| 47 |
+
result[key] = round(result[key], round_digits)
|
| 48 |
+
else: result = round(result, round_digits)
|
| 49 |
return result
|
| 50 |
|
| 51 |
|