• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Word类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Word的典型用法代码示例。如果您正苦于以下问题:C++ Word类的具体用法?C++ Word怎么用?C++ Word使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: test_unfold

void test_unfold( )
{
  typedef IntLabeledGraph Graph;
  typedef Graph::edge_type edge_type;
  typedef Graph::vertex_type vertex_type;
  Graph F;

  int o = F.newVertex( );
  Word x1( 1 );
  Word x2( 2 );
  for( int i=0 ; i<5; ++i ) {
    Word w = Word::randomWord( 2 , 3 );
    addLoop( F , o , w.begin( ) , w.end( ) );
  }
  
  set< int > candidates;
  candidates.insert( o );
  list< FoldDetails< vertex_type , edge_type > > details;
  fold( F , candidates , &details );
  if( F.getVertices( ).size( )>1 )
    return;
  
  pair< bool , list< edge_type > > path = trace_path( F , o , x2.begin( ) , x2.end( ) );
  liftup( F , o , path.second , details.begin( ) , details.end( ) );
}
开发者ID:dpantele,项目名称:crag,代码行数:25,代码来源:test_graph_algs.cpp


示例2: main

int main( )
{
  FPGroup G;
  cout << "Enter nilpotentcy class first then group ";
  int NilpotentcyClass;
  cin >> NilpotentcyClass;
  Chars errMsg = cin >> G;
  if (errMsg.length()>0) 
    return 1;
 
  NilpotentGroup ng(G.namesOfGenerators(),
		    NilpotentcyClass,makeVectorOf(G.getRelators()));
  ng.initialize();
  VectorOf<Word> vw;
  Word w;
  for (int i=1;true;i++){
    cout << endl << "Enter the "<<i<<" generator of subgroup"<< endl;
    cout << "Empty word to finish: ";
    w = G.readWord(cin,errMsg);
    if (w.length()==0)
      break;
    if (errMsg.length()>0) 
      return 1;
    vw.append(w);
  }
  SGOfNilpotentGroup sg(ng,vw);
  sg.initBasis();
  sg.printBasis(cout);
  cout << "The Hirsch number :" << sg.theHirschNumber() << endl;
  cout << "Index in parent group :" << sg.index() << endl;
  cout << "Is Trivial :" << sg.isTrivial() << endl;
  cout << "Is Central :" << sg.isCentral() << endl;
  cout << "Is normal :" << sg.isNormal() << endl;
  cout << "Is abelian :" << sg.isAbelian() << endl;
  cout << "Subgroup class :" << sg.subgroupClass() << endl;
  cout << "Generators of normal closure :" << endl;
  vw = sg.normalClosureGens();
  for (int i=0;i<vw.length();i++){
    G.printWord(cout,vw[i]);
    cout << endl;
  }
  PresentationForSNG sgp = sg.makePresentation();
  cout << "Presentation of subgroup :" << endl;
  sgp.print(cout);
  cout << endl << "Enter the word :";
  errMsg = "";
  w = G.readWord(cin,errMsg);
  if (errMsg.length()>0){ 
    cout << errMsg;
    return 1; 
  }
  cout << endl << "Does subgroup contain the word :" << sg.contains(w) << endl;
  PolyWord result;
  if (sg.decompose(ng.decompose(w),result))
    cout << "Decomposition in sg basis :" << sg.asDecomposition(result);
  else
    cout << "Subgroup does not contain this word";

}
开发者ID:koudonojinchuu,项目名称:magnus,代码行数:59,代码来源:test_NilpotentSubgroup.C


示例3: GetWordID

// get wordID_t index for word represented as string
wordID_t Vocab::GetWordID(const std::string& word_str,
                          const FactorDirection& direction, const FactorList& factors, bool isNonTerminal)
{
  // get id for factored string
  Word word;
  word.CreateFromString( direction, factors, word_str, isNonTerminal);
  return GetWordID( word);
}
开发者ID:sleepcry,项目名称:mosesdecoder,代码行数:9,代码来源:vocab.cpp


示例4: right

int Group::right (int v, const Word& word)
{
    int g = v;
    for (unsigned t=0; t<word.size(); ++t) {
        g = right(g, word[word.size() -t -1]);
    }
    return g;
}
开发者ID:Hovelander,项目名称:jenn3d,代码行数:8,代码来源:todd_coxeter.C


示例5: main6

//测试word的相关操作
int main6() {
	Word *word = new Word("wordfdsafds");
	RedisProxy redisProxy("localhost", 6379);
	redisProxy.addWord(word);
	word = redisProxy.getWord(word->getId());
	std::cout << word->getId() << " " << word->getName();
	return 0;
}
开发者ID:muyuxuebao,项目名称:eclipse_workspace_cpp,代码行数:9,代码来源:main.cpp


示例6: greedyReduce

