More usual 1899-12-30 base Date in Basic
[LibreOffice.git] / lingucomponent / source / languageguessing / simpleguesser.hxx
blobaec5442853b1e1862768c995a278c4bfb2ffe7e2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
22 #include <string>
23 #include <vector>
24 #include "guess.hxx"
26 #define MAX_STRING_LENGTH_TO_ANALYSE 200
28 class SimpleGuesser final
30 public:
31 /**inits the object with conf file "./conf.txt"*/
32 SimpleGuesser();
34 /**
35 * @param SimpleGuesser& sg the other guesser
37 SimpleGuesser& operator=(const SimpleGuesser& sg);
39 /**
40 * destroy the object
42 ~SimpleGuesser();
44 /**
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);
51 /**
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);
58 /**
59 * List all available languages (possibly to be in guesses)
60 * @return the list of languages
62 std::vector<Guess> GetAvailableLanguages();
64 /**
65 * List all languages (possibly in guesses or not)
66 * @return the list of languages
68 std::vector<Guess> GetAllManagedLanguages();
70 /**
71 * List all Unavailable languages (disable for any reason)
72 * @return the list of languages
74 std::vector<Guess> GetUnavailableLanguages();
76 /**
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);
82 /**
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);
88 /**
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);
95 private:
96 //Where typical fingerprints (n-gram tables) are stored
97 void* h;
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);
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */