Permalink
Browse files

Version 1.8

- **NOTE:** this is a special update build for Vim/GVim v7.4 only! If you are using Vim 7.3 or an earlier build, please keep using VimChatBot v1.7 which is actually the preferred build for older Vims! This version requires Vim 7.4, the script interface on vim.org doesn't let me specify 7.4 as the target version, so I had to specify 7.3 instead, sorry.
- updated the human input routines to account for some of the changes in Vim 7.4 that broke the echo output.
  • Loading branch information...
1 parent e72ee3d commit 6d491a8aa3ea2588ef2f1aaf1241dc703b05ea1f Michael Kamensky committed with Sep 3, 2013
Showing with 7 additions and 7 deletions.
  1. +7 −7 plugin/VimChatBot.vim
View
14 plugin/VimChatBot.vim
@@ -1,5 +1,5 @@
" VimChatBot.vim : A self-teaching chat bot for Vim
-" Version : 1.7
+" Version : 1.8
" Maintainer : Michael Kamensky <stavdev@mail.ru>
" Last Modified : 12/21/2012
" License : This script is released under the Vim License.
@@ -24,9 +24,9 @@
" : Ctrl+C can be used to forcefully finish the conversation
" : without having to type /Q once or twice.
-if v:version < 700
+if v:version < 704
echohl Error
- echo "ERROR: Vim v7.0 or newer is required for Vim ChatBot!"
+ echo "ERROR: Vim v7.4 or newer is required for Vim ChatBot!"
echohl None
finish
endif
@@ -43,7 +43,7 @@ nnoremap <unique> <silent> <Leader>Cb :call VCB_MainChatLoop()<CR>
" Script variables
let s:ChatIteration = 1
let s:MagicalContexts = 2
-let s:BotVersion = "1.7"
+let s:BotVersion = "1.8"
" Vi compatibility mode workaround
let s:GlobalCPO = &cpo
@@ -194,13 +194,13 @@ function! s:VCB_AI_Respond(pattern, iteration)
echo "ChatBot: I don't understand that. Can you please tell me what you would say?\n"
echohl None
let suggested_response = input("You say: ")
+ echo "\n"
if suggested_response == "/Q" || suggested_response =~ "^\\s*$"
echohl Comment
echo "ChatBot: Fine, don't teach me if you don't want to!\n"
echohl None
return
endif
- echo "Human: " . s:VCB_Macroexpand(suggested_response) . "\n"
call s:VCB_AI_Store_New_Response(a:pattern, suggested_response, a:iteration)
echohl Comment
echo "ChatBot: Thanks, I'll remember that!\n"
@@ -219,13 +219,13 @@ function! s:VCB_AI_AskBack(resp_offset, iteration, next_request, request_signatu
let decision = s:VCB_Random(0, len(requests) - 1)
echo "ChatBot: " . s:VCB_Macroexpand(requests[decision][:-a:resp_offset]) . "\n"
let taught_response = input("You say: ")
+ echo "\n"
if taught_response == "/Q" || taught_response =~ "^\\s*$"
echohl Comment
echo "ChatBot: Fine, don't want to answer me - don't answer.\n"
echohl None
return
endif
- echo "Human: " . s:VCB_Macroexpand(taught_response) . "\n"
let response_group_loc = s:VCB_GetLineMatchingPattern(requests[decision][:-a:resp_offset] . a:request_signature)
let already_has_resp = s:VCB_HasResponse(response_group_loc, taught_response)
if already_has_resp != 1
@@ -262,14 +262,14 @@ function! VCB_MainChatLoop()
endif
endif
let HumanResponse = input("You say: ")
+ echo "\n"
if HumanResponse =~ "^\\s*$"
continue
endif
if HumanResponse == "/Q"
echo "ChatBot: Bye-bye!\n"
break
endif
- echo "Human: " . s:VCB_Macroexpand(HumanResponse) . "\n"
call s:VCB_AI_Respond(HumanResponse, s:ChatIteration)
let s:ChatIteration += 1
endwhile

0 comments on commit 6d491a8

Please sign in to comment.