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


C++ Alignment::size方法代码示例

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


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

示例1: Assign

void Alignment::Assign(Alignment &rhs) {
    ((AlignmentStats*)this)->Assign(rhs);
    qPos = rhs.qPos; tPos = rhs.tPos;
    qAlignLength = rhs.qAlignLength;
    tAlignLength = rhs.tAlignLength;
    qLength = rhs.qLength;
    zScore  = rhs.zScore;
    qName   = rhs.qName;
    tName   = rhs.tName;
    qStrand = rhs.qStrand;
    tStrand = rhs.tStrand;
    nCells  = rhs.nCells;
    std::vector<Block> empty;
    blocks.swap(empty);
    blocks.resize(rhs.size());
    int b;
    for (b = 0; b < rhs.blocks.size(); b++) {
        blocks[b].Assign(rhs.blocks[b]);
    }
}
开发者ID:outpaddling,项目名称:blasr_libcpp,代码行数:20,代码来源:Alignment.cpp

示例2: Main

int ExtractGHKM::Main(int argc, char *argv[])
{
  // Process command-line options.
  Options options;
  ProcessOptions(argc, argv, options);

  // Open input files.
  InputFileStream targetStream(options.targetFile);
  InputFileStream sourceStream(options.sourceFile);
  InputFileStream alignmentStream(options.alignmentFile);

  // Open output files.
  OutputFileStream fwdExtractStream;
  OutputFileStream invExtractStream;
  std::ofstream glueGrammarStream;
  std::ofstream unknownWordStream;
  std::string fwdFileName = options.extractFile;
  std::string invFileName = options.extractFile + std::string(".inv");
  if (options.gzOutput) {
    fwdFileName += ".gz";
    invFileName += ".gz";
  }
  OpenOutputFileOrDie(fwdFileName, fwdExtractStream);
  OpenOutputFileOrDie(invFileName, invExtractStream);
  if (!options.glueGrammarFile.empty()) {
    OpenOutputFileOrDie(options.glueGrammarFile, glueGrammarStream);
  }
  if (!options.unknownWordFile.empty()) {
    OpenOutputFileOrDie(options.unknownWordFile, unknownWordStream);
  }

  // Target label sets for producing glue grammar.
  std::set<std::string> labelSet;
  std::map<std::string, int> topLabelSet;

  // Word count statistics for producing unknown word labels.
  std::map<std::string, int> wordCount;
  std::map<std::string, std::string> wordLabel;

  std::string targetLine;
  std::string sourceLine;
  std::string alignmentLine;
  XmlTreeParser xmlTreeParser(labelSet, topLabelSet);
  ScfgRuleWriter writer(fwdExtractStream, invExtractStream, options);
  size_t lineNum = options.sentenceOffset;
  while (true) {
    std::getline(targetStream, targetLine);
    std::getline(sourceStream, sourceLine);
    std::getline(alignmentStream, alignmentLine);

    if (targetStream.eof() && sourceStream.eof() && alignmentStream.eof()) {
      break;
    }

    if (targetStream.eof() || sourceStream.eof() || alignmentStream.eof()) {
      Error("Files must contain same number of lines");
    }

    ++lineNum;

    // Parse target tree.
    if (targetLine.size() == 0) {
      std::cerr << "skipping line " << lineNum << " with empty target tree\n";
      continue;
    }
    std::auto_ptr<ParseTree> t;
    try {
      t = xmlTreeParser.Parse(targetLine);
      assert(t.get());
    } catch (const Exception &e) {
      std::ostringstream s;
      s << "Failed to parse XML tree at line " << lineNum;
      if (!e.GetMsg().empty()) {
        s << ": " << e.GetMsg();
      }
      Error(s.str());
    }

    // Read source tokens.
    std::vector<std::string> sourceTokens(ReadTokens(sourceLine));

    // Read word alignments.
    Alignment alignment;
    try {
      alignment = ReadAlignment(alignmentLine);
    } catch (const Exception &e) {
      std::ostringstream s;
      s << "Failed to read alignment at line " << lineNum << ": ";
      s << e.GetMsg();
      Error(s.str());
    }
    if (alignment.size() == 0) {
      std::cerr << "skipping line " << lineNum << " without alignment points\n";
      continue;
    }

    // Record word counts.
    if (!options.unknownWordFile.empty()) {
      CollectWordLabelCounts(*t, options, wordCount, wordLabel);
    }
//.........这里部分代码省略.........
开发者ID:dallas1109,项目名称:mosesdecoder,代码行数:101,代码来源:ExtractGHKM.cpp


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