Skip to content

Commit

Permalink
Fix kenlm loading in readme (#62)
Browse files Browse the repository at this point in the history
* Fix kenlm loading in readme.

* Update __init__.py

Co-authored-by: Jeremy Lopez <lopez86@users.noreply.github.com>
  • Loading branch information
DanBmh and lopez86 authored Apr 20, 2022
1 parent 2fd33dc commit 9071d50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@ pip install pyctcdecode
### Quick Start:

``` python
import kenlm
from pyctcdecode import build_ctcdecoder

# load trained kenlm model
kenlm_model = kenlm.Model("/my/dir/kenlm_model.arpa")

# specify alphabet labels as they appear in logits
labels = [
" ", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l",
Expand All @@ -40,7 +36,7 @@ labels = [
# prepare decoder and decode logits via shallow fusion
decoder = build_ctcdecoder(
labels,
kenlm_model,
kenlm_model_path="/my/dir/kenlm_model.arpa", # either .arpa or .bin file
alpha=0.5, # tuned on a val set
beta=1.0, # tuned on a val set
)
Expand All @@ -56,7 +52,7 @@ labels = ["<unk>", "▁bug", "s", "▁bunny"]

decoder = build_ctcdecoder(
labels,
kenlm_model,
kenlm_model_path,
)
text = decoder.decode(logits)
```
Expand Down
2 changes: 1 addition & 1 deletion pyctcdecode/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@


__package_name__ = "pyctcdecode"
__version__ = "0.3.3"
__version__ = "0.3.4"

0 comments on commit 9071d50

Please sign in to comment.