fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / lingucomponent / source / languageguessing / simpleguesser.hxx
blobdb6cc6a1491d2bae635e3cfcdfa96a47ce1fff68
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.h>
23 #include <string>
24 #include <cstdlib>
25 #include <vector>
26 #include <guess.hxx>
28 #define MAX_STRING_LENGTH_TO_ANALYSE 200
30 using namespace std;
32 /**
33 @author Jocelyn Merand
35 class SimpleGuesser{
36 public:
37 /**inits the object with conf file "./conf.txt"*/
38 SimpleGuesser();
40 /**
41 * @param SimpleGuesser& sg the other guesser
43 SimpleGuesser& operator=(const SimpleGuesser& sg);
45 /**
46 * destroy the object
48 ~SimpleGuesser();
50 /**
51 * Analyze a text and return the most probable languages of the text
52 * @param char* text is the text to analyze
53 * @return the list of guess
55 vector<Guess> GuessLanguage(const char* text);
57 /**
58 * Analyze a text and return the most probable language of the text
59 * @param char* text is the text to analyze
60 * @return the guess (containing language)
62 Guess GuessPrimaryLanguage(const char* text);
64 /**
65 * List all available languages (possibly to be in guesses)
66 * @return the list of languages
68 vector<Guess> GetAvailableLanguages();
70 /**
71 * List all languages (possibly in guesses or not)
72 * @return the list of languages
74 vector<Guess> GetAllManagedLanguages();
76 /**
77 * List all Unavailable languages (disable for any reason)
78 * @return the list of languages
80 vector<Guess> GetUnavailableLanguages();
82 /**
83 * Mark a language enabled
84 * @param string lang the language to enable (build like language-COUNTRY-encoding)
86 void EnableLanguage(const string& lang);
88 /**
89 * Mark a language disabled
90 * @param string lang the language to disable (build like language-COUNTRY-encoding)
92 void DisableLanguage(const string& lang);
94 /**
95 * Load a new DB of fingerprints
96 * @param const char* thePathOfConfFile self explaining
97 * @param const char* prefix is the path where the directory witch contains fingerprint files is stored
99 void SetDBPath(const char* thePathOfConfFile, const char* prefix);
101 protected:
103 //Where typical fingerprints (n-gram tables) are stored
104 void* h;
106 //Is used to select languages into the fingerprints DB, the mask is used to indicate if we want enabled disabled or both
107 vector<Guess> GetManagedLanguages(const char mask);
109 //Like getManagedLanguages, this function enable or disable a language and it depends of the mask
110 void XableLanguage(const string& lang, char mask);
113 #endif
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */