NjxManageLearnDic Function

Description

This function performs various operations on learning dictionaries.
This function is used when merging learning dictionaries.

Syntax

#include <mw/iwnn/iwnnCTR.h>

s16 NjxManageLearnDic(
     const IWNN_CLASS* iwnn,                     // Parsing information class
     u32 operation                               // Operation type
);

Arguments

NameDescription
IN const IWNN_CLASS* iwnn Parsing information class.
The learning dictionary set in the dictionary set in this structure is the target of operations.
IN u32 operation Operation type.
Specifies the operation to perform on the learning dictionary.
NJ_MLD_OPERATION_COMMIT:
Records (commits) the single-word registration range currently in effect.
The commit range is protected from writing by functions for learning and so on.
NJ_MLD_OPERATION_COMMIT_TO_TOP:
  Single words added after the previous commit position are moved ahead of the previous commit range and re-committed.
NJ_MLD_OPERATION_COMMIT_CANCEL:
  Single words added after the previous commit position are deleted.
NJ_MLD_OPERATION_GET_SPACE:
  Gets the maximum number of candidates that can be registered outside the commit range.

Return Value

s16 Negative in case of an error.
The return value differs depending on the operation type if termination is normal.
- NJ_MLD_OPERATION_GET_SPACE: The maximum number of registerable candidates
- Other: 0

Error Code Description of Error
NJ_ERR_PARAM_ENVIRONMENT_NULL A NULL pointer was specified for iwnn
NJ_ERR_PARAM_MODE An invalid value was specified for operation
NJ_ERR_DIC_BROKEN Dictionary corruption was detected
NJ_ERR_DIC_NOT_FOUND The learning dictionary does not exist inside the dictionary set specified in iwnn->dicSet

In the case of learning dictionaries, the order (old to new) in which single words are registered (learned) is recorded. Candidates are handled such that the newer the entry, the higher the priority (frequency value). When adding single words from another learning dictionary to the learning dictionary currently being used, you can treat added single words as candidates older (having lower priority) than words already registered by using the NJ_MLD_OPERATION_COMMIT_TO_TOP operation.
Learning dictionary content: Operation:
Old -> -> New
Already learned range (A) (Empty) NJ_MLD_OPERATION_COMMIT: Records the already learned range.
Already learned range (A) Added candidates (B) Candidates from another learning dictionary are registered by using the single-word registration function.
Added candidates (B) Already learned range (A) NJ_MLD_OPERATION_COMMIT_TO_TOP: Moves added candidates (B) in front of already learned candidates (A). The range for both (B) and (A) at this time is redefined as the commit range.

The committed range is protected from being overwritten by the add and delete word functions and the learning function. If the available memory outside the commit range is insufficient, the add word function and learning function return an error. The commit range specification can be canceled by executing NJ_MLD_OPERATION_COMMIT_CANCEL or executing the initialization function (NjxInit).

CONFIDENTIAL