/* Copyright (C) 2003 Datapark corp. All rights reserved.
   Copyright (C) 2000-2002 Lavtech.com corp. All rights reserved.

   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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
*/

#ifndef DPS_GUESSER_H
#define DPS_GUESSER_H

#include "dps_uniconv.h"

/* Structure to sort guesser results */
typedef struct {
     DPS_LANGMAP * map;
     size_t hits, miss;
} DPS_MAPSTAT;

extern int DpsLMstatcmp(const void * i1, const void * i2);
extern int DpsLMcmpCount(const void * i1,const void * i2);
extern int DpsLMcmpIndex(const void * i1,const void * i2);

extern void  DpsBuildLangMap(DPS_LANGMAP * map,const char * text,size_t text_len, int StrFlag);
extern void  DpsPrepareLangMap(DPS_LANGMAP * map);
extern void  DpsCheckLangMap(DPS_LANGMAP * map, DPS_LANGMAP * text, DPS_MAPSTAT *mstat, size_t InfMiss);
extern void  DpsLangMapListFree(DPS_LANGMAPLIST *);
extern void DpsLangMapListSave(DPS_LANGMAPLIST *List);
#ifdef _DPS_COMMON_H
extern  int  DpsGuessCharSet(DPS_AGENT *Indexer, DPS_DOCUMENT * D, DPS_LANGMAPLIST *L, DPS_LANGMAP *M);
#endif

extern __C_LINK int __DPSCALL DpsLoadLangMapList(DPS_LANGMAPLIST *L, const char * mapdir);
extern __C_LINK int __DPSCALL DpsLoadLangMapFile(DPS_LANGMAPLIST *L, const char * mapname);

#endif
