Home > database >  setContextPath() not found
setContextPath() not found

Time:12-18

I am trying to use the library Porcupine on Android. I have now downloaded a Rhino context file (.rhn) but can't find a way how to implement that file into my code.

The documentation says that I should use setContextPath() but this gives me the error:

Cannot resolve method 'setContextPath' in 'Builder'

That's how I tried it:

try {
    porcupineManager = new PorcupineManager.Builder()
            .setModelPath("porcupine_params_de.pv")
            .setAccessKey(ACCESS_KEY)
            .setKeywordPath("my_file_de_android_v2_0_0.ppn")
            .setContextPath("my_file_de_android_v2_0_0.rhn");
            .setSensitivity(0.7f).build(
                    getApplicationContext(),
                    porcupineManagerCallback);
    porcupineManager.start();
}
...

I don't know what this method is good for since I can't even find it in its class.

So how can I use my .rhn file?

CodePudding user response:

In the sample code from the link you provide, this method is called on different class:

PicovoiceManager picovoiceManager = new PicovoiceManager.Builder()
  .setAccessKey("${ACCESS_KEY}")
  .setKeywordPath("${KEYWORD_FILE_PATH}")
  .setWakeWordCallback(wakeWordCallback)
  .setContextPath("${CONTEXT_FILE_PATH}")
  .setInferenceCallback(inferenceCallback)
  .build(context);

you use PorcupineManager while sample code uses PicovoiceManager.

  • Related