<?php
  
@require_once("stuff.php");
  
printHead("Lyrics Generator");
?>
<body>

<h1>Lyrics Generator</h1>

<p>Ever heard a HIM (or whatever) song? <abbr title="in my opinion">IMO</abbr>: if you have heard one, you've heard them all.</p>

<p>These lyrics are randomly generated from a list of sentence structures, which is combined with a list of valid words for each position in the sentence (huh?).</p>

<p>The lyrics produced by this script and the <a href="lyrics.phps">source code</a> are in the public domain; you may use them for whatever you wish without any restrictions. If you <strong>do</strong> turn any of this nonsense into something useful, like a hit single, I'd be happy to recieve a free CD. Hah!</p>

<hr class="lyrics" />

<?php

// Sentences
// #N = noun
// #V = non-targeted verbs
// #T = time
// #P = person
// #A = adjective
// #W = ownership
// #I = *ing-verbs
// #G = targeted verbs
// #L = "In " . places
// #H = has/have/will
// #E = emotion

$sentences = array("If #P would #G me #T",
           
"Her #A #N, so #A",
           
"I #H #V, for #N, #T",
           
"#A, I #H #V for #W #A #N",
           
"If #P would #G #N, I would #V",
           
"Would I #V, #P would #V",
           
"If I #V, #P is #I",
           
"With #W #A #N, I #H #V",
           
"#T I will #G #W #N",
           
"In #E, I #V",
           
"#T, forever, in #L",
           
"#W #A #N, so #A and #A",
           
"#A and #A, but #A like #N",
           
"#P and #N, destined to #V",
           
"#A, #V and #V to #V",
           
"#A #E, #A #T",
           
"#H I #V, I #H #V, #T",
           
"So #A within, yet #A",
           
"#V for #E, #A #T",
           
"In #P, so #A and #A",
           
"#G #N, #G me and #V",
           
"In #L #T, I can #V",
           
"In #L, #I #T",
           
"For #N, I would #G her",
           
"If #P would #V in #L",
           
"When #P is #I",
           
"#I in #L, so #A #T",
           
"Me and her, in #L #T"
           
);

// Init words
$person = array("I""you""she""death""God""time""life""Satan");
$who = array("my""your""her");
$verb = array("cry""bleed""drown""die""survive""scream""love""hate""despise""kiss""hope""conceal""awaken""dream""pray");
$tverb = array("cut""kill""fuck""bury""rape""bless""search for""find""discover""resurrect""forget""dream of""kneel to""hope for""conceal""awaken""trust""pray to""destroy");
$place = array("my grave""your arms""hell""darkness""Tokyo""love""heaven""my dreams""your dreams""another world""the past""my crypt""my tomb");
$ing = array("crying""hoping""falling""dreaming""dying""feeling""drawing near""lying""singing""praying");
$emotion = array("lust""hope""sorrow""hate""love""trust""darkness""emptiness");
$has = array("will""would""can""might""shall""could");
$time = array("tomorrow""yesterday""tonight""today""forever""now");
$noun = array("blood""Satan""God""love""hate""death""razorblade""torment""bride""fire""pride""time""hell""sin""bliss""child""girl""sorrow""darkness""pain""lust""tonight""flame""eternity""night""wrist""blade""knife""resurrection""kiss""spider""princess""queen""king""hope""retreat""trust""eyes""master""slave""funeral""angel");
$adj = array("crying""burning""drowning""loving""tormented""burned""buried""beautiful""sweet""young""innocent""blessed""morbid""dark""evil""unseen""painful""eternal""sleeping""shining""screaming""sharp""lost""missing""final""hidden""peaceful""pale""forgetful""dyslectic""fragile""malfunctioning");

$text "";

// Generate four verses
for ($i 0$i 4$i++)
{
  
// Generate four lines for each verse
  
for ($j 0$j 4$j++)
  {
    
// Shuffle all the words around
    
shuffle($time); shuffle($adj); shuffle($who); shuffle($noun);
    
shuffle($person); shuffle($verb); shuffle($has); shuffle($ing);
    
shuffle($place); shuffle($tverb);

    
// Select a random sentence form
    
$sentence $sentences[array_rand($sentences)];

    
// Replace markers with words
        
    
for ($t 0$t 5$t++)
    {
      
$sentence preg_replace("/\\#L/"$place[array_rand($place)], $sentence1);
      
$sentence preg_replace("/\\#G/"$tverb[array_rand($tverb)], $sentence1);
      
$sentence preg_replace("/\\#I/"$ing[array_rand($ing)], $sentence1);
      
$sentence preg_replace("/\\#N/"$noun[array_rand($noun)], $sentence1);
      
$sentence preg_replace("/\\#A/"$adj[array_rand($adj)], $sentence1);
      
$sentence preg_replace("/\\#T/"$time[array_rand($time)], $sentence1);
      
$sentence preg_replace("/\\#P/"$person[array_rand($person)], $sentence1);
      
$sentence preg_replace("/\\#W/"$who[array_rand($who)], $sentence1);
      
$sentence preg_replace("/\\#H/"$has[array_rand($has)], $sentence1);
      
$sentence preg_replace("/\\#V/"$verb[array_rand($verb)], $sentence1);
      
$sentence preg_replace("/\\#E/"$emotion[array_rand($emotion)], $sentence1);
    }

    
// Add the text and a newline to each line
    
$text .= ucfirst($sentence) . "\n";
  }

  
// Add an extra space between each verse
  
$text .= "\n";
}

// Text has been generated

print "<p class=\"lyrics\">" nl2br($text) . "</p>";

?>

<?php @printPageFoot(); ?>

</body>
</html>