Been working more on building really generic and simple machine learning tools. This one is a generic recommendation script built to run as a lambda or gcf. This iteration on my GitHub is built to run locally but it’s straight forward enough to import json, parse, and run it as a microservice. Requirements numpy gensim nltk==3.4.5 textblob==0.15.3 Usage Run locally, the recommender crawls through a column of a csv and matches the recommendations for similar content. Those are based on the content passed in the –text field. Can use the –recs option to define the number of recs you’d like to recieve in response. python recommender.py --file='my.csv' --text="Flash update" --column="title"…
-
-
Lightweight Python Tagger Using NLTK
Recently I was looking at automating the tagging of content from a mysql database. NLTK (Natural Language Training Kit) to the rescue to make this pretty easy. This GitHub project wraps NLTK into a small script to tag and provides a class for excluding words: Once the tagger was written we could add cursor.execute() or cursor.fetchall() as a way to bring in input from mysql content or since it’s a one-time run, we can use a simple mysql query run from bash and dump the output into the script as follows: mysql -X -u $supersecretUSER -p$supersecretPASS -h$HostName -D$MyDB -e'SELECT notes FROM tablename > notes.json lightweighttagger.py In the above just swap…
-
lightweightsentiment
Worked on a little sentiment analysis tool. The goal was to have a natural language processor that would report back a basic polarity score on text provided. So lightweightsentiment is a Lightweight Sentiment Analysis Tool built using the nltk (natural language toolkit) python framework. Requirements lightweightsentiment was written to conform to python 2 or 3 and requires the following modules installed (newer versions may work): nltk==3.4.5 textblob==0.15.3 To install nltk run: python -m textblob.download_corpora Usage Simply run the input.py script with a –text option and then some text to see sentiment. For example: python input.py --text "Gosh, I hate this feature" The output would then be a number between -1.0…