1/*---------------------------------------------------------------------------*
2 *  ann_util.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#ifndef _ANNOTATE_UTITITIES_INCLUDED_
21#define _ANNOTATE_UTITITIES_INCLUDED_
22
23
24#include "utteranc.h"
25#include "c42mul.h"
26
27#ifdef SET_RCSID
28static const char col_util_h[] = "$Id: ann_util.h,v 1.1.10.4 2007/08/31 17:44:52 dahan Exp $";
29#endif
30#define TCP_BLOCK_SIZE 10
31
32/**
33 * @todo document
34 */
35typedef struct
36{
37  annotate  *tcp;
38  int   numWords;
39  int   NumFrames;
40  int                 snr;
41}
42annotate_info;
43
44
45annotate_info* allocate_annotation(void);
46void annotation_create_tcp_entry(annotate_info* hAnnotation ,
47                                 char* label);
48
49void free_annotation(annotate_info* hAnnotation);
50
51
52
53int annotation_delete_segment(annotate_info* hAnnotation, int id);
54int annotation_delete_leading_segments(annotate_info* hAnnotation,
55                                       int num_to_delete, int num_to_keep, int min_length, int max_length,
56                                       int min_sil_dur);
57void annotation_delete_segment_info(annotate_info* hAnnotation);
58void annotation_decorate_labels(annotate_info* hAnnotation, char *label);
59int annotation_segment_utterance(annotate_info* hAnnotation,
60                                 utterance_info* utt,
61                                 preprocessed *prep,
62                                 char *label,
63                                 int *has_trailing_silence);
64
65int annotation_add_utt_segment_to_acoustic(model_info *acc,
66    preprocessed *prep,
67    utterance_info* utt,
68    annotate_info* hAnnotation,
69    char* base_label,
70    int do_backup);
71int  annotation_from_voicing(annotate_info * hAnnotation,
72                             utterance_info * utt,
73                             preprocessed * prep);
74int annotation_compare(annotate_info *test_annotation,
75                       annotate_info *ref_annotation);
76void save_annotations(annotate_info* hAnnotation, char* FileName);
77int annotation_from_results(annotate_info *hAnnotation, srec *rec);
78void annotation_get_data(annotate_info* hAnnotation, int id,
79                         int* begin, int* end,  char* buff, int buffLen);
80int construct_syntax_for_annotation(syntax_info *rule, annotate_info* hAnnotation);
81
82int find_beep_in_utterance(annotate_info *hAnnotation, utterance_info *utt,
83                           utterance_info *beep_utt, preprocessed *prep, char *label);
84int detect_beep_by_shape(preprocessed  *prep, utterance_info *utt1,
85                         utterance_info *utt2, int *start, int *end);
86#endif
87