1d1766043SAndrew Rist/**************************************************************
2cdf0e10cSrcweir *
3d1766043SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4d1766043SAndrew Rist * or more contributor license agreements.  See the NOTICE file
5d1766043SAndrew Rist * distributed with this work for additional information
6d1766043SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
7d1766043SAndrew Rist * to you under the Apache License, Version 2.0 (the
8d1766043SAndrew Rist * "License"); you may not use this file except in compliance
9d1766043SAndrew Rist * with the License.  You may obtain a copy of the License at
10d1766043SAndrew Rist *
11d1766043SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
12d1766043SAndrew Rist *
13d1766043SAndrew Rist * Unless required by applicable law or agreed to in writing,
14d1766043SAndrew Rist * software distributed under the License is distributed on an
15d1766043SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16d1766043SAndrew Rist * KIND, either express or implied.  See the License for the
17d1766043SAndrew Rist * specific language governing permissions and limitations
18d1766043SAndrew Rist * under the License.
19d1766043SAndrew Rist *
20d1766043SAndrew Rist *************************************************************/
21d1766043SAndrew Rist
22d1766043SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir#ifndef __com_sun_star_linguistic2_XLanguageGuessing_idl__
25cdf0e10cSrcweir#define __com_sun_star_linguistic2_XLanguageGuessing_idl__
26cdf0e10cSrcweir
27cdf0e10cSrcweir#ifndef _COM_SUN_STAR_UNO_XINTERFACE_idl_
28cdf0e10cSrcweir#include <com/sun/star/uno/XInterface.idl>
29cdf0e10cSrcweir#endif
30cdf0e10cSrcweir#ifndef _COM_SUN_STAR_LANG_LOCALE_idl_
31cdf0e10cSrcweir#include <com/sun/star/lang/Locale.idl>
32cdf0e10cSrcweir#endif
33cdf0e10cSrcweir#ifndef _COM_SUN_STAR_LANG_ILLEGALARGUMENTEXCEPTION_IDL_
34cdf0e10cSrcweir#include <com/sun/star/lang/IllegalArgumentException.idl>
35cdf0e10cSrcweir#endif
36cdf0e10cSrcweir
37cdf0e10cSrcweirmodule com { module sun { module star { module linguistic2 {
38cdf0e10cSrcweir
39cdf0e10cSrcweir/** This interface allows to guess the language of a text
40cdf0e10cSrcweir
41cdf0e10cSrcweir    <p> The current set of supported languages is:
42cdf0e10cSrcweir    <ul>
43cdf0e10cSrcweir        <li>af : Afrikaans</li>
44cdf0e10cSrcweir        <li>am : Amharic</li>
45cdf0e10cSrcweir        <li>ar : Arabic</li>
46cdf0e10cSrcweir        <li>be : Belarus</li>
47cdf0e10cSrcweir        <li>br : Breton</li>
48cdf0e10cSrcweir        <li>bs : Bosnian</li>
49cdf0e10cSrcweir        <li>ca : Catalan</li>
50cdf0e10cSrcweir        <li>cs : Czech</li>
51cdf0e10cSrcweir        <li>cy : Welsh</li>
52cdf0e10cSrcweir        <li>da : Danish</li>
53cdf0e10cSrcweir        <li>de : German</li>
54cdf0e10cSrcweir        <li>drt : Drents</li>
55cdf0e10cSrcweir        <li>el : Greek</li>
56cdf0e10cSrcweir        <li>en : English</li>
57cdf0e10cSrcweir        <li>eo : Esperanto</li>
58cdf0e10cSrcweir        <li>es : Spanish</li>
59cdf0e10cSrcweir        <li>et : Estonian</li>
60cdf0e10cSrcweir        <li>eu : Basque</li>
61*56021edfSAriel Constenla-Haile        <li>fa : Persian</li>
62cdf0e10cSrcweir        <li>fi : Finnish</li>
63cdf0e10cSrcweir        <li>fr : French</li>
64cdf0e10cSrcweir        <li>fy : Frisian</li>
65cdf0e10cSrcweir        <li>ga : Irish Gaelic</li>
66cdf0e10cSrcweir        <li>gd : Scots Gaelic</li>
67cdf0e10cSrcweir        <li>gv : Manx Gaelic</li>
68cdf0e10cSrcweir        <li>he : Hebrew</li>
69cdf0e10cSrcweir        <li>hi : Hindi</li>
70cdf0e10cSrcweir        <li>hr : Croatian</li>
71cdf0e10cSrcweir        <li>hu : Hungarian</li>
72cdf0e10cSrcweir        <li>hy : Armenian</li>
73cdf0e10cSrcweir        <li>id : Indonesian</li>
74cdf0e10cSrcweir        <li>is : Icelandic</li>
75cdf0e10cSrcweir        <li>it : Italian</li>
76cdf0e10cSrcweir        <li>ja : Japanese</li>
77cdf0e10cSrcweir        <li>ka : Georgian</li>
78cdf0e10cSrcweir        <li>ko : Korean</li>
79cdf0e10cSrcweir        <li>la : Latin</li>
80cdf0e10cSrcweir        <li>lb : Luxembourgish (added with OOo 3.3)</li>
81cdf0e10cSrcweir        <li>lt : Lithuanian</li>
82cdf0e10cSrcweir        <li>lv : Latvian</li>
83cdf0e10cSrcweir        <li>mr : Marathi</li>
84cdf0e10cSrcweir        <li>ms : Malay</li>
85cdf0e10cSrcweir        <li>ne : Nepali</li>
86cdf0e10cSrcweir        <li>nl : Dutch</li>
87cdf0e10cSrcweir        <li>nb : Norwegian (Bokmal)</li>
88cdf0e10cSrcweir        <li>pl : Polish</li>
89cdf0e10cSrcweir        <li>pt-PT : Portuguese (Portugal)</li>
90cdf0e10cSrcweir        <li>qu : Quechua</li>
91cdf0e10cSrcweir        <li>rm : Romansh</li>
92cdf0e10cSrcweir        <li>ro : Romanian</li>
93cdf0e10cSrcweir        <li>ru : Russian</li>
94cdf0e10cSrcweir        <li>sa : Sanskrit</li>
95cdf0e10cSrcweir        <li>sco : Scots</li>
96cdf0e10cSrcweir        <li>sh : Serbian (written with latin characters)</li>
97cdf0e10cSrcweir        <li>sk-SK : Slovak (written with latin characters)</li>
98cdf0e10cSrcweir        <li>sl : Slovenian</li>
99cdf0e10cSrcweir        <li>sq : Albanian</li>
100cdf0e10cSrcweir        <li>sr : Serbian (written with cyrillic characters) (added with OOo 3.4)</li>
101cdf0e10cSrcweir        <li>sv : Swedish</li>
102cdf0e10cSrcweir        <li>sw : Swahili</li>
103cdf0e10cSrcweir        <li>ta : Tamil</li>
104cdf0e10cSrcweir        <li>th : Thai</li>
105cdf0e10cSrcweir        <li>tl : Tagalog</li>
106cdf0e10cSrcweir        <li>tr : Turkish</li>
107cdf0e10cSrcweir        <li>uk : Ukrainian</li>
108cdf0e10cSrcweir        <li>vi : Vietnamese</li>
109cdf0e10cSrcweir        <li>yi : Yiddish</li>
110cdf0e10cSrcweir        <li>zh-CN : Chinese (simplified)</li>
111cdf0e10cSrcweir        <li>zh-TW : Chinese (traditional)</li>
112cdf0e10cSrcweir    </ul>
113cdf0e10cSrcweir
114cdf0e10cSrcweir    </p>
115cdf0e10cSrcweir
116cdf0e10cSrcweir    @since OOo 2.2
117cdf0e10cSrcweir */
118cdf0e10cSrcweirinterface XLanguageGuessing
119cdf0e10cSrcweir{
120cdf0e10cSrcweir    //-------------------------------------------------------------------------
121cdf0e10cSrcweir    /** determines the single most probable language of a sub-string.
122cdf0e10cSrcweir
123cdf0e10cSrcweir        <p>Please note that because statistical analysis is part
124cdf0e10cSrcweir        of the algorithm the the likelihood to get the correct
125cdf0e10cSrcweir        result increases with the length of the sub-string.
126cdf0e10cSrcweir        A word is much less likely guessed correctly compared to
127cdf0e10cSrcweir        a sentence or even a whole paragraph.</p>
128cdf0e10cSrcweir
129cdf0e10cSrcweir        <p>Also note that some languages are that 'close' to each other
130cdf0e10cSrcweir        that it will be quite unlikely to find a difference in them,
131cdf0e10cSrcweir        e.g. English (UK), English (IE) and English (AUS) and
132cdf0e10cSrcweir        most liklely English (US) as well. And thus the result may
133cdf0e10cSrcweir        be arbitrary.</p>
134cdf0e10cSrcweir
135cdf0e10cSrcweir        @returns
136cdf0e10cSrcweir            the locale for the language identified.
137cdf0e10cSrcweir            If no language could be identified the locale will be empty.
138cdf0e10cSrcweir
139cdf0e10cSrcweir        @param  aText
140cdf0e10cSrcweir            all the text including the part that should checked.
141cdf0e10cSrcweir
142cdf0e10cSrcweir        @param nStartPos
143cdf0e10cSrcweir            specifies the starting index of the sub-string to be checked
144cdf0e10cSrcweir            The value must met 0 <= nStartPos < (length of text - 1).
145cdf0e10cSrcweir
146cdf0e10cSrcweir        @param nLen
147cdf0e10cSrcweir            specifies the length of the sub-string to be checked.
148cdf0e10cSrcweir            The value must met 0 <= nLen <= (length of text).
149cdf0e10cSrcweir
150cdf0e10cSrcweir        @see    <type scope="com::sun::star::lang">Locale</type>
151cdf0e10cSrcweir     */
152cdf0e10cSrcweir    com::sun::star::lang::Locale    guessPrimaryLanguage(
153cdf0e10cSrcweir            [in] string  aText,
154cdf0e10cSrcweir            [in] long    nStartPos,
155cdf0e10cSrcweir            [in] long    nLen )
156cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
157cdf0e10cSrcweir
158cdf0e10cSrcweir    //-------------------------------------------------------------------------
159cdf0e10cSrcweir    /** allows to explicitly discard some languages from the set of
160cdf0e10cSrcweir        languages possibly returned.
161cdf0e10cSrcweir
162cdf0e10cSrcweir        <p>By default all languages are enabled.</p>
163cdf0e10cSrcweir    */
164cdf0e10cSrcweir    void disableLanguages(
165cdf0e10cSrcweir            [in] sequence< com::sun::star::lang::Locale > aLanguages )
166cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
167cdf0e10cSrcweir
168cdf0e10cSrcweir    //-------------------------------------------------------------------------
169cdf0e10cSrcweir    /** allows to explicitly re-enable some languages that got previously
170cdf0e10cSrcweir        disabled.
171cdf0e10cSrcweir
172cdf0e10cSrcweir        <p>By default all languages are enabled.</p>
173cdf0e10cSrcweir    */
174cdf0e10cSrcweir    void enableLanguages(
175cdf0e10cSrcweir            [in] sequence< com::sun::star::lang::Locale > aLanguages )
176cdf0e10cSrcweir        raises( com::sun::star::lang::IllegalArgumentException );
177cdf0e10cSrcweir
178cdf0e10cSrcweir    //-------------------------------------------------------------------------
179cdf0e10cSrcweir    /** returns a list of all supported languages.
180cdf0e10cSrcweir
181cdf0e10cSrcweir        <p>This should be the same as the mathematical union of
182cdf0e10cSrcweir        all enabled and disabled languages.</p>
183cdf0e10cSrcweir    */
184cdf0e10cSrcweir    sequence< com::sun::star::lang::Locale > getAvailableLanguages();
185cdf0e10cSrcweir
186cdf0e10cSrcweir    //-------------------------------------------------------------------------
187cdf0e10cSrcweir    /** returns the list of all enabled languages
188cdf0e10cSrcweir    */
189cdf0e10cSrcweir    sequence< com::sun::star::lang::Locale > getEnabledLanguages();
190cdf0e10cSrcweir
191cdf0e10cSrcweir    //-------------------------------------------------------------------------
192cdf0e10cSrcweir    /** returns the list of all disabled languages
193cdf0e10cSrcweir    */
194cdf0e10cSrcweir    sequence< com::sun::star::lang::Locale > getDisabledLanguages();
195cdf0e10cSrcweir
196cdf0e10cSrcweir};
197cdf0e10cSrcweir
198cdf0e10cSrcweir}; }; }; };
199cdf0e10cSrcweir
200cdf0e10cSrcweir#endif
201cdf0e10cSrcweir
202