IFEDictionary
This is a global interface.
This interface allows clients to access a
user dictionary of MS-IME.
Interface id |
IID_IFEDictionary |
Version |
1.0 |
IFEDictionary methods |
Description |
Open |
Open dictionary file |
Close |
Close dictionary file |
GetHeader |
Get distionary header from dictionary file |
SetHeader |
Set dictionary header to dictionary file |
Create |
Create a user dictionary file |
Release |
Free the IFEDictionary object |
GetPosTable |
Get public POS table |
GetWords |
Get word entry from dictionary |
NextWords |
Get next word entry from dictionary |
ExistWord |
Check if specified word exist in dictionary |
RegisterWord |
Register a word into dictionary |
Data Structure
WORD descriptor - IMEWRD
typedef struct _IMEWRD {
WCHAR *pwchReading;
WCHAR *pwchDisplay;
Union {
ULONG ulPos;
Struct {
WORD nPos1; //hinshi
WORD nPos2; //extended
hinshi
};
};
ULONG rgulAttrs[2]; //attributes
INT cbComment; //size of user comment
IMEUCT uct; //type of user comment
VOID *pvComment; //user comment
} IMEWRD, *PIMEWRD;
User Comment Type - IMEUCT
typedef enum
{
IFED_UCT_NONE,
IFED_UCT_STRING_SJIS,
IFED_UCT_STRING_UNICODE,
IFED_UCT_USER_DEFINED,
IFED_UCT_MAX,
} IMEUCT;
Notes on User Comment
IMEUCT specifies the type of user comment.
IFED_UCT_STRING_SJIS is a string in S-Jis format and IFED_UCT_STRING_UNICODE is a string in Unicode format. If a string is null-terminated, the size of data must include the last null char. IFED_UCT_USER_DEFINED means a client can register a word with user comment of this type and use it for whatever reasons the client may have. The IME kernel will not use a word of this type during morphological analysis. When IMEWRD structure is returned via GetNextWord, the pvComment field will be set to NULL and cbComment will be zero if there are no user comment for that word. Otherwise, the IMEUCT field specifies the type of user comment. The pvComment is allocated by IFEDictionary object. The size of buffer is the actual data size (cbComment) plus two, and the last two bytes are set to zero. This allows non-zero-terminated strings to be made zero-terminated without copying string to another location with a bigger buffer. The client must free the pvComment buffer.
Dictionary
Header - IMESHF
typedef struct {
WORD cbShf; //size of SHF
WORD verDic; //user specified dictionary version
CHAR szTitle[48];
//title of dictionary
CHAR szDescription[256];
//description of dictionary
CHAR szCopyright[128];
//copyright info
}
IMESHF;
Creating
IFEDictionary Instance
This creates an IFEDictionary object, and returns a pointer to the object. This is one way of obtaining an interface pointer to IFEDictionary. Another way of obtaining this pointer is via IFECommon interface, using the QueryInterface method with IID_IFEDictionary interface id defined in msime.h.
This is a DLL function.
HRESULT
CreateIFEDictionaryInstance
Parameters:
void **ppvObj |
(OUT) A pointer to the created
object is placed |
Return Values:
HRESULT |
- S_OK
- E_OUTOFMEMORY
- E_FAIL
|
Operating
Dictionary file object
HRESULT IFEDictionary::Open
This opens an existing dictionary file and
associates it with this
IFEDictionary object.
Parameters:
CHAR * pchFileName |
(IN) Points to a file name (NULL
terminated) string to be opened. If pchFileName is NULL or an empty string, user
dictionary opened by the IME kernel will be used. If pchFileName is an empty string, name
of user dictionary will be copied into pchFileName. In this case, the size of pchFileName
must be MAX_PATH. |
IMESHF * pSHF |
(OUT) header of the opened file
is stored at pSHF, when the opened file is a NANAMI binary dictionary. Can be NULL. |
Return Values:
HRESULT |
- S_OK
- JDIC_S_EMPTY_DICTIONARY
- IFED_E_NOT_FOUND
- IFED_E_INVALID_FORMAT
- IFED_E_OPEN_FAILED
- E_FAIL
|
To implement a multiple dictionary
facility, multiple open/release procedure must be carried out.
HRESULT
IFEDictionary::Close
This closes the file associated to this object.
Parameters: None
Return Values
HRESULT
IFEDictionary::GetHeader
This method obtains the header of a
dictionary without opening the dictionary.
Parameters:
CHAR * pchFileName |
(IN) Points to a file name (NULL
terminated) string. |
IMESHF * pSHF |
(OUT) header of the dictionary is
stored at pSHF, when the opened file is a NANAMI binary dictionary. Can be NULL. |
IMEFMT *pjfmt |
- IFED_UNKNOWN,
- IFED_ACTIVE_DICT,
- IFED_MSIME_BIN_SYSTEM,
- IFED_MSIME_BIN_USER,
- IFED_MSIME_SYSTEM_CE,
- IFED_MSIME2_BIN_SYSTEM,
- IFED_MSIME2_BIN_USER,
- IFED_MSIME95_BIN_SYSTEM,
- IFED_MSIME95_BIN_USER,
- IFED_MSIME97_BIN_SYSTEM,
- IFED_MSIME97_BIN_USER,
|
IMEDICAT *pdicat |
(OUT) dictionary type is
returned.
- dicatNone undefined
- dicatGeneral general dictionary
- dicatNamePlace name/place dictionary
- dicatSpeech speech dictionary
- dicatReverse reverse dictionary
- dicatEnglish English dictionary
- dicatALL or of above flags
|
Return Values:
HRESULT |
- S_OK
- IFED_E_INVALID_FORMAT
- E_FAIL
|
HRESULT
IFEDictionary::SetHeader
This sets/modifies the dictionary header of
"this" IFEDictionary object. This set/modifies a header of dictionary
object.
Parameters:
IMESHF * pSHF |
(IN) Points to a dictionary
header structure. |
Return Values:
HRESULT
IFEDictionary::Create
This creates a User dictionary and associates it with
"this"
IFEDictionary object.
Parameters:
CHAR * pchFileName |
(IN) Points to a file path (Null
terminated) string to be created. |
IMESHF * pSHF |
(IN) Points to a dictionary
header structure. |
Return Values:
HRESULT |
- S_OK
- IFED_S_EMPTY_DICTIONARY
- E_OUTOFMEMORY
- E_FAIL
|
ULONG
IFEDictionary::Release
This frees the IFEDictionary object.
Getting and
Registering Words
HRESULT
IFEDictionary::GetPosTable
This method obtains the public POS (part of speech) table.
Since this table is language dependent and IME dependent, clients must include an
appropriate header for a particular language. For Japanese, the header is named " msime.h"
and includes the following data structure.
POSTBL
//POS table data
structure
typedef struct _POSTBL {
WORD nPos; //pos number
BYTE *szName; //name of pos
} POSTBL;
Parameters:
POSTBL **prgPosTbl |
(OUT) pointer to the array of
POSTBL. |
int *pcPosTbl |
(OUT) pointer to the count of
part of speech in POSTBL; can be NULL. |
Return Values:
HRESULT
IFEDictionary::GetWords
This method gets word entries from a
dictionary. The selection can be done by some combinations of reading with/without a wildcard at tail, display with/without a wildcard at its tail, and POS. In addition, retrievals by a reading can be done by specifying a range in the Hiragana go-jyuu-on ordering.
Parameters:
WCHAR * pwchFirst, |
(IN) Points to a reading string
against which IFEDictionary entries are matched. The value must be one of the followings:
- NULL (meaning "low-value")
- Hiragana string (full reading to be retrieved)
- Hiragana string ended by "*" (specifying
only leading characters of reading)
This can be a starting reading string when a range of words
is to be retrieved. In this case, a wildcard must not be used. |
WCHAR * pwchLast, |
(IN) Points to a reading string.
This is used to ending reading string. This must contain the same value of pwchReading
when a retrieval is done by a single value, i.e., by not a range value. The value must be
one of the followings:
- NULL (meaning "high-value")
- Hiragana string (full reading to be retrieved)
- Hiragana string ended by "*" (specifying
only leading characters of reading)
|
WCHAR * pwchDisplay, |
(IN) Points to a display string
against which IFEDictionary entries are matched. The value must be one of the followings:
- NULL (meaning "*")
- Any Japanese string
- Japanese string ended by "*"
|
ULONG ulPos, |
The filters of MS-IME public POS.
- IFED_POS_NONE
- IFED_POS_NOUN
- IFED_POS_VERB
- IFED_POS_ADJECTIVE
- IFED_POS_ADJECTIVE_VERB
- IFED_POS_ADVERB
- IFED_POS_ADNOUN
- IFED_POS_CONJUNCTION
- IFED_POS_INTERJECTION
- IFED_POS_INDEPENDENT
- IFED_POS_INFLECTIONALSUFFIX
- IFED_POS_PREFIX
- IFED_POS_SUFFIX
- IFED_POS_AFFIX
- IFED_POS_TANKANJI
- IFED_POS_IDIOMS
- IFED_POS_SYMBOLS
- IFED_POS_PARTICLE
- IFED_POS_AUXILIARY_VERB
- IFED_POS_SUB_VERB
- IFED_POS_DEPENDENT
- IFED_POS_ALL
|
ULONG ulSelect |
(IN) Bit mask
which specifies the query output of a word. Must be logical OR of the followings:
- IFED_SELECT_NONE
- IFED_SELECT_READING
- IFED_SELECT_DISPLAY
- IFED_SELECT_POS
- IFED_SELECT_ALL
Other bits are reserved for future extensions (translation,
definition, etc.) |
ULONG ulWordSrc |
(IN) Bit flag to specify word
source. Must be logical OR of the followings when the IFEDictionary is a user dictionary.
- IFED_REG_USER
- IFED_REG_AUTO
- IFED_REG_ALL
Other bits are reserved for future extensions. This
parameter must be NULL when the IFEDictionary is a system dictionary object. |
UCHAR * pchBuffer |
(IN/OUT) The caller provides the
buffer and this function fills up the data. |
ULONG cbBuffer |
(IN) size of pchBuffer |
ULONG * pcWrd |
(OUT) Number of IMEWRD structure
returned in buffer. If more entries is found than the pchBuffer can store, an
IFED_S_MORE_ENTRIES will be returned. |
Return Values:
HRESULT |
- S_OK
- IFED_S_MORE_ENTRIES - Client must call NextWords to get
further IMEWRD structures.
- IFED_E_NO_ENTRY
- E_OUTOFMEMORY
- E_FAIL
|
HRESULT
IFEDictionary::NextWords
The following must be used after GetWords to get further words.
Parameters:
UCHAR * pchBuffer |
(IN/OUT) The caller provides the
buffer and this function fills up the data. |
ULONG cbBuffer |
(IN) size of pchBuffer |
ULONG * pcWrd |
(OUT) Number of IMEWRD structure
returned in buffer. If more entries is found than the pchBuffer can store, an
IFED_S_MORE_ENTRIES will be returned. |
Return Values:
HRESULT |
- S_OK
- IFED_S_MORE_ENTRIES - Client must call NextWords to get
further IMEWRD structures.
- E_FAIL
|
HRESULT
IFEDictionary::ExistWord
This determines if the specified word
exists in the IFEDictionary.
Parameters:
IMEWRD *pwrd |
(IN) word being checked |
Return Values:
HRESULT |
- S_OK - word exists
- S_FALSE - word does not exist
- E_FAIL - error condition
|
HRESULT
IFEDictionary::RegisterWord
This registers a word in the IFEDictionary.
Parameters:
IMEREG reg |
(IN) Register type
- JDIC_REG_HEAD - register the word at head
- JDIC_REG_TAIL - register the word at tail
- IFED_REG_DEL - delete the word.
|
IMEWRD * pWrd |
(IN) Points to a IMEWRD
structure. |
Return Values
HRESULT |
- S_OK - success
- IFED_E_NOT_USER_DIC - this object is not a user dictionary
- IFED_S_WORD_EXISTS - word is already registered
- IFED_E_USER_COMMENT - failed to insert user comment
- S_FALSE - failed to register/delete a word
- E_FAIL - unexpected error
|
|