From 6ba1e63c412a726c1fae0aa69d2efdfb9a0f5a89 Mon Sep 17 00:00:00 2001 From: Xinyuan Li Date: Wed, 24 Jan 2024 23:38:35 -0500 Subject: [PATCH] Small change to avoid hardcoded change in make_kn_lm.py Signed-off-by: Xinyuan Li --- icefall/shared/make_kn_lm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/icefall/shared/make_kn_lm.py b/icefall/shared/make_kn_lm.py index c7f77be28..14af1c242 100755 --- a/icefall/shared/make_kn_lm.py +++ b/icefall/shared/make_kn_lm.py @@ -169,7 +169,10 @@ class NgramCounts: with open(filename, encoding=default_encoding) as fp: for line in fp: line = line.strip(strip_chars) - self.add_raw_counts_from_line(line.split()[0]) + if self.ngram_order == 1: + self.add_raw_counts_from_line(line.split()[0]) + else: + self.add_raw_counts_from_line(line) lines_processed += 1 if lines_processed == 0 or args.verbose > 0: print(