📄 amis.cc
字号:
////////////////////////////////////////////////////////////////////////// Copyright (c) 2000, Yusuke Miyao// You may distribute under the terms of the Artistic License.//// Amis - A maximum entropy estimator//// Author: Yusuke Miyao (yusuke@is.s.u-tokyo.ac.jp)// $Id: amis.cc,v 1.7 2003/05/16 05:29:13 yusuke Exp $////////////////////////////////////////////////////////////////////////#include <amis/AmisDriver.h>#include <string>//////////////////////////////////////////////////////////////////////// Main routineusing namespace std;using namespace amis;int main( int argc, const char** argv ) { AMIS_PROFILE_START; int status = 0; try { AmisDriver amis_driver; status = amis_driver.run( argc, argv ); } catch ( ErrorBase err ) { cerr << "ERROR: " << err.message() << endl; return 1; } catch ( ... ) { cerr << "Unknown error" << endl; return 100; } AMIS_PROFILE_FINISH; return status; /* // Go into the analyzing loop if( amis_driver.getProperty()->analyzeLoop() ) { cerr << "Start analyzing loop" << endl; istream* input; ostream* output; bool out_is_file = false; if( amis_driver.getProperty()->analyzeInput() == "stdin" ) { input = &cin; } else { input = new ifstream(amis_driver.getProperty()->analyzeInput().c_str()); } if( amis_driver.getProperty()->analyzeOutput() == "stdout" ) { output = &cout; } else if (amis_driver.getProperty()->analyzeOutput() == "stderr") { output = &cerr; } else { output = new ofstream(amis_driver.getProperty()->analyzeOutput().c_str()); out_is_file = true; } bool output_best_target = amis_driver.getProperty()->analyzeOutputBest(); while(input){ vector< pair<Name, Real> > prod; //string line; //getline(*input, line); //cerr << "line=" << line << endl; //stringstream is; //is << line; //cerr << "A" << flush; bool suc = amis_driver.setProducts(*input, prod); if( !suc ) { cerr << "Break analyzing loop" << endl << flush; break; } if( output_best_target ) { Name max_name = prod[0].first; Real max_val = prod[0].second; for(int i = 0; i < prod.size(); i++){ if( prod[i].second > max_val ) { max_name = prod[i].first; max_val = prod[i].second; } } (*output) << max_name; } else{ //cerr << "prod.size() = " << prod.size() << endl << flush; // name1 p1 name2 p2 ... namen pn for(int i = 0; i < prod.size(); i++){ (*output) << prod[i].first << ' ' << prod[i].second << ' '; //cerr << prod[i].first << ' ' << prod[i].second << ' '; } //cerr << endl; } (*output) << '\n' << flush; } if( out_is_file ){ dynamic_cast<ofstream*>(output)->close(); } } */ }// end of amis.cc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -