• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef ENCODINGS_COMPACT_LANG_DET_WIN_CLD_UNICODETEXT_H_
6 #define ENCODINGS_COMPACT_LANG_DET_WIN_CLD_UNICODETEXT_H_
7 
8 #include "languages/public/languages.h"
9 #include "unicode/utypes.h"
10 
11 namespace CompactLangDet {
12   struct DetectionTables;
13 }  // namespace CompactLangDet
14 
15 // Detects a language of the UTF-16 encoded zero-terminated text.
16 // [in] detection_tables - internal CLD data tables (see compact_lang_det.h).
17 //     Can be NULL, in this case CLD will fall back to builtin static tables.
18 // [in] text - UTF-16 encoded text to detect a language of.
19 // [in] is_plain_text - true if plain text, false otherwise (e.g. HTML).
20 // [out] is_reliable - true, if returned language was detected reliably.
21 //     See compact_lang_det.h for details.
22 // [out] num_languages - set to the number of languages detected on the page.
23 //     Language counts only if it's detected in more than 20% of the text.
24 // [out, optional] error_code - set to 0 in case of success, Windows
25 //     GetLastError() code otherwise.  Pass NULL, if not interested in errors.
26 // See encodings/compact_lang_det/compact_lang_det.h,
27 //     CompactLangDet::DetectLanguage() description for other input parameters
28 //     description.
29 // Returns: Language enum.
30 //     Returns NUM_LANGUAGES in case of any error.
31 //     See googleclient/languages/internal/languages.cc
32 //     for details.
33 Language DetectLanguageOfUnicodeText(
34     const CompactLangDet::DetectionTables* detection_tables,
35     const UChar* text, bool is_plain_text,
36     bool* is_reliable, int* num_languages,
37     int* error_code, int* text_bytes);
38 
39 
40 #endif  // ENCODINGS_COMPACT_LANG_DET_WIN_CLD_UNICODETEXT_H_
41