ignore changes

master
Your Name 7 years ago
parent 52ed7b7257
commit dfdb0623fb

2
.gitignore vendored

@ -1,3 +1,3 @@
images/** images/**
output/** output/**
src/index.json

@ -6,8 +6,7 @@ import json
#from thread import start_new_thread #from thread import start_new_thread
import os import os
r= Rake() r = Rake()
def chunks(l, n): def chunks(l, n):
for i in range(0, len(l), n): for i in range(0, len(l), n):
@ -30,15 +29,15 @@ class HelloBot(irc.bot.SingleServerIRCBot):
def on_pubmsg(self, c, e): def on_pubmsg(self, c, e):
print(e.arguments, e.source) print(e.arguments, e.source)
msg=e.arguments[0] msg=e.arguments[0]
print(e.source.split("!")[0][:1])
incoming_msg = e.arguments[0] incoming_msg = e.arguments[0]
print(incoming_msg)
r.extract_keywords_from_text(msg) r.extract_keywords_from_text(msg)
#r.get_ranked_phrases_with_scores()
listOfKeys = r.get_ranked_phrases() listOfKeys = r.get_ranked_phrases()
msg_where = "" msg_where = ""
if incoming_msg != "I don't know anything about that": if e.source.split("!")[0][-3:] != "bot" or e.source.split("!")[0][:1] != "A":
print("true")
for keyWord in listOfKeys: for keyWord in listOfKeys:
if keyWord in self.index: if keyWord in self.index:
msg = (index.get(keyWord)[0].get('sentence')) msg = (index.get(keyWord)[0].get('sentence'))
@ -46,15 +45,11 @@ class HelloBot(irc.bot.SingleServerIRCBot):
else: else:
msg = "I don't know anything about that" msg = "I don't know anything about that"
msg_where = "" msg_where = ""
for chunk in chunks(msg, 400): for chunk in chunks(msg, 400):
c.privmsg(self.channel, chunk)
print(chunk) print(chunk)
c.privmsg(self.channel, chunk)
else:
c.privmsg(self.channel, msg_where) print("bot")
if __name__ == "__main__": if __name__ == "__main__":
@ -80,5 +75,5 @@ if __name__ == "__main__":
myhost = os.uname()[1] myhost = os.uname()[1]
bot = HelloBot(args.channel, "{0}-{1}-bot".format(myhost, len(index)), args.server, args.port, index) bot = HelloBot(args.channel, "A-2{}-bot".format(len(index)), args.server, args.port, index)
bot.start() bot.start()

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save