BatchalignHK 0.7.19.post13__tar.gz → 0.7.19.post15__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.
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/PKG-INFO +2 -3
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/SOURCES.txt +1 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/PKG-INFO +2 -3
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/cli/cli.py +13 -5
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/cli/dispatch.py +13 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/__init__.py +1 -1
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/dispatch.py +3 -1
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/__init__.py +1 -0
- batchalignhk-0.7.19.post15/batchalign/pipelines/utr/tencent_utr.py +230 -0
- batchalignhk-0.7.19.post15/batchalign/version +3 -0
- batchalignhk-0.7.19.post13/batchalign/version +0 -3
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/dependency_links.txt +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/entry_points.txt +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/requires.txt +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/top_level.txt +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/LICENSE +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/MANIFEST.in +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/README.md +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/__main__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/cli/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/constants.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/document.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/errors.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/base.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/file.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/generator.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/lexer.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/parser.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/file.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/generator.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/parser.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/resolve.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/config.yaml +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/infer.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/training/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/training/run.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/training/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/cantonese_infer.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/dataset.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/execute.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/infer.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/prep.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/train.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/wave2vec/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/wave2vec/infer_fa.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/infer_asr.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/infer_fa.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/analysis/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/analysis/eval.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/num2chinese.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/oai_whisper.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/rev.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/tencent.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/whisper.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/whisperx.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/base.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/cleanup.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/disfluencies.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/parse_support.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/retrace.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/support/filled_pauses.eng +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/support/replacements.eng +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/support/test.test +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/wave2vec_fa.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/whisper_fa.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/coref.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/en/irr.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/fr/apm.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/fr/apmn.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/fr/case.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/ja/verbforms.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/ud.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/pipeline.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/speaker/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/speaker/nemo_speaker.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/gtrans.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/seamless.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/rev_utr.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/whisper_utr.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utterance/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utterance/ud_utterance.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/conftest.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/chat/test_chat_file.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/chat/test_chat_generator.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/chat/test_chat_lexer.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/chat/test_chat_parser.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/chat/test_chat_utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/formats/textgrid/test_textgrid.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/analysis/test_eval.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/asr/test_asr_pipeline.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/asr/test_asr_utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/cleanup/test_disfluency.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/cleanup/test_parse_support.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/fa/test_fa_pipeline.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/fixures.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/test_pipeline.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/test_pipeline_models.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/test_document.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/__init__.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/abbrev.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/config.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/dp.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/names.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/utils/utils.py +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/setup.cfg +0 -0
- {batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: BatchalignHK
|
|
3
|
-
Version: 0.7.19.
|
|
3
|
+
Version: 0.7.19.post15
|
|
4
4
|
Summary: Python Speech Language Sample Analysis
|
|
5
5
|
Author: Brian MacWhinney, Houjun Liu
|
|
6
6
|
Author-email: macw@cmu.edu, houjun@cmu.edu
|
|
@@ -50,7 +50,6 @@ Dynamic: author-email
|
|
|
50
50
|
Dynamic: classifier
|
|
51
51
|
Dynamic: description
|
|
52
52
|
Dynamic: description-content-type
|
|
53
|
-
Dynamic: license-file
|
|
54
53
|
Dynamic: provides-extra
|
|
55
54
|
Dynamic: requires-dist
|
|
56
55
|
Dynamic: summary
|
|
@@ -92,6 +92,7 @@ batchalign/pipelines/translate/seamless.py
|
|
|
92
92
|
batchalign/pipelines/translate/utils.py
|
|
93
93
|
batchalign/pipelines/utr/__init__.py
|
|
94
94
|
batchalign/pipelines/utr/rev_utr.py
|
|
95
|
+
batchalign/pipelines/utr/tencent_utr.py
|
|
95
96
|
batchalign/pipelines/utr/utils.py
|
|
96
97
|
batchalign/pipelines/utr/whisper_utr.py
|
|
97
98
|
batchalign/pipelines/utterance/__init__.py
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: BatchalignHK
|
|
3
|
-
Version: 0.7.19.
|
|
3
|
+
Version: 0.7.19.post15
|
|
4
4
|
Summary: Python Speech Language Sample Analysis
|
|
5
5
|
Author: Brian MacWhinney, Houjun Liu
|
|
6
6
|
Author-email: macw@cmu.edu, houjun@cmu.edu
|
|
@@ -50,7 +50,6 @@ Dynamic: author-email
|
|
|
50
50
|
Dynamic: classifier
|
|
51
51
|
Dynamic: description
|
|
52
52
|
Dynamic: description-content-type
|
|
53
|
-
Dynamic: license-file
|
|
54
53
|
Dynamic: provides-extra
|
|
55
54
|
Dynamic: requires-dist
|
|
56
55
|
Dynamic: summary
|
|
@@ -110,10 +110,16 @@ batchalign.add_command(train, "models")
|
|
|
110
110
|
default=False, help="For utterance timing recovery, OpenAI Whisper (ASR) instead of Rev.AI (default).")
|
|
111
111
|
@click.option("--wav2vec/--whisper_fa",
|
|
112
112
|
default=True, help="Use Whisper instead of Wav2Vec for English (defaults for Whisper for non-English)")
|
|
113
|
+
@click.option("--tencent/--rev",
|
|
114
|
+
default=False, help="Use Tencent instead of Rev.AI (default).")
|
|
113
115
|
@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)
|
|
114
|
-
|
|
116
|
+
@click.option("--wor/--nowor",
|
|
117
|
+
default=True, help="Should we write word level alignment line? Default to yes.")
|
|
118
|
+
@click.option("--data",
|
|
119
|
+
help="the URL of the data",
|
|
120
|
+
type=str)
|
|
115
121
|
@click.pass_context
|
|
116
|
-
def align(ctx, in_dir, out_dir, whisper, wav2vec, **kwargs):
|
|
122
|
+
def align(ctx, in_dir, out_dir, whisper, wav2vec, tencent, **kwargs):
|
|
117
123
|
"""Align transcripts against corresponding media files."""
|
|
118
124
|
def loader(file):
|
|
119
125
|
return (
|
|
@@ -122,7 +128,7 @@ def align(ctx, in_dir, out_dir, whisper, wav2vec, **kwargs):
|
|
|
122
128
|
)
|
|
123
129
|
|
|
124
130
|
def writer(doc, output):
|
|
125
|
-
CHATFile(doc=doc).write(output)
|
|
131
|
+
CHATFile(doc=doc).write(output, write_wor=kwargs.get("wor", True))
|
|
126
132
|
|
|
127
133
|
if not wav2vec:
|
|
128
134
|
_dispatch("align", "eng", 1,
|
|
@@ -130,7 +136,8 @@ def align(ctx, in_dir, out_dir, whisper, wav2vec, **kwargs):
|
|
|
130
136
|
in_dir, out_dir,
|
|
131
137
|
loader, writer, C,
|
|
132
138
|
fa="whisper_fa",
|
|
133
|
-
utr="whisper_utr" if whisper else
|
|
139
|
+
utr=("whisper_utr" if whisper else
|
|
140
|
+
("tencent_utr" if tencent else "rev_utr")),
|
|
134
141
|
**kwargs)
|
|
135
142
|
else:
|
|
136
143
|
_dispatch("align", "eng", 1,
|
|
@@ -138,7 +145,8 @@ def align(ctx, in_dir, out_dir, whisper, wav2vec, **kwargs):
|
|
|
138
145
|
in_dir, out_dir,
|
|
139
146
|
loader, writer, C,
|
|
140
147
|
fa="wav2vec_fa",
|
|
141
|
-
utr="whisper_utr" if whisper else
|
|
148
|
+
utr=("whisper_utr" if whisper else
|
|
149
|
+
("tencent_utr" if tencent else "rev_utr")),
|
|
142
150
|
**kwargs)
|
|
143
151
|
|
|
144
152
|
#################### TRANSCRIBE ################################
|
|
@@ -77,6 +77,8 @@ def _dispatch(command, lang, num_speakers,
|
|
|
77
77
|
files.append(url)
|
|
78
78
|
outputs.append(os.path.join(out_dir, base))
|
|
79
79
|
|
|
80
|
+
extr_data_mapping = {}
|
|
81
|
+
|
|
80
82
|
for basedir, _, fs in os.walk(in_dir):
|
|
81
83
|
for f in fs:
|
|
82
84
|
path = Path(os.path.join(basedir, f))
|
|
@@ -116,6 +118,16 @@ def _dispatch(command, lang, num_speakers,
|
|
|
116
118
|
# if the file needs to get processed, append it to the list
|
|
117
119
|
# to be processed and compute the output
|
|
118
120
|
if ext in extensions:
|
|
121
|
+
for indx, i in enumerate(files):
|
|
122
|
+
# check if this is a duplicate file
|
|
123
|
+
if (not isinstance(i, str) and
|
|
124
|
+
Path(i.geturl()).stem == Path(inp_path).stem):
|
|
125
|
+
extr_data_mapping[inp_path] = i.geturl()
|
|
126
|
+
|
|
127
|
+
files.pop(indx)
|
|
128
|
+
outputs.pop(indx)
|
|
129
|
+
break
|
|
130
|
+
|
|
119
131
|
files.append(inp_path)
|
|
120
132
|
outputs.append(str(repathed))
|
|
121
133
|
# otherwise just copy the file
|
|
@@ -176,6 +188,7 @@ def _dispatch(command, lang, num_speakers,
|
|
|
176
188
|
# RUN THE PUPPY!
|
|
177
189
|
doc = pipeline(doc,
|
|
178
190
|
callback=lambda *args:progress_callback(file, *args),
|
|
191
|
+
extra_info={"extra_input": extr_data_mapping.get(file)},
|
|
179
192
|
**kw)
|
|
180
193
|
msgs = [escape(str(i.message)).strip() for i in w]
|
|
181
194
|
# write the format, as needed
|
|
@@ -7,7 +7,7 @@ from .cleanup import NgramRetraceEngine, DisfluencyReplacementEngine
|
|
|
7
7
|
from .speaker import NemoSpeakerEngine
|
|
8
8
|
|
|
9
9
|
from .fa import WhisperFAEngine, Wave2VecFAEngine
|
|
10
|
-
from .utr import WhisperUTREngine, RevUTREngine
|
|
10
|
+
from .utr import WhisperUTREngine, RevUTREngine, TencentUTREngine
|
|
11
11
|
|
|
12
12
|
from .analysis import EvaluationEngine
|
|
13
13
|
from .utterance import StanzaUtteranceEngine
|
|
@@ -7,7 +7,7 @@ from batchalign import (WhisperEngine, WhisperFAEngine, StanzaEngine, RevEngine,
|
|
|
7
7
|
NgramRetraceEngine, DisfluencyReplacementEngine, WhisperUTREngine,
|
|
8
8
|
RevUTREngine, EvaluationEngine, WhisperXEngine, NemoSpeakerEngine,
|
|
9
9
|
StanzaUtteranceEngine, CorefEngine, Wave2VecFAEngine, SeamlessTranslationModel, TencentEngine,
|
|
10
|
-
GoogleTranslateEngine, OAIWhisperEngine)
|
|
10
|
+
GoogleTranslateEngine, OAIWhisperEngine, TencentUTREngine)
|
|
11
11
|
|
|
12
12
|
from batchalign import BatchalignPipeline
|
|
13
13
|
from batchalign.models import resolve
|
|
@@ -136,6 +136,8 @@ def dispatch_pipeline(pkg_str, lang, num_speakers=None, **arg_overrides):
|
|
|
136
136
|
engines.append(SeamlessTranslationModel())
|
|
137
137
|
elif engine == "tencent":
|
|
138
138
|
engines.append(TencentEngine(lang=lang))
|
|
139
|
+
elif engine == "tencent_utr":
|
|
140
|
+
engines.append(TencentUTREngine(lang=lang))
|
|
139
141
|
elif engine == "gtrans":
|
|
140
142
|
engines.append(GoogleTranslateEngine())
|
|
141
143
|
elif engine == "whisper_oai":
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"""
|
|
2
|
+
rev.py
|
|
3
|
+
Support for Rev.ai, a commerical ASR service
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from batchalign.document import *
|
|
7
|
+
from batchalign.pipelines.base import *
|
|
8
|
+
from batchalign.pipelines.asr.utils import *
|
|
9
|
+
from batchalign.utils.config import config_read
|
|
10
|
+
|
|
11
|
+
from batchalign.pipelines.utr.utils import bulletize_doc
|
|
12
|
+
|
|
13
|
+
from batchalign.errors import *
|
|
14
|
+
import warnings
|
|
15
|
+
|
|
16
|
+
import time
|
|
17
|
+
import pathlib
|
|
18
|
+
import pycountry
|
|
19
|
+
|
|
20
|
+
from opencc import OpenCC
|
|
21
|
+
cc = OpenCC('s2hk')
|
|
22
|
+
|
|
23
|
+
import time
|
|
24
|
+
import pathlib
|
|
25
|
+
import tempfile
|
|
26
|
+
import pycountry
|
|
27
|
+
import numpy as np
|
|
28
|
+
import soundfile as sf
|
|
29
|
+
# from pydub import AudioSegment
|
|
30
|
+
# from pydub.effects import normalize
|
|
31
|
+
import base64
|
|
32
|
+
from tencentcloud.common.credential import Credential
|
|
33
|
+
from tencentcloud.asr.v20190614.asr_client import AsrClient, models
|
|
34
|
+
|
|
35
|
+
import asyncio
|
|
36
|
+
import tempfile
|
|
37
|
+
import os
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
import logging
|
|
41
|
+
L = logging.getLogger("batchalign")
|
|
42
|
+
|
|
43
|
+
class TencentUTREngine(BatchalignEngine):
|
|
44
|
+
tasks = [ Task.UTTERANCE_TIMING_RECOVERY ]
|
|
45
|
+
|
|
46
|
+
def __init__(self, key:str=None, lang="eng"):
|
|
47
|
+
|
|
48
|
+
if key == None or key.strip() == "":
|
|
49
|
+
config = config_read()
|
|
50
|
+
try:
|
|
51
|
+
id = config["asr"]["engine.tencent.id"]
|
|
52
|
+
key = config["asr"]["engine.tencent.key"]
|
|
53
|
+
except KeyError:
|
|
54
|
+
raise ConfigError("No Tencent Cloud key found. Tencent Cloud was not set up! Please write one yourself and place it at ~/.batchalign.ini.")
|
|
55
|
+
|
|
56
|
+
self.__lang_code = lang
|
|
57
|
+
|
|
58
|
+
if lang == "yue":
|
|
59
|
+
self.__lang = "yue"
|
|
60
|
+
else:
|
|
61
|
+
self.__lang = pycountry.languages.get(alpha_3=lang).alpha_2
|
|
62
|
+
|
|
63
|
+
cred = Credential(id, key)
|
|
64
|
+
self.__client = AsrClient(cred, "ap-hongkong")
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def replace_cantonese_words(self, word):
|
|
68
|
+
"""Function to replace Cantonese words with custom replacements."""
|
|
69
|
+
word_replacements = {
|
|
70
|
+
"系": "係",
|
|
71
|
+
"唔系": "唔係",
|
|
72
|
+
"噶": "㗎",
|
|
73
|
+
"咧": "呢",
|
|
74
|
+
"嗬": "喎",
|
|
75
|
+
"只": "隻",
|
|
76
|
+
"咯": "囉",
|
|
77
|
+
"嚇": "吓",
|
|
78
|
+
"飲": "飲",
|
|
79
|
+
"喐": "郁",
|
|
80
|
+
"食": "食",
|
|
81
|
+
"啫": "咋",
|
|
82
|
+
"哇": "嘩",
|
|
83
|
+
"着": "著",
|
|
84
|
+
"中意": "鍾意",
|
|
85
|
+
"嘞": "喇",
|
|
86
|
+
"啵": "噃",
|
|
87
|
+
"遊水": "游水",
|
|
88
|
+
"羣組": "群組",
|
|
89
|
+
"古仔": "故仔",
|
|
90
|
+
"甕": "㧬",
|
|
91
|
+
"牀": "床",
|
|
92
|
+
"松": "鬆",
|
|
93
|
+
"較剪": "鉸剪",
|
|
94
|
+
"吵": "嘈",
|
|
95
|
+
"衝涼": "沖涼",
|
|
96
|
+
"分鍾": "分鐘",
|
|
97
|
+
"重復": "重複"
|
|
98
|
+
}
|
|
99
|
+
return word_replacements.get(word, word)
|
|
100
|
+
|
|
101
|
+
@staticmethod
|
|
102
|
+
def is_roman(x):
|
|
103
|
+
"""check if x contains only roman characters"""
|
|
104
|
+
return all(c.isalpha() and ord(c) < 128 for c in x if not c.isspace())
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def process(self, doc, **kwargs):
|
|
109
|
+
# bring language code into the stack to access
|
|
110
|
+
lang = self.__lang
|
|
111
|
+
try:
|
|
112
|
+
lang = pycountry.languages.get(alpha_3=doc.langs[0]).alpha_2
|
|
113
|
+
except:
|
|
114
|
+
# some languages don't have alpha 2
|
|
115
|
+
pass
|
|
116
|
+
|
|
117
|
+
if lang == "zh":
|
|
118
|
+
lang = "cmn"
|
|
119
|
+
|
|
120
|
+
client = self.__client
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
# check and if there are existing utterance timings, warn
|
|
124
|
+
if any([i.alignment for i in doc.content if isinstance(i, Utterance)]):
|
|
125
|
+
warnings.warn(f"We found existing utterance timings in the document with {doc.media.url}! Skipping rough utterance alignment.")
|
|
126
|
+
return doc
|
|
127
|
+
|
|
128
|
+
f = kwargs.get("extra_info", {}).get("extra_input")
|
|
129
|
+
|
|
130
|
+
if not f:
|
|
131
|
+
assert doc.media != None and doc.media.url != None, f"We cannot add utterance timings to something that doesn't have a media path! Provided media tier='{doc.media}'"
|
|
132
|
+
|
|
133
|
+
f = f if f else doc.media.url
|
|
134
|
+
|
|
135
|
+
lang = self.__lang
|
|
136
|
+
client = self.__client
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
# processed_path = self.__preprocess_audio(f)
|
|
141
|
+
# audio = AudioSegment.from_file(processed_path)
|
|
142
|
+
|
|
143
|
+
L.info(f"Uploading '{pathlib.Path(f).stem}'...")
|
|
144
|
+
# we will send the file for processing
|
|
145
|
+
if not str(f).startswith("http"):
|
|
146
|
+
with open(f, "rb") as image_file:
|
|
147
|
+
encoded_string = base64.b64encode(image_file.read())
|
|
148
|
+
|
|
149
|
+
req = models.CreateRecTaskRequest()
|
|
150
|
+
if lang in {'zho', 'yue', 'wuu', 'nan','hak'}:
|
|
151
|
+
req.EngineModelType = "16k_zh_large"
|
|
152
|
+
else:
|
|
153
|
+
req.EngineModelType = f"16k_{lang}"
|
|
154
|
+
req.ResTextFormat = 1
|
|
155
|
+
req.SpeakerDiarization = 1
|
|
156
|
+
req.ChannelNum = 1
|
|
157
|
+
if not str(f).startswith("http"):
|
|
158
|
+
req.Data = encoded_string.decode('ascii')
|
|
159
|
+
req.SourceType = 1
|
|
160
|
+
else:
|
|
161
|
+
req.Url = f
|
|
162
|
+
req.SourceType = 0
|
|
163
|
+
resp = client.CreateRecTask(req)
|
|
164
|
+
|
|
165
|
+
L.info(f"Tencent is transcribing '{pathlib.Path(f).stem}'...")
|
|
166
|
+
req = models.DescribeTaskStatusRequest()
|
|
167
|
+
req.TaskId = resp.Data.TaskId
|
|
168
|
+
|
|
169
|
+
res = client.DescribeTaskStatus(req)
|
|
170
|
+
while res.Data.Status not in [2, 3]:
|
|
171
|
+
time.sleep(15)
|
|
172
|
+
res = client.DescribeTaskStatus(req)
|
|
173
|
+
|
|
174
|
+
if res.Data.Status in ["3", 3]:
|
|
175
|
+
raise RuntimeError(f"Tencent reports job failed! error='{res.Data.ErrorMsg}'")
|
|
176
|
+
|
|
177
|
+
turns = []
|
|
178
|
+
for i in res.Data.ResultDetail:
|
|
179
|
+
turn = []
|
|
180
|
+
start = i.StartMs
|
|
181
|
+
roman_cache = ""
|
|
182
|
+
roman_cache_start = i.StartMs
|
|
183
|
+
roman_cache_end = i.StartMs
|
|
184
|
+
for j in i.Words:
|
|
185
|
+
word = j.Word
|
|
186
|
+
if self.__lang == "yue":
|
|
187
|
+
word = cc.convert(word)
|
|
188
|
+
|
|
189
|
+
word = self.replace_cantonese_words(word)
|
|
190
|
+
|
|
191
|
+
if self.is_roman(word):
|
|
192
|
+
if roman_cache == "":
|
|
193
|
+
roman_cache_start = (j.OffsetStartMs + start)
|
|
194
|
+
roman_cache = roman_cache + word
|
|
195
|
+
roman_cache_end = (j.OffsetEndMs + start)
|
|
196
|
+
else:
|
|
197
|
+
if roman_cache != "":
|
|
198
|
+
turn.append({
|
|
199
|
+
"type": "text",
|
|
200
|
+
"ts": roman_cache_start / 1000,
|
|
201
|
+
"end_ts": roman_cache_end / 1000,
|
|
202
|
+
"value": roman_cache
|
|
203
|
+
})
|
|
204
|
+
roman_cache = ""
|
|
205
|
+
turn.append({
|
|
206
|
+
"type": "text",
|
|
207
|
+
"ts": (j.OffsetStartMs + start) / 1000,
|
|
208
|
+
"end_ts": (j.OffsetEndMs + start) / 1000,
|
|
209
|
+
"value": word
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
if roman_cache != "":
|
|
213
|
+
turn.append({
|
|
214
|
+
"type": "text",
|
|
215
|
+
"ts": roman_cache_start / 1000,
|
|
216
|
+
"end_ts": roman_cache_end / 1000,
|
|
217
|
+
"value": roman_cache
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
turns.append({
|
|
221
|
+
"elements": turn,
|
|
222
|
+
"speaker": i.SpeakerId
|
|
223
|
+
})
|
|
224
|
+
L.debug(f"Tencent done.")
|
|
225
|
+
|
|
226
|
+
res = bulletize_doc({"monologues": turns}, doc)
|
|
227
|
+
L.debug(f"done...")
|
|
228
|
+
|
|
229
|
+
return res
|
|
230
|
+
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/entry_points.txt
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/requires.txt
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/BatchalignHK.egg-info/top_level.txt
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
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/chat/generator.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/file.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/generator.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/formats/textgrid/parser.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/config.yaml
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/infer.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/speaker/utils.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/training/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/training/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/dataset.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/execute.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/infer.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/prep.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/utterance/train.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/wave2vec/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/wave2vec/infer_fa.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/infer_asr.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/models/whisper/infer_fa.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/analysis/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/analysis/eval.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/num2chinese.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/oai_whisper.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/tencent.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/whisper.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/asr/whisperx.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/cleanup.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/cleanup/retrace.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/wave2vec_fa.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/fa/whisper_fa.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/coref.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/morphosyntax/ud.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/speaker/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/__init__.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/gtrans.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/seamless.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/translate/utils.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/rev_utr.py
RENAMED
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utr/whisper_utr.py
RENAMED
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/pipelines/utterance/__init__.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
|
|
File without changes
|
|
File without changes
|
{batchalignhk-0.7.19.post13 → batchalignhk-0.7.19.post15}/batchalign/tests/pipelines/fixures.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
|