Skip to content

Commit

Permalink
Bug fix for phonetisaurus training
Browse files Browse the repository at this point in the history
  • Loading branch information
mmcauliffe committed Jun 27, 2022
1 parent a99c937 commit 714fc16
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions montreal_forced_aligner/g2p/phonetisaurus_trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1023,22 +1023,26 @@ def train_ngram_model(self) -> None:
os.path.join(self.working_log_directory, "model.log"), "w", encoding="utf8"
) as logf:
ngrammerge_proc = subprocess.Popen(
[thirdparty_binary("ngrammerge"), *count_paths],
[
thirdparty_binary("ngrammerge"),
f'--ofile={self.ngram_path.replace(".fst", ".cnts")}',
*count_paths,
],
stderr=logf,
stdout=subprocess.PIPE,
# stdout=subprocess.PIPE,
env=os.environ,
)
ngrammerge_proc.communicate()
ngrammake_proc = subprocess.Popen(
[
thirdparty_binary("ngrammake"),
f"--method={self.smoothing_method}",
self.ngram_path.replace(".fst", ".cnts"),
],
stdin=ngrammerge_proc.stdout,
stderr=logf,
stdout=subprocess.PIPE,
env=os.environ,
)
ngrammake_proc.communicate()

ngramshrink_proc = subprocess.Popen(
[
Expand Down

0 comments on commit 714fc16

Please sign in to comment.