From 23c26277086c78704a17f0dae86da947816320c0 Mon Sep 17 00:00:00 2001 From: George Gekov Date: Mon, 16 Aug 2021 11:32:10 +0100 Subject: MLECO-2079 Adding the C++ KWS example Signed-off-by: Eanna O Cathain Change-Id: I81899bbfaada32f478c2e2fc6441eabb94d8d0fc --- samples/SpeechRecognition/src/Decoder.cpp | 45 +++++++++++++++---------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'samples/SpeechRecognition/src/Decoder.cpp') diff --git a/samples/SpeechRecognition/src/Decoder.cpp b/samples/SpeechRecognition/src/Decoder.cpp index 663d4db5b5..b95288e95c 100644 --- a/samples/SpeechRecognition/src/Decoder.cpp +++ b/samples/SpeechRecognition/src/Decoder.cpp @@ -5,33 +5,32 @@ #include "Decoder.hpp" -namespace asr { +namespace asr +{ - Decoder::Decoder(std::map& labels): - m_labels(labels) - {} +Decoder::Decoder(std::map& labels) : + m_labels(labels) {} - std::string Decoder::FilterCharacters(std::vector& unfiltered) - { - std::string filtered = ""; +std::string Decoder::FilterCharacters(std::vector& unfiltered) +{ + std::string filtered; - for(int i = 0; i < unfiltered.size(); ++i) + for (int i = 0; i < unfiltered.size(); ++i) + { + if (unfiltered.at(i) == '$') { - if (unfiltered.at(i) == '$') - { - continue; - } - - else if (i + 1 < unfiltered.size() && unfiltered.at(i) == unfiltered.at(i + 1)) - { - continue; - } - else - { - filtered += unfiltered.at(i); - } + continue; + } + else if (i + 1 < unfiltered.size() && unfiltered.at(i) == unfiltered.at(i + 1)) + { + continue; + } + else + { + filtered += unfiltered.at(i); } - return filtered; } -}// namespace + return filtered; +} +} // namespace asr -- cgit v1.2.1