Skip to content

Instantly share code, notes, and snippets.

Copyright (c) 2016 Tariq Ali

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTH

A fledgling campaign to recall the judge who sentenced a former Stanford University swimmer to six months in jail for sexually assaulting an unconscious woman gained momentum Friday as three prominent political consultants joined the effort.

When law enforcement arrived, one of the deputies, in a loud voice, asked the victim several times, “Can you hear me?”

There was no response. Paramedics tried a “shake and shout” technique and applied a physical pain stimulant. Still no response. She vomited once but didn’t regain consciousness.

In an ambulance later, a deputy tried to wake her repeatedly, without success. There was still no response after an EMT stuck an IV needle in the young woman’s arm.The victim finally regained consciousness about 4:15 a.m. at a hospital. Later that morning, doctors said her blood alcohol concentration was 0.12 percent — and estimated her intoxication level at the time of the assault to be 0.22 percent.

Aggressive sexual behavior

@tra38
tra38 / spintax.rb
Last active July 18, 2016 16:24
This is a script to 'unspin' a spintax-generated blog post about templating
require 'spintax_parser'
class String
include SpintaxParser
end
spintext = %{
>"Templates may seem like a terrible way to produce sentences until you consider the alternatives." --[Chris Pressey](https://github.com/dariusk/NaNoGenMo-2015/issues/16)
{How can you|Is it possible to|How on earth do you} {build|create|come up with|compose} an {algorithm|program} {to build|to create|for making} 'human-readable' novels? While {there was|there has been} [several](https://en.wikipedia.org/wiki/Just_This_Once) [attempts](https://en.wikipedia.org/wiki/Racter) made, {people|individuals|humans|human beings} {never|has not|has not yet|haven't} {reached|arrived at|spotted|located|stumbled on|found} a good "answer" {to that particular|to this} question... yet.
@tra38
tra38 / chat.rb
Last active August 12, 2016 04:28
Classifier Reborn
require 'classifier-reborn'
#To speed up processing power, I also had to install the following libaries
#GNU GSL (using Homebrew)
#rb-gsl (using RubyGem)
#Technically this is all under the GPL license (please read it here: https://www.gnu.org/licenses/gpl-3.0.en.html)
lsi = ClassifierReborn::LSI.new
strings = ["A dumb oven doesn't deserve credit, but a 'smart' oven does. Machine capabilities are constantly increasing, meaning they are doing more and more of the stuff that was traditionally reserved to humans. So...as a result, they deserve more of the credit. The long-divison algorithm, hm, I would guess it'd dependent on who's performing the algorithm. If a human did it, good job. If you have the calculator perform the long-division algorithm for you (like I reluctantly do), well...the calculator gets the credit for the math problem.","I guess we're back to 'agree to disagree' :slightly_smiling_face: i have no way to understand giving credit for a long-division problem to either a calculator, or to the lon
introduction = %{
Previous Text Generation Articles:
- [Structure in Computer-Generated Novels](https://dev.to/tra/structure-in-computer-generated-novels)
- [Using Templates In Computer-Generated Works](https://dev.to/tra/using-templates-innbspcomputer-generated-works)
#Introduction
"It's ... worth noting, I think, that many successful machine-made works, like the [music of EMI](https://www.amazon.com/Experiments-Musical-Intelligence-Computer-Digital/dp/0895793377) or Cope's subsequent machine creativity project, [Emily Howell](https://en.wikipedia.org/wiki/Emily_Howell), or the screenplay for [Sunspring](https://en.wikipedia.org/wiki/Sunspring), rely heavily on interpretation by humans, making the machine prominence of the source a novelty which **excuses the search for meaning instead of encouraging it.**
By which I mean, it's difficult to say what Benjamin, the AI that wrote Sunspring, could possibly be getting at, because Benjamin is an artificial intelligence. The common sense read is that Benjam
@tra38
tra38 / chat.rb
Last active September 15, 2016 01:22
When you search for a term that does not appear in the corpus, you receive an error.
require 'classifier-reborn'
lsi = ClassifierReborn::LSI.new
strings = ["A dumb oven doesn't deserve credit, but a 'smart' oven does. Machine capabilities are constantly increasing, meaning they are doing more and more of the stuff that was traditionally reserved to humans. So...as a result, they deserve more of the credit. The long-divison algorithm, hm, I would guess it'd dependent on who's performing the algorithm. If a human did it, good job. If you have the calculator perform the long-division algorithm for you (like I reluctantly do), well...the calculator gets the credit for the math problem.","I guess we're back to 'agree to disagree' :slightly_smiling_face: i have no way to understand giving credit for a long-division problem to either a calculator, or to the long-division algorithm","tra38 so, by that reasoning, would you give credit for baking bread to an oven? (if i'm slipping back into the argument, apologies. maybe i just can't pin down the cause of my confusion.) and indulge me only one more ex
@tra38
tra38 / plot_curve.rb
Last active September 18, 2016 13:38
This is the final-part of a 4-part series on text generation.
# We're requiring "sentimental", a Ruby Gem
require 'sentimental'
puts %{Previous Text Generation Articles:
- [Structure in Computer-Generated Novels](https://dev.to/tra/structure-in-computer-generated-novels)
- [Using Templates In Computer-Generated Works](https://dev.to/tra/using-templates-innbspcomputer-generated-works)
- [The "Commonsense" Problem In Computer-Generated Works](https:/m/dev.to/tra/the-commonsense-knowledge-problem-in-computer-generated-works)
}
@tra38
tra38 / blog_post_generator.rb
Last active September 18, 2016 18:29
This is a script to generate a blog post.
def boilerplate_introduction(bulletpoints)
%{>"Welcome! I think you'll find that writing code that writes a book that is not-boring to read for the first few hundred words is not too difficult.
>After those first few hundred words, though... well, all I can suggest is you download one of the completed novels (from this year or from any earlier year) and try to read the whole thing. The word "boring" does not quite do justice to the experience."---[Chris Pressey](https://github.com/dariusk/NaNoGenMo-2015/issues/98#issuecomment-153375005)
Every November is "National Novel Generation Month" (NaNoGenMo), a competition inspired by the more famous NaNoWriMo. In NaNoGenMo, the goal is to write computer code that can write a novel of 50,000 words or more. It started in 2013 and the only rules are that you must provide a copy of your novel and the source code to qualify.
- [2013 Repo](https://github.com/dariusk/NaNoGenMo)
- [2014 Repo](https://github.com/dariusk/NaNoGenMo-2014)
- [2015 Repo](https://github.com/da
@tra38
tra38 / gutenberg_scifi.json
Last active October 28, 2016 00:21
Here's the corpus I assembled
{
"Description": "Edited passages from public domain works, for use in a science-fiction novella",
"Frankenisten_Destroyer_Propaganda": {
"Source_1": {
"Url": "https://en.wikisource.org/wiki/Erewhon/Chapter_23",
"Paragraphs": [
"There was a time, when the earth was to all appearance utterly destitute both of animal and vegetable life, and when according to the opinion of our best philosophers it was simply a hot round ball with a crust gradually cooling. Now if a human being had existed while the earth was in this state and had been allowed to see it as though it were some other world with which he had no concern, and if at the same time he were entirely ignorant of all physical science, would he not have pronounced it impossible that creatures possessed of anything like consciousness should be evolved from the seeming cinder which he was beholding? Would he not have denied that it contained any potentiality of consciousness? Yet in the course of time consciousness came. Is it not
require 'prolefeed'
prolefeed = Prolefeed.new
prolefeed.add_to_bookends %{
#NaNoGenMo 2016
NaNoGenMo stands for National Novel Generation Month. Can you write code that can generate a 50,000-word novel in one month? Since it started in 2013, it has slowly gained a reputation for innovation in tackling a very hard problem (generating text at scale) in a variety of different ways.
[NaNoGenMo 2016](https://github.com/NaNoGenMo/2016) appeared to be less active than [NaNoGenMo 2015](https://github.com/dariusk/NaNoGenMo-2015) or [NaNoGenMo 2014](https://github.com/dariusk/NaNoGenMo-2014). It had less issues and less stars overall. Media attention, once widespread and viral, has dropped off significantly - the only news article of note was [Nerdcore](http://www.nerdcore.de/2016/11/30/█-blackout-█-generative-censorship-poetry/)'s acknowledgement of the existence of the generative novel [The Days Left Foreboding and Water](https://github.com/NaNoGenMo/2016/issues/119). Coverage appears to be limited to sympathetic