本文整理匯總了Python中markov.Markov.read方法的典型用法代碼示例。如果您正苦於以下問題:Python Markov.read方法的具體用法?Python Markov.read怎麽用?Python Markov.read使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類markov.Markov
的用法示例。
在下文中一共展示了Markov.read方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: Markov
# 需要導入模塊: from markov import Markov [as 別名]
# 或者: from markov.Markov import read [as 別名]
NICKNAME = "PyBotDev"
# :`str`: Password to authenticate with NickServ
PASSWORD = "<PASSWORD>"
# :'str': Path to markov json file
BRAIN = "pybot.json"
# Set our spam variable to None
LAST_REQUEST = None
# List of nicknames to ignore
IGNORED_NICKS = [NICKNAME, 'Francis', 'Meatball']
# Tracks how many lines the bot has listened to before talking itself
LISTEN_COUNTER = 0
# Number of lines the bot will read before it speaks by itself
TALK_FREQUENCY = 100
chatbot = Markov(BRAIN)
chatbot.read()
def connect_to_server():
# Connect to `HOST`, join `CHAN`, and authenticate with nickserv
CONN = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
try:
CONN.connect((HOST, PORT))
# Send NICKNAME to server
CONN.send('NICK {}\r\n'.format(NICKNAME))
# Define USER for setting hostmask
CONN.send('USER {} {} localhost :{}\r\n'.format(
NICKNAME, NICKNAME, NICKNAME))
# Wait for the server to catch up before trying to authenticate
wait_for_it = True