Word GAConjProblemForORGroupSolver::greedyReduce( const OneRelatorGroup& group , const Word& word )
{
  Word w = word;
  w = w.cyclicallyReduce( );
  while( oneGreedyReduce( group , w ) );

  return w;
}
开发者ID:koudonojinchuu,项目名称:magnus,代码行数:8,代码来源:GACPforORGSolver.C


示例7: MakeWord

static Word MakeWord(string text)
{
    FactorCollection &factorCollection = FactorCollection::Instance();
    const Factor* f = factorCollection.AddFactor(Input,0,text);
    Word w;
    w.SetFactor(0,f);
    return w;
}
开发者ID:mitramah,项目名称:mosesdecoder,代码行数:8,代码来源:PhraseLengthFeatureTest.cpp


示例8: transform

bool operator > (Word w1, Word w2) {
    string w1word = w1.getWord();
    string w2word = w2.getWord();
    transform(w1word.begin(), w1word.end(), w1word.begin(), ::toupper);
    transform(w2word.begin(), w2word.end(), w2word.begin(), ::toupper);

    return (w1word > w2word);
}
开发者ID:codingkitty81,项目名称:CSCI-21-FALL-2015,代码行数:8,代码来源:word.cpp


示例9: reduce

Word TheGrigorchukGroupAlgorithms::reduce( const Word& w )
{
  Word result;
  for( Word::const_iterator w_it=w.begin( ) ; w_it!=w.end( ) ; ++w_it )
    push_back( result , *w_it );
  
  return result;
}
开发者ID:dpantele,项目名称:crag,代码行数:8,代码来源:TheGrigorchukGroupWordProblem.cpp


示例10: int2word

 Word int2word(int g)
 {
   Word result;
   while (g) {
     result.push_back((g % 10) - 1);
     g /= 10;
   }
   return result;
 }
开发者ID:b3sigma,项目名称:fourd,代码行数:9,代码来源:polytopes.cpp


示例11: VERBOSE

void GlobalLexicalModel::Load()
{
  FactorCollection &factorCollection = FactorCollection::Instance();
  const std::string& factorDelimiter = StaticData::Instance().GetFactorDelimiter();

  VERBOSE(2, "Loading global lexical model from file " << m_filePath << endl);

  m_inputFactors = FactorMask(m_inputFactorsVec);
  m_outputFactors = FactorMask(m_outputFactorsVec);
  InputFileStream inFile(m_filePath);

  // reading in data one line at a time
  size_t lineNum = 0;
  string line;
  while(getline(inFile, line)) {
    ++lineNum;
    vector<string> token = Tokenize<string>(line, " ");

    if (token.size() != 3) { // format checking
      UTIL_THROW2("Syntax error at " << m_filePath << ":" << lineNum << ":" << line);
    }

    // create the output word
    Word *outWord = new Word();
    vector<string> factorString = Tokenize( token[0], factorDelimiter );
    for (size_t i=0 ; i < m_outputFactorsVec.size() ; i++) {
      const FactorDirection& direction = Output;
      const FactorType& factorType = m_outputFactorsVec[i];
      const Factor* factor = factorCollection.AddFactor( direction, factorType, factorString[i] );
      outWord->SetFactor( factorType, factor );
    }

    // create the input word
    Word *inWord = new Word();
    factorString = Tokenize( token[1], factorDelimiter );
    for (size_t i=0 ; i < m_inputFactorsVec.size() ; i++) {
      const FactorDirection& direction = Input;
      const FactorType& factorType = m_inputFactorsVec[i];
      const Factor* factor = factorCollection.AddFactor( direction, factorType, factorString[i] );
      inWord->SetFactor( factorType, factor );
    }

    // maximum entropy feature score
    float score = Scan<float>(token[2]);

    // std::cerr << "storing word " << *outWord << " " << *inWord << " " << score << endl;

    // store feature in hash
    DoubleHash::iterator keyOutWord = m_hash.find( outWord );
    if( keyOutWord == m_hash.end() ) {
      m_hash[outWord][inWord] = score;
    } else { // already have hash for outword, delete the word to avoid leaks
      (keyOutWord->second)[inWord] = score;
      delete outWord;
    }
  }
}
开发者ID:DoWhatILove,项目名称:mosesdecoder,代码行数:57,代码来源:GlobalLexicalModel.cpp


示例12: print

void WQueue::print()
{
	Word* cur = front;
	while (cur != NULL)
	{
		cout << cur->getData() << " ";
		cur = cur->getNext();
	}
}
开发者ID:k1ll3rzamb0n1,项目名称:Code_backup,代码行数:9,代码来源:WQueue.cpp


示例13: DisplayS

void TTSQueue::DisplayS()
{
	Word * word = header;
	while(word != NULL)
	{
		word->DisplayS();
		word = word->next;
	}
}
开发者ID:engindemir,项目名称:Turkish_TTS,代码行数:9,代码来源:TTSQueue.cpp


示例14: strcpy

