Blame gettext-tools/src/msgl-fsearch.h

Packit Bot 06c835
/* Fast fuzzy searching among messages.
Packit Bot 06c835
   Copyright (C) 2006, 2008, 2015 Free Software Foundation, Inc.
Packit Bot 06c835
   Written by Bruno Haible <bruno@clisp.org>, 2006.
Packit Bot 06c835
Packit Bot 06c835
   This program is free software: you can redistribute it and/or modify
Packit Bot 06c835
   it under the terms of the GNU General Public License as published by
Packit Bot 06c835
   the Free Software Foundation; either version 3 of the License, or
Packit Bot 06c835
   (at your option) any later version.
Packit Bot 06c835
Packit Bot 06c835
   This program is distributed in the hope that it will be useful,
Packit Bot 06c835
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 06c835
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot 06c835
   GNU General Public License for more details.
Packit Bot 06c835
Packit Bot 06c835
   You should have received a copy of the GNU General Public License
Packit Bot 06c835
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
Packit Bot 06c835
Packit Bot 06c835
#ifndef _MSGL_FSEARCH_H
Packit Bot 06c835
#define _MSGL_FSEARCH_H 1
Packit Bot 06c835
Packit Bot 06c835
#include "message.h"
Packit Bot 06c835
Packit Bot 06c835
#include <stdbool.h>
Packit Bot 06c835
Packit Bot 06c835
Packit Bot 06c835
#ifdef __cplusplus
Packit Bot 06c835
extern "C" {
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
Packit Bot 06c835
/* A fuzzy index is a data structure that corresponds to a set of messages,
Packit Bot 06c835
   allowing for fuzzy searching of a message.  It is optimized for large sets
Packit Bot 06c835
   of messages.  */
Packit Bot 06c835
typedef struct message_fuzzy_index_ty message_fuzzy_index_ty;
Packit Bot 06c835
Packit Bot 06c835
/* Allocate a fuzzy index corresponding to a given list of messages.
Packit Bot 06c835
   The list of messages and the msgctxt and msgid fields of the messages
Packit Bot 06c835
   inside it must not be modified while the returned fuzzy index is in use.  */
Packit Bot 06c835
extern message_fuzzy_index_ty *
Packit Bot 06c835
       message_fuzzy_index_alloc (const message_list_ty *mlp,
Packit Bot 06c835
                                  const char *canon_charset);
Packit Bot 06c835
Packit Bot 06c835
/* Find a good match for the given msgctxt and msgid in the given fuzzy index.
Packit Bot 06c835
   The match does not need to be optimal.
Packit Bot 06c835
   Ignore matches for which the fuzzy_search_goal_function is < LOWER_BOUND.
Packit Bot 06c835
   LOWER_BOUND must be >= FUZZY_THRESHOLD.
Packit Bot 06c835
   If HEURISTIC is true, only the few best messages among the list - according
Packit Bot 06c835
   to a certain heuristic - are considered.  If HEURISTIC is false, all
Packit Bot 06c835
   messages with a fuzzy_search_goal_function > FUZZY_THRESHOLD are considered,
Packit Bot 06c835
   like in message_list_search_fuzzy (except that in ambiguous cases where
Packit Bot 06c835
   several best matches exist, message_list_search_fuzzy chooses the one with
Packit Bot 06c835
   the smallest index whereas message_fuzzy_index_search makes a better
Packit Bot 06c835
   choice).  */
Packit Bot 06c835
extern message_ty *
Packit Bot 06c835
       message_fuzzy_index_search (message_fuzzy_index_ty *findex,
Packit Bot 06c835
                                   const char *msgctxt, const char *msgid,
Packit Bot 06c835
                                   double lower_bound,
Packit Bot 06c835
                                   bool heuristic);
Packit Bot 06c835
Packit Bot 06c835
/* Free a fuzzy index.  */
Packit Bot 06c835
extern void
Packit Bot 06c835
       message_fuzzy_index_free (message_fuzzy_index_ty *findex);
Packit Bot 06c835
Packit Bot 06c835
Packit Bot 06c835
#ifdef __cplusplus
Packit Bot 06c835
}
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
#endif /* _MSGL_FSEARCH_H */