JavaScript
/* Daily Mail headline generator script
Author: Chris Applegate (www.qwghlm.co.uk)
Version: 1.1 January 7, 2009
License: GNU GPL v2 or later
Changelog:
1.1 [Jan 2009]
- Added past/present tenses
- Updated with 2009-relevant terms
- Added sarcastic comments to code
1.0 [2003]
- Original version
*/
// A more random random generator
function getRandom(a) {
if (a.length == 1) {
return a[0];
}
var n = new Array(50);
for (var i = 0; i < n.length; i++) {
n[i] = Math.random();
}
var m = n[Math.floor(Math.random() * n.length)];
var o = Math.floor(m * a.length);
return a[o];
}
// Objects for nouns, modifier verbs and phrases
function Verb(plural, singular, tense) {
this.singular = singular;
this.plural = plural;
this.tense = tense;
}
function Noun(word, person, number) {
this.word = word;
this.person = person;
this.number = number;
}
function Phrase(present, past, active, object) {
this.present = present;
this.past = past;
this.active = active;
this.object = object;
}
// Auxiliary verbs (the first word in the sentence)
auxiliary_verbs = [
new Verb("will", "will", "present"),
new Verb("could", "could", "present"),
new Verb("are", "is", "active"),
new Verb("have", "has", "past")
];
// Subjects (i.e. bad things)
subjects = [
new Noun("Manager v3", 3, 1),
new Noun("Querly", 3, 1),
new Noun("Text analytics", 3, 1),
new Noun("Real time analytics", 3, 1),
new Noun("Jeff Bezos", 3, 1),
new Noun("Education program", 3, 1),
new Noun("Excel", 3, 1),
new Noun("My new spreadsheet", 3, 1),
new Noun("Open Web Analytics", 3, 1),
new Noun("Rapier", 3, 1),
new Noun("Context Optional", 3, 1),
new Noun("Amazon Web Services", 3, 1)
];
// Transitive phrases (i.e. bad thing they do)
transitive_phrases = [
//new Phrase("give", "given", "giving", "cancer"),new Phrase("facilitate",...