/* Copyright (C) 2008-2012 Børre Gaup This file is part of the program wordlist2hunspell. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifdef HAVE_CONFIG_H #include #endif #include // for the help text #include // for printing the affix file #include "wordlistparserall.h" // to be able to parse a sorted lemmafile #include "wordlistparsernocompound.h" // to be able to parse a sorted lemmafile #include "setoptimizer.h" // to optimize derivation and suffix sets #include "hunspellprintercompounding.h" #include "hunspellprinternocompounding.h" std::string version = "$Revision$"; void help() { std::cout << "This program expects three arguments:" << std::endl; std::cout << "the directory where the output files are written" << std::endl; std::cout << "the ISO-639 language of the language it makes dictionaries for" << std::endl; std::cout << "the input file containing sorted wordforms" << std::endl; } int main (int argc, char **argv) { if (argc == 3) { std::cerr << "compounding" << std::endl; std::istream* inputfile = new std::ifstream(*(argv+2)); WordlistParserAll wp; wp.processFile(inputfile); wp.writeStatistics(); delete inputfile; SetOptimizer so(wp.getSuffixSetStemSet()); HunspellPrinterCompounding hp(std::string(*(argv+1))); std::map hmhm = hp.preparePLXClasses(wp.getPlxClasses()); hp.prepareAfmap(so.giveSubsetsToStems()); hp.printDic(wp.getStems()); hp.printAffFile(hmhm, wp.getSuffixMap(), so.getSuffixMap()); } else if (argc == 4) { std::cerr << "no compounding" << std::endl; std::istream* inputfile = new std::ifstream(*(argv+3)); WordlistParserNoCompound wp; wp.processFile(inputfile); wp.writeStatistics(); delete inputfile; SetOptimizer so(wp.getSuffixSetStemSet()); HunspellPrinterNoCompounding hp(std::string(*(argv+2))); std::map hmhm = hp.preparePLXClasses(wp.getPlxClasses()); hp.prepareAfmap(so.giveSubsetsToStems()); hp.printDic(wp.getStems()); hp.printAffFile(hmhm, wp.getSuffixMap(), so.getSuffixMap()); } else { help(); } }