aichaos / rivescript-python

A RiveScript interpreter for Python. RiveScript is a scripting language for chatterbots.
https://www.rivescript.com
MIT License
158 stars 72 forks source link

use blank reply on * trigger #109

Closed elpimous closed 6 years ago

elpimous commented 6 years ago

hi Noah, Always working on your fabulous chatbot...

My question : need my robot to keep silence when noise or fragments of words.. (it uses STT in continuous)

I tested it :

+ *
- 

Of course it produces an error, but here is exactly the result i need ! (and i'll have a reply after some blank replies)

an idea ?

Thanks Noah

kirsle commented 6 years ago

How I've done this in the past is to include a special "tag" in the reply which tells my program not to send the user a message.

Like:

+ *
- <noreply>
reply = rs.reply(user, msg)
if not "<noreply>" in reply:
    send_message(user, reply)
elpimous commented 6 years ago

Hi Noah. Thanks for speed answer, and for the idea !! I followed you idea ...but with noise remover (my deep stt can send some letters):

this function only sends stt_result >=10 characters, to rivescript

    def listen_callback(self,msg):
        sentence = msg.data # what the stt sends
                # if listening noise (not enough letters to valid the sentence)
                if sentence and not (len(sentence) < 10):
                        # for french preprocess
                        sentence = sentence.replace('é','e').replace('è','e').replace('ç','c')
            #print ("user --> ", sentence, "\n")
            reply = self.ai.reply("localuser", sentence)
            #print ("Alfred --> ", reply, "\n")
            replyUTF = reply.encode('utf8')
            self.speak_this(replyUTF)
        else :
            pass

Thanks Noah