Skip to content

Commit

Permalink
Improvements to generate_pmdl.py
Browse files Browse the repository at this point in the history
  • Loading branch information
chenguoguo committed Dec 31, 2020
1 parent 7e4b186 commit 5c22195
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
8 changes: 2 additions & 6 deletions examples/Python/generate_pmdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import tempfile
import uuid
from scipy.io import wavfile
from slugify import slugify
import snowboy_model_config
from lib.snowboy_model import SnowboyPersonalEnroll, SnowboyTemplateCut

Expand All @@ -15,17 +14,14 @@ def check_enroll_output(enroll_ans):
elif enroll_ans == 2:
raise Exception("Hotword is too short")

def get_model_name(name):
return "{}_{}.pmdl".format(slugify(name), uuid.uuid1())


def main():
parser = argparse.ArgumentParser(description='Command line client for generating snowboy personal model')
parser.add_argument('-r1', '--record1', dest="record1", required=True, help="Record voice 1")
parser.add_argument('-r2', '--record2', dest="record2", required=True, help="Record voice 2")
parser.add_argument('-r3', '--record3', dest="record3", required=True, help="Record voice 3")
parser.add_argument('-n', '--name', dest="model_name", required=True, help="Personal model name")
parser.add_argument('-lang', '--language', default="en", dest="language", help="Language")
parser.add_argument('-n', '--name', default="temp", dest="model_name", help="Personal model name")
args = parser.parse_args()

print("template cut")
Expand Down Expand Up @@ -54,7 +50,7 @@ def main():

check_enroll_output(enroll_ans)

filename = get_model_name(args.model_name)
filename = args.model_name
print("saving file to %s" % filename)
f = open(filename, "wb")
f.write(open(out.name).read())
Expand Down
1 change: 0 additions & 1 deletion examples/Python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
PyAudio==0.2.9
python-slugify==4.0.1
scipy==1.2.3

0 comments on commit 5c22195

Please sign in to comment.