Acme-Daily-Fail

 view release on metacpan or  search on metacpan

lib/Acme/Daily/Fail.pm  view on Meta::CPAN

	["foxes",3,2],
	["twitter",3,1],            # Topical
	["the mmr jab",3,1],             # Topical
  ["judges",3,2],
  ["covid",3,1],              # fuck you, 2020
  ['meghan markle',3,1],
  ['woke',3,1],
  ['wokery',3,1],     # sophisticated
];

# Transitive phrases (i.e. bad thing they do)
#function Phrase(present, past, active, object) {

my $transitive_phrases = [
	["give", "given", "giving", "cancer"],
	["give", "given", "giving", "cancer"], # Have it twice as they're so bloody obsessed by it
	["give", "given", "giving", "covid"],
	["infect", "infected", "infecting", "with AIDS"],
	["make", "made", "making", "obese"],
	["give", "given", "giving", "diabetes"],
	["make", "made", "making", "impotent"],
	["turn","turned","turning","gay"],
	["scrounge off","scrounged off","scrounging off",""],
	["tax", "taxed", "taxing", ""],
	["cheat", "cheated", "cheating", ""],
	["defraud", "defrauded", "defrauding", ""],
	["steal from","stolen from","stealing from",""],
	["burgle","burgled","burgling",""],
	["devalue","devalued","devaluing",""],
	["rip off","ripped off","ripping off",""],
	["molest","molested","molesting",""],
	["have sex with","had sex with","having sex with",""],
	["impregnate", "impregnated", "impregnating", ""],
	["steal the identity of","stolen the identity of","stealing the identity of",""],
	["destroy","destroyed","destroying",""],
	["kill","killed", "killing",""],
	["ruin","ruined","ruining",""],
	["hurt","hurt", "hurting",""]
];

# Objects (i.e. saintly, saintly things)
my $objects = [
	"the british people",
	"the middle class",
	"middle britain",
	"england",
	"hard-working families",
	"homeowners",
	"pensioners",
	"drivers",
	"taxpayers",
	"taxpayers' money",
	"house prices",
	"property prices", # Hahahahahahahaa
	"britain's farmers",
	"britain's fishermen",
	"the countryside",
	"british justice",
	"british sovereignty",
	"common sense and decency",
	"the queen",    # God bless 'er
	"the king",     # God bless 'im
	"the royal family",
	"the church",
	"you",
	"your mortgage",
	"your pension",
	"your daughters",
	"your children",
	"your house",
	"your pets",
	"the conservative party",  # FAIL
	"cliff richard",           # Should this be in here?
	"the memory of diana",
	"Britain's swans",         # This always stays
  "Brexit",
];

# Matches an auxiliary verb with the subject
sub _match_verb_and_subject {
  my ($subject,$verb) = @_;

	if ($subject->[NUMBER] == 1 && $subject->[PERSON] == 3) {
		 return $verb->[SINGULAR];
	}
	else {
		 return $verb->[PLURAL];
	}
}

# Matchs the transitive verb's tense with that of the verb
#function Phrase(present, past, active, object) {
sub _match_verb_and_tense {
  my ($verb,$phrase) = @_;
	if ($verb->[TENSE] eq "present") {
		return $phrase->[PRESENT];
	}
	elsif ($verb->[TENSE] eq "past") {
		return $phrase->[PAST];
	}
	elsif ($verb->[TENSE] eq "active") {
		return $phrase->[ACTIVE];
	}
}

#  Returns a Daily Mail Headline as a string
sub get_headline {
	my @sentence;

  my $subject = _getRandom($subjects);
	my $phrase = _getRandom($transitive_phrases);
	my $verb = _getRandom($auxiliary_verbs);
	my $object = _getRandom($objects);

	$sentence[0] = _match_verb_and_subject($subject, $verb);
	$sentence[1] = $subject->[WORD];
	$sentence[2] = _match_verb_and_tense($verb, $phrase);
	$sentence[3] = $object;
  $sentence[4] = $phrase->[OBJECT] if $phrase->[OBJECT];

	my $s = join ' ', map { uc } @sentence;
	$s .= '?';



( run in 2.166 seconds using v1.01-cache-2.11-cpan-cdf2f3d4e48 )