📄 itrec.h
字号:
/*****************************************************************************
**
** itrec.h - InfoTalk Recognizer Service API header file for ITREC product
**
** This software is developed by InfoTalk Corporation Limited (InfoTalk).
** It contains information that is proprietary and confidential to InfoTalk,
** and is released to licensed partners and customers under a non-disclosure
** agreement.
**
** Copyright (c) 1997-2002 InfoTalk Corporation Limited. All rights reserved.
**
******************************************************************************/
#ifndef __ITREC_H__
#define __ITREC_H__
#ifdef __cplusplus
extern "C" {
#endif
/*****************************************************************************
*
* Macro & enum constants
*
******************************************************************************/
#include "vtdefs.h"
/*****************************************************************************
*
* ITREC Service API function prototypes
*
******************************************************************************/
/*----------------------------------------------------------------------------
*
* Function: itrec_initialize
*
* Description: This function retrieves the recognition status code or results
* it will also returns the grammar associated with each result
*
* Parameters: config_file [in] Name of an optional configuration file
* num_instance [in] Number of recognizer instances to be started
* total_instance [out] Total number of recognizer instances started
*
*----------------------------------------------------------------------------*/
int itrec_initialize(char *config_file, int num_instance, int *total_instance);
/*----------------------------------------------------------------------------
*
* Function: itrec_start_recognizer
*
* Description: This functin starts the recognizer to perform a new speech recognition
*
* Parameters: asr_index [in] Index of Recognizer instance
*
*----------------------------------------------------------------------------*/
int itrec_start_recognizer(int asr_index);
/*----------------------------------------------------------------------------
*
* Function: itrec_stop_recognizer
*
* Description: This function inform the recognizer that no more speech data will be
* entered for process
*
* Parameters: asr_index [in] Index of Recognizer instance
*
*----------------------------------------------------------------------------*/
int itrec_stop_recognizer(int asr_index);
/*----------------------------------------------------------------------------
*
* Function: itrec_abort_recognizer
*
* Description: This function aborts the current recognition
*
* Parameters: asr_index [in] Index of Recognizer instance
*
*----------------------------------------------------------------------------*/
int itrec_abort_recognizer(int asr_index);
/*----------------------------------------------------------------------------
*
* Function: itrec_recognize
*
* Description: This function sends a block of speech data to recognizer to perform
* a speech recognition.
*
* Parameters: asr_index [in] Index of Recognizer instance
* speech_buffer [in] A block of speech data
* speech_buffer_size [in] Amount of speech data in speech_buffer
* done [out] Flag to indicate that the recognizer is done with a speech recognition
* speech_begin [out] Time at which speech is detect to begin (seconds)
* speech_end [out] Time at which speech is detected to end (seconds)
*
*----------------------------------------------------------------------------*/
int itrec_recognize(int asr_index, void *speech_buffer, unsigned speech_buffer_size, int *done, float *speech_begin, float *speech_end);
/*----------------------------------------------------------------------------
*
* Function: itrec_query_status
*
* Description: This function query the status of the recognizer
*
* Parameters: asr_index [in] Index of Recognizer instance
* status [out] Status of the recognizer
* speech_begin [out] Time at which speech is detect to begin (seconds)
* speech_end [out] Time at which speech is detected to end (seconds)
*
*----------------------------------------------------------------------------*/
int itrec_query_status(int asr_index, int *status_code, float *speech_begin, float *speech_end);
/*----------------------------------------------------------------------------
*
* Function: itrec_query_result
*
* Description: This function retrieves the recognition status code or results
* it will also returns the grammar associated with each result
*
* Parameters: asr_index [in] Index of Recognizer instance
* nbest [in] Required NBest results
* done [out] Whether the recognition is done
* result_code [out] Result code of the recognition
* num_result [out] Number of results that will be returned
* result [out] Array of recognition results
*
*----------------------------------------------------------------------------*/
int itrec_query_result(int asr_index, int nbest, int *done, int *result_code, int *num_result, VT_RESULT *result);
/*----------------------------------------------------------------------------
*
* Function: itrec_save_utterance
*
* Description: This function stroes the speech data received into a file
*
* Parameters: asr_index [in] Index of Recognizer instance
* sz_filename [in] Name of the utterance file
*
*----------------------------------------------------------------------------*/
int itrec_save_utterance(int index, char *sz_filename);
/*----------------------------------------------------------------------------
*
* Function: itrec_set_parameter
*
* Description: This function parses a parameter assignment string to assign
* value of a parameter
*
* Parameters: asr_index [in] Index of Recognizer instance
* parameter [in] Parameter whose value will be set
* value_ptr [in] Pointer to a memory location with
the value of the parameter to set
*
*----------------------------------------------------------------------------*/
int itrec_set_parameter(int asr_index, int parameter, void *value_ptr);
/*----------------------------------------------------------------------------
*
* Function: itrec_get_parameter
*
* Description: This function returns the current value of a specified parameter
*
* Parameters: asr_index [in] Index of Recognizer instance
* parameter [in] Parameter whose value will be returned
* value_ptr [in] Pointer to a memory location with
the current value of the parameter
*
*----------------------------------------------------------------------------*/
int itrec_get_parameter(int asr_index, int parameter, void *value_ptr);
/*----------------------------------------------------------------------------
*
* Function: itrec_do_sd
*
* Description: This function sends a block of speech data to recognizer to perform
* speech detection
*
* Parameters: asr_index [in] Index of Recognizer instance
* speech_buffer [in] A block of speech data
* speech_buffer_size [in] Amount of speech data in speech_buffer
* speech_begin [out] Time at which speech is detected to begin (seconds)
* speech_end [out] Time at which speech is detected to end (seconds)
*
*----------------------------------------------------------------------------*/
int itrec_do_sd(int asr_index, void *speech_buffer, unsigned speech_buffer_size, float *speech_begin, float *speech_end);
/*----------------------------------------------------------------------------
*
* Function: itrec_recognize_file
*
* Description: This function reads speech data from a file and sends the speech data to
* recognizer to perform speech recognition.
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -