-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pause macro during speech #124
Comments
Hi It's because So you'll call You're probably best off handling the delay outside the RiveScript module, like,
reply = bot.reply(user, message)
parts = re.split(r'<pause \d+?>', reply) # split at a `<pause>` tag but include the tag:
# ["a moment, searching for best AI response ", "<pause 2>", "Ok, I have it now"]
for part in parts:
m = re.search(r'^<pause (\d+?)>$', part)
if m: # this is the `<pause>` tag
time.sleep( int(m.group(1) ) # sleep the 2 seconds
else:
print(part) # or whatever |
Thanks for explanations !! ps : parts = re.split(r'<pause \d+?>', reply) doesn't keep pause part in parts ! |
another re command ? Didn't find correct one ! thanks |
Ah sorry, I meant to include parenthesis around the regexp: parts = re.split(r'(<pause \d+?>)', reply) |
Very good ! works very nicely !!
|
Hi all.
Need to see Alfred pause into a retry, to simulate brain search activity...
here is my simple macro :
here is my try (failed) :
It should speak, make a 2s pause, and speak again,
but it just starts with pause, and after, speak all sentence (a moment, searching for best AI response Ok, I have it now)
?
The text was updated successfully, but these errors were encountered: