From 9071d5091387579b4722cfcbe0c8597ad0b16227 Mon Sep 17 00:00:00 2001 From: DanBmh Date: Wed, 20 Apr 2022 21:31:30 +0200 Subject: [PATCH] Fix kenlm loading in readme (#62) * Fix kenlm loading in readme. * Update __init__.py Co-authored-by: Jeremy Lopez --- README.md | 8 ++------ pyctcdecode/__init__.py | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 8f1c432..2c92092 100644 --- a/README.md +++ b/README.md @@ -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", @@ -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 ) @@ -56,7 +52,7 @@ labels = ["", "▁bug", "s", "▁bunny"] decoder = build_ctcdecoder( labels, - kenlm_model, + kenlm_model_path, ) text = decoder.decode(logits) ``` diff --git a/pyctcdecode/__init__.py b/pyctcdecode/__init__.py index 0d1cf53..b60c7b4 100644 --- a/pyctcdecode/__init__.py +++ b/pyctcdecode/__init__.py @@ -5,4 +5,4 @@ __package_name__ = "pyctcdecode" -__version__ = "0.3.3" +__version__ = "0.3.4"