Word Word::operator+(const Word& rhs)
{
	char* temp = new char[this->string_length_ + rhs.len() - 1];
	strcpy(temp, this->string_);
	strcat(temp, rhs.getString());
	Word sum(temp);
	delete [] temp;
	return sum;
}
开发者ID:wspurgin,项目名称:SortingProject,代码行数:9,代码来源:Word.cpp


示例15: TEST_F

//word
TEST_F(Gtest, test_Word) {
	std::string name = "wordfdsafds";
	Word *word = new Word("wordfdsafds");
	RedisProxy redisProxy("localhost", 6379);
	redisProxy.addWord(word);
	word = redisProxy.getWord(word->getId());
	std::cout << word->getId() << " " << word->getName() << std::endl;
	EXPECT_EQ(name, word->getName());
}
开发者ID:muyuxuebao,项目名称:RedisJson_makefile,代码行数:10,代码来源:test.cpp


示例16: main10

int main10() {
	RedisProxy redisProxy("localhost", 6379);
	User *user = new User("yinliang");
	Word * word = new Word("ABCD");
	redisProxy.addUser(user);
	redisProxy.addWord(word);
	redisProxy.userBuyWord(user->getId(), word->getId());

}
开发者ID:muyuxuebao,项目名称:eclipse_workspace_cpp,代码行数:9,代码来源:main.cpp


示例17: eval

Elt SubgroupRep::eval( const Word& w ) const {
  #if SAFETY > 0
    if ( w.maxOccurringGenerator() > theNumberOfGenerators )
	   error("SubgroupRep::eval: attempt to evaluate word with no "
				"interpretation in parent group");
  #endif

  return w.replaceGenerators(theGenerators);
}
开发者ID:koudonojinchuu,项目名称:magnus,代码行数:9,代码来源:Subgroup.C


示例18: interp

void Probe::operator()(const SmartPointer<Block> &block) {
  interp(block);

  if (!block->isDeleted()) {
    if (!didOutputProbe && block->findWord('M', 3)) {
      outputProbe();
      didOutputProbe = true;
    }
    
    if (didOutputProbe && block->findWord('G', 1) &&
        getAxisPosition('Z') < clearHeight) {
      double x = getAxisPosition('X');
      double y = getAxisPosition('Y');
      double z = getAxisPosition('Z');

      vector<ProbePoint *> pt = grid->find(Vector2D(x, y));
      double x1 = pt[0]->x();
      double x2 = pt[1]->x();
      double y1 = pt[0]->y();
      double y2 = pt[2]->y();
      double denom = (x2 - x1) * (y2 - y1);
      double v[4] = {
        ((x2 - x) * (y2 - y)) / denom,
        ((x - x1) * (y2 - y)) / denom,
        ((x2 - x) * (y - y1)) / denom,
        ((x - x1) * (y - y1)) / denom,
      };

      SmartPointer<Entity> expr;
      Word *zWord = block->findWord('Z');
      if (useLastZExpression) expr = getVarExpr('Z');
      else if (zWord) expr = zWord->getExpression();
      else expr = new Number(z);

      for (int i = 0; i < 4; i++) {
        if (!pt[i]->address)
          THROWS("Point " << pt[i] << " does not have address");

        SmartPointer<Entity> ref = new Reference(new Number(pt[i]->address));
        SmartPointer<Entity> num = new Number(v[i]);

        expr = new BinaryOp(Operator::ADD_OP, expr,
                            new BinaryOp(Operator::MUL_OP, ref, num));
      }
      expr = new QuotedExpr(expr);

      if (!zWord) {
        zWord = new Word('Z', expr);
        block->push_back(zWord);

      } else zWord->setExpression(expr);
    }
  }

  Printer::operator()(block);
}
开发者ID:Akfreak,项目名称:OpenSCAM,代码行数:56,代码来源:Probe.cpp


示例19: start

void Wordreciting::start()
{
	isStart = true;
    wordlist = (strategy->selectRandom ? random : ordered);
	for (int i = 0; i < wordlist->size(); i++)
	{
		Word *word = wordlist->getWord(i);
		word->setLevel();
	}
}
开发者ID:zerotrac,项目名称:OOP_Dictionary,代码行数:10,代码来源:Wordreciting.cpp


示例20: isTrivialSolution

bool QuadEquationTranformationGraph::isTrivialSolution( const Word& e ) const
{
  Word r;
  for( Word::const_iterator e_it=e.begin() ; e_it!=e.end( ) ; ++e_it ) {
    int g = *e_it;
    if( theEquation.isGenerator( g ) )
      r.push_back( g );
  }
  return r.length( )==0;
}
开发者ID:dpantele,项目名称:crag,代码行数:10,代码来源:QuadEquatTransformationGraph.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ WordLangTuple类代码示例发布时间:2022-05-31
下一篇:
C++ WolframLibraryData类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap