Exemplo n.º 1
0
int
main(int argc, char *argv[])
{
   struct rlimit 	core_limits;
   core_limits.rlim_cur = 0;
   core_limits.rlim_max = 0;
   setrlimit( RLIMIT_CORE, &core_limits );

   ECArgs args( argc, argv );
   Feat::Usage = ISCALE;
   ECString  path( args.arg( 1 ) );
   Term::init(path);

   conditionedType = args.arg(0);
   cerr << "start iScale: " << conditionedType << endl;
   //Pst pst(path);

   Feature::init(path, conditionedType);
   whichInt = Feature::whichInt;
   ECString fHp(path);
   fHp += conditionedType;
   fHp += ".f";
   ifstream fHps(fHp.c_str());
   if(!fHps)
     {
       cerr << "Could not find " << fHp << endl;
       assert(fHps);
     }

   features = new FeatureTree(fHps);

   //features->subtree;
   
   initFeatVals();
   
   ECString gt(path);
   gt += conditionedType;
   gt += ".g";
   ofstream gtstream(gt.c_str());
   assert(gtstream);
   gtstream.precision(3);

   FTreeMap::iterator ftmi = features->subtree.begin();
   for( ; ftmi != features->subtree.end() ; ftmi++)
     {
       int afv = (*ftmi).first;
       (*ftmi).second->printFTree(afv, gtstream);
     }
   return 1;
}
Exemplo n.º 2
0
int
main(int argc, char *argv[])
{
  struct rlimit 	core_limits;
  core_limits.rlim_cur = 0;
  core_limits.rlim_max = 0;
  setrlimit( RLIMIT_CORE, &core_limits );

  ECArgs args( argc, argv );
  assert(args.nargs() == 3);
  ECString conditionedType = args.arg(0);
  Feat::Usage = SEL;

  percentDesiredFeatures = (float)atoi(args.arg(1).c_str())/100.0;
  cerr << "start selFeats: " << conditionedType
       << " " << percentDesiredFeatures  << endl;
  ECString  path( args.arg( 2 ) );
  ECString fHp(path);
  fHp += conditionedType;
  fHp += ".ff";
  Feature::init(path, conditionedType);
  ifstream fHps(fHp.c_str());
  new FeatureTree(fHps);

  whichInt = Feature::whichInt;

  cerr << "Before doRanking" << endl;
  doRanking();
  totDesiredFeatures = (int) (percentDesiredFeatures * totStates);
  cerr << "Before markFeats" << endl;
  markFeats();

  ECString resS(path);
  resS += conditionedType;
  resS += ".f";
  ofstream res(resS.c_str());

  FeatureTree* root = FeatureTree::roots(whichInt);
  FTreeMap::iterator ftmIter = root->subtree.begin();
  cerr << "About to print featuretree" << endl;
  for( ; ftmIter != root->subtree.end() ; ftmIter++)
    {
      int asVal = (*ftmIter).first;
      FeatureTree* subRoot = root->subtree[asVal];
      subRoot->printFTree(asVal, res);
    }
  res << "\n\nSelected " << totSelectedStates << " of "
       << totStates << endl;
  return 0;
}