BatchalignHK 0.7.17.post13__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.
Files changed (119) hide show
  1. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/PKG-INFO +311 -0
  2. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/SOURCES.txt +117 -0
  3. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/dependency_links.txt +1 -0
  4. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/entry_points.txt +2 -0
  5. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/requires.txt +36 -0
  6. batchalignhk-0.7.17.post13/BatchalignHK.egg-info/top_level.txt +1 -0
  7. batchalignhk-0.7.17.post13/LICENSE +11 -0
  8. batchalignhk-0.7.17.post13/MANIFEST.in +4 -0
  9. batchalignhk-0.7.17.post13/PKG-INFO +311 -0
  10. batchalignhk-0.7.17.post13/README.md +258 -0
  11. batchalignhk-0.7.17.post13/batchalign/__init__.py +19 -0
  12. batchalignhk-0.7.17.post13/batchalign/__main__.py +4 -0
  13. batchalignhk-0.7.17.post13/batchalign/cli/__init__.py +1 -0
  14. batchalignhk-0.7.17.post13/batchalign/cli/cli.py +371 -0
  15. batchalignhk-0.7.17.post13/batchalign/cli/dispatch.py +193 -0
  16. batchalignhk-0.7.17.post13/batchalign/constants.py +20 -0
  17. batchalignhk-0.7.17.post13/batchalign/document.py +439 -0
  18. batchalignhk-0.7.17.post13/batchalign/errors.py +15 -0
  19. batchalignhk-0.7.17.post13/batchalign/formats/__init__.py +2 -0
  20. batchalignhk-0.7.17.post13/batchalign/formats/base.py +15 -0
  21. batchalignhk-0.7.17.post13/batchalign/formats/chat/__init__.py +1 -0
  22. batchalignhk-0.7.17.post13/batchalign/formats/chat/file.py +146 -0
  23. batchalignhk-0.7.17.post13/batchalign/formats/chat/generator.py +164 -0
  24. batchalignhk-0.7.17.post13/batchalign/formats/chat/lexer.py +207 -0
  25. batchalignhk-0.7.17.post13/batchalign/formats/chat/parser.py +338 -0
  26. batchalignhk-0.7.17.post13/batchalign/formats/chat/utils.py +155 -0
  27. batchalignhk-0.7.17.post13/batchalign/formats/textgrid/__init__.py +1 -0
  28. batchalignhk-0.7.17.post13/batchalign/formats/textgrid/file.py +110 -0
  29. batchalignhk-0.7.17.post13/batchalign/formats/textgrid/generator.py +83 -0
  30. batchalignhk-0.7.17.post13/batchalign/formats/textgrid/parser.py +148 -0
  31. batchalignhk-0.7.17.post13/batchalign/models/__init__.py +6 -0
  32. batchalignhk-0.7.17.post13/batchalign/models/resolve.py +23 -0
  33. batchalignhk-0.7.17.post13/batchalign/models/speaker/__init__.py +1 -0
  34. batchalignhk-0.7.17.post13/batchalign/models/speaker/config.yaml +68 -0
  35. batchalignhk-0.7.17.post13/batchalign/models/speaker/infer.py +87 -0
  36. batchalignhk-0.7.17.post13/batchalign/models/speaker/utils.py +44 -0
  37. batchalignhk-0.7.17.post13/batchalign/models/training/__init__.py +2 -0
  38. batchalignhk-0.7.17.post13/batchalign/models/training/run.py +22 -0
  39. batchalignhk-0.7.17.post13/batchalign/models/training/utils.py +110 -0
  40. batchalignhk-0.7.17.post13/batchalign/models/utils.py +199 -0
  41. batchalignhk-0.7.17.post13/batchalign/models/utterance/__init__.py +4 -0
  42. batchalignhk-0.7.17.post13/batchalign/models/utterance/cantonese_infer.py +194 -0
  43. batchalignhk-0.7.17.post13/batchalign/models/utterance/dataset.py +181 -0
  44. batchalignhk-0.7.17.post13/batchalign/models/utterance/execute.py +34 -0
  45. batchalignhk-0.7.17.post13/batchalign/models/utterance/infer.py +121 -0
  46. batchalignhk-0.7.17.post13/batchalign/models/utterance/prep.py +100 -0
  47. batchalignhk-0.7.17.post13/batchalign/models/utterance/train.py +137 -0
  48. batchalignhk-0.7.17.post13/batchalign/models/wave2vec/__init__.py +1 -0
  49. batchalignhk-0.7.17.post13/batchalign/models/wave2vec/infer_fa.py +135 -0
  50. batchalignhk-0.7.17.post13/batchalign/models/whisper/__init__.py +2 -0
  51. batchalignhk-0.7.17.post13/batchalign/models/whisper/infer_asr.py +283 -0
  52. batchalignhk-0.7.17.post13/batchalign/models/whisper/infer_fa.py +132 -0
  53. batchalignhk-0.7.17.post13/batchalign/pipelines/__init__.py +15 -0
  54. batchalignhk-0.7.17.post13/batchalign/pipelines/analysis/__init__.py +1 -0
  55. batchalignhk-0.7.17.post13/batchalign/pipelines/analysis/eval.py +159 -0
  56. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/__init__.py +4 -0
  57. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/num2chinese.py +88 -0
  58. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/rev.py +103 -0
  59. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/tencent.py +124 -0
  60. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/utils.py +247 -0
  61. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/whisper.py +77 -0
  62. batchalignhk-0.7.17.post13/batchalign/pipelines/asr/whisperx.py +131 -0
  63. batchalignhk-0.7.17.post13/batchalign/pipelines/base.py +49 -0
  64. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/__init__.py +3 -0
  65. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/cleanup.py +5 -0
  66. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/disfluencies.py +18 -0
  67. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/parse_support.py +81 -0
  68. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/retrace.py +62 -0
  69. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/support/filled_pauses.eng +5 -0
  70. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/support/replacements.eng +7 -0
  71. batchalignhk-0.7.17.post13/batchalign/pipelines/cleanup/support/test.test +6 -0
  72. batchalignhk-0.7.17.post13/batchalign/pipelines/dispatch.py +141 -0
  73. batchalignhk-0.7.17.post13/batchalign/pipelines/fa/__init__.py +2 -0
  74. batchalignhk-0.7.17.post13/batchalign/pipelines/fa/wave2vec_fa.py +163 -0
  75. batchalignhk-0.7.17.post13/batchalign/pipelines/fa/whisper_fa.py +187 -0
  76. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/__init__.py +3 -0
  77. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/coref.py +45 -0
  78. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/en/irr.py +215 -0
  79. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/fr/apm.py +15 -0
  80. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/fr/apmn.py +81 -0
  81. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/fr/case.py +33 -0
  82. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/ja/verbforms.py +147 -0
  83. batchalignhk-0.7.17.post13/batchalign/pipelines/morphosyntax/ud.py +1016 -0
  84. batchalignhk-0.7.17.post13/batchalign/pipelines/pipeline.py +185 -0
  85. batchalignhk-0.7.17.post13/batchalign/pipelines/speaker/__init__.py +1 -0
  86. batchalignhk-0.7.17.post13/batchalign/pipelines/speaker/nemo_speaker.py +65 -0
  87. batchalignhk-0.7.17.post13/batchalign/pipelines/translate/__init__.py +1 -0
  88. batchalignhk-0.7.17.post13/batchalign/pipelines/translate/seamless.py +53 -0
  89. batchalignhk-0.7.17.post13/batchalign/pipelines/utr/__init__.py +2 -0
  90. batchalignhk-0.7.17.post13/batchalign/pipelines/utr/rev_utr.py +97 -0
  91. batchalignhk-0.7.17.post13/batchalign/pipelines/utr/utils.py +69 -0
  92. batchalignhk-0.7.17.post13/batchalign/pipelines/utr/whisper_utr.py +43 -0
  93. batchalignhk-0.7.17.post13/batchalign/pipelines/utterance/__init__.py +1 -0
  94. batchalignhk-0.7.17.post13/batchalign/pipelines/utterance/ud_utterance.py +325 -0
  95. batchalignhk-0.7.17.post13/batchalign/tests/__init__.py +0 -0
  96. batchalignhk-0.7.17.post13/batchalign/tests/conftest.py +53 -0
  97. batchalignhk-0.7.17.post13/batchalign/tests/formats/chat/test_chat_file.py +31 -0
  98. batchalignhk-0.7.17.post13/batchalign/tests/formats/chat/test_chat_generator.py +36 -0
  99. batchalignhk-0.7.17.post13/batchalign/tests/formats/chat/test_chat_lexer.py +13 -0
  100. batchalignhk-0.7.17.post13/batchalign/tests/formats/chat/test_chat_parser.py +208 -0
  101. batchalignhk-0.7.17.post13/batchalign/tests/formats/chat/test_chat_utils.py +36 -0
  102. batchalignhk-0.7.17.post13/batchalign/tests/formats/textgrid/test_textgrid.py +51 -0
  103. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/analysis/test_eval.py +26 -0
  104. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/asr/test_asr_pipeline.py +12 -0
  105. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/asr/test_asr_utils.py +15 -0
  106. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/cleanup/test_disfluency.py +82 -0
  107. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/cleanup/test_parse_support.py +22 -0
  108. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/fa/test_fa_pipeline.py +10 -0
  109. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/fixures.py +43 -0
  110. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/test_pipeline.py +57 -0
  111. batchalignhk-0.7.17.post13/batchalign/tests/pipelines/test_pipeline_models.py +22 -0
  112. batchalignhk-0.7.17.post13/batchalign/tests/test_document.py +33 -0
  113. batchalignhk-0.7.17.post13/batchalign/utils/__init__.py +1 -0
  114. batchalignhk-0.7.17.post13/batchalign/utils/config.py +95 -0
  115. batchalignhk-0.7.17.post13/batchalign/utils/dp.py +224 -0
  116. batchalignhk-0.7.17.post13/batchalign/utils/utils.py +133 -0
  117. batchalignhk-0.7.17.post13/batchalign/version +3 -0
  118. batchalignhk-0.7.17.post13/setup.cfg +4 -0
  119. batchalignhk-0.7.17.post13/setup.py +112 -0
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.2
2
+ Name: BatchalignHK
3
+ Version: 0.7.17.post13
4
+ Summary: Python Speech Language Sample Analysis
5
+ Author: Brian MacWhinney, Houjun Liu
6
+ Author-email: macw@cmu.edu, houjun@cmu.edu
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Topic :: Utilities
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: pydantic>=2.4
12
+ Requires-Dist: nltk>=3.8
13
+ Requires-Dist: praatio<6.1.0,>=6.0.0
14
+ Requires-Dist: torch>=2.6.0
15
+ Requires-Dist: torchaudio
16
+ Requires-Dist: hmmlearn==0.3.0
17
+ Requires-Dist: eyed3
18
+ Requires-Dist: pydub
19
+ Requires-Dist: imblearn
20
+ Requires-Dist: plotly>=5.3.0
21
+ Requires-Dist: transformers>=4.37
22
+ Requires-Dist: tokenizers>=0.14.1
23
+ Requires-Dist: pycountry>=22.3
24
+ Requires-Dist: stanza[transformers]>=1.10.1
25
+ Requires-Dist: scipy~=1.11
26
+ Requires-Dist: rev_ai>=2.18.0
27
+ Requires-Dist: rich~=13.6
28
+ Requires-Dist: click~=8.1
29
+ Requires-Dist: matplotlib<4.0.0,>=3.8.0
30
+ Requires-Dist: pyfiglet==1.0.2
31
+ Requires-Dist: setuptools
32
+ Requires-Dist: soundfile~=0.12.0
33
+ Requires-Dist: rich-click>=1.7.0
34
+ Requires-Dist: typing-extensions
35
+ Requires-Dist: num2words
36
+ Requires-Dist: tiktoken
37
+ Requires-Dist: blobfile
38
+ Requires-Dist: sentencepiece
39
+ Requires-Dist: tencentcloud-sdk-python-common
40
+ Requires-Dist: tencentcloud-sdk-python-asr
41
+ Provides-Extra: dev
42
+ Requires-Dist: pytest; extra == "dev"
43
+ Provides-Extra: train
44
+ Requires-Dist: accelerate~=0.27; extra == "train"
45
+ Dynamic: author
46
+ Dynamic: author-email
47
+ Dynamic: classifier
48
+ Dynamic: description
49
+ Dynamic: description-content-type
50
+ Dynamic: provides-extra
51
+ Dynamic: requires-dist
52
+ Dynamic: summary
53
+
54
+ # TalkBank | Batchalign2
55
+
56
+ Welcome! **Batchalign2** is a Python suite of language sample analysis (LSA) software from the TalkBank project. It is used to interact with conversation audio files and their transcripts, and provides a whole host of analyses within this space.
57
+
58
+ The TalkBank Project, of which Batchalign is a part, is supported by NIH grant HD082736.
59
+
60
+ ----
61
+
62
+ ## Quick Start
63
+
64
+ The following instructions provide a quick start to installing Batchalign. For most users aiming to process CHAT and audio with Batchalign, we recommend more detailed usage instructions: for [usage](https://talkbank.org/info/BA2-usage.pdf) and [human transcript cleanup](https://talkbank.org/info/BA2-cleanup.pdf). The following provides a quick start guide for the program.
65
+
66
+ ### Get Python
67
+ - We support Python versions 3.9, 3.10, 3.11 and 3.12.
68
+ - First, check to see if you have Python by running `python`. If it reports any of the versions above, skip the following step.
69
+ - To install Python, follow the instructions...
70
+ - for macOS
71
+ 1. Install Brew: [visit this link](https://brew.sh/)
72
+ 2. Install Python and Pipx: execute `brew install python@3.11 pipx`
73
+ 3. Copy the pipx path to yours: execute `pipx ensurepath`
74
+ - for Windows
75
+ 1. Install Python 3.11: [via this link](https://www.python.org/ftp/python/3.11.7/python-3.11.7-amd64.exe)
76
+ 2. If later commands report `pip module not found`, [this page may help](https://github.com/TalkBank/batchalign2/wiki/Troubleshooting-Tips#get-pip-on-windows)
77
+ - your distribution's instructions for Linux
78
+
79
+ For first-time users of Python, note that if you didn't install Python 3.11 (as we recommended above), it may be complex to change Python versions downstream and may cause additional problems. We recommend explicitly installing Python 3.11 by installing it explicitly via specifying a version number as we show above.
80
+
81
+ ### Install and Update the Package
82
+ You can get Batchalign from PyPi, and you can update the package in the same way:
83
+
84
+ #### macOS
85
+
86
+ Since Batchalign is a command line program, we recommend using `pipx`, the newly standard environment-based Python program installer, on macOS:
87
+
88
+ ```
89
+ pipx install batchalign --python $(brew --prefix)/bin/python3.11
90
+ ```
91
+
92
+ #### Linux
93
+
94
+ ```
95
+ pip install -U batchalign
96
+ ```
97
+
98
+ #### Windows
99
+
100
+ ```
101
+ py -m pip install -U batchalign
102
+ ```
103
+
104
+ Note that if your system reports `pip: command not found`, replace every use of `pip` in the instructions with `pip3` and try again.
105
+
106
+ ### Rock and Roll
107
+ There are two main ways of interacting with Batchalign. Batchalign can be used as a program to batch-process CHAT (hence the name), or as a Python LSA library.
108
+
109
+ - to get started with the Batchalign program, [tap here](#quick-start-command-line)
110
+ - to get started on the Batchalign Library (assumes familiarity with Python), [tap here](#quick-start-python)
111
+
112
+ ## Quick Start: Command Line
113
+
114
+ ### Basic Usage
115
+
116
+ Once installed, you can invoke the Batchalign program by typing `batchalign` into the Terminal (MacOS) or Command Prompt (Windows).
117
+
118
+ It is used in the following basic way:
119
+
120
+ ```
121
+ batchalign [verb] [input_dir] [output_dir]
122
+ ```
123
+
124
+ Where `verb` includes:
125
+
126
+ 1. `transcribe` - by placing only an audio of video file (`.mp3/.mp4/.wav`) in the input directory, this function performs ASR on the audio, diarizes utterances, identifies some basic conversational features like retracing and filled pauses, and generates word-level alignments. You must supply a language code flag: `--lang=[three letter ISO language code]` for the ASR system to know what language the transcript is in. You can choose the flags `--rev` to use Rev.AI, a commercial ASR service, or `--whisper`, to use a local copy of OpenAI Whisper.
127
+ 2. `align` - by placing both an audio of video file (`.mp3/.mp4/.wav`) and an *utterance-aligned* CHAT file in the input directory, this function recovers utterance-level time alignments (if they are not already annotated) and generates word-level alignments. The @Languages header in the CHAT file tells the program which language is in the transcript.
128
+ 3. `morphotag` - by placing a CHAT file in the input directory, this function uses Stanford NLP Stanza to generate morphological and dependency analyses. The @Languages header in the CHAT file tells the program which language is in the transcript. You must supply a language code flag: `--lang=[three letter ISO language code]` for the alignment system to know what language the transcript is in.
129
+ <!-- 4. `bulletize` - placing both an audio of video file (`.mp3/.mp4/.wav`) and an *unlinked* CHAT file in the input directory, generate utterance-level alignments through ASR -->
130
+
131
+ You can get a CHAT transcript to experiment with [at the TalkBank website](https://talkbank.org/), under any of the "Banks" that are available. You can also generate and parse a CHAT transcript via [the Python program](https://github.com/TalkBank/batchalign2?tab=readme-ov-file#chat).
132
+
133
+ ### Sample Commands
134
+ For input files (CHAT and audio for `align`, CHAT only for `morphotag`, and audio only for `transcribe`), located in `~/ba_input` dumping the output to `~/ba_output`, one could write:
135
+
136
+ #### ASR + Segmentation
137
+
138
+ ```
139
+ batchalign transcribe --lang=eng ~/ba_input ~/ba_output
140
+ ```
141
+
142
+ #### morphosyntactic analysis
143
+
144
+ ```
145
+ batchalign morphotag ~/ba_input ~/ba_output
146
+ ```
147
+
148
+ #### forced alignment
149
+
150
+ ```
151
+ batchalign align ~/ba_input ~/ba_output
152
+ ```
153
+
154
+
155
+ -----
156
+
157
+ Follow instructions from
158
+
159
+ ```
160
+ batchalign --help
161
+ ```
162
+
163
+ and
164
+
165
+ ```
166
+ batchalign [verb] --help
167
+ ```
168
+
169
+ to learn more about other options.
170
+
171
+ ### Verbosity
172
+
173
+ Placing one or multiple `-v` *behind the word `batchalign`* (i.e. behind the `[verb]` will not work) increases the verbosity of Batchalign. The default mode and one `-v` will use the normal Batchalign interface, whereas Batchalign with more than 1 `-v` will switch to the text-based "logging" interface.
174
+
175
+ For instance, here is the instruction for running Batchalign to perform forced-alignment:
176
+
177
+ ```
178
+ batchalign align input output
179
+ ```
180
+
181
+ With one `-v`, you can get stack trace information about any files that crashes:
182
+
183
+ ```
184
+ batchalign -v align input output
185
+ ```
186
+
187
+ and with two `-vv`, we will ditch the loading bar user interface and instead switch to a logging-based interface that has more information about what Batchalign is doing under the hood:
188
+
189
+ ```
190
+ batchalign -vv align input output
191
+ ```
192
+
193
+ ## Quick Start: Python
194
+
195
+ Let's begin!
196
+
197
+ ```python
198
+ import batchalign as ba
199
+ ```
200
+
201
+ ### Document
202
+ The `Document` is the most basic object in Bachalign. All processing pipelines expect `Document` as input, and will spit out `Document` as output.
203
+
204
+ ```python
205
+ doc = ba.Document.new("Hello, this is a transcript! I have two utterances.",
206
+ media_path="audio.mp3", lang="eng")
207
+
208
+ # navigating the document
209
+ first_utterance = doc[0]
210
+ first_form = doc[0][0]
211
+ the_comma = doc[0][1]
212
+
213
+ assert the_comma.text == ','
214
+ assert the_comma.type == ba.TokenType.PUNCT
215
+
216
+ # taking a transcript
217
+ sentences = doc.transcript(include_tiers=False, strip=True)
218
+ ```
219
+
220
+ Notably, if you have a Document that you haven't transcribed yet, you still can make a Document!
221
+
222
+ ```python
223
+ doc = ba.Document.new(media_path="audio.mp3", lang="eng")
224
+ ```
225
+
226
+ ### Pipelines
227
+ <!-- You can process the language samples you got (perform ASR, forced alignment, utterance segmentation, and more!) via `BatchalignPipeline`. There are two levels of access to this API: you can either create a pipeline and use our default settings, or create and customize the underlying `BatchalignEngine`s yourself to perform processing. -->
228
+
229
+ #### Quick Pipeline
230
+ Say you wanted to perform ASR, and then tag morphology of the resulting output.
231
+
232
+ ```python
233
+ nlp = ba.BatchalignPipeline.new("asr,morphosyntax", lang="eng", num_speakers=2)
234
+ doc = ba.Document.new(media_path="audio.mp3", lang="eng")
235
+ doc = nlp(doc) # this is equivalent to nlp("audio.mp3"), we will make the initial doc for you
236
+
237
+ first_word_pos = doc[0][0].morphology
238
+ first_word_time = doc[0][0].time
239
+ first_utterance_time = doc[0].alignment
240
+ ```
241
+
242
+ The quick API (right now) has support for the following tasks, which you can pass in a comma-separated list in the first argument:
243
+
244
+ - `asr`: ASR!
245
+ - `morphosyntax`: PoS and dependency analysis
246
+ - `fa`: Forced Alignment (require utterance-level timings already)
247
+
248
+ We will support many, many, many more tasks soon with this API. For now, to gain access to the whole suite of tools, use the second pipeline API discussed below.
249
+
250
+ #### Manual Pipeline
251
+ Batchalign ships with a plurality of engines which preform the actual processing. For instance, to recreate the demo we had above using the Engines API, we would write
252
+
253
+ ```python
254
+ # ASR
255
+ whisper = ba.WhisperEngine(lang="eng")
256
+ # retracing and disfluency analysis
257
+ retrace = ba.NgramRetraceEngine()
258
+ disfluency = ba.DisfluencyReplacementEngine()
259
+ # morphosyntax
260
+ morphosyntax = ba.StanzaEngine()
261
+
262
+ # create a pipeline
263
+ nlp = ba.BatchalignPipeline(whisper, retrace, disfluency, morphosyntax)
264
+
265
+ # and run it!
266
+ doc = nlp("audio.mp3")
267
+ ```
268
+
269
+ [Here's a list](https://github.com/TalkBank/batchalign2/blob/master/batchalign/pipelines/__init__.py) of available engines.
270
+
271
+ ### Formats
272
+ We currently support reading and writing two transcript formats: TalkBank CHAT, and Praat TextGrid.
273
+
274
+ #### CHAT
275
+
276
+ Here's how to read and write a CHAT file to parse a TalkBank transcript!
277
+
278
+ ```python
279
+ # reading
280
+ chat = ba.CHATFile(path="chat.cha")
281
+ doc = chat.doc
282
+
283
+ # writing
284
+ chat = ba.CHATFile(doc=doc)
285
+ chat.write("chat.cha")
286
+ ```
287
+
288
+ We will automatically detect audio files located within the same directory as the CHAT file, and associate it with the Batchalign Document.
289
+
290
+ #### TextGrid
291
+
292
+ Importantly, there are two ways a TextGrid could be written: we can either place each **utterance** in an individual `IntervalTier`, or each **word** in its own `IntervalTier`; we leave that decision up to you. To learn more about TextGrid, [visit this page](https://github.com/timmahrt/praatIO).
293
+
294
+ ```python
295
+ # reading; recall we can either interpret each IntervalTier as a word or utterance
296
+ tg_utterance = ba.TextGridFile("utterance", path="tg_ut.TextGrid", lang="eng")
297
+ tg_word = ba.TextGridFile("word", path="tg_w.TextGrid", lang="eng")
298
+
299
+ doc1 = tg_utterance.doc
300
+ doc2 = tg_word.doc
301
+
302
+ # writing
303
+ tg_utterance = ba.TextGridFile("utterance", doc=doc1)
304
+ tg_word = ba.TextGridFile("word", doc=doc2)
305
+
306
+ tg_utterance.write("tg_ut.TextGrid")
307
+ tg_word.write("tg_w.TextGrid")
308
+ ```
309
+ ## Questions?
310
+ If you have any questions or concerns, please reach out! If something isn't working right, [open an issue on GitHub](https://github.com/TalkBank/batchalign2/issues); if you need support, please feel free to email `houjun@cmu.edu` and `macw@cmu.edu`.
311
+
@@ -0,0 +1,117 @@
1
+ LICENSE
2
+ MANIFEST.in
3
+ README.md
4
+ setup.py
5
+ BatchalignHK.egg-info/PKG-INFO
6
+ BatchalignHK.egg-info/SOURCES.txt
7
+ BatchalignHK.egg-info/dependency_links.txt
8
+ BatchalignHK.egg-info/entry_points.txt
9
+ BatchalignHK.egg-info/requires.txt
10
+ BatchalignHK.egg-info/top_level.txt
11
+ batchalign/__init__.py
12
+ batchalign/__main__.py
13
+ batchalign/constants.py
14
+ batchalign/document.py
15
+ batchalign/errors.py
16
+ batchalign/version
17
+ batchalign/cli/__init__.py
18
+ batchalign/cli/cli.py
19
+ batchalign/cli/dispatch.py
20
+ batchalign/formats/__init__.py
21
+ batchalign/formats/base.py
22
+ batchalign/formats/chat/__init__.py
23
+ batchalign/formats/chat/file.py
24
+ batchalign/formats/chat/generator.py
25
+ batchalign/formats/chat/lexer.py
26
+ batchalign/formats/chat/parser.py
27
+ batchalign/formats/chat/utils.py
28
+ batchalign/formats/textgrid/__init__.py
29
+ batchalign/formats/textgrid/file.py
30
+ batchalign/formats/textgrid/generator.py
31
+ batchalign/formats/textgrid/parser.py
32
+ batchalign/models/__init__.py
33
+ batchalign/models/resolve.py
34
+ batchalign/models/utils.py
35
+ batchalign/models/speaker/__init__.py
36
+ batchalign/models/speaker/config.yaml
37
+ batchalign/models/speaker/infer.py
38
+ batchalign/models/speaker/utils.py
39
+ batchalign/models/training/__init__.py
40
+ batchalign/models/training/run.py
41
+ batchalign/models/training/utils.py
42
+ batchalign/models/utterance/__init__.py
43
+ batchalign/models/utterance/cantonese_infer.py
44
+ batchalign/models/utterance/dataset.py
45
+ batchalign/models/utterance/execute.py
46
+ batchalign/models/utterance/infer.py
47
+ batchalign/models/utterance/prep.py
48
+ batchalign/models/utterance/train.py
49
+ batchalign/models/wave2vec/__init__.py
50
+ batchalign/models/wave2vec/infer_fa.py
51
+ batchalign/models/whisper/__init__.py
52
+ batchalign/models/whisper/infer_asr.py
53
+ batchalign/models/whisper/infer_fa.py
54
+ batchalign/pipelines/__init__.py
55
+ batchalign/pipelines/base.py
56
+ batchalign/pipelines/dispatch.py
57
+ batchalign/pipelines/pipeline.py
58
+ batchalign/pipelines/analysis/__init__.py
59
+ batchalign/pipelines/analysis/eval.py
60
+ batchalign/pipelines/asr/__init__.py
61
+ batchalign/pipelines/asr/num2chinese.py
62
+ batchalign/pipelines/asr/rev.py
63
+ batchalign/pipelines/asr/tencent.py
64
+ batchalign/pipelines/asr/utils.py
65
+ batchalign/pipelines/asr/whisper.py
66
+ batchalign/pipelines/asr/whisperx.py
67
+ batchalign/pipelines/cleanup/__init__.py
68
+ batchalign/pipelines/cleanup/cleanup.py
69
+ batchalign/pipelines/cleanup/disfluencies.py
70
+ batchalign/pipelines/cleanup/parse_support.py
71
+ batchalign/pipelines/cleanup/retrace.py
72
+ batchalign/pipelines/cleanup/support/filled_pauses.eng
73
+ batchalign/pipelines/cleanup/support/replacements.eng
74
+ batchalign/pipelines/cleanup/support/test.test
75
+ batchalign/pipelines/fa/__init__.py
76
+ batchalign/pipelines/fa/wave2vec_fa.py
77
+ batchalign/pipelines/fa/whisper_fa.py
78
+ batchalign/pipelines/morphosyntax/__init__.py
79
+ batchalign/pipelines/morphosyntax/coref.py
80
+ batchalign/pipelines/morphosyntax/ud.py
81
+ batchalign/pipelines/morphosyntax/en/irr.py
82
+ batchalign/pipelines/morphosyntax/fr/apm.py
83
+ batchalign/pipelines/morphosyntax/fr/apmn.py
84
+ batchalign/pipelines/morphosyntax/fr/case.py
85
+ batchalign/pipelines/morphosyntax/ja/verbforms.py
86
+ batchalign/pipelines/speaker/__init__.py
87
+ batchalign/pipelines/speaker/nemo_speaker.py
88
+ batchalign/pipelines/translate/__init__.py
89
+ batchalign/pipelines/translate/seamless.py
90
+ batchalign/pipelines/utr/__init__.py
91
+ batchalign/pipelines/utr/rev_utr.py
92
+ batchalign/pipelines/utr/utils.py
93
+ batchalign/pipelines/utr/whisper_utr.py
94
+ batchalign/pipelines/utterance/__init__.py
95
+ batchalign/pipelines/utterance/ud_utterance.py
96
+ batchalign/tests/__init__.py
97
+ batchalign/tests/conftest.py
98
+ batchalign/tests/test_document.py
99
+ batchalign/tests/formats/chat/test_chat_file.py
100
+ batchalign/tests/formats/chat/test_chat_generator.py
101
+ batchalign/tests/formats/chat/test_chat_lexer.py
102
+ batchalign/tests/formats/chat/test_chat_parser.py
103
+ batchalign/tests/formats/chat/test_chat_utils.py
104
+ batchalign/tests/formats/textgrid/test_textgrid.py
105
+ batchalign/tests/pipelines/fixures.py
106
+ batchalign/tests/pipelines/test_pipeline.py
107
+ batchalign/tests/pipelines/test_pipeline_models.py
108
+ batchalign/tests/pipelines/analysis/test_eval.py
109
+ batchalign/tests/pipelines/asr/test_asr_pipeline.py
110
+ batchalign/tests/pipelines/asr/test_asr_utils.py
111
+ batchalign/tests/pipelines/cleanup/test_disfluency.py
112
+ batchalign/tests/pipelines/cleanup/test_parse_support.py
113
+ batchalign/tests/pipelines/fa/test_fa_pipeline.py
114
+ batchalign/utils/__init__.py
115
+ batchalign/utils/config.py
116
+ batchalign/utils/dp.py
117
+ batchalign/utils/utils.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ batchalign = batchalign.cli.cli:batchalign
@@ -0,0 +1,36 @@
1
+ pydantic>=2.4
2
+ nltk>=3.8
3
+ praatio<6.1.0,>=6.0.0
4
+ torch>=2.6.0
5
+ torchaudio
6
+ hmmlearn==0.3.0
7
+ eyed3
8
+ pydub
9
+ imblearn
10
+ plotly>=5.3.0
11
+ transformers>=4.37
12
+ tokenizers>=0.14.1
13
+ pycountry>=22.3
14
+ stanza[transformers]>=1.10.1
15
+ scipy~=1.11
16
+ rev_ai>=2.18.0
17
+ rich~=13.6
18
+ click~=8.1
19
+ matplotlib<4.0.0,>=3.8.0
20
+ pyfiglet==1.0.2
21
+ setuptools
22
+ soundfile~=0.12.0
23
+ rich-click>=1.7.0
24
+ typing-extensions
25
+ num2words
26
+ tiktoken
27
+ blobfile
28
+ sentencepiece
29
+ tencentcloud-sdk-python-common
30
+ tencentcloud-sdk-python-asr
31
+
32
+ [dev]
33
+ pytest
34
+
35
+ [train]
36
+ accelerate~=0.27
@@ -0,0 +1,11 @@
1
+ Copyright 2024 Brian MacWhinney
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,4 @@
1
+ recursive-include batchalign *.py
2
+ include batchalign/version
3
+ include batchalign/pipelines/cleanup/support/*
4
+ include batchalign/models/speaker/*.yaml