NaomiProject / Naomi

The Naomi Project is an open source, technology agnostic platform for developing always-on, voice-controlled applications!
https://projectnaomi.com/
MIT License
242 stars 49 forks source link

Fix issue with path to CMU Dictionary #383

Closed aaronchantrill closed 1 year ago

aaronchantrill commented 1 year ago

Description

Back in the old days, we used to require the user to download their own HMM model and CMU dictionary. The HMM model might be installed by installing a system package, along with the download of the pocketsphinx source code, or independently. Same with the CMU dictionary file.

At one point, it just seemed easier to host copies of the HMM model and dictionary ourselves. That way we would know where to download them from and could help the user with that, and would know what format everything is in.

Recently, I decided instead of asking for the locations of both the HMM model and the dictionary, just ask for the HMM model and assume that the dictionary is in that same folder and named CMUDict.dict.

Unfortunately, if it isn't, then that causes problems. I may need to revert to keeping the two settings separate in the future, but for right now, I am going to stop searching in all the odd places for the HMM model and dictionary and just assume we are using our hosted version. If the user does not have that installed, then download it for them.

There was an additional problem where if you did not download the HMM model and CMUDict during startup, the CMUDict variable did not get set. I have moved the initialization of that variable outside of that if/then block.

Related Issue

Fix issue with CMU Dictionary path #382

Motivation and Context

Fixes an error that occurs under certain circumstances

How Has This Been Tested?

Tested on several computers. All unit tests passed. Flake8 reported no issues.

Types of changes

Checklist: