Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 126 lines (99 sloc) 6.059 kb
f64dea4 Version 1.0: Initial upload
Michael Kamensky authored
1 Agetian's Vim ChatBot (C) 2012 by Michael Kamensky, all rights reserved.
2 This script is distributed under Vim license.
3 ==============================================================================
4
5 Vim ChatBot is a simple self-teaching chat bot game for Vim. It will try to
6 communicate with the human and will accumulate the human's questions and answers
7 over time, utilizing them later and trying to mimic human behavior. This chat
8 bot is not meant to be smart, at best it resembles a talking parrot and it's far
9 from being a real human-like chat robot companion. It's meant to be fun and it
10 was originally intended as a little project to teach myself how to script Vim.
11
12 IMPORTANT -- READ BEFORE USING OR DON'T TELL ME YOU WERE NOT WARNED:
13 ====================================================================
14
15 Vim ChatBot will use the currently open file in the buffer as a source and as a
16 target for its database of known questions and replies! It will automatically
17 append new lines to the end of the current file as it learns the phrases from
18 the human! Therefore, if you were working on some important document prior to
19 starting the chat bot, make sure you switch to a new document or open your chat
20 database before initiating a conversation.
21
22 Vim ChatBot will never automatically save the file for you though, and it's
23 always up to you to decide if you want to save the updated database or not. You
24 should do it explicitly using the :write (or another command) to save the file.
25
26 Vim ChatBot utilizes the concept of a here-document (similar to here-documents
27 in bash) to be able to store its database of known questions and replies in the
28 script file itself. When VimChatBot.vim is opened in Vim, the chat bot will
29 automatically append new entries to the end of the script file as it learns new
30 phrases from you, and it will not corrupt the script file. If you'd like to keep
31 the updated database, you need to make sure you save the script file (:w or :x)
32 after you're done chatting.
33
34 Starting the Vim ChatBot
35 ========================
36
37 By default, Vim ChatBot maps itself to the <Leader>Cb command in normal mode
38 (<Leader> is the backslash symbol by default, so unless you've changed your
39 leader, the default command to start Vim Chatbot is \Cb ).
40
41 If the <Leader>Cb command is already taken by something among your scripts, feel
42 free to change the mapping (just search for nnoremap in the script file and
43 change the mapping to another combination of keys).
44
433c98e Version 1.1
Michael Kamensky authored
45 Macros
46 ======
47
877409f Version 1.2
Michael Kamensky authored
48 You can use the following macros when typing answers, the bot will also utilize
49 them when learning to use the phrase from you:
433c98e Version 1.1
Michael Kamensky authored
50
51 $TIME$ - refers to the current time.
52 $TIME12$ - (experimental) refers to the current time in 12-hour format.
53 $DAY$ - refers to the current day.
54 $WEEKDAY$ - refers to the current day of the week.
55 $MONTH$ - refers to the current month.
56 $YEAR$ - refers to the current year.
48f1c03 Version 1.4
Michael Kamensky authored
57 $HOUR$ - refers to the current hour.
58 $MINUTE$ - refers to the current minute.
59 $SECOND$ - refers to the current second.
433c98e Version 1.1
Michael Kamensky authored
60
f64dea4 Version 1.0: Initial upload
Michael Kamensky authored
61 Finishing the conversation
62 ==========================
63
64 To finish the conversation, type /Q into the "You Say:" prompt. Unless you are
65 asked something (or told something) by the bot and it's waiting for you to teach
66 it how to reply to that, /Q will end the conversation immediately. If, however,
67 the bot is waiting for your reply to learn something from you, /Q will merely
68 inform the bot that you don't have the intention to answer the question. If you
69 want to quit the conversation altogether, you will need to type /Q again.
70
71 Ctrl+C can be used as the universal quit command if you want to quit chatting
72 when in the middle of a bot-asked question and when you don't feel like typing
73 /Q twice.
74
75 Magical contexts
76 ================
77
78 By default, Vim ChatBot treats the first two responses as special, that is, the
79 bot will store a separate set of responses for the phrases you type as your
80 first and as your second lines, and will respond accordingly. This is to prevent
81 absolute stupidity, such as saying "Hi!" in the middle of a conversation. The
82 number of "magical contexts" (responses which should be treated specially) can
83 be modified and is stored in the s:MagicalContexts variable.
84
85 Database Modification
86 =====================
87
88 You can modify the database manually by adding or removing phrases in case you
89 are not satisfied with something that the bot has learned or would like to teach
90 it something without having to go through the process of teaching-by-chatting.
91
92 The database for Vim ChatBot is stored in the following way:
93
94 <Phrase>:::[MagicalContextID]
95 <Response1>
96 <Response2>
97 ...
98 <BLANK_LINE>
99
100 Quirks
101 ======
102
103 The database structure described above has an important consequence: when
104 speaking to Vim ChatBot, never use a triple colon (:::) symbol in your phrases,
105 they will confuse the bot and may make it behave more stupidly than normal.
106
3062695 Version 1.0a
Michael Kamensky authored
107 In the beginning of the conversation, the bot might seem not to recognize some
108 of the phrases you taught it before - this is due to the magical contexts
109 kicking in, the bot hasn't yet been taught to recognize that specific phrase in
110 that particular position. This is normal behavior, just patiently repeat the
111 lesson.
112
113 If you have a Python-enabled version of Vim, ChatBot will utilize the Python
114 random number generation algorithm from the "random" library. If your Vim is not
115 Python-enabled, a simpler algorithm will be utilized instead, based on the idea
116 suggested by Bee-9 at:
117 http://vim.1045645.n5.nabble.com/simple-16-bit-random-number-generator-td2843842.html
118 This algorithm is less efficient and will produce less random numbers, which may
119 or may not be apparent in the actual conversation with the bot (your mileage may
120 vary). At any rate, a Python-enabled Vim is recommended for more randomness, but
121 not strictly required.
122
f64dea4 Version 1.0: Initial upload
Michael Kamensky authored
123 ==============================================================================
124 Remember: Don't take Vim ChatBot seriously and just have fun! :)
125
Something went wrong with that request. Please try again.