Menu

Trying to add more than one key phrase

Help
2017-12-13
2017-12-14
  • Luiz França

    Luiz França - 2017-12-13

    Hi y'all. I'm trying to add more than one keyphrase to the same recognizer. I've read multiple questions like this, but none of them worked with me. I have this code that creates the recognizer.

    recognizer = SpeechRecognizerSetup.defaultSetup()
                        .setAcousticModel(new File(assetDir, "en-us-ptm"))
                        .setDictionary(new File(assetDir, "cmudict-en-us.dict"))
                        .getRecognizer();
                recognizer.addListener(this.keyphraseRecognizer);
    

    If I try to add just one keyphrase search like this:

    recognizer.addKeyphraseSearch("wakeup", "good morning");
    

    It works fine. But if I try:

    recognizer.addKeyphraseSearch("wakeup", "good morning");
    recognizer.addKeyphraseSearch("wakeup", "good night");
    

    It doesn't work. I've tried to add keywords instead, but it just recognizes the first word of the list. I've tried to add grammar, but no matter what I say, it will think that I said some word from the grammar. I've tried to find the documentation of the library, but I didn't find any.

    Does anybody know what should I do?

    Thanks in advance.

     

    Last edit: Luiz França 2017-12-13
    • Nickolay V. Shmyrev

      You have to use keyphrase list file and addKwsSearch method.

       
      • Luiz França

        Luiz França - 2017-12-14

        I tried to add kws. There is no addKwsSearch method on the api for android on the SpeechRecognizer. So I tried:

        recognizer = SpeechRecognizerSetup.defaultSetup()
                            .setAcousticModel(new File(assetDir, "en-us-ptm"))
                            .setDictionary(new File(assetDir, "cmudict-en-us.dict"))
                            .getRecognizer();
                    recognizer.addListener(this.keyphraseRecognizer);
        
                 recognizer.getDecoder().setKws("wakeup", "/storage/emulated/0/Android/data/br.org.project.conversation/files/sync/keyphrase.list");
        

        And this was the keyphrase.list:

        good morning /1e-1/
        good afternoon /1e-1/
        good night /1e-1/
        

        But it just recognizes the fisrt keyphrase, and only sometimes.

         

        Last edit: Luiz França 2017-12-14
  • Luiz França

    Luiz França - 2017-12-14

    The file that I tried was actually in portuguese, I had added the wors on the dictionary and it worked fine when using addkeyphrasesearch, but when I use the setKws it only works the wors in English. Does anybody knows why it would work with addKeyphraseSearch and not with setKws?

     
    • Nickolay V. Shmyrev

      There is no addKwsSearch

      The method name is addKeywordSearch

      Does anybody knows why it would work with addKeyphraseSearch and not with setKws?

      Maybe thresholds are different, overall you need Portuguese model if you want to spot for Portuguese keyphrases.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.