00001 /* 00002 Phrasehunter - index and query text corpora 00003 Copyright (C) 2006 Torsten Marek (shlomme@gmx.de) & 00004 Armin Schmidt (armin.sch@gmail.com) 00005 00006 This program is free software; you can redistribute it and/or 00007 modify it under the terms of the GNU General Public License 00008 as published by the Free Software Foundation; either version 2 00009 of the License, or (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #include <boost/format.hpp> 00022 00023 #include "support/hptimer.hpp" 00024 00025 #include "phrasehunter/corpus.h" 00026 #include "phrasehunter/phexception.h" 00027 00028 using boost::format; 00029 00030 int main(int argc, char** argv) 00031 { 00032 PhraseHunter::CorpusManager corpus(argv[1], 00033 PhraseHunter::CorpusManager::Write); 00034 00035 hptimer timer; 00036 00037 for(int fileIdx = 2; fileIdx < argc; ++fileIdx) { 00038 try { 00039 timer.restart(); 00040 corpus.addFile(argv[fileIdx], argv[fileIdx]); 00041 std::cout << format("Indexing %||: %|3.2|s") 00042 % argv[fileIdx] 00043 % (timer.elapsed() / static_cast<double>(1000)) 00044 << std::endl; 00045 00046 } catch (PhraseHunter::Exceptions::FileError& e) { 00047 std::cout << e.what() << std::endl; 00048 } 00049 } 00050 return 0; 00051 }