From ab4471551a3fbeedf5658304598333111e46b78a Mon Sep 17 00:00:00 2001 From: Peter Roelants Date: Fri, 26 Apr 2024 19:49:56 +0200 Subject: [PATCH] preprocess.py literal comparison using equals String/Literal comparison should be done using `==` instead of `is` --- allosaurus/pm/preprocess.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/allosaurus/pm/preprocess.py b/allosaurus/pm/preprocess.py index 5512b1b..ce9e9a9 100644 --- a/allosaurus/pm/preprocess.py +++ b/allosaurus/pm/preprocess.py @@ -42,7 +42,7 @@ def framesig(sig, frame_len, frame_step, dither=1.0, preemph=0.97, remove_dc_off # check kaldi/src/feat/feature-window.h # the last frame_len-1 points might be cutoff padsignal = sig[:(numframes - 1) * frame_step + frame_len] - if wintype is 'povey': + if wintype == 'povey': win = np.empty(frame_len) for i in range(frame_len): win[i] = (0.5 - 0.5 * np.cos(2 * np.pi / (frame_len - 1) * i)) ** 0.85 @@ -163,4 +163,4 @@ def do_preemphasis(signal, coeff=0.97): :param coeff: The preemphasis coefficient. 0 is no filter, default is 0.95. :returns: the filtered signal. """ - return np.append((1 - coeff) * signal[0], signal[1:] - coeff * signal[:-1]) \ No newline at end of file + return np.append((1 - coeff) * signal[0], signal[1:] - coeff * signal[:-1])