NjxGetCandidate Function

Description

This function is used to get a candidate string (processing result) from the processing result structure. If the return value indicates an error, undefined values may be stored in the buffer for storing candidate strings (buf).

Syntax

#include <mw/iwnn/iwnnCTR.h>

s16 NjxGetCandidate(
     wchar_t* buf,                                // Buffer for getting candidate strings
     const IWNN_CLASS* iwnn,                      // Parsing information class
     const IWNN_RESULT* result,                   // Processing result structure
     u16 bufSize                                  // Buffer byte size
);

Arguments

NameDescription
OUT wchar_t* buf Buffer for storing candidate strings.
Allocates a buffer and specifies a pointer. Use a wchar_t array of size MM_MAX_MORPHOLIZE_LEN + NJ_TERM_SIZE for the results of morphological analysis and one of size NJ_MAX_RESULT_LEN + NJ_TERM_SIZE for the results of other processes.
IN const IWNN_CLASS* iwnn Parsing information class.
An error results if NULL is specified.
IN const IWNN_RESULT* result The processing result structure.
An error results if NULL is specified.
IN u16 bufSize Byte size of buffer for storing candidate strings.
Specify a size that includes a string terminator. Specify the size as a number of bytes.

Return Value

s16 Length of the obtained string. (Terminator not included.) A negative value indicates 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 for result
NJ_ERR_BUFFER_NOT_ENOUGH   ■ A NULL pointer was specified in buf
  ■ 0 was specified in bufSize
  ■ The candidate string length of result is larger than bufSize
NJ_ERR_INVALID_RESULT   ■ An undefined code was set for operations on result
  ■ 0 was set for the candidate length of result
NJ_ERR_CANDIDATE_TOO_LONG A value greater than NJ_MAX_RESULT_LEN + 1 was set for the candidate string length of result)
NJ_ERR_DIC_TYPE_INVALID The dictionary type associated with the single-word dictionary address specified in result is not supported
NJ_ERR_DIC_BROKEN This is returned if the target dictionary for result is an uncompressed dictionary and any of the following situations occur
  ■ The queue ID (result->word.stem.location.current) is corrupted
  ■ An input string longer than NJ_MAX_USER_LEN or a candidate string longer than NJ_MAX_USER_CANDIDATE_LEN is found in the user dictionary
  ■ An input string longer than NJ_MAX_LEN + 1 or a candidate string longer than NJ_MAX_RESULT_LEN + 1 is found in a dictionary other than the user dictionary
  ■ Connection information for a single word used in multiple queues is corrupted

CONFIDENTIAL