Posts

machine learning Experiment Psuedocode only

This is all psuedocode Disclaimer: None of the code has been run, tested or even typed into a code editor.  This post is to hold the experiment idea, for future use. Machine Learning Experiment (1-27-19) The idea is to try this out, so I can see how machine learning works more. I understand there is a lot of data reconciliation and probability involved. The libraries currently used in python are advanced and extremely well built I am sure, but I need to see the interaction, see what's happening and how. This may be completely wrong, but once again.... Why not? After completing the initial post, I have the suspicion that I am in way over my head. It's way past my bedtime, I gotta sleep.  So not just a grain of salt with this one, bring a whole bucket. 1:  SQLite does not support holding a list      solution, either use an INTEGER and increment                ...

local vs global python

I revisited this concept after reading through some forum posts. I wanted to add something to it, but decided to write up some code for visual people like me.  It's so much easier to see it in action, then have someone explain it to me. So here is some code, try it out, see how the local and global stuff reacts. Hope to have some more bigger projects soon! ####### local_global.py   ########## a_list = [] b = [] adictionary = {} astring = "hello world" an_integer = 8 a_boolean = True def print_globals():     global astring     global an_integer     global a_boolean     print("=" * 10)     print('b = ', b)     print('a_list =', a_list)     print('adictionary = ', adictionary)     print('astring = ', astring)     print('an_integer = ', an_integer)     print('a_boolean = ', a_boolean)     print("=" * 10...

Django, {{ }}, interpolation bindings, double curly brackets, session, dynamic changes

Image
Disclaimer, I am really new at this still, so if I have somehow blasphemed the use of Django sessions, I am sorry.  Feel free to leave a comment!  I'd love it honestly.  Django's page on sessions: https://docs.djangoproject.com/en/2.1/topics/http/sessions/ *If you just want the links to the full code that accomplishes this. *  scroll to bottom *Honest if you just want the code, it's cool. Originally I wanted this to work with JavaScript: <!-- <script> function remove_bg(){    document.getElementById("wiwa_bg").style.backgroundImage = "none";    document.getElementById("wiwa_bg").style.backgroundColor = "white"; }; function add_bg(){    document.getElementById("wiwa_bg").style.backgroundImage = "url('/static/images/unicorn4_12-22-18.png')"; } document.getElementById("rm_button").addEventListener("click", remove_bg); document.getElementById("add_image_button")...

JavaScript Event handlers

Image
So for this experiment I was intrigued by the continual functions run in a website,  or event handlers.   It took me a bit to figure out what exactly needed a time out, closure, all the stuff mentioned in this article: Medium : front-end-javascript-interviews-in-2018-19 After a fair bit of searching I decided what I wanted my experiment to be in order to understand these concepts better. I'm going to make my own 'event_handler'. I've done it in python with Tkinter: An experiment with Tkinter python blog post Now most would say, "Why go to all the trouble of making something that exists?" And my answer will 99% of the time be, "Because I want to know how it works." For me the best way to learn that, is to try and make it happen myself the way the already existing thing works.   My dad would say something along the lines of, "You really learn how a carburetor works after you've (successfully) rebuilt one."  Helpful links ...

Javascript : check if a word contains a char in a text file

Image
JavaScript Experiment #1 The goal for this was to read a txt file, go through each word of that txt file, and make a string from every word in that txt file that contain the letter 'o'. *"Halt!" and "hand.]"   are in there because in my list made from the text file:        'down.]\nHalt!' --- is the item in the list.  It's printing the newline. So         they appear seperated.         Same with hand --     'hand.]\nWhoa', There were many many answers that weren't exactly what I was looking for, but gave me the breadcrumb to follow to the next search I needed to do. This was my extension to an exercise from Learn JavaScript the Hard way. Shaving the yak is more fun if you get to give it a fun haircut before the real work starts. (*draws a maze in the yak fur with shears for my toy soldier to tromp through*) Some things I found out: 1) (some string) = string...

Getting random lines from txt files

Image
   Working on my whispering wall the other day, I wanted a much better way to 'randomly' select lines it would give back to the user.  random.shuffle seemed like a better way. Thanks again to the interwebs for the tools to search up the things I need.    I wasn't sure how to properly handle the global aspect of 'LINE_GET' for this piece. LINE_GET is going to be the integer I use to select a number from the list that is made, that is then in turn used to get a 'random' line from my txt file.    In my whispering wall, this variable would be a part of the WhisperingWall class. And it's alteration would be internal, but for the sake of making this blog post I needed it to be easy to access and alter.  And globals, well, everyone says they are bad. I may be writing completely horrible code for that part. I am not sure, but hey, I didn't use a global!  kinda... sorta.... Anyway! two methods, a class(**cough global**), and a system argumen...

fail on retraining tagger, file rewrites accomplished

(Original post was to be me figuring out how to train the tagger in NLTK so it doesn't tag everything it can't recognize as a noun.) Monty python scripts -- http://www.montypython.net/scriptsidx.php NLTK Website docs: https://www.nltk.org/book/ch03.html When I went to do this project, I had no idea what it entailed. So for the purpose of this post, let me say, This is how far I got. I still have no clear picture if training the punkt pos_tagger is useful. More research to do, but I think I need to give it an entirely different data-set to go off from.  Looks like the free one I downloaded isn't very good with tagging spoken language vs. written. But if you came for some code, here's to methods I wrote to clean up the monty python scripts. First step was to copy paste into a new file the script. Second step:  save it as txt file Third: run these py files on the script to clean it up a bit for training texts for NLTK, when I figure that bit out.  ** fin...