I can't create a custom chatbot system

Posted 8 months by saidbicer

Post a topic
Un Solved
s
saidbicer

Hi,

I am an android developer. I'm developing apps for Pepper.

I need help with something on android side.

I'm developing a custom chatbot over the BaseChatbot class. 
But I never get the listened text. phrase.getText() in the replyTo function is always empty. I tried the language in English and Turkish, the result did not change.
The GreetingChatbot example on the following page is not working


0 Votes


8 Comments

Sorted by
s

saidbicer posted 8 months

Thank you for your answer. See you soon, bye

0 Votes

C

Clement Portales posted 8 months Admin

Yes I understand, Softbank has undergone a restructuration lately and their support has been overwhelmed since. 

If you have bought the robots from Softbank, they will be the only ones able to activate the remote speech recognition service for you. 

You can contact them through the ticket platform : https://account.aldebaran.com/support/


If you don't get an answer in the next days, I'll try to see what I can do to help you.

0 Votes

s

saidbicer posted 8 months

Thank you for the answer.


Yes, I am working with a real robot.


I didn't know that an option called remote speech recognition needed to be enabled. This is definitely my problem.


I searched the internet for the phrase "remote speech recognition".


The problem here is the same as mine.


https://stackoverflow.com/questions/56972445/add-cloud-speech-recognition-to-pepper-qisdk


Those who contacted Softbank could not get any results.



Here are the marks I got in the blue area:

In wildcards = "<>"

In remote chatbot recognition = "?"



I hesitate to email Softbank. I have a new robot, I emailed it to be added to the command center. It's been a week and they still haven't responded.

0 Votes

C

Clement Portales posted 8 months Admin

I believe you are trying it live on your Pepper. Can you describe or maybe take a picture of the blue speech bar when you are talking to pepper ? 

A custom chatbot requires an available remote speech recognition : if the speech bar always returns "?" or "<>", it might be that your remote speech recognition is not active, which you should request to Softbank. 


0 Votes

s

saidbicer posted 8 months

The code I sent is the same example as the one in the link you gave. Java version.


 

if (greetings.contains(phrase.getText()))



The incoming text in the expression is compared with the string. But the problem is that phrase.getText() always returns null.


I want to send the text that will come here to a web service and return a response via the smart assistant.


But I can't see the sentence heard by the robot as text.


The dialog created as a .top file is fine. I want to capture the dialogs that I did not write in the .top file on the code side.


0 Votes

C

Clement Portales posted 8 months Admin

Actually this  


Log.e("text", phrase.getText()); 


isn't in the example from  https://developer.softbankrobotics.com/pepper-qisdk/api/conversation/reference/basechatbot

What are you trying to achieve with this line ? 


0 Votes

s

saidbicer posted 8 months

Hello, Thank you for your help.




Naoqi version : 2.9.5

Pepper 1.8a


 

public class GreetingChatbot extends BaseChatbot {

    private static final String TAG = "GreetingChatbot";

    static private List<String> greetings = Arrays.asList( "hello", "hi", "good morning", "good afternoon", "good evening" );

    public GreetingChatbot(QiContext context) {
        super(context);
    }

    @Override
    public StandardReplyReaction replyTo(@NonNull Phrase phrase, Locale locale) {
        
        Log.e("text", phrase.getText());
        
        if (greetings.contains(phrase.getText())) {
            return new StandardReplyReaction(
                    new MyChatbotReaction(getQiContext(), "Hello you"),
                    ReplyPriority.NORMAL);
        } else {
            return new StandardReplyReaction(
                    new MyChatbotReaction(getQiContext(), ""),
                    ReplyPriority.FALLBACK);
        }
    }

    @Override
    public void acknowledgeHeard(Phrase phrase, Locale locale) {
        Log.i(TAG, "Last phrase heard by the robot and whose chosen answer is not mine: " + phrase.getText());
    }

    @Override
    public void acknowledgeSaid(Phrase phrase, Locale locale) {
        Log.i(TAG, "Another chatbot answered: " + phrase.getText());
    }


    class MyChatbotReaction extends BaseChatbotReaction {

        private String answer;
        private Future<Void> fSay;

        MyChatbotReaction(final QiContext context, String answer) {
            super(context);
            this.answer = answer;
        }

        @Override
        public void runWith(SpeechEngine speechEngine) {

            Say say = SayBuilder.with(speechEngine)
                    .withText(answer)
                    .build();
            fSay = say.async().run();

            try {
                fSay.get(); // Do not leave the method before the actions are done
            } catch (ExecutionException e) {
                Log.e(TAG, "Error during Say", e);
            } catch (CancellationException e) {
                Log.i(TAG, "Interruption during Say");
            }
        }

        @Override
        public void stop() {
            if (fSay != null) {
                fSay.cancel(true);
            }
        }
    }
}

 



 

  Log.e("text", phrase.getText());

 This line never gets any text.



0 Votes

C

Clement Portales posted 8 months Admin

Hello saidbicer, 


I can have a look into your issues. Can you indicate to me : 

- the Hardware and Software version of the Pepper you are using ? 

- do you have a nao-diagnosis available ? 

- do you have the logs of whenever the issue is happening ? 

- If possible, can you share your code so we can look into it ? 

0 Votes

Login or Sign up to post a comment