flashctc 0.7.0__py3-none-any.whl
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.
- flashctc/__init__.py +6 -0
- flashctc/alphabet.py +176 -0
- flashctc/constants.py +18 -0
- flashctc/decoder.py +1151 -0
- flashctc/flashlight_backend.py +335 -0
- flashctc/language_model.py +519 -0
- flashctc/py.typed +0 -0
- flashctc-0.7.0.dist-info/METADATA +213 -0
- flashctc-0.7.0.dist-info/RECORD +13 -0
- flashctc-0.7.0.dist-info/WHEEL +4 -0
- flashctc-0.7.0.dist-info/licenses/AUTHORS.md +10 -0
- flashctc-0.7.0.dist-info/licenses/LICENSE +202 -0
- flashctc-0.7.0.dist-info/licenses/NOTICE +12 -0
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: flashctc
|
|
3
|
+
Version: 0.7.0
|
|
4
|
+
Summary: CTC beam search decoder for speech recognition, with an optional flashlight-text C++ backend.
|
|
5
|
+
Keywords: ctc,beam search,speech recognition,asr,kenlm,language model,decoder
|
|
6
|
+
Author: Kensho Technologies, LLC., Yehor Smoliakov
|
|
7
|
+
Author-email: Yehor Smoliakov <egorsmkv@gmail.com>
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: AUTHORS.md
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: NOTICE
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
26
|
+
Classifier: Typing :: Typed
|
|
27
|
+
Requires-Dist: camel-kenlm>=2026.2.7
|
|
28
|
+
Requires-Dist: numpy>=1.15.0,<3.0.0
|
|
29
|
+
Requires-Dist: pygtrie>=2.1,<3.0
|
|
30
|
+
Requires-Dist: flashlight-text>=0.0.7 ; extra == 'flashlight'
|
|
31
|
+
Requires-Dist: sentencepiece>=0.1.99 ; extra == 'flashlight'
|
|
32
|
+
Requires-Dist: huggingface-hub ; extra == 'hub'
|
|
33
|
+
Maintainer: Yehor Smoliakov
|
|
34
|
+
Maintainer-email: Yehor Smoliakov <egorsmkv@gmail.com>
|
|
35
|
+
Requires-Python: >=3.10
|
|
36
|
+
Project-URL: Homepage, https://github.com/BitingSnakes/flashctc
|
|
37
|
+
Project-URL: Source, https://github.com/BitingSnakes/flashctc
|
|
38
|
+
Project-URL: Issues, https://github.com/BitingSnakes/flashctc/issues
|
|
39
|
+
Project-URL: Tutorials, https://github.com/BitingSnakes/flashctc/tree/main/tutorials
|
|
40
|
+
Project-URL: Upstream, https://github.com/kensho-technologies/pyctcdecode
|
|
41
|
+
Provides-Extra: flashlight
|
|
42
|
+
Provides-Extra: hub
|
|
43
|
+
Description-Content-Type: text/markdown
|
|
44
|
+
|
|
45
|
+
<a href="https://github.com/BitingSnakes/flashctc/actions?query=workflow%3A%22Tests+and+lint%22"><img src="https://github.com/BitingSnakes/flashctc/workflows/Tests%20and%20lint/badge.svg" /></a>
|
|
46
|
+
<a href="https://pypi.org/project/flashctc/"><img src="https://img.shields.io/pypi/v/flashctc.svg" /></a>
|
|
47
|
+
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" /></a>
|
|
48
|
+
<a href="http://www.repostatus.org/#active"><img src="http://www.repostatus.org/badges/latest/active.svg" /></a>
|
|
49
|
+
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" /></a>
|
|
50
|
+
|
|
51
|
+
## flashctc
|
|
52
|
+
|
|
53
|
+
`flashctc` is a fork of [pyctcdecode](https://github.com/kensho-technologies/pyctcdecode) by Kensho Technologies, with fixes from the upstream pull requests, NumPy 2 support and an optional C++ beam search backend built on [flashlight-text](https://github.com/flashlight/text). The Python API is the same as pyctcdecode's: replace `import pyctcdecode` with `import flashctc`.
|
|
54
|
+
|
|
55
|
+
A fast and feature-rich CTC beam search decoder for speech recognition written in Python, providing n-gram (kenlm) language model support similar to PaddlePaddle's decoder, but incorporating many new features such as byte pair encoding and real-time decoding to support models like Nvidia's [Conformer-CTC](https://github.com/BitingSnakes/flashctc/blob/main/tutorials/01_pipeline_nemo.ipynb) or Facebook's [Wav2Vec2](https://github.com/BitingSnakes/flashctc/blob/main/tutorials/02_pipeline_huggingface.ipynb).
|
|
56
|
+
|
|
57
|
+
``` bash
|
|
58
|
+
pip install flashctc
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The KenLM bindings come with it, from [camel-kenlm](https://github.com/CAMeL-Lab/camel-kenlm) (prebuilt wheels for Linux and macOS; on Windows pip builds it from source). Uninstall the official `kenlm` package first if you have it: both provide `import kenlm`.
|
|
62
|
+
|
|
63
|
+
### Main Features:
|
|
64
|
+
|
|
65
|
+
- 🔥 hotword boosting
|
|
66
|
+
- 🤖 handling of BPE vocabulary
|
|
67
|
+
- 👥 multi-LM support for 2+ models
|
|
68
|
+
- 🕒 stateful LM for real-time decoding
|
|
69
|
+
- ✨ native frame index annotation of words
|
|
70
|
+
- 💨 fast runtime, comparable to C++ implementation
|
|
71
|
+
- 🐍 easy-to-modify Python code
|
|
72
|
+
|
|
73
|
+
### Quick Start:
|
|
74
|
+
|
|
75
|
+
``` python
|
|
76
|
+
from flashctc import build_ctcdecoder
|
|
77
|
+
|
|
78
|
+
# specify alphabet labels as they appear in logits
|
|
79
|
+
labels = [
|
|
80
|
+
" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
|
|
81
|
+
"m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
|
|
82
|
+
]
|
|
83
|
+
|
|
84
|
+
# prepare decoder and decode logits via shallow fusion
|
|
85
|
+
decoder = build_ctcdecoder(
|
|
86
|
+
labels,
|
|
87
|
+
kenlm_model_path="/my/dir/kenlm_model.arpa", # either .arpa or .bin file
|
|
88
|
+
alpha=0.5, # tuned on a val set
|
|
89
|
+
beta=1.0, # tuned on a val set
|
|
90
|
+
)
|
|
91
|
+
text = decoder.decode(logits)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If the vocabulary is BPE-based, `flashctc` will automatically recognize that and handled token merging automatically.
|
|
95
|
+
|
|
96
|
+
_(Note: the LM itself has no notion of this and is still word-based.)_
|
|
97
|
+
|
|
98
|
+
``` python
|
|
99
|
+
labels = ["<unk>", "▁bug", "s", "▁bunny"]
|
|
100
|
+
|
|
101
|
+
decoder = build_ctcdecoder(
|
|
102
|
+
labels,
|
|
103
|
+
kenlm_model_path,
|
|
104
|
+
)
|
|
105
|
+
text = decoder.decode(logits)
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Improve domain specificity by adding important contextual words ("hotwords") during inference:
|
|
109
|
+
|
|
110
|
+
``` python
|
|
111
|
+
hotwords = ["looney tunes", "anthropomorphic"]
|
|
112
|
+
text = decoder.decode(
|
|
113
|
+
logits,
|
|
114
|
+
hotwords=hotwords,
|
|
115
|
+
hotword_weight=10.0,
|
|
116
|
+
)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
_(Note: `flashctc` contains several free hyperparameters
|
|
120
|
+
that can strongly influence error rate and wall time. Default values
|
|
121
|
+
for these parameters were (merely) chosen in order to yield good
|
|
122
|
+
performance for one particular use case. For best results, especially
|
|
123
|
+
when working with languages other than English, users are encouraged
|
|
124
|
+
to perform a hyperparameter optimization study on their own data.)_
|
|
125
|
+
|
|
126
|
+
Batch support via multiprocessing:
|
|
127
|
+
|
|
128
|
+
``` python
|
|
129
|
+
import multiprocessing
|
|
130
|
+
|
|
131
|
+
with multiprocessing.get_context("fork").Pool() as pool:
|
|
132
|
+
text_list = decoder.decode_batch(pool, logits_list)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Use `flashctc` for a pretrained Conformer-CTC model:
|
|
136
|
+
|
|
137
|
+
``` python
|
|
138
|
+
import nemo.collections.asr as nemo_asr
|
|
139
|
+
|
|
140
|
+
asr_model = nemo_asr.models.EncDecCTCModelBPE.from_pretrained(
|
|
141
|
+
model_name='stt_en_conformer_ctc_small'
|
|
142
|
+
)
|
|
143
|
+
logits = asr_model.transcribe(["my_file.wav"], logprobs=True)[0]
|
|
144
|
+
|
|
145
|
+
decoder = build_ctcdecoder(asr_model.decoder.vocabulary)
|
|
146
|
+
decoder.decode(logits)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
The tutorials folder contains many well documented notebook examples on how to run speech recognition using pretrained models from Nvidia's [NeMo](https://github.com/NVIDIA/NeMo) and Huggingface/Facebook's [Wav2Vec2](https://huggingface.co/transformers/model_doc/wav2vec2.html).
|
|
150
|
+
|
|
151
|
+
For more details on how to use all of the features, have a look at the [main tutorial](https://github.com/BitingSnakes/flashctc/blob/main/tutorials/00_basic_usage.ipynb).
|
|
152
|
+
|
|
153
|
+
### Faster decoding: flashlight-text backend (experimental)
|
|
154
|
+
|
|
155
|
+
An optional backend runs the beam search in C++ with
|
|
156
|
+
[flashlight-text](https://github.com/flashlight/text) (`pip install flashctc[flashlight]`;
|
|
157
|
+
flashlight-text has prebuilt wheels up to Python 3.12).
|
|
158
|
+
It needs a KenLM word model; BPE alphabets also need the SentencePiece model of the acoustic
|
|
159
|
+
model, to spell the words of the unigram list in pieces:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from flashctc.flashlight_backend import FlashlightBeamSearchDecoderCTC
|
|
163
|
+
|
|
164
|
+
decoder = FlashlightBeamSearchDecoderCTC(labels, "/my/dir/kenlm_model.arpa", unigrams)
|
|
165
|
+
# BPE: decoder = FlashlightBeamSearchDecoderCTC(
|
|
166
|
+
# labels, "/my/dir/kenlm_model.arpa", unigrams, tokenizer_model_path="/my/dir/tokenizer.model"
|
|
167
|
+
# )
|
|
168
|
+
decoder.decode(logits)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Measured against the Python decoder, with the backend's defaults:
|
|
172
|
+
|
|
173
|
+
| model | words outside the unigram list | WER (python / flashlight) | decoding speed-up |
|
|
174
|
+
|---|---|---|---|
|
|
175
|
+
| Wav2Vec2-BERT CTC, 512 SentencePiece pieces, 493 clips (45 min) | 8.7% | 5.72% / 5.76% | 5.7x |
|
|
176
|
+
| LibriSpeech character logits, 200k words ([`scripts/benchmark_flashlight.py`](https://github.com/BitingSnakes/flashctc/blob/main/scripts/benchmark_flashlight.py)) | - | same text | 1x |
|
|
177
|
+
|
|
178
|
+
It does not support hotwords, multiple language models or streaming decoding. Its
|
|
179
|
+
`unk_score_offset` (-5) and `beam_prune_logp` (-15) defaults differ from the Python decoder's,
|
|
180
|
+
because flashlight applies the penalty for out-of-vocabulary words at once; see the notes in
|
|
181
|
+
[`flashctc/flashlight_backend.py`](https://github.com/BitingSnakes/flashctc/blob/main/flashctc/flashlight_backend.py). With fewer out-of-vocabulary words, `beam_prune_logp=-10`
|
|
182
|
+
and `unk_score_offset=-10` decode several times faster.
|
|
183
|
+
|
|
184
|
+
### Why a decoder in Python?
|
|
185
|
+
|
|
186
|
+
_(From the pyctcdecode authors.)_ In scientific computing, there’s often a tension between a language’s performance and its ease of use for prototyping and experimentation. Although C++ is the conventional choice for CTC decoders, we decided to try building one in Python. This choice allowed us to easily implement experimental features, while keeping runtime competitive through optimizations like caching and beam pruning. We compare the performance of `pyctcdecode` to an industry standard C++ decoder at various beam widths (shown as inline annotations), allowing us to visualize the trade-off of word error rate (y-axis) vs runtime (x-axis). For beam widths of 10 or greater, pyctcdecode yields strictly superior performance, with lower error rates in less time, see code [here](https://github.com/BitingSnakes/flashctc/blob/main/tutorials/03_eval_performance.ipynb).
|
|
187
|
+
|
|
188
|
+
<p align="center"><img src="https://raw.githubusercontent.com/BitingSnakes/flashctc/main/docs/images/performance.png"></p>
|
|
189
|
+
|
|
190
|
+
The use of Python allows us to easily implement features like hotword support with only a few lines of code.
|
|
191
|
+
|
|
192
|
+
<p align="center"><img width="800px" src="https://raw.githubusercontent.com/BitingSnakes/flashctc/main/docs/images/hotwords.png"></p>
|
|
193
|
+
|
|
194
|
+
The decoder can return either a single transcript, or the full results of the beam search algorithm. The latter provides the language model state to enable real-time inference as well as word-based logit indices (frames) to enable word-based timing and confidence score calculations natively through the decoding process.
|
|
195
|
+
|
|
196
|
+
<p align="center"><img width="450px" src="https://raw.githubusercontent.com/BitingSnakes/flashctc/main/docs/images/beam_output.png"></p>
|
|
197
|
+
|
|
198
|
+
Additional features such as BPE vocabulary, as well as examples of `flashctc` as part of a full speech recognition pipeline, can be found in the [tutorials section](https://github.com/BitingSnakes/flashctc/tree/main/tutorials).
|
|
199
|
+
|
|
200
|
+
### Resources:
|
|
201
|
+
|
|
202
|
+
- [NeMo](https://github.com/NVIDIA/NeMo) and [Wav2Vec2](https://huggingface.co/transformers/model_doc/wav2vec2.html)
|
|
203
|
+
- [CTC blog post](https://distill.pub/2017/ctc/)
|
|
204
|
+
- [Beam search](https://www.youtube.com/watch?v=RLWuzLLSIgw) by Andrew Ng
|
|
205
|
+
- Talks on beam search and pyctcdecode ([Longer talk](https://www.youtube.com/watch?v=CDuvVL0z_xk) and [Shorter talk](https://www.youtube.com/watch?v=mp7fHMTnK9A))
|
|
206
|
+
|
|
207
|
+
### License:
|
|
208
|
+
|
|
209
|
+
Licensed under the Apache 2.0 License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
210
|
+
|
|
211
|
+
Copyright 2021-present Kensho Technologies, LLC. The present date is determined by the timestamp of the most recent commit in the repository.
|
|
212
|
+
|
|
213
|
+
Modifications copyright 2026-present Yehor Smoliakov (egorsmkv@gmail.com). This fork modifies the original work; see [NOTICE](https://github.com/BitingSnakes/flashctc/blob/main/NOTICE).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
flashctc/__init__.py,sha256=12PFZJfRha8hRuaSubBW6OVKai6BwEAjD0Dcd816Elc,269
|
|
2
|
+
flashctc/alphabet.py,sha256=y1DHW3xbFQrLHoZIqblVagYhESrcKn7wk_LPXQSmRP8,7213
|
|
3
|
+
flashctc/constants.py,sha256=Bgo_0Y_B1R14-nkATpyQ8fMO_VabV1e6tm9dJojwtck,667
|
|
4
|
+
flashctc/decoder.py,sha256=BWk5eDbxdLvZYYBR2r993Cy7o2_lb2HVNiUuoSOQDaE,46289
|
|
5
|
+
flashctc/flashlight_backend.py,sha256=svHhNn2op1YuX5CzCrdNr5iatA3jsNlwCcqng5-IqkU,16260
|
|
6
|
+
flashctc/language_model.py,sha256=_bpGGp9AxFjuuruNyDPV6aGvR_3a2WT6nYEyX2vNfKo,20801
|
|
7
|
+
flashctc/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
+
flashctc-0.7.0.dist-info/licenses/AUTHORS.md,sha256=Q8UkWWchrg5mdyc8A53Zww7e9AHBbChisTfYheA_UnM,205
|
|
9
|
+
flashctc-0.7.0.dist-info/licenses/LICENSE,sha256=3CkxYE8cBhlOIBOwDLT0kR3j-RWZi6VShTTtinFEsK4,11364
|
|
10
|
+
flashctc-0.7.0.dist-info/licenses/NOTICE,sha256=CS61Towz4reU4_5H9lJEKzlyZ9mTtmlG3a--LvsJzqk,678
|
|
11
|
+
flashctc-0.7.0.dist-info/WHEEL,sha256=wfHFB5CQ4yOA68LQ_ISeFjKJGxj2GfVzMH9QxkYgrCw,81
|
|
12
|
+
flashctc-0.7.0.dist-info/METADATA,sha256=wg80SJSSgAHjghbehDe_F_GUDv93Tww21O5jVRBYZHo,11622
|
|
13
|
+
flashctc-0.7.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2021-present Kensho Technologies, LLC.
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
flashctc
|
|
2
|
+
Copyright 2021-present Kensho Technologies, LLC.
|
|
3
|
+
Modifications copyright 2026-present Yehor Smoliakov <egorsmkv@gmail.com>.
|
|
4
|
+
|
|
5
|
+
This product is a modified version of pyctcdecode
|
|
6
|
+
(https://github.com/kensho-technologies/pyctcdecode), developed by Kensho Technologies, LLC.
|
|
7
|
+
and licensed under the Apache License, Version 2.0.
|
|
8
|
+
|
|
9
|
+
Changes from pyctcdecode 0.6.0 include: renaming the package to flashctc, fixes from upstream
|
|
10
|
+
pull requests, NumPy 2 support, KenLM bindings from camel-kenlm, and an optional beam search backend built on flashlight-text
|
|
11
|
+
(flashctc/flashlight_backend.py). See the git history of
|
|
12
|
+
https://github.com/BitingSnakes/flashctc for the full list of changes.
|