keys.avapose.com

Simple .NET/ASP.NET PDF document editor web control SDK

You have the basic methods implemented in the Bot class, so let s play with it as-is before looking at extending it any further. The first step is to prepare a better set of data for the bot to use so that your conversations can be more engaging than those with the dummy test data shown earlier in this chapter.

winforms pdf 417 reader, winforms qr code reader, winforms upc-a reader, winforms data matrix reader, winforms ean 128 reader, winforms ean 13 reader, itextsharp remove text from pdf c#, itextsharp replace text in pdf c#, winforms code 39 reader, c# remove text from pdf,

In this section you re going to tweak the bot_data_to_yaml.rb script you created earlier to generate a YAML file for your first bot to use. Its name will be Fred and you ll generate a bot data file called fred.bot. Here s bot_data_to_yaml.rb extended with a better set of phrases and substitutions:

As I discussed earlier in the chapter, subclasses expand on the definitions in their superclasses. You indicate the superclass in a class statement by writing it in parentheses after the class name: class Filter: def init(self): self.blocked = [] def filter(self, sequence): return [x for x in sequence if x not in self.blocked] class SPAMFilter(Filter): # SPAMFilter is a subclass of Filter def init(self): # Overrides init method from Filter superclass self.blocked = ['SPAM'] Filter is a general class for filtering sequences. Actually it doesn t filter out anything: >>> >>> >>> [1, f = Filter() f.init() f.filter([1, 2, 3]) 2, 3]

227 228 230 230 233 237 240 240 241 241 242 243 245 256 257 259 260 261 262

require 'yaml' bot_data = { :presubs => [ ["dont", "do not"], ["don't", "do not"], ["youre", "you're"], ["love", "like"], ["apologize", "are sorry"], ["dislike", "hate"], ["despise", "hate"], ["yeah", "yes"], ["mom", "family"] ], :responses => { :default => [ "I don't understand.", "What ", "Huh ", "Tell me about something else.", "I'm tired of this. Change the subject." ],

=> [ "Hi. I'm [name]. Want to chat ", "What's on your mind today ", "Hi. What would you like to talk about " ], :farewell => ["Good bye!", "Au revoir!"], 'hello' => [ "How's it going ", "How do you do ", "Enough of the pleasantries!" ], 'sorry' => ["There's no need to apologize."], 'different' => [ "How is it different ", "What has changed " ], 'everyone *' => ["You think everyone * "], 'do not know'=> ["Are you always so indecisive "], 'yes' => [ "At least you're positive about something!", "Great." ], 'family' => ["Tell me about your family"], 'you are *' => [ "What makes you think I am * ", "Are you so sure I am * " ], 'i am *' => [ "Is it normal for you to be * ", "Do you like being * " ], 'i do not *' => ["Why don't you * "], 'what' => ["Why do you ask ", "Why ", "I don't know. Do you "], 'no' => [ "Really ", "Fair enough." ], 'why does *' => [ "I don't know why *", "Do you already know the answer " ], 'why can\'t i *' => ["Do you want to * "],

Adding Graphics to the Explanation Slides Fine-Tuning and Finishing Up Adding Graphics to the Title and Closing Credits Slides Reviewing and Adding Graphics to the Notes Pages Reviewing and Finalizing the Storyboard 10 Tips for Enhancing Your Storyboard

'why can\'t you *' => ["Do you want me to * "], 'hates *' => [ "Why do you think they hate * " ], 'hate *' => [ "Why don't you like * ", "Why the dislike of * " ], 'i like *' => [ "Why do you like * ", "Wow! I like * too!" ] } } # Show the user the YAML data for the bot structure puts bot_data.to_yaml # Write the YAML data to file f = File.open(ARGV.first || 'bot_data', "w") f.puts bot_data.to_yaml f.close

   Copyright 2020.