NjxCheckDic Function

Description

This function checks the integrity and compatibility of dictionaries and automatically restores them. Restoration can be executed by specifying the automatic restoration flag, but only when the dictionary handle of a user dictionary or learning dictionary has been specified. An error results if automatic restoration is impossible. If an error occurs, recreate the user dictionary or learning dictionary using the dictionary creation function (NjxCreateDic).
Only a minimal dictionary check is made. Sometimes corruption of the dictionary is detected while using the dictionary even though no problem was found with the integrity or compatibility of the dictionary. Try automatic restoration if an error related to dictionary corruption occurs while using this function.

Syntax

#include <mw/iwnn/iwnnCTR.h>

s16 NjxCheckDic(
     IWNN_DIC_HANDLE  handle,                     // Dictionary handle
     const IWNN_CLASS* iwnn,                      // Parsing information class
     u8 dicType,                                  //  Dictionary handle type
     u8 restore,                                  //  Automatic restoration flag
     u32  size                                    //  Dictionary byte size
);

Arguments

NameDescription
IN / OUT IWNN_DIC_HANDLE handle Dictionary handle to be checked.
An error results if NULL is specified.
IN const IWNN_CLASS* iwnn Parsing information class
An error results if NULL is specified.
IN u8 dicType Dictionary handle type of the dictionary handle to be checked.
IN u8 restore Automatic restoration flag
Determines whether automatic restoration is performed on the specified user dictionary or learning dictionary.
1: Automatically restore the dictionary
0: Do not restore (perform dictionary check only)
IN u32 size Dictionary byte size.
Byte size of the dictionary specified by dictionary handle.

Return Value

s16 Negative value: Error
Other: Normal exit

Error Code Description of Error
NJ_ERR_PARAM_ENVIRONMENT_NULL A NULL pointer was specified for iwnn
NJ_ERR_DIC_HANDLE_NULL NULL was set in dic
NJ_ERR_INVALID_FLAG An out-of-range value was set in restore
NJ_ERR_AREA_SIZE_INVALID   ■ One of the values given below was set for the dictionary header size in size
  ■ The value in size does not match the dictionary size calculated from information in handle
NJ_ERR_FORMAT_INVALID   ■ The dictionary start and end IDs are invalid
  ■ The dictionary version inside the dictionary area is invalid
  ■ The maximum length of single word stored in the dictionary according to its header exceeds NJ_MAX_LEN
  ■ The maximum candidate length for single words stored in the dictionary according to its header exceeds NJ_MAX_RESULT_LEN
  ■ An undefined dictionary type was set in the dictionary header
NJ_ERR_DIC_BROKEN   ■ 0 was specified in restore
  ■ The number of words registered according to the dictionary header exceeds the maximum number of registerable words
  ■ An invalid value is stored in the index region in the dictionary
  ■ A power outage occurred and the backup data is corrupted
  ■ Backup processing is enabled if a power outage occurs
NJ_ERR_CANNOT_RESTORE   ■ 1 was specified in restore
  ■ The number of words registered according to the dictionary header exceeds the maximum number of register words
  ■ An invalid value is stored in the index region in the dictionary
  ■ A power outage occurred and the backup data is corrupted
  ■ A power outage occurred and backup processing was executed, but restoration was not possible


CONFIDENTIAL