0

It is possible to recognize a Hindi speech and show text in the Hindi language using Speech Recognizer. I tried a below code but its always show in English (UK).

Not Want to use any paid API for that

  launcherSpeech =
        registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
            if (it.resultCode == Activity.RESULT_OK) {
                val spokenText: String? =
                    it.data?.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS)
                        .let { text -> text?.get(0) }
                msg?.setText("${msg?.text.toString()} $spokenText")
            }
        }



    R.id.csVoice -> {
      val intent = Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH)
      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,"hi-IN")
      intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, Locale("hi_IN"))
      intent.putExtra(RecognizerIntent.EXTRA_PROMPT, "Listening....")
      launcherSpeech?.launch(intent)
    }
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 14 '22 at 19:50

0 Answers0