aboutsummaryrefslogtreecommitdiff
path: root/samples/SpeechRecognition/src/Decoder.cpp
diff options
context:
space:
mode:
authorGeorge Gekov <george.gekov@arm.com>2021-08-16 11:32:10 +0100
committerJim Flynn <jim.flynn@arm.com>2022-02-05 19:49:06 +0000
commit23c26277086c78704a17f0dae86da947816320c0 (patch)
tree88b02fd1fae3130256d059251788a7ef68d2831f /samples/SpeechRecognition/src/Decoder.cpp
parent922b912fd2d462bac0809bac5669310ad1506310 (diff)
downloadarmnn-23c26277086c78704a17f0dae86da947816320c0.tar.gz
MLECO-2079 Adding the C++ KWS example
Signed-off-by: Eanna O Cathain <eanna.ocathain@arm.com> Change-Id: I81899bbfaada32f478c2e2fc6441eabb94d8d0fc
Diffstat (limited to 'samples/SpeechRecognition/src/Decoder.cpp')
-rw-r--r--samples/SpeechRecognition/src/Decoder.cpp45
1 files changed, 22 insertions, 23 deletions
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<int, std::string>& labels):
- m_labels(labels)
- {}
+Decoder::Decoder(std::map<int, std::string>& labels) :
+ m_labels(labels) {}
- std::string Decoder::FilterCharacters(std::vector<char>& unfiltered)
- {
- std::string filtered = "";
+std::string Decoder::FilterCharacters(std::vector<char>& 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