IFELanguage Functions

IFELanguage methods

Description

Open

Open the interface to initiate a session

Close

Close the interface to terminate a session

GetMorphResult

Get morphological analysis result

GetConversionModeCaps

Get conversion mode capability

GetPhonetic

Convert string to phonetic symbol

HRESULT IFELanguage::Open

This method must be called before use of IFELanguage for initialization.

Parameters:    None.

Return Values:

HRESULT

  • S_OK: Successfully terminated.
  • S_FALSE: Fails to create result.

Note    MS-IME 98 Japanese version has a limitation that multiple processes should not initialize via this call at the same time.

HRESULT IFELanguage::Close

This method must be called after use of IFELanguage for termination.

Parameters:    None

Return Values:

HRESULT

  • S_OK: Successfully terminated.
  • S_FALSE: Fails to create result.

HRESULT IFELanguage:: GetPhonetic

It converts the input string (which usually contains Kanji character) to phonetic symbol.

Parameters

BSTR string

(IN) a string of Kanji characters, to convert to phonetic symbols.

LONG start

(IN) the number of character from which IFELanguage be.g.in conversion. The first character is 1 (not 0).

LONG length

(IN) the length of character to convert. If this value is (-1), it means whole length from start column is selected.

BSTR *phonetic

(OUT) the result string. This string is allocated by SysAllocStringLen and must be freed by clients.

Return Values

HRESULT

  • S_OK: Successfully terminated.
  • S_FALSE: Fails to create result.

HRESULT IFELanguage::GetMorphResult

This method is used to get morphological analysis result. Before you use this function, call IFELanguage::Open for initialization once.

Parameters

DWORD dwRequest

(IN) Kind of request for conversion.

  • FELANG_REQ_CONV
  • FELANG_REQ_RECONV
  • FELANG_REQ_REV
DWORD dwCMode

(IN) Any combination of the values below is possible, which determines the conversion output characters and some conversion options.

  • FELANG_CMODE_NOPRUNING
  • FELANG_CMODE_PINYIN
  • FELANG_CMODE_BOPOMOHO
  • FELANG_CMODE_HANGUL
  • FELANG_CMODE_MONORUBY
  • FELANG_CMODE_KATAKANAOUT
  • FELANG_CMODE_HIRAGANAOUT
  • FELANG_CMODE_HALFWIDTHOUT
  • FELANG_CMODE_FULLWIDTHOUT
  • FELANG_CMODE_PRECONV
  • FELANG_CMODE_RADICAL
  • FELANG_CMODE_UNKNOWNREADING
  • FELANG_CMODE_MARGECAND
  • FELANG_CMODE_ROMAN
  • FELANG_CMODE_BESTFIRST
  • FELANG_CMODE_PLAURALCLAUSE
  • FELANG_CMODE_SINGLECONVERT
  • FELANG_CMODE_AUTOMATIC
  • FELANG_CMODE_PHRASEPREDICT
  • FELANG_CMODE_CONVERSATION
  • FELANG_CMODE_NAME
  • FELANG_CMODE_USENOREVWORDS
  • FELANG_CMODE_NOINVISIBLECHAR
INT cwchInput (IN) Number of characters of ptchInput
WCHAR *pwchInput

(IN) Original input characters to be converted by morphology engine.

NULL means to get the next entry for the previously given string, with next rank.

This must be UNICODE string.

The order that next entries are returned is defined by an implementation.

DWORD *pfCInfo

(IN) means the information for each column (ptchInput[x]). If pfCInfo[x] (column info) can be a combination of the flags below:

  • FELANG_CLMN_WBREAK
  • FELANG_CLMN_NOWBREAK
  • FELANG_CLMN_PBREAK
  • FELANG_CLMN_NOPBREAK
  • FELANG_CLMN_FIXR
  • FELANG_CLMN_FIXD

NULL can be used. That means all of pfCInfo[] are FALSE. (No request from client)

MORRSLT **ppResult

(OUT) Address of an MORRSLT structure that receives morphology result data.

GetMorphResult() allocates memory (using the OLE task allocator) for the returned data, and sets the pResult to point to the memory.

The application must free the memory pointed to by pResult, by using the CoTaskMemFree function.

Return Values:

HRESULT
  • S_OK:

More candidates exist. If you call this function with ptchInput NULL, the next best candidate for the previous ptchInput will be gotten.

  • S_FALSE: Fails to create result.
  • E_NOCAND: No more candidates
  • E_LARGEINPUT: Too large input

Fails to create result.

dwRequest

request for conversion.

FELANG_REQ_CONV : to get a composition string from a reading.

This request requires the input string is a reading which does not have any ideographic character.

FELANG_REQ_RECONV : to get a composition string from a composition string.

The request is to get a re-conversion result from a conversion result.

FELANG_REQ_REV : to get a reading from a composition string.

On this request, the contents of WDD[n].wDispPos and WDD[n].wReadPos are exchanged.

MORRSLT.pwchRead is used as the source of rev. conversion.

pfCInfo

Information of an input in each column

any combination of the flags below can be set for each column of an input string.

