Blame view

tools/sctk-2.4.10/src/asclite/core/recording.h 5.01 KB
8dcb6dfcb   Yannick Estève   first commit
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  /*
   * ASCLITE
   * Author: Jerome Ajot, Jon Fiscus, Nicolas Radde, Chris Laprun
   *
   * This software was developed at the National Institute of Standards and Technology by 
   * employees of the Federal Government in the course of their official duties. Pursuant
   * to title 17 Section 105 of the United States Code this software is not subject to
   * copyright protection and is in the public domain. ASCLITE is an experimental system.
   * NIST assumes no responsibility whatsoever for its use by other parties, and makes no
   * guarantees, expressed or implied, about its quality, reliability, or any other
   * characteristic. We would appreciate acknowledgement if the software is used.
   *
   * THIS SOFTWARE IS PROVIDED "AS IS."  With regard to this software, NIST MAKES NO EXPRESS
   * OR IMPLIED WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING MERCHANTABILITY,
   * OR FITNESS FOR A PARTICULAR PURPOSE.
   */
   
  #ifndef RECORDING_H
  #define RECORDING_H
  
  #include "stdinc.h"
  #include "properties.h"
  #include "speech.h"
  #include "speechset.h"
  #include "aligner.h"
  #include "filter.h"
  #include "levenshtein.h"
  #include "inputparser.h"
  #include "ctm_inputparser.h"
  #include "stm_inputparser.h"
  #include "trn_inputparser.h"
  #include "rttm_inputparser.h"
  #include "reportgenerator.h"
  #include "rawsys_reportgenerator.h"
  #include "sgml_reportgenerator.h"
  #include "scorer.h"
  #include "stt_scorer.h"
  #include "ctmstmrttm_segmentor.h"
  #include "trntrn_segmentor.h"
  #include "spkrautooverlap.h"
  #include "uemfilter.h"
  #include "speakermatch.h"
  #include "logger.h"
  #include "sgml_generic_reportgenerator.h"
  
  /**
   * A recording contain all the data needed to score a testset.
   * From the argument to the list of parser (input) and generator (output report).
   * This is the main entry to the aligner.
   */
  class Recording
  {
  	public:
          // class constructor
          Recording();
          // class destructor
          ~Recording();
  
          /**
           * State constants
           */
          static const int INITIALIZED = 0;
          static const int LOADED = 1;
          static const int ALIGNED = 2;
          static const int SCORED = 3;		
          /**
           * Load the reference&Hypothesis files into the system.
           * use the right loader based on the type.
           */
          void Load(const string& refFile, const string& refType, const vector<string> & hypFiles, const vector<string> & HypTitles, const vector<string> & HypTypes, const string& uemFile, const string& speakeralignfile);
          void Load(const vector<string> & hypFiles, const vector<string> & HypTitles, const vector<string> & HypTypes, const string& uemFile, const string& speakeralignfile);
          /**
           * Filter the references and hypothesis with the availables filters.
           */
          void Filter(const vector<string> & _filters);
          /**
           * Align the ref to the hyp with the select align algo
           */
          void Align() { m_bGenericAlignment ? AlignGeneric() : AlignHypRef(); };
          void AlignHypRef();
          void AlignGeneric();
          /**
           * Score the Alignement with the selected scoring system
           */
          void Score();
          /**
           * Generate the reports based on the scored alignment.
           */
          void GenerateReport(const vector<string> & reportType);
  		
  		//void AddInterSegmentGapsToRefs();
          
  	private:
          /**
           * contain all the available input parser
           */
          map<string, InputParser*> inputParsers;
  		
          /**
           * contain all the available report generator
           */
          map<string, ReportGenerator*> reportGenerators;
  		SGMLGenericReportGenerator* pSGMLGenericReportGenerator;
          /**
           * contain all the available Aligner
           */
          map<string, Aligner*> aligner;
  		
          /**
           * contain all the available Scorer
           */
          map<string, Scorer*> scorer;
  		
          /**
           * contain all the available Segmentors
           */
          map<string, Segmentor*> segmentors;
  		
          /**
  		 * contain all the available Filters
           */
          map<string, ::Filter*> filters;
          
  		/**
  		 * Database for the optimization speaker alignment 
  		 */
  		SpeakerMatch* m_pSpeakerMatch;
  		
  		/** the logger */
          static Logger* logger;
  	  
          //-------------------------------------
          // State dependents attribute
          //-------------------------------------
          /**
           * State of the Recording object
           * The different state can be 
           * - INITIALIZED
           * - LOADED
           * - ALIGNED
           * - SCORED
           * @todo Curently not implemented and use in the code
           */
          int state;
          /**
           * The current segmentor
           */
          Segmentor* segmentor;
  		/**
  		 * A list of all the references of the Recording.
  		 */
  		SpeechSet* references;
  		/**
  		 * A list of all the hypothesis of the Recording.
  		 * More than one group of hypothesis can be done at once.
  		 */
  		map<string, SpeechSet*> hypothesis;
  		/**
  		 * Alignment object
  		 */
  		Alignment* alignments;
  		
  		bool m_bGenericAlignment;
  };
  
  #endif // RECORDING_H