NjxMergeWordList Function

Description

This function merges multiple candidate lists to create a single candidate list.
A list with redundant candidates removed can be created by collecting words with the same notation.
Also, since you can select the merge method for the same notation candidates, you can flexibly order the candidate list.
This can be used when creating a candidate list that always includes pseudo-candidates at the end of the list.
If an abnormal termination occurs, the content of the candidate list (wordList) is undefined.

Syntax

#include <mw/iwnn/iwnnCTR.h>

s16 NjxMergeWordList(
     IWNN_MERGE_RESULT* wordList,                 // Candidate list
     s32 listMax,                                 // Maximum number of storable candidates
     u32 mode,                                    // Merge method
     const IWNN_CLASS* iwnn,                      // Parsing information class
     const IWNN_RESULT* result,                   // Array of candidates to be merged
     u32 num                                      // Number of candidates to be merged
);

Arguments

NameDescription
IN / OUT IWNN_MERGE_RESULT* wordList Candidate list.
This is used to store the order of the list.
Because pointers to iwnn and result are maintained internally, the memory pointed to by iwnn and result for input should not be overwritten or deallocated until use of the candidate list has ended.
IN s32 listMax Maximum number of storable candidates.
This is the maximum number of candidates that can be stored in wordList. This cannot be specified if NJ_MAX_CANDIDATE is exceeded.
IN u32 mode Merge method
- NJ_MERGE_INIT:
  Clear the list and then add. (Used when creating an initial candidate list)
- NJ_MERGE_NOT_EXIST:
  Append only items not currently on the candidate list.
  Items beyond the maximum number of storable candidates are not added.
- NJ_MERGE_NOT_EXIST_FORCE:
  Only items that do not exist on the candidate list are added to the end.
If the number of candidates to add exceeds the maximum storable number, candidates are deleted from the end of the existing candidate list.
- NJ_MERGE_FORCE:
  All candidates in result are added to the end of the list.
Existing candidates matching added candidates are moved to the end of the existing list.
If the number of candidates to add exceeds the maximum storable number, candidates are deleted from the end of the existing candidate list.
IN const IWNN_CLASS* iwnn Parsing information class. This is used to obtain word information from result.
IN const IWNN_RESULT* result Candidate array to be merged. This is the array of candidates to add to the candidate list. This array must not contain duplicate candidates.
IN u32 num Number of candidates to be merged. This is the number of array candidates to merge with the candidate list. If a number larger than list_num is specified, operations are carried out as if list_num had been specified.

Return Value

s16 Number of candidates stored in the candidate list. Negative in the event of an error.

Error Code Description of Error
NJ_ERR_PARAM_ENVIRONMENT_NULL A NULL pointer was specified for iwnn
NJ_ERR_PARAM_RESULT_NULL A NULL pointer was specified in wordList or result
NJ_ERR_PARAM_MODE An invalid value was specified for mode
NJ_ERR_BUFFER_NOT_ENOUGH A value larger than NJ_MAX_CANDIDATE was specified in listMax
NJ_ERR_INVALID_RESULT Candidate information specified in result or in wordList has been corrupted

CONFIDENTIAL