FELANG_CLMN_WBREAK PwchInput[x] is forced to be the start of word in analysis
FELANG_CLMN_NOWBREAK The result must not be divided here when IFELanguage makes a word. FELANG_CLMN_NOWBREAK always includes FELANG_CLMN_NOPBREAK.
FELANG_CLMN_PBREAK PwchInput[x] is forced to be the start of a phrase in analysis. FELANG_CLMN_PBREAK always includes FELANG_CLMN_WBREAK.
FELANG_CLMN_NOPBREAK The result must not be divided here when IFELanguage makes a PHRASE.
FELANG_CLMN_FIXR PwchInput[x] is used as reading character in a conversion result on FELANG_REQ_REV request. That is, the reading character of the conversion result is fixed to be ptchInput[x].
FELANG_CLMN_FIXD PwchInput[x] is used as display character in a conversion result on FELANG_REQ_CONV request. That is, the display character of the conversion result is fixed to be ptchInput[x].

dwCMode

Conversion mode

any combination of the values below is possible, which determine the conversion mode.

  • FELANG_CMODE_NOPRUNING: no pruning (filter) in morphology analysis.

On input of "", it may return, for example,"" ("" is the body part of ""). This result is impossible from grammar, but with FELANG_CMODE_NOPRUNING, one can get this candidate.

  • FELANG_CMODE_PINYIN: output is in Pinyin (Chinese phonetic) characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_BOPOMOHO: output is in Bopomoho (Taiwan phonetic) characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_HANGUL: output is in Hangul (Korean phonetic) characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_KATAKANAOUT: output is in Katakana (Japanese phonetic) characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_HIRAGANAOUT: output is in Hirakana (Japanese phonetic) characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_ROMAN: output is in Roman characters when IFELANG_REQ_REV is specified.
  • FELANG_CMODE_HALFWIDTHOUT: output is in Half Width characters.
  • FELANG_CMODE_FULLWIDTHOUT: output is in Full Width characters. [default].
  • FELANG_CMODE_MONORUBY: it makes a reading string for mono-ruby wherever possible. If this flag is set, the returned result is put at paMonoBubyPos. This mode is valid when FELANG_REQ_REV is specified.
  • FELANG_CMODE_PRECONV: It does the following conversion before the actual conversion. Those are implementation defined.
    1. ROMAN to a phonetic characters. Ex.[][n
    2. The auto collect before the conversion. Ex. [][|]
    3. The conversion of the punctuation mark and the brackets. Ex.[][C]
  • FELANG_CMODE_RADICAL: reading is returned in radical (CHN)
  • FELANG_CMODE_UNKNOWNREADING: reading is returned in unknown format. (CHN)
  • FELANG_CMODE_MERGECAND: The result strings (candidates) are merged when the strings are the same.
  • FELANG_CMODE_ROMAN (JPN): enable the roma-kana conversion.
  • FELANG_CMODE_BESTFIRST: force simple conversion to get better performance time rather than conversion accuracy.
  • FELANG_CMODE_PLAURALCLAUSE corresponds to the analysis in IME_SMODE_ PLAURALCLAUSE
  • FELANG_CMODE_SINGLECONVERT corresponds to the analysis in IME_SMODE_SINGLECONVERT
  • FELANG_CMODE_AUTOMATIC corresponds to the analysis in IME_SMODE_AUTOMATIC
  • FELANG_CMODE_PHRASEPREDICT corresponds to the analysis in IME_SMODE_PHRASEPREDICT
  • FELANG_CMODE_CONVERSATION corresponds to the analysis in IME_SMODE_CONVERSATION
  • FELANG_CMODE_NAME(JPN) Name mode (same as FELANG_CMODE_PLAURALCLAUSE)
  • FELANG_CMODE_USENOREVWORDS(JPN) Optional conversion using additional words. (e.g. reverse conversion from address to ZIP code).
  • FELANG_CMODE_NOINVISIBLECHAR

Remove invisible characters in output string when FELANG_CMODE_NOINVISIBLECHAR is specified. This flag is usually used for display purpose. Both CHN and TWN IME will return some spaces and invisible character (e.g.. First tone mark, U+02c9, in Bopomofo). However, for these invisible characters should be removed on displaying.

REMARKS:

This function should not fail on any input (except memory full, etc.) In the worst case, this function returns a result w/ an unknown word.

HRESULT IFELanguage::GetConversionModeCaps

This method is used to get conversion mode capability of the IFELanguage.  This function returns which FELANG_CMODE_xxxfs are supported by the object. *pdwCaps is a combination of FELANG_CMODE_xxxfs which are supported.

Parameters:

DWORD *pdwCaps (OUT) *pdwCaps is a bit field which contains FELANG_CMODE_xxx.

Return Values:

HRESULT
  • S_OK

SucSuccessfullyrminated.

  • S_FALSE

Fails to create result.


HRESULT IFELanguage::GetPhonetic.

  This method is a thin wrapper function of GetJMorphResult with FELANG_REQ_REV. It simply converts the input string (which usually contains Kanji character) to phonetic symbol. This function is designed to be called by VB (VBA) through TLB.

Parameters:

BSTR string (IN) a string of Kanji characters, to convert to phonetic symbols.
LONG start (IN) the number of character from which IFELanguage be.g.in conversion. The first character is 1 (not 0).
LONG length (IN) the length of character to convert. If this value is (-1), it means whole length from estartf column is selected.
BSTR *phonetic (OUT) the result string. This string is allocated by SysAllocStringLen and must be freed by clients.

Return Values:

HRESULT

  • S_OK: Successfully terminated.
  • S_FALSE: Fails to create result.