1/*---------------------------------------------------------------------------*
2 *  lts.h  *
3 *                                                                           *
4 *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5 *                                                                           *
6 *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7 *  you may not use this file except in compliance with the License.         *
8 *                                                                           *
9 *  You may obtain a copy of the License at                                  *
10 *      http://www.apache.org/licenses/LICENSE-2.0                           *
11 *                                                                           *
12 *  Unless required by applicable law or agreed to in writing, software      *
13 *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15 *  See the License for the specific language governing permissions and      *
16 *  limitations under the License.                                           *
17 *                                                                           *
18 *---------------------------------------------------------------------------*/
19
20
21
22#ifndef _LTS_H__
23#define _LTS_H__
24
25#if defined (GEN_STATIC_SLTS) && defined (WIN32)
26#include <stdio.h>
27#endif
28
29#define MTAG NULL
30
31typedef void* FSM_DICT_HANDLE;
32
33typedef void* LTS_HANDLE;
34
35typedef void* PHONEMAP_TABLE_HANDLE;
36
37/*
38  creates an instance of the LTS and loads its data from file provided.
39  Returns NULL if error.
40*/
41SWIsltsResult create_lts(char *data_filename, LTS_HANDLE *phLts);
42
43/*
44  deallocates an instance of LTS
45*/
46SWIsltsResult free_lts(LTS_HANDLE hLts);
47
48/*
49  runs letter_to_sound rules.
50
51  Fills up phones in phone_string.  This needs to be allocated by calling
52  function to max_length.  Each elements of phone string needs to be 4
53  characters long (output can be 3 characters plus need room for
54  EOS)
55
56  return length of phone string.
57  If max_phone_length is exceeded, truncates output and returns max_phone_length.
58
59  Returns -1 if error
60*/
61SWIsltsResult run_lts(LTS_HANDLE h, FSM_DICT_HANDLE hdict, char *input_sentence, char **output_phone_string, int *phone_length);
62
63/* static code generator for LTS structure */
64#if defined (GEN_STATIC_SLTS) && defined (WIN32)
65void gen_static_lts(LTS_HANDLE h, const char *name, FILE *fp_out);
66#endif
67
68#if defined (GEN_STATIC_FSMD) && defined (WIN32)
69void gen_static_fsmd(FSM_DICT_HANDLE h, const char *name, FILE *fp_out);
70#endif
71
72typedef struct SWIsltsEngine {
73  LTS_HANDLE m_hLts;
74
75  FSM_DICT_HANDLE m_hDict;
76
77} SLTS_Engine;
78
79
80#endif /* _LTS_H__ */
81