diff --git a/recognize/src/include/recognize.h b/recognize/src/include/recognize.h
index 8e130b7..b614438 100644
--- a/recognize/src/include/recognize.h
+++ b/recognize/src/include/recognize.h
@@ -75,7 +75,7 @@ private:
void executeJuliusEngine();
void filterOutputJulius();
void generateConfidence();
- void notifyListeners(char* text);
+ void notifyListeners(char* text, int64_t pts);
void notifyEndExtraction(int sentences_size);
void cleanFiles();
diff --git a/recognize/src/recognize.cpp b/recognize/src/recognize.cpp
index 6667fbe..7dce75f 100644
--- a/recognize/src/recognize.cpp
+++ b/recognize/src/recognize.cpp
@@ -32,6 +32,7 @@
#define FIND_SENTENCE "\"sentence1:\""
#define FILENAME_AUDIOPART "audio00"
+#define AUDIO_SILENT ""
#define PROGRAM "ffmpeg" // ffmpeg
#define PTS_PATTERN 1000
@@ -121,7 +122,7 @@ void Recognize::Run(){
cleanFiles();
finished = true;
- notifyEndExtraction(count_lines-1);
+ notifyEndExtraction(count_lines);
}
void Recognize::setFrequency(int freq) {
@@ -343,8 +344,8 @@ void Recognize::filterOutputJulius() {
sentences = new std::list();
string command = "cat ";
- command.append(PATH_GTAAAS_WEB).append(id).append(FILENAME_RECOGNIZED_OUT).append(" | grep ").
- append(FIND_SENTENCE).append(" >> ").append(PATH_GTAAAS_WEB).append(id).append(FILENAME_FILTEROUT);
+ command.append(PATH_GTAAAS_WEB).append(id).append(FILENAME_RECOGNIZED_OUT).append(" | grep -e ").
+ append(FIND_SENTENCE).append(" -e \"").append(AUDIO_SILENT).append("\"").append(" >> ").append(PATH_GTAAAS_WEB).append(id).append(FILENAME_FILTEROUT);
system(command.c_str());
//printf("\n\n---> command: %s\n\n", command.c_str());
@@ -365,17 +366,20 @@ void Recognize::filterOutputJulius() {
do {
getline(in, line);
if (line.length() > 0) {
- sizeLine = (int)line.length();
- strFilter = line.substr(strlen(FIND_SENTENCE), sizeLine);
- sentence_ptr = new char[strFilter.length()+1];
- strcpy(sentence_ptr, (char*) strFilter.c_str());
- if(getConfidence())
- notifyListeners(sentence_ptr);
- else
- notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE");
- scores.erase(scores.begin());
+ if (line != AUDIO_SILENT){
+ sizeLine = (int)line.length();
+ strFilter = line.substr(strlen(FIND_SENTENCE), sizeLine);
+ sentence_ptr = new char[strFilter.length()+1];
+ strcpy(sentence_ptr, (char*) strFilter.c_str());
+ if(getConfidence())
+ notifyListeners(sentence_ptr, pts.front());
+ else
+ notifyListeners((char*) "SENTENCA_COM_BAIXA_QUALIDADE", pts.front());
+ scores.erase(scores.begin());
+ count_lines++;
+ }
+ pts.erase(pts.begin());
}
- count_lines++;
} while (!in.eof());
in.close();
}
@@ -386,15 +390,12 @@ void Recognize::filterOutputJulius() {
}
-void Recognize::notifyListeners(char* text) {
+void Recognize::notifyListeners(char* text, int64_t pts) {
//cout << "NOTIFY: " << text << endl;
- int64_t pts_run = pts.front();
for(list::iterator it = listeners->begin(); it != listeners->end(); it++){
- (*it)->notifyTextRecognized((unsigned char*) text, calcula_pts(pts_run));
-
+ (*it)->notifyTextRecognized((unsigned char*) text, calcula_pts(pts));
}
- pts.erase(pts.begin());
}
--
libgit2 0.21.2