当前位置: 首页>>代码示例>>Python>>正文


Python Markov.read方法代码示例

本文整理汇总了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
开发者ID:dezka,项目名称:pybot,代码行数:33,代码来源:pybotX.py


注:本文中的markov.Markov.read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。