Make naming convention consistent, and synchronize code
This commit is contained in:
34
src/model.cc
34
src/model.cc
@@ -1,27 +1,27 @@
|
||||
#include "model.h"
|
||||
|
||||
Model::Model(const std::string &url, const std::string& storepath, const std::string& id, int index) : GenericModel(url, storepath, id, index) {
|
||||
model::model(const std::string &url, const std::string& storepath, const std::string& id, int index) : genericModel(url, id, storepath, index) {
|
||||
if(!loadModel()) return;
|
||||
model = vosk_model_new(this->storepath.c_str());
|
||||
if(model == nullptr) {
|
||||
mdl = vosk_model_new(".");
|
||||
if(mdl == nullptr) {
|
||||
fireEv("error", "Unable to initialize model");
|
||||
return;
|
||||
}
|
||||
fireEv("ready");
|
||||
};
|
||||
|
||||
bool Model::checkModel(const std::string& path) {
|
||||
return fs::exists(path + "/am/final.mdl") &&
|
||||
fs::exists(path + "/conf/mfcc.conf") &&
|
||||
fs::exists(path + "/conf/model.conf") &&
|
||||
fs::exists(path + "/graph/phones/word_boundary.int") &&
|
||||
fs::exists(path + "/graph/Gr.fst") &&
|
||||
fs::exists(path + "/graph/HCLr.fst") &&
|
||||
fs::exists(path + "/graph/disambig_tid.int") &&
|
||||
fs::exists(path + "/ivector/final.dubm") &&
|
||||
fs::exists(path + "/ivector/final.ie") &&
|
||||
fs::exists(path + "/ivector/final.mat") &&
|
||||
fs::exists(path + "/ivector/global_cmvn.stats") &&
|
||||
fs::exists(path + "/ivector/online_cmvn.conf") &&
|
||||
fs::exists(path + "/ivector/splice.conf");
|
||||
bool model::checkModel() {
|
||||
return fs::exists("am/final.mdl") &&
|
||||
fs::exists("conf/mfcc.conf") &&
|
||||
fs::exists("conf/model.conf") &&
|
||||
fs::exists("graph/phones/word_boundary.int") &&
|
||||
fs::exists("graph/Gr.fst") &&
|
||||
fs::exists("graph/HCLr.fst") &&
|
||||
fs::exists("graph/disambig_tid.int") &&
|
||||
fs::exists("ivector/final.dubm") &&
|
||||
fs::exists("ivector/final.ie") &&
|
||||
fs::exists("ivector/final.mat") &&
|
||||
fs::exists("ivector/global_cmvn.stats") &&
|
||||
fs::exists("ivector/online_cmvn.conf") &&
|
||||
fs::exists("ivector/splice.conf");
|
||||
}
|
||||
Reference in New Issue
Block a user