Spaces:
Sleeping
Sleeping
Upload TranscribedData.py
Browse files
src/modules/TranscribedData.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Docstring"""
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
class TranscribedData:
|
| 5 |
+
"""Transcribed data from json file"""
|
| 6 |
+
|
| 7 |
+
def __init__(self, transcribed_json):
|
| 8 |
+
# Vosk = conf, Whisper = confidence
|
| 9 |
+
self.conf = transcribed_json.get(
|
| 10 |
+
"conf", transcribed_json.get("confidence", None)
|
| 11 |
+
)
|
| 12 |
+
# Vosk = word, Whisper = text
|
| 13 |
+
self.word = transcribed_json.get(
|
| 14 |
+
"word", transcribed_json.get("text", None)
|
| 15 |
+
)
|
| 16 |
+
self.end = transcribed_json.get("end", None)
|
| 17 |
+
self.start = transcribed_json.get("start", None)
|
| 18 |
+
self.is_hyphen = transcribed_json.get("is_hyphen", None)
|
| 19 |
+
self.is_word_end = transcribed_json.get("is_word_end", True)
|