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
26 #define MAX_STRING_LENGTH_TO_ANALYSE 200
28 class SimpleGuesser final
31 /**inits the object with conf file "./conf.txt"*/
35 * @param SimpleGuesser& sg the other guesser
37 SimpleGuesser
& operator=(const SimpleGuesser
& sg
);
45 * Analyze a text and return the most probable languages of the text
46 * @param char* text is the text to analyze
47 * @return the list of guess
49 std::vector
<Guess
> GuessLanguage(const char* text
);
52 * Analyze a text and return the most probable language of the text
53 * @param char* text is the text to analyze
54 * @return the guess (containing language)
56 Guess
GuessPrimaryLanguage(const char* text
);
59 * List all available languages (possibly to be in guesses)
60 * @return the list of languages
62 std::vector
<Guess
> GetAvailableLanguages();
65 * List all languages (possibly in guesses or not)
66 * @return the list of languages
68 std::vector
<Guess
> GetAllManagedLanguages();
71 * List all Unavailable languages (disable for any reason)
72 * @return the list of languages
74 std::vector
<Guess
> GetUnavailableLanguages();
77 * Mark a language enabled
78 * @param string lang the language to enable (build like language-COUNTRY-encoding)
80 void EnableLanguage(const std::string
& lang
);
83 * Mark a language disabled
84 * @param string lang the language to disable (build like language-COUNTRY-encoding)
86 void DisableLanguage(const std::string
& lang
);
89 * Load a new DB of fingerprints
90 * @param const char* thePathOfConfFile self explaining
91 * @param const char* prefix is the path where the directory which contains fingerprint files is stored
93 void SetDBPath(const char* thePathOfConfFile
, const char* prefix
);
96 //Where typical fingerprints (n-gram tables) are stored
99 //Is used to select languages into the fingerprints DB, the mask is used to indicate if we want enabled disabled or both
100 std::vector
<Guess
> GetManagedLanguages(const char mask
);
102 //Like getManagedLanguages, this function enable or disable a language and it depends of the mask
103 void XableLanguage(const std::string
& lang
, char mask
);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */