1 /***************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: simpleguesser.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef SIMPLEGUESSER_H
31 #define SIMPLEGUESSER_H
39 #define MAX_STRING_LENGTH_TO_ANALYSE 200
44 @author Jocelyn Merand
48 /**inits the object with conf file "./conf.txt"*/
51 /** Compares the current Simpleguesser with an other
52 * @param SimpleGuesser& sg the other guesser to compare
54 void operator=(SimpleGuesser
& sg
);
62 * Analyze a text and return the most probable languages of the text
63 * @param char* text is the text to analyze
64 * @return the list of guess
66 vector
<Guess
> GuessLanguage(char* text
);
69 * Analyze a text and return the most probable language of the text
70 * @param char* text is the text to analyze
71 * @return the guess (containing language)
73 Guess
GuessPrimaryLanguage(char* text
);
76 * List all available languages (possibly to be in guesses)
77 * @return the list of languages
79 vector
<Guess
> GetAvailableLanguages();
82 * List all languages (possibly in guesses or not)
83 * @return the list of languages
85 vector
<Guess
> GetAllManagedLanguages();
88 * List all Unavailable languages (disable for any reason)
89 * @return the list of languages
91 vector
<Guess
> GetUnavailableLanguages();
94 * Mark a language enabled
95 * @param string lang the language to enable (build like language-COUNTRY-encoding)
97 void EnableLanguage(string lang
);
100 * Mark a language disabled
101 * @param string lang the language to disable (build like language-COUNTRY-encoding)
103 void DisableLanguage(string lang
);
106 * Load a new DB of fingerprints
107 * @param const char* thePathOfConfFile self explaining
108 * @param const char* prefix is the path where the directory witch contains fingerprint files is stored
110 void SetDBPath(const char* thePathOfConfFile
, const char* prefix
);
114 //Where typical fingerprints (n-gram tables) are stored
117 //Is used to select languages into the fingerprints DB, the mask is used to indicate if we want enabled disabled or both
118 vector
<Guess
> GetManagedLanguages(const char mask
);
120 //Like getManagedLanguages, this function enable or disable a language and it depends of the mask
121 void XableLanguage(string lang
, char mask
);