1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_LINGUCOMPONENT_SOURCE_LANGUAGEGUESSING_SIMPLEGUESSER_HXX
20 #define INCLUDED_LINGUCOMPONENT_SOURCE_LANGUAGEGUESSING_SIMPLEGUESSER_HXX
28 #define MAX_STRING_LENGTH_TO_ANALYSE 200
32 class SimpleGuesser final
{
34 /**inits the object with conf file "./conf.txt"*/
38 * @param SimpleGuesser& sg the other guesser
40 SimpleGuesser
& operator=(const SimpleGuesser
& sg
);
48 * Analyze a text and return the most probable languages of the text
49 * @param char* text is the text to analyze
50 * @return the list of guess
52 vector
<Guess
> GuessLanguage(const char* text
);
55 * Analyze a text and return the most probable language of the text
56 * @param char* text is the text to analyze
57 * @return the guess (containing language)
59 Guess
GuessPrimaryLanguage(const char* text
);
62 * List all available languages (possibly to be in guesses)
63 * @return the list of languages
65 vector
<Guess
> GetAvailableLanguages();
68 * List all languages (possibly in guesses or not)
69 * @return the list of languages
71 vector
<Guess
> GetAllManagedLanguages();
74 * List all Unavailable languages (disable for any reason)
75 * @return the list of languages
77 vector
<Guess
> GetUnavailableLanguages();
80 * Mark a language enabled
81 * @param string lang the language to enable (build like language-COUNTRY-encoding)
83 void EnableLanguage(const string
& lang
);
86 * Mark a language disabled
87 * @param string lang the language to disable (build like language-COUNTRY-encoding)
89 void DisableLanguage(const string
& lang
);
92 * Load a new DB of fingerprints
93 * @param const char* thePathOfConfFile self explaining
94 * @param const char* prefix is the path where the directory which contains fingerprint files is stored
96 void SetDBPath(const char* thePathOfConfFile
, const char* prefix
);
100 //Where typical fingerprints (n-gram tables) are stored
103 //Is used to select languages into the fingerprints DB, the mask is used to indicate if we want enabled disabled or both
104 vector
<Guess
> GetManagedLanguages(const char mask
);
106 //Like getManagedLanguages, this function enable or disable a language and it depends of the mask
107 void XableLanguage(const string
& lang
, char mask
);
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */