/************************************************************************** * * mgpp_invf_dict_dump.cpp -- Program to printthe various inverted dictionaries * Copyright (C) 1999 Rodger McNab * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. * **************************************************************************/ #define _XOPEN_SOURCE 1 // This was added for Solaris, but it makes things worse on Solaris for me... // #define _XOPEN_SOURCE_EXTENDED 1 // need this to avoid bizarre compiler problems under VC++ 6.0 #if defined (__WIN32__) && !defined (GSDL_USE_IOS_H) # include #endif /* getopt is in posix.2, so cygwin should have it in unistd, but doesn't */ #if defined (__WIN32__) || defined (__CYGWIN__) # include "getopt_old.h" #else # include #endif #include "sysfuncs.h" #include "messages.h" #include "mg_files.h" #include "invf.h" static void process_files (char *filename, bool printHeader, bool printWords, bool printTags) { // open the dictionary FILE *dictFile = open_file (filename, INVF_DICT_SUFFIX, "rb", MAGIC_STEM_BUILD, MG_ABORT); invf_dict_header idh; idh.Read (dictFile); // print the information from the inverted dictionary file header if (printHeader) { cout << "lookback: " << idh.lookback << "\n"; cout << "word_dict_start: " << idh.word_dict_start << "\n"; cout << "word_dict_size: " << idh.word_dict_size << "\n"; cout << "tag_dict_start: " << idh.tag_dict_start << "\n"; cout << "tag_dict_size: " << idh.tag_dict_size << "\n"; cout << "num_docs: " << idh.num_docs << "\n"; cout << "num_frags: " << idh.num_frags << "\n"; cout << "num_words: " << idh.num_words << "\n"; cout << "total_bytes: " << idh.total_bytes << "\n"; cout << "index_string_bytes: " << idh.index_string_bytes << "\n"; cout << "num_levels: " << idh.num_levels << "\n"; cout << "\n"; } if (printWords) { fseek (dictFile, idh.word_dict_start, SEEK_SET); mg_u_long wordNum; word_dict_el wordEl; wordEl.SetNumLevels (idh.num_levels); for (wordNum=0; wordNum