batchalign 0.7.11a0__tar.gz → 0.7.11b2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {batchalign-0.7.11a0/batchalign.egg-info → batchalign-0.7.11b2}/PKG-INFO +1 -1
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/cli/cli.py +5 -1
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/whisper/infer_fa.py +2 -2
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/fa/whisper_fa.py +24 -15
- batchalign-0.7.11b2/batchalign/version +3 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2/batchalign.egg-info}/PKG-INFO +1 -1
- batchalign-0.7.11a0/batchalign/version +0 -3
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/LICENSE +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/MANIFEST.in +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/README.md +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/__main__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/cli/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/cli/dispatch.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/constants.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/document.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/errors.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/base.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/file.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/generator.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/lexer.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/parser.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/chat/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/textgrid/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/textgrid/file.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/textgrid/generator.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/formats/textgrid/parser.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/resolve.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/speaker/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/speaker/config.yaml +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/speaker/infer.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/speaker/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/training/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/training/run.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/training/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/dataset.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/execute.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/infer.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/prep.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/utterance/train.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/whisper/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/models/whisper/infer_asr.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/analysis/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/analysis/eval.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/asr/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/asr/rev.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/asr/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/asr/whisper.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/asr/whisperx.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/base.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/cleanup.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/disfluencies.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/parse_support.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/retrace.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/support/filled_pauses.eng +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/support/replacements.eng +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/support/test.test +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/dispatch.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/fa/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/coref.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/en/irr.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/fr/apm.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/fr/apmn.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/fr/case.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/ja/verbforms.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/ud.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/pipeline.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/speaker/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/speaker/nemo_speaker.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utr/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utr/rev_utr.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utr/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utr/whisper_utr.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utterance/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/utterance/ud_utterance.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/conftest.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_file.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_generator.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_lexer.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_parser.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/textgrid/test_textgrid.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/analysis/test_eval.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/asr/test_asr_pipeline.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/asr/test_asr_utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/cleanup/test_disfluency.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/cleanup/test_parse_support.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/fa/test_fa_pipeline.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/fixures.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/test_pipeline.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/test_pipeline_models.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/test_document.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/utils/__init__.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/utils/config.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/utils/dp.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/utils/utils.py +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign.egg-info/SOURCES.txt +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign.egg-info/dependency_links.txt +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign.egg-info/entry_points.txt +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign.egg-info/requires.txt +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign.egg-info/top_level.txt +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/setup.cfg +0 -0
- {batchalign-0.7.11a0 → batchalign-0.7.11b2}/setup.py +0 -0
@@ -107,12 +107,16 @@ batchalign.add_command(train, "models")
|
|
107
107
|
@common_options
|
108
108
|
@click.option("--whisper/--rev",
|
109
109
|
default=False, help="For utterance timing recovery, OpenAI Whisper (ASR) instead of Rev.AI (default).")
|
110
|
+
@click.option("--pauses", type=bool, default=False, help="Should we try to bullet each word or should we try to add pauses in between words by grouping them? Default: no pauses.", is_flag=True)
|
110
111
|
|
111
112
|
@click.pass_context
|
112
113
|
def align(ctx, in_dir, out_dir, whisper, **kwargs):
|
113
114
|
"""Align transcripts against corresponding media files."""
|
114
115
|
def loader(file):
|
115
|
-
return
|
116
|
+
return (
|
117
|
+
CHATFile(path=os.path.abspath(file)).doc,
|
118
|
+
{"pauses", kwargs.get("pauses", False)}
|
119
|
+
)
|
116
120
|
|
117
121
|
def writer(doc, output):
|
118
122
|
CHATFile(doc=doc).write(output)
|
@@ -79,10 +79,10 @@ class WhisperFAModel(object):
|
|
79
79
|
# and return the audio file
|
80
80
|
return ASRAudioFile(f, resampled, self.sample_rate)
|
81
81
|
|
82
|
-
def __call__(self, audio, text):
|
82
|
+
def __call__(self, audio, text, pauses=False):
|
83
83
|
L.debug("Whisper Preprocessing...")
|
84
84
|
# input features
|
85
|
-
features = self.__processor(audio=audio, text=" ".join(list(text)),
|
85
|
+
features = self.__processor(audio=audio, text=(" ".join(list(text)) if pauses else text),
|
86
86
|
sampling_rate=self.sample_rate,
|
87
87
|
return_tensors='pt')
|
88
88
|
tokens = features["labels"][0]
|
@@ -29,6 +29,9 @@ class WhisperFAEngine(BatchalignEngine):
|
|
29
29
|
self.__whisper = WhisperFAModel(model)
|
30
30
|
|
31
31
|
def process(self, doc:Document, **kwargs):
|
32
|
+
# check if pauses
|
33
|
+
pauses = kwargs.get("pauses", False)
|
34
|
+
|
32
35
|
# check that the document has a media path to align to
|
33
36
|
assert doc.media != None and doc.media.url != None, f"We cannot forced-align something that doesn't have a media path! Provided media tier='{doc.media}'"
|
34
37
|
|
@@ -83,7 +86,7 @@ class WhisperFAEngine(BatchalignEngine):
|
|
83
86
|
# if "noone's" in detokenized:
|
84
87
|
# breakpoint()
|
85
88
|
res = self.__whisper(audio=f.chunk(grp[0][1][0], grp[-1][1][1]),
|
86
|
-
text=detokenized)
|
89
|
+
text=detokenized, pauses=pauses)
|
87
90
|
except IndexError:
|
88
91
|
# utterance contains nothing
|
89
92
|
continue
|
@@ -109,19 +112,25 @@ class WhisperFAEngine(BatchalignEngine):
|
|
109
112
|
alignments.reverse()
|
110
113
|
for indx,elem in enumerate(alignments):
|
111
114
|
if isinstance(elem, Match):
|
112
|
-
|
113
|
-
|
114
|
-
next_elem
|
115
|
-
|
116
|
-
next_elem
|
115
|
+
if pauses:
|
116
|
+
next_elem = indx - 1 # remember this is backwards, see above
|
117
|
+
while next_elem >= 0 and alignments[next_elem].payload == elem.payload:
|
118
|
+
next_elem -= 1
|
119
|
+
if next_elem < 0:
|
120
|
+
next_elem = None
|
121
|
+
else:
|
122
|
+
next_elem = alignments[next_elem]
|
123
|
+
grp[elem.reference_payload][0].time = (int(round((timings[elem.payload]*1000 +
|
124
|
+
grp[0][1][0]))),
|
125
|
+
int(round((timings[elem.payload]*1000 +
|
126
|
+
grp[0][1][0])))+500 if next_elem == None else
|
127
|
+
int(round((timings[next_elem.payload]*1000 +
|
128
|
+
grp[0][1][0]))))
|
117
129
|
else:
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
grp[0][1][0])))+500 if next_elem == None else
|
123
|
-
int(round((timings[next_elem.payload]*1000 +
|
124
|
-
grp[0][1][0]))))
|
130
|
+
grp[elem.reference_payload][0].time = (int(round((timings[elem.payload]*1000 +
|
131
|
+
grp[0][1][0]))),
|
132
|
+
int(round((timings[elem.payload]*1000 +
|
133
|
+
grp[0][1][0]))))
|
125
134
|
|
126
135
|
L.debug(f"Correcting text...")
|
127
136
|
|
@@ -153,8 +162,8 @@ class WhisperFAEngine(BatchalignEngine):
|
|
153
162
|
w.time = (w.time[0], doc.content[next_ut].alignment[0])
|
154
163
|
else:
|
155
164
|
w.time = (w.time[0], w.time[0]+500) # give half a second because we don't know
|
156
|
-
|
157
|
-
|
165
|
+
elif not pauses:
|
166
|
+
w.time = (w.time[0], ut.content[tmp].time[0])
|
158
167
|
|
159
168
|
# just in case, bound the time by the utterance derived timings
|
160
169
|
if ut.alignment and ut.alignment[0] != None:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/support/filled_pauses.eng
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/cleanup/support/replacements.eng
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/pipelines/morphosyntax/ja/verbforms.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_generator.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_lexer.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_parser.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/chat/test_chat_utils.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/formats/textgrid/test_textgrid.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/analysis/test_eval.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/asr/test_asr_pipeline.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/asr/test_asr_utils.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/cleanup/test_disfluency.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/cleanup/test_parse_support.py
RENAMED
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/fa/test_fa_pipeline.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{batchalign-0.7.11a0 → batchalign-0.7.11b2}/batchalign/tests/pipelines/test_pipeline_models.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|