Comments (3)
I think I got it. This is a search & reply that tweets three times and only to tweets that have the exact phrase.
num_hits = 0
search("'lovely bones'") do |tweet|
ttext = @grammar.flatten("#origin#") //that generates my phrase, using tracery
bot.exclude_retweets
ttweet = tweet.text
if ttweet.include? "lovely bones"
puts "it matches"
reply "#USER# #{ttext}", tweet
num_hits += 1
end
break if num_hits == 3
end
Sorry, I'm not a good programmer. So this took me some time to figure out.
from chatterbot.
Ah, this seems to work (got this by looking at the tests):
search("'lovely bones'", :skip_retweets => "true") do |tweet|
bot.exclude_retweets
reply "#USER# Lovely bones is a great book", tweet
end
I'll close this. But if you have a solution for how to only include the exact search phrase, let me know.
from chatterbot.
This is basically how I handle this as well by the way. Twitter's exact phrase search works inconsistently so it's sometimes better to do that check yourself. Neat use of tracery btw!
from chatterbot.
Related Issues (20)
- How do i even run this? The wiki did not help. I opened command prompt type in Ruby chatterbot-register.rb and it said its not a command HOT 1
- deprecation warning HOT 4
- Running on Heroku HOT 5
- Handle config writing if disk is full
- 401 when streaming. Oauth_timestamp? HOT 9
- chatterbot-register no such file or directory HOT 6
- chatterbot-register failures HOT 14
- chatterbot-register access_token and secret swapped. HOT 1
- replies block is not working HOT 4
- Attaching Pic to Tweet/Direct Message HOT 5
- Breaking out of nested direct_messages block HOT 3
- Retween with comment HOT 2
- Twitter Automated Experiences HOT 1
- Place / Location for tweet or reply? HOT 1
- New to this, any ideas how to use the docker? HOT 4
- only_interact_with_followers not working HOT 1
- Reply Tweets must start with an @ mention HOT 1
- only_interact_with_following ? HOT 4
- Documentation fix HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chatterbot.