forked from adhearsion/cspeech
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cspeech.h
85 lines (68 loc) · 2.18 KB
/
cspeech.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* cspeech - Speech document (SSML, SRGS, NLSML) modelling and matching for C
* Copyright (C) 2013, Grasshopper
*
* License: MIT
*
* Contributor(s):
* Chris Rienzo <[email protected]>
*
* cspeech.h
*
*/
#ifndef CSPEECH_H_
#define CSPEECH_H_
#ifdef __cplusplus
extern "C" {
#endif
int cspeech_init(void);
/* logging */
typedef enum {
CSPEECH_LOG_DEBUG = 7,
CSPEECH_LOG_INFO = 6,
CSPEECH_LOG_NOTICE = 5,
CSPEECH_LOG_WARNING = 4,
CSPEECH_LOG_ERROR = 3,
CSPEECH_LOG_CRIT = 2,
CSPEECH_LOG_ALERT = 1,
} cspeech_log_level_t;
typedef int (*cspeech_logging_callback)(cspeech_log_level_t log_level, const char *id, const char *file, int line, const char *log_message);
void cspeech_set_logger(cspeech_logging_callback logger);
#if 0
/* NLSML */
enum nlsml_match_type {
NMT_BAD_XML,
NMT_MATCH,
NMT_NOINPUT,
NMT_NOMATCH
};
extern int nlsml_init(void);
enum nlsml_match_type nlsml_parse(const char *result, const char *uuid);
iks *nlsml_normalize(const char *result);
extern iks *nlsml_create_dtmf_match(const char *digits, const char *interpretation);
#endif
/* SRGS */
struct cspeech_srgs_parser;
struct cspeech_srgs_grammar;
enum cspeech_srgs_match_type {
/** invalid input */
CSMT_NO_MATCH,
/** matches, can accept more input */
CSMT_MATCH,
/** not yet a match, but valid input so far */
CSMT_MATCH_PARTIAL,
/** matches, cannot accept more input */
CSMT_MATCH_END
};
struct cspeech_srgs_parser *cspeech_srgs_parser_new(const char *uuid);
void cspeech_srgs_parser_destroy(struct cspeech_srgs_parser *parser);
struct cspeech_srgs_grammar *cspeech_srgs_parse(struct cspeech_srgs_parser *parser, const char *document);
const char *cspeech_srgs_grammar_to_regex(struct cspeech_srgs_grammar *grammar);
const char *cspeech_srgs_grammar_to_jsgf(struct cspeech_srgs_grammar *grammar);
const char *cspeech_srgs_grammar_to_jsgf_file(struct cspeech_srgs_grammar *grammar, const char *basedir, const char *ext);
enum cspeech_srgs_match_type cspeech_srgs_grammar_match(struct cspeech_srgs_grammar *grammar, const char *input, char **interpretation);
void cspeech_srgs_grammar_destroy(struct cspeech_srgs_grammar *grammar);
#ifdef __cplusplus
}
#endif
#endif // CSPEECH_H_