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


C++ ECString类代码示例

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


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

示例1: readCRules

void
ClassRule::
readCRules(ECString path)
{
  ECString flnm = path;
  flnm += L"rules.txt";
  ifstream is(flnm.c_str());
  int wh = 2;
  //wcerr << "RCR" << endl;
  int modm = Term::stopTerm->toInt();

  assert(is);

  ECString tmp;
  for( ; ; )
    {
      int d, m, r, t;
      is >> tmp;
      if(tmp == L"Thirds:")
	{
	  wh = 3;
	  continue;
	}
      //wcerr << "T1 " << tmp << endl;
      if(!is) break;
      d = Term::get(tmp)->toInt();
      is >> tmp;
      m = Term::get(tmp)->toInt();
      is >> r;
      r--;
      is >> tmp;
      t = Term::get(tmp)->toInt();
      assert(is);
      ClassRule cr(d,m,r,t);
      //wcerr << "RR " << cr << endl;
      if(wh == 3) rBundles3_[d][m-modm].push_back(cr);
      else rBundles2_[d][m-modm].push_back(cr);
    }
  flnm = path;
  flnm += L"rules.m";
  ifstream ism(flnm.c_str());
  if(!ism) return;
  ism >> tmp; // all thirds;
  for( ; ; )
    {
      ECString tmp;
      int d, m, t;
      ism >> tmp;
      //wcerr << "T1 " << tmp << endl;
      if(!ism) break;
      d = Term::get(tmp)->toInt();
      ism >> tmp;
      m = Term::get(tmp)->toInt();
      ism >> tmp;
      t = Term::get(tmp)->toInt();
      assert(ism);
      ClassRule cr(d,m,0,t);
      rBundlesm_[d][m].push_back(cr);
    }
}
开发者ID:dorony,项目名称:CharniakParserWindows,代码行数:60,代码来源:ClassRule.cpp

示例2: auxify

ECString
auxify(ECString wM, ECString trmM)
{
  char temp[128];
  ECString w = toUpper(wM.c_str(),temp);
  ECString trm = toUpper(trmM.c_str(),temp);
  cerr << "AUX!!!" << endl;
  assert(0);
  if( isVerb( trm ) )
    {
      //cout << "saw verb " << trm << " " << wM << endl;
      if( isAux( w ) || hasAuxSuf( w ) )
	{
	  //cout << "was aux " << w << endl;
	  return "AUX";
	}
      else if( isAuxg( w ) )
	{
	  //cout << "was auxg " << w << endl;
	  return "AUXG";
	}
    }
  if(trm == "BES" || trm == "HVS")  //??? strange tags in switchboard
    {
      assert(w == "'S" || w == "-S");
      return "AUX";
    }
  return trmM;
}
开发者ID:jimwhite,项目名称:bllip-parser,代码行数:29,代码来源:auxify.C

示例3: pegt

float
Pst::
pegt(ECString& sh, int t)
{
  int len = sh.length();
  if(len < 3) return .01;
  ECString e = sh.substr(len -2, 2);
  float phegt = pHegt(e,t);
  return phegt;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:10,代码来源:Pst.C

示例4: hasAuxSuf

bool
hasAuxSuf( ECString word )
{
    size_t pos = word.find_first_of("\'");
    if(pos == -1) return false;
    ECString apostrophe = word.substr(pos, word.length()-pos);
    for( int i = 0; suffixes[i]; i++)
    {
	if( apostrophe == suffixes[i] ) 
	    return true;
    }
    return false;
}
开发者ID:jimwhite,项目名称:bllip-parser,代码行数:13,代码来源:auxify.C

示例5: pCapgt

double
Pst::
pCapgt(const ECString& shU, int t, int word_num)
{
  if(word_num == 0) return 1;
  //cerr << "pCapgt = " << pcap << endl;
  if(shU.length() < 2) return 1;  //ignore words of length 1;
  char temp[1024];
  ECString sh(langAwareToLower(shU.c_str(),temp));
  bool cap = false;
  if(shU[0] != sh[0] && shU[1] == sh[1]) cap = true;
  double pcap = pHcapgt(t);  
  return cap ? pcap : (1 - pcap);
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:14,代码来源:Pst.C

示例6: readTermProbs

void
Pst::
readTermProbs(ECString& pTString, ECString& pUstring)
{
  ifstream pTstream(pTString.c_str());
  assert(pTstream);
  ignoreComment(pTstream);
  ifstream pUstream(pUstring.c_str());
  assert(pUstream);
  ignoreComment(pUstream);
  int i, j;
  for( i = 0 ; i <=  Term::lastNTInt() ; i++ )
    {
      int t;
      pUstream >> t;
      float p;
      pUstream >> p;
      pHugt(t) = p;
      pUstream >> p;
      if(p == 0) p = .00001;  //Anything might be capitalized;
      pHcapgt(t) = p;
      pUstream >> p;
      pHhypgt(t) = p;
    }
  int numpT;
  pTstream >> numpT;
  pHegt_ = new Phegt[numpT];
  egtSize_ = numpT;

  i = 0;
  while(pTstream)
    {
      int t;
      char e0;
      char e1;
      float p;
      pTstream >> t;
      if(!pTstream) break;
      assert(i < numpT);
      pTstream >> e0;
      pTstream >> e1;
      pTstream >> p;
      pHegt_[i].t = t;
      pHegt_[i].e[0] = e0;
      pHegt_[i].e[1] = e1;
      pHegt_[i].p = p;
      i++;
    }
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:49,代码来源:Pst.C

示例7: tree_watpos

int
tree_watpos(int pos)
{
    if(pos < 0)
    {
        return nullWordInt;
    }
    ECString wrd = sentence[pos]->head();
    char tmp[1024];
    ECString wrdl=langAwareToLower(wrd.c_str(), tmp);
    const WordInfo* wi = Pst::get(wrdl);
    assert(wi);
    int ans = wi->toInt();
    assert(ans >= 0);
    return ans;
}
开发者ID:jordi-adell,项目名称:bllip-parser,代码行数:16,代码来源:treeHistSf.C

示例8: readOneLevel0

int
FeatureTree::
readOneLevel0(istream& is, int c)
{
  int nextInd;
  ECString nextIndStr;
  is >> nextIndStr;
  if(!is) return -1;
  if(nextIndStr == "Selected") return -1;
  nextInd = atoi(nextIndStr.c_str());
  FeatureTree& nft = subtree.array_[c];
  nft.ind_ = nextInd;
  nft.read(is,Feature::ftTree[Feature::whichInt].left);
  nft.back = this; 
  return nextInd;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:16,代码来源:FeatureTree.C

示例9: psutt

double
Pst::
psutt(const ECString& shU, int t, int word_num)
{
  //cerr << "Unknown word: " << shU << " for tag: " << t << endl; 
  double ans = pHugt(t);
  //cerr << "pHugt = " << ans << endl;
  if(ans == 0) return 0;
  double phyp = pHypgt(shU,t);
  ans *= phyp;
  //cerr << "pHypgt = " << phyp << endl;
  double phcp = pCapgt(shU,t, word_num);
  ans *= phcp;
  ans *= .000001;
  if(Term::fromInt(t)->openClass())
    {
      char temp[1024];
      ECString sh(langAwareToLower(shU.c_str(),temp));
      float phegt = pegt(sh,t);
      if(phegt == 0) phegt = .00001;
      //if(phegt == 0) phegt = .00005;
      //cerr << "pegt( " << sh << " | " << t << " ) = " << phegt << endl;
      ans *= phegt;
    }
  else
    ans *= .00000001;

  //cerr << "psutt( " << shU << " | " << t << " ) = " << ans << endl;
  return ans;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:30,代码来源:Pst.C

示例10: ewDciTokStrm

ewDciTokStrm::
ewDciTokStrm( const ECString& name )
  : istr_(name.c_str()), useCin(0),
     savedWrd_( "" ),             // holds not-yet-processed parts of current Wrd
  nextWrd_( "" ),              // holds "on-deck" Wrd
  ellipFlag( 0 ),                   // counts how many dots are in an ellipsis
  parenFlag( 0 )                        // ParenFlag = 0 except while words
{}
开发者ID:josepvalls,项目名称:parserservices,代码行数:8,代码来源:ewDciTokStrm.C

示例11: main

int
main(int argc, char *argv[])
{
  if (argc==1) {
    usage(argv[0]);
    return 1;
  }

  ECArgs args( argc, argv );
  params.init( args );
  int numThreads=DEFAULT_NTHREAD;
  if(args.isset('t')) 
    numThreads = atoi(args.value('t').c_str());

  TimeIt timeIt;
  ECString  path( args.arg( 0 ) );
  generalInit(path);

  ECString flnm = "dummy";
  if(args.nargs()==2) flnm = args.arg(1);
  if(Bchart::tokenize)
    {
      if (args.nargs() == 1) {
        tokStream = new ewDciTokStrm(cin);
      }
      else {
        ifstream* stream = new ifstream(flnm.c_str());
        tokStream = new ewDciTokStrm(*stream);
      }
    }
  if(args.nargs()==2) nontokStream = new ifstream(args.arg(1).c_str());
  else nontokStream = &cin;

  pthread_t thread[MAXNUMTHREADS];
  int id[MAXNUMTHREADS];
  int i;
  for(i = 0 ; i < numThreads  ; i++){
    id[i]=i;
    pthread_create(&thread[i],0,mainLoop, &id[i]);
  }
  for(i=0; i<numThreads; i++){
    pthread_join(thread[i],0);
  }
  pthread_exit(0);
  return 0;
}
开发者ID:lramach,项目名称:bllip-parser,代码行数:46,代码来源:parseIt.C

示例12: pHypgt

double
Pst::
pHypgt(const ECString& shU, int t)
{
  bool hyp = false;
  if( shU.find("-") >= 0) hyp = true;
  double phyp = pHhypgt(t);  
  return hyp ? phyp : (1 - phyp);
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:9,代码来源:Pst.C

示例13:

ECString::ECString(const ECString &rString, EC_U32 nSize)
:m_pStr(EC_NULL)
,m_nSize(nSize)
{
    m_pStr = new EC_CHAR[nSize+1];
    if(m_pStr)
    {
        m_nSize = nSize;
        ECStringOP::StrNCopy(m_pStr, rString.ToCStr(), nSize);
        m_pStr[m_nSize] = 0;
    }
}
开发者ID:jinghao666,项目名称:HTTP-Service,代码行数:12,代码来源:ECString.cpp

示例14: psktt

double
Pst::
psktt(const ECString& shU, int t, int word_num)
{
  char temp[1024];
  ECString sh(langAwareToLower(shU.c_str(), temp));
  double ans = pHst(sh, t);
  double phcp = pCapgt(shU,t, word_num);
  ans *= phcp;
  double put = pHugt(t);
  ans *= (1-put);
  //cerr << "psktt( " << shU << " | " << t << " ) = " << ans << endl;
  return ans;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:14,代码来源:Pst.C

示例15: pstt

double
Pst::
pstt(ECString& shU, int t, int word_num)
{
  char temp[1024];
  ECString sh(langAwareToLower(shU.c_str(), temp));
  const Term* tTerm = Term::fromInt(t);
  double phst = pHst(sh, t);
  double ans;
  if(phst > 0)
    ans =  psktt(shU, t, word_num);
  else ans = psutt(shU, t, word_num);
  return ans;
}
开发者ID:BLLIP,项目名称:bllip-parser,代码行数:14,代码来源:Pst.C


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