Added lm-order
@@ -237,7 +237,16 @@ class KaldiModel(BaseModel): # TODO not thread safe
for stage in sorted(stages):
print(f"======== STAGE {stage} STARTING ========")
self.status = f'stage {stage} in-progress'
- p = run(f"cd {local_kaldi_path}; stages/{stage} > {run_log_path}")
+
+ with open(local_kaldi_path.joinpath('stages').joinpath(stage), 'r') as file :
+ filedata = file.read()
+
+ filedata = filedata.replace('lm_order=1', f'lm_order={self.ngram}')
+
+ with open(local_kaldi_path.joinpath('stages').joinpath(stage), 'w') as file:
+ file.write(filedata)
+
+ p = run(f"touch {run_log_path}; cd {local_kaldi_path}; stages/{stage} >> {run_log_path}")
print(p.stdout)
print(f"======== STAGE {stage} COMPLETE ========")
self.status = f'stage {stage} complete'
