#include #include #include #include #include #include #include "concordia/concordia_config.hpp" #include "concordia/sentence_tokenizer.hpp" #include "concordia/tokenized_sentence.hpp" #include "concordia/common/config.hpp" #include "concordia/common/utils.hpp" namespace po = boost::program_options; int main(int argc, char** argv) { po::options_description desc("Allowed options"); desc.add_options() ("help,h", "Display this message") ("config,c", boost::program_options::value(), "Concordia configuration file (required)"); po::variables_map cli; po::store(po::parse_command_line(argc, argv, desc), cli); po::notify(cli); if (cli.count("help")) { std::cerr << desc << std::endl; return 1; } std::string configFile; if (cli.count("config")) { configFile = cli["config"].as(); } else { std::cerr << "No Concordia configuration file given. Terminating." << std::endl; return 1; } try { boost::shared_ptr config = boost::shared_ptr ( new ConcordiaConfig(configFile)); SentenceTokenizer sentenceTokenizer(config); for (std::string line; std::getline(std::cin, line);) { TokenizedSentence ts = sentenceTokenizer.tokenize(line); std::cout << ts.getTokenizedSentence() << std::endl; } } catch(ConcordiaException & e) { std::cerr << "ConcordiaException caught with message: " << std::endl << e.what() << std::endl << "Terminating execution." << std::endl; return 1; } catch(std::exception & e) { std::cerr << "Unexpected exception caught with message: " << std::endl << e.what() << std::endl << "Terminating execution." << std::endl; return 1; } return 0; }