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 .
20 #ifndef __com_sun_star_linguistic2_XLanguageGuessing_idl__
21 #define __com_sun_star_linguistic2_XLanguageGuessing_idl__
23 #include
<com
/sun
/star
/uno
/XInterface.idl
>
24 #include
<com
/sun
/star
/lang
/Locale.idl
>
25 #include
<com
/sun
/star
/lang
/IllegalArgumentException.idl
>
27 module com
{ module sun
{ module star
{ module linguistic2
{
29 /** This interface allows to guess the language of a text
31 <p> The current set of supported languages is:
33 <li>af : Afrikaans</li>
47 <li>eo : Esperanto</li>
49 <li>et : Estonian</li>
55 <li>ga : Irish Gaelic</li>
56 <li>gd : Scots Gaelic</li>
57 <li>gv : Manx Gaelic</li>
60 <li>hr : Croatian</li>
61 <li>hu : Hungarian</li>
62 <li>hy : Armenian</li>
63 <li>id : Indonesian</li>
64 <li>is : Icelandic</li>
66 <li>ja : Japanese</li>
67 <li>ka : Georgian</li>
70 <li>lb : Luxembourgish (added with OOo 3.3)</li>
71 <li>lt : Lithuanian</li>
77 <li>nb : Norwegian (Bokmal)</li>
79 <li>pt-PT : Portuguese (Portugal)</li>
82 <li>ro : Romanian</li>
84 <li>sa : Sanskrit</li>
86 <li>sh : Serbian (written with latin characters)</li>
87 <li>sk-SK : Slovak (written with Latin characters)</li>
88 <li>sl : Slovenian</li>
89 <li>sq : Albanian</li>
90 <li>sr : Serbian (written with cyrillic characters) (added with OOo 3.4)</li>
97 <li>uk : Ukrainian</li>
98 <li>vi : Vietnamese</li>
100 <li>zh-CN : Chinese (simplified)</li>
101 <li>zh-TW : Chinese (traditional)</li>
108 interface XLanguageGuessing
110 /** determines the single most probable language of a sub-string.
112 <p>Please note that because statistical analysis is part
113 of the algorithm the likelihood to get the correct
114 result increases with the length of the sub-string.
115 A word is much less likely guessed correctly compared to
116 a sentence or even a whole paragraph.</p>
118 <p>Also note that some languages are that "close" to each other
119 that it will be quite unlikely to find a difference in them,
120 e.g. English (UK), English (IE) and English (AUS) and
121 most likely English (US) as well. And thus the result may
125 the locale for the language identified.
126 If no language could be identified the locale will be empty.
129 all the text including the part that should checked.
132 specifies the starting index of the sub-string to be checked
133 The value must met 0 <= nStartPos < (length of text - 1).
136 specifies the length of the sub-string to be checked.
137 The value must met 0 <= nLen <= (length of text).
139 @see com::sun::star::lang::Locale
141 com
::sun
::star
::lang
::Locale guessPrimaryLanguage
(
145 raises
( com
::sun
::star
::lang
::IllegalArgumentException
);
147 /** allows to explicitly discard some languages from the set of
148 languages possibly returned.
150 <p>By default all languages are enabled.</p>
152 void disableLanguages
(
153 [in] sequence
< com
::sun
::star
::lang
::Locale
> aLanguages
)
154 raises
( com
::sun
::star
::lang
::IllegalArgumentException
);
156 /** allows to explicitly re-enable some languages that got previously
159 <p>By default all languages are enabled.</p>
161 void enableLanguages
(
162 [in] sequence
< com
::sun
::star
::lang
::Locale
> aLanguages
)
163 raises
( com
::sun
::star
::lang
::IllegalArgumentException
);
165 /** returns a list of all supported languages.
167 <p>This should be the same as the mathematical union of
168 all enabled and disabled languages.</p>
170 sequence
< com
::sun
::star
::lang
::Locale
> getAvailableLanguages
();
172 /** returns the list of all enabled languages
174 sequence
< com
::sun
::star
::lang
::Locale
> getEnabledLanguages
();
176 /** returns the list of all disabled languages
178 sequence
< com
::sun
::star
::lang
::Locale
> getDisabledLanguages
();
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */