LibreOffice
LibreOffice 24.2 SDK API Reference
Public Member Functions | List of all members
XLanguageGuessing Interface Reference

This interface allows to guess the language of a text. More...

import"XLanguageGuessing.idl";

Inheritance diagram for XLanguageGuessing:
LanguageGuessing

Public Member Functions

com::sun::star::lang::Locale guessPrimaryLanguage ([in] string aText, [in] long nStartPos, [in] long nLen) raises ( com::sun::star::lang::IllegalArgumentException )
 determines the single most probable language of a sub-string. More...
 
void disableLanguages ([in] sequence< com::sun::star::lang::Locale > aLanguages) raises ( com::sun::star::lang::IllegalArgumentException )
 allows to explicitly discard some languages from the set of languages possibly returned. More...
 
void enableLanguages ([in] sequence< com::sun::star::lang::Locale > aLanguages) raises ( com::sun::star::lang::IllegalArgumentException )
 allows to explicitly re-enable some languages that got previously disabled. More...
 
sequence< com::sun::star::lang::LocalegetAvailableLanguages ()
 returns a list of all supported languages. More...
 
sequence< com::sun::star::lang::LocalegetEnabledLanguages ()
 returns the list of all enabled languages More...
 
sequence< com::sun::star::lang::LocalegetDisabledLanguages ()
 returns the list of all disabled languages More...
 

Detailed Description

This interface allows to guess the language of a text.

The current set of supported languages is:

Since
OOo 2.2

Member Function Documentation

◆ disableLanguages()

void disableLanguages ( [in] sequence< com::sun::star::lang::Locale aLanguages)
raises (com::sun::star::lang::IllegalArgumentException
)

allows to explicitly discard some languages from the set of languages possibly returned.

By default all languages are enabled.

◆ enableLanguages()

void enableLanguages ( [in] sequence< com::sun::star::lang::Locale aLanguages)
raises (com::sun::star::lang::IllegalArgumentException
)

allows to explicitly re-enable some languages that got previously disabled.

By default all languages are enabled.

◆ getAvailableLanguages()

sequence< com::sun::star::lang::Locale > getAvailableLanguages ( )

returns a list of all supported languages.

This should be the same as the mathematical union of all enabled and disabled languages.

◆ getDisabledLanguages()

sequence< com::sun::star::lang::Locale > getDisabledLanguages ( )

returns the list of all disabled languages

◆ getEnabledLanguages()

sequence< com::sun::star::lang::Locale > getEnabledLanguages ( )

returns the list of all enabled languages

◆ guessPrimaryLanguage()

com::sun::star::lang::Locale guessPrimaryLanguage ( [in] string  aText,
[in] long  nStartPos,
[in] long  nLen 
)
raises (com::sun::star::lang::IllegalArgumentException
)

determines the single most probable language of a sub-string.

Please note that because statistical analysis is part of the algorithm the likelihood to get the correct result increases with the length of the sub-string. A word is much less likely guessed correctly compared to a sentence or even a whole paragraph.

Also note that some languages are that "close" to each other that it will be quite unlikely to find a difference in them, e.g. English (UK), English (IE) and English (AUS) and most likely English (US) as well. And thus the result may be arbitrary.

Returns
the locale for the language identified. If no language could be identified the locale will be empty.
Parameters
aTextall the text including the part that should checked.
nStartPosspecifies the starting index of the sub-string to be checked The value must met 0 <= nStartPos < (length of text - 1).
nLenspecifies the length of the sub-string to be checked. The value must met 0 <= nLen <= (length of text).
See also
com::sun::star::lang::Locale

The documentation for this interface was generated from the following file: