pdtnod_03.cc

来自「这是一个从音频信号里提取特征参量的程序」· CC 代码 · 共 139 行

CC
139
字号
// file: $isip/class/pr/PhoneticDecisionTreeNode/pdtnod_03.cc// version: $Id: pdtnod_03.cc,v 1.2 2002/09/11 20:04:08 parihar Exp $//// isip include files//#include "PhoneticDecisionTreeNode.h"// method: read//// arguments://  Sof& sof: (input) sof file object//  long tag: (input) sof object instance tag//  const String& name: (input) sof object instance name//// return: a boolean value indicating status//// this method has the object read itself from an Sof file//boolean PhoneticDecisionTreeNode::read(Sof& sof_a, long tag_a,				       const String& name_a) {  // read the instance of the object from the Sof file  //  if (!sof_a.find(name_a, tag_a)) {    return false;  }    // read the actual data from the sof file  //  if (!readData(sof_a)) {    return false;  }    // exit gracefully  //  return true;  }// method: readData//// arguments://  Sof& sof: (input) sof file object//  const String& pname: (input) parameter name//  long size: (input) size in bytes of object (or full_size)//  boolean param: (input) is the parameter name in the file?//  boolean nested: (input) are we nested?//// return: a boolean value indicating status//// this method has the object read itself from an Sof file. it assumes// that the Sof file is already positioned correctly.//boolean PhoneticDecisionTreeNode::readData(Sof& sof_a, const String& pname_a,					   long size_a, boolean param_a,					   boolean nested_a) {  Integral::DEBUG debug_level = Integral::NONE;  SofParser parser;  parser.setDebug(debug_level);      // ignore implicit parameter setting  //    // are we nested?  //  if (nested_a) {    parser.setNest();  }    // load the parse  //  if (!parser.load(sof_a, size_a)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }	      // get the datapoints  //  if (!datapoints_d.readData(sof_a, PARAM_DATAPOINTS,			     parser.getEntry(sof_a, PARAM_DATAPOINTS),			     false, false)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }	      // get the best attribute  //  if (!best_attribute_d.readData(sof_a, PARAM_BEST_ATTRIBUTE,				 parser.getEntry(sof_a, PARAM_BEST_ATTRIBUTE),				 true, true)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }  // get the typical statistical-model index  //  if (!typical_index_d.readData(sof_a, PARAM_TYPICAL_INDEX,				parser.getEntry(sof_a, PARAM_TYPICAL_INDEX),				true, true)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }  // get the actual index  //  if (!actual_index_d.readData(sof_a, PARAM_ACTUAL_INDEX,				parser.getEntry(sof_a, PARAM_ACTUAL_INDEX),				true, true)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }  // get the typical statistical-model  //  if (!typical_stat_model_d.readData(sof_a, PARAM_TYPICAL_STAT_MODEL,				     parser.getEntry(sof_a, PARAM_TYPICAL_STAT_MODEL),				     true, true)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }  // get the flag that denotes whether a node exists or it is merged  // with some other node  //  if (!flag_exists_d.readData(sof_a, PARAM_FLAG_EXISTS,			      parser.getEntry(sof_a, PARAM_FLAG_EXISTS),			      true, true)) {    return Error::handle(name(), L"readData", Error::READ,			 __FILE__, __LINE__, Error::WARNING);  }  // exit gracefully  //  return true;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?