Fix langauge of voice touch command as Korean 53/281653/1
authorSuyeon Hwang <stom.hwang@samsung.com>
Tue, 20 Sep 2022 07:58:13 +0000 (16:58 +0900)
committerTizen AI <ai.tzn.sec@samsung.com>
Tue, 20 Sep 2022 08:16:12 +0000 (17:16 +0900)
- Issue:
Current voice modality sends text with Korean.

- Solution:
This patch changes the candidates of the voice touch command to Korean
language version. Current voice modality just recognize Korean language
only, so without Korean command MMI manager can not be properly worked.
Through this patch, MMI manager can recognize Korean ASR result.

Change-Id: I0f621effe00a9dc672fb295dbd87de63ddd5c486
Signed-off-by: Suyeon Hwang <stom.hwang@samsung.com>
src/mmimgr/iu/VoiceTouchEngine.cpp

index 2b021e0..0c4b13d 100644 (file)
@@ -32,6 +32,10 @@ static const string __SHOW_TOOLTIP_INVOCATION = "show tooltip";
 static const string __SHOW_NUMBER_INVOCATION = "show numbers";
 static const string __SHOW_GRID_INVOCATION = "show grid";
 
+static const vector<string> __SHOW_NUMBER_KOKR = {"힌트 보여줘", "숫자 힌트 보여줘", "숫자 보여줘", "숫자"};
+static const vector<string> __SHOW_LABEL_KOKR = {"힌트 메세지 보여줘", "텍스트 보여줘", "텍스트", "텍스트 힌트 보여줘"};
+static const vector<string> __SHOW_GRID_KOKR = {"그리드", "그리드 모드", "그리드로 보여줘"};
+
 static const int __DEFAULT_DISPLAY_WIDTH = 1920;
 static const int __DEFAULT_DISPLAY_HEIGHT = 1080;
 
@@ -258,17 +262,28 @@ void VoiceTouchEngine::makeClickedItemResult(ClickableItem* command, int timesta
        }
 }
 
+static bool __is_exist_in_candidates(const string &text, const vector<string> &candidates)
+{
+       for (auto &candidate : candidates) {
+               if (0 == text.compare(candidate)) {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
 bool VoiceTouchEngine::checkVoiceTouchMode(const std::string &text)
 {
        _I("[VoiceTouchEngine] Input text(%s)", text.c_str());
 
        string loweredText = StringUtil::makeLowerCase(text);
        voice_touch_mode_e mode = __currentMode;
-       if (0 == loweredText.compare(__SHOW_TOOLTIP_INVOCATION)) {
+       if (__is_exist_in_candidates(loweredText, __SHOW_LABEL_KOKR)) {
                mode = VOICE_TOUCH_MODE_TOOLTIP_TEXT;
-       } else if (0 == loweredText.compare(__SHOW_NUMBER_INVOCATION)) {
+       } else if (__is_exist_in_candidates(loweredText, __SHOW_NUMBER_KOKR)) {
                mode = VOICE_TOUCH_MODE_TOOLTIP_NUMBER;
-       } else if (0 == loweredText.compare(__SHOW_GRID_INVOCATION)) {
+       } else if (__is_exist_in_candidates(loweredText, __SHOW_GRID_KOKR)) {
                mode = VOICE_TOUCH_MODE_GRID;
        }