Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef _voice_recognition_alg_h_
00026 #define _voice_recognition_alg_h_
00027
00028 #include <iri_voice_recognition/VoiceRecognitionConfig.h>
00029 #include "mutex.h"
00030
00031
00032 extern "C"
00033 {
00034 #include <iatros-speech/version.h>
00035 #include <iatros/version.h>
00036 #include <prhlt/args.h>
00037 #include <iatros/lex.h>
00038 #include <iatros/hmm.h>
00039 #include <iatros/grammar.h>
00040 #include <iatros/viterbi.h>
00041 #include <iatros/heap.h>
00042 #include <iatros/lattice.h>
00043 #include <prhlt/trace.h>
00044 #include <prhlt/gzip.h>
00045 #include <prhlt/constants.h>
00046 #include <iatros-speech/libAudio.h>
00047 #include <iatros-speech/acquisitor.h>
00048 #include <time.h>
00049 }
00050
00051 #define NONE 0
00052 #define AUTORES 1
00053 #define HABILIDADES 2
00054 #define IDENTIFICACION 3
00055 #define LUGAR 4
00056 #define OTROS_PROYECTOS 5
00057 #define OTROS_ROBOTS 6
00058 #define ZONA 7
00059 #define EDIF 8
00060 #define AUL 9
00061 #define NCLASSES 10
00062
00068 class VoiceRecognitionAlgorithm
00069 {
00070 protected:
00077 CMutex alg_mutex_;
00078
00079
00080 std::string filePath_;
00081
00082 args_t *args;
00083 decoder_t *decoder;
00084 acquisitor_t *acquisitor;
00085
00086 std::string answer_type(std::string answerfn);
00087 std::string answer_type_location(std::string answerfn, std::string loc);
00088 std::string generate_answer(double *probs, char **sentences_str, int n);
00089 std::string outputs(const args_t *args, lattice_t *lattice);
00090
00091 public:
00098 typedef iri_voice_recognition::VoiceRecognitionConfig Config;
00099
00106 Config config_;
00107
00116 VoiceRecognitionAlgorithm(void);
00117
00123 void lock(void) { alg_mutex_.enter(); };
00124
00130 void unlock(void) { alg_mutex_.exit(); };
00131
00139 bool try_enter(void) { return alg_mutex_.try_enter(); };
00140
00152 void config_update(Config& new_cfg, uint32_t level=0);
00153
00154
00155
00156 void initialize();
00157 std::string iteration();
00158 void finalize();
00159 void setFilePath(std::string path);
00160
00161 int answerCode_;
00162
00169 ~VoiceRecognitionAlgorithm(void);
00170 };
00171
00172 #endif