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