當前位置: 首頁>>代碼示例>>Python>>正文


Python RiveScript._dump方法代碼示例

本文整理匯總了Python中rivescript.RiveScript._dump方法的典型用法代碼示例。如果您正苦於以下問題:Python RiveScript._dump方法的具體用法?Python RiveScript._dump怎麽用?Python RiveScript._dump使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rivescript.RiveScript的用法示例。


在下文中一共展示了RiveScript._dump方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: input

# 需要導入模塊: from rivescript import RiveScript [as 別名]
# 或者: from rivescript.RiveScript import _dump [as 別名]
For a more full-fledged example, try running: `python rivescript brain`
This will run the built-in Interactive Mode of the RiveScript library. It has
some more advanced features like supporting JSON for communication with the
bot. See `python rivescript --help` for more info.

example3.py is just a simple script that loads the RiveScript documents from
the 'brain/' folder, and lets you chat with the bot.

Type /quit when you're done to exit this example.
""")

user = "localuser"

while True:
    msg = input("You> ")
    if msg == '/quit':
        quit()
    elif msg == '/dump':
        rs._dump()
    elif msg.startswith('/user '):
        user = msg[6:].strip()
        print("User changed to: " + user)
    elif msg.startswith('/exec '):
        eval(msg[6:].strip(), globals(), locals())
    else:
        reply = rs.reply(user, msg, False)
        print("Bot>", reply)

# vim:expandtab
開發者ID:FujiMakoto,項目名稱:makoto-rivescript,代碼行數:31,代碼來源:example3.py


注:本文中的rivescript.RiveScript._dump方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。