当前位置: 首页>>代码示例>>C++>>正文


C++ Lattice::clear方法代码示例

本文整理汇总了C++中Lattice::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ Lattice::clear方法的具体用法?C++ Lattice::clear怎么用?C++ Lattice::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lattice的用法示例。


在下文中一共展示了Lattice::clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(void)
{
  long double res, scalar = 1000000000.0;
  struct timespec begin, end;

  vector<Point> inData;
  vector<PointMu> outData;
  Lattice testLattice;
  LatticePaths decoded;

  string testDataFile = "./signal.txt";

  //class components
  SingularityBuilder sb;
  LatticeBuilder lb;
  Viterbi vt;
  LanguageModel lm;

  //lattice and viterbi test
  cout << "Vini Vitti Viterbi..." << endl;
  clock_gettime(CLOCK_MONOTONIC,&begin);
  lb.TestBuildLattice(testLattice);
  vt.Process(testLattice, decoded);
  //lb.ClearLattice(testLattice);
  clock_gettime(CLOCK_MONOTONIC,&end);
  cout << "runtime: " << diffTimeSpecs(&begin,&end) << " (s)" << endl;

  cout << "decoded: ";
  if(decoded.size() > 0){
    cout << decoded.begin()->first << endl;
  }

  //full path-enumeration testing
  testLattice.clear();
  decoded.clear();
  cout << "Running exhaustive dfs graph search..." << endl;
  clock_gettime(CLOCK_MONOTONIC,&begin);
  lb.TestBuildLattice(testLattice);
  vt.RunExhaustiveSearch(testLattice,decoded,-1);
  clock_gettime(CLOCK_MONOTONIC,&end);
  cout << "runtime: " << diffTimeSpecs(&begin,&end) << " (s)" << endl;
  vt.PrintResultList(decoded);


  //try a basic pruned/beam search
  testLattice.clear();
  decoded.clear();
  //full path-enumeration testing
  cout << "Running pruned dfs graph search..." << endl;
  clock_gettime(CLOCK_MONOTONIC,&begin);
  lb.TestBuildLattice(testLattice);
  vt.RunPrunedSearch(testLattice,decoded,-1);
  clock_gettime(CLOCK_MONOTONIC,&end);
  cout << "runtime: " << diffTimeSpecs(&begin,&end) << " (s)" << endl;
  vt.PrintResultList(decoded);

  //try a basic pruned/beam search
  testLattice.clear();
  decoded.clear();
  //full path-enumeration testing
  cout << "Running pruned dfs graph search..." << endl;
  clock_gettime(CLOCK_MONOTONIC,&begin);
  lb.TestBuildLattice(testLattice);
  vt.RunPrunedSearch(testLattice,decoded,-1);
  //delete candidate words after 100 words
  //for()
  lm.Process(decoded);
  clock_gettime(CLOCK_MONOTONIC,&end);
  cout << "runtime: " << diffTimeSpecs(&begin,&end) << " (s)" << endl;
  cout << "after language model conditioning: " << endl;
  vt.PrintResultList(decoded);



/*
  //read in some test data. note the chained pipe-transform pattern: output param of each class becomes input to next class
  sb.BuildTestData(testDataFile, inData);
  sb.Process(inData, outData);
  lb.BuildStaticLattice(outData, testLattice);
  vt.Process(testLattice, decoded);
*/  


  return 0;
}
开发者ID:niceyeti,项目名称:Twitch,代码行数:85,代码来源:main.cpp


注:本文中的Lattice::clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。