本文整理汇总了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