| 30 | } |
| 31 | |
| 32 | bool DeepData::Build(const DeepConfig& config) { |
| 33 | // item feature |
| 34 | if (!config.item_feature().empty()) { |
| 35 | item_feature_loader_ = NewFeatureLoader(); |
| 36 | if (!item_feature_loader_->Load(config.item_feature(), |
| 37 | config.thread_num())) { |
| 38 | DXERROR("Failed to load item feature from %s.", |
| 39 | config.item_feature().c_str()); |
| 40 | return false; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | // inst file |
| 45 | if (!config.inst_file().empty()) { |
| 46 | inst_file_loader_ = |
| 47 | InstFileLoader::Create(config.inst_file(), config.thread_num()); |
| 48 | if (!inst_file_loader_) { |
| 49 | return false; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // freq file |
| 54 | if (!config.freq_file().empty()) { |
| 55 | freq_file_loader_ = FreqFileLoader::Create( |
| 56 | config.node_config(), config.freq_file(), config.thread_num()); |
| 57 | if (!freq_file_loader_) { |
| 58 | return false; |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | if (!item_feature_loader_ && !inst_file_loader_ && !freq_file_loader_) { |
| 63 | DXERROR("Failed to build deep data, check if config file is empty."); |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | } // namespace embedx |
no test coverage detected