Posts

Showing posts from March, 2019

Python enchant and building a spell checker

Image
I decided to do this experiment because I realized Whispering wall would default to the end clause if everything a user enters is spelled wrong. Pictured below:  Watson assistant failed when I told him "I want to work on improving watson"  I probably had a mispelling, I can not fathom why it didn't pick something out of the sentence to use. h htt https://twitter.com/NelliesNoodles/status/1109236474640257024 ps://twitter.com/NelliesNoodles/status/1109236474640257024 ttps://twitter.com/NelliesNoodles/status/1109236474640257024 My enchant dictionary checked the validity of a word, but if that word was misspelled it was not valid, and placed in the errors.  The enchant dictionary also has an issue with whitespace, as I found out doing this, and that needed to be corrected for Wiwa also. Hoping to update her tomorrow. I still have to build the method that returns a 'fixed it for you' sentence, But I am debating if I want wiwa to just run with whatever w...

Python class and instance explained in simple terms

I was trying to explain this to someone in the forum, and decided it's time to re-write how class's, instances, object, and self work.  Here it goes, a big ol' metaphor. A Python class is like a blueprint. I have all the technical data inside it to lay out how to build a particular object. The Python compiler is going to store that code away, and then you can 'access' it, or build something from that blueprint.  The thing that is built is the instance. class Spamalot(object):     def __init__(self):         self.spam = "spam"     def give_me_spam(self):         print("here is your ", self.spam) It's just a silly class that doesn't do much.  Python has much more complex class's stored away in it's library for us to use on a regular basis.  Blueprints to something like : BaseException or modules like math. We create instances of Spamalot because we don'...

JavaScript Ascii animation with while loops and console.log

I was working on figuring out while loops for an exercise in LearnJavaScriptTheHardWay  by Zed Shaw,  and I decided to do this: The red text console.logs were for debugging, and will take over the animation if the comments are removed. The bold red number is the point at which the loop stops.  My CPU didn't have too much trouble with that large number, but I'd recommend dialing it down if your CPU is slow. Also if your CPU is really fast, you'll have to change the pause to something much lower to see the animation better.  That too is in a loop, so the more that pause happens, the more loops your CPU is running.   Link: https://stackoverflow.com/questions/9006988/node-js-on-windows-how-to-clear-console To clear screen as described in link above, uncomment the bold purple comment I tried to comment the code to help learners see what I did,  any comments or suggestions, feel free to drop em in!        ...