forked from kying18/graph-composer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 63251a6
Showing
6 changed files
with
1,087 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
I've been watching you for some time | ||
Can't stop staring at those ocean eyes | ||
Burning cities and napalm skies | ||
Fifteen flares inside those ocean eyes | ||
Your ocean eyes | ||
|
||
No fair | ||
You really know how to make me cry | ||
When you give me those ocean eyes | ||
I'm scared | ||
I've never fallen from quite this high | ||
Falling into your ocean eyes | ||
Those ocean eyes | ||
|
||
I've been walking through a world gone blind | ||
Can't stop thinking of your diamond mind | ||
Careful creature made friends with time | ||
He left her lonely with a diamond mind | ||
And those ocean eyes | ||
|
||
No fair | ||
You really know how to make me cry | ||
When you give me those ocean eyes | ||
I'm scared | ||
I've never fallen from quite this high | ||
Falling into your ocean eyes | ||
Those ocean eyes | ||
|
||
No fair | ||
You really know how to make me cry | ||
When you give me those ocean eyes | ||
I'm scared | ||
I've never fallen from quite this high | ||
Falling into your ocean eyes | ||
Those ocean eyes | ||
|
||
White shirt now red, my bloody nose | ||
Sleeping, you're on your tippy toes | ||
Creeping around like no one knows | ||
Think you're so criminal | ||
|
||
Bruises on both my knees for you | ||
Don't say thank you or please, I do | ||
What I want when I'm wanting to | ||
My soul? So cynical | ||
|
||
So you're a tough guy | ||
Like-it-really-rough guy | ||
Just-can't-get-enough guy | ||
Chest-always-so-puffed guy | ||
I'm that bad type | ||
Make-your-mama-sad type | ||
Make-your-girlfriend-mad type | ||
Might-seduce-your-dad type | ||
I'm the bad guy, duh | ||
|
||
I'm the bad guy | ||
|
||
I like it when you take control | ||
Even if you know that you don't | ||
Own me, I'll let you play the role | ||
I'll be your animal | ||
|
||
My mommy likes to sing along | ||
With me but she won't sing this song | ||
If she reads all the lyrics | ||
She'll pity the men I know | ||
|
||
So you're a tough guy | ||
Like-it-really-rough guy | ||
Just-can't-get-enough guy | ||
Chest-always-so-puffed guy | ||
I'm that bad type | ||
Make-your-mama-sad type | ||
Make-your-girlfriend-mad type | ||
Might-seduce-your-dad type | ||
I'm the bad guy, duh | ||
|
||
I'm the bad guy, duh | ||
|
||
I'm only good at being bad | ||
Bad | ||
|
||
I like when you get mad | ||
I guess I'm pretty glad | ||
That you're alone | ||
You said she's scared of me? | ||
I mean | ||
I don't see what she sees | ||
But maybe it's 'cause I'm wearing your cologne | ||
|
||
I'm a bad guy | ||
I'm, I'm a bad guy | ||
Bad guy, bad guy | ||
I'm a bad guy | ||
|
||
Bite my tongue bide my time | ||
Wearing a warning sign | ||
Wait till the world is mine | ||
Visions I vandalize | ||
Cold in my kingdom size | ||
Fell for these ocean eyes | ||
|
||
You should see me in a crown | ||
I'm gonna run this nothing town | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by | ||
You should see me in a crown | ||
Your silence is my favorite sound | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by one | ||
|
||
Count my cards watch them fall | ||
Blood on a marble wall | ||
I like the way they all | ||
Scream | ||
Tell me which one is worse | ||
Living or dying first | ||
Sleeping inside a hearse | ||
I don't dream | ||
|
||
You say | ||
Come over baby | ||
I think you're pretty | ||
I'm okay | ||
I'm not your baby | ||
If you think I'm pretty | ||
|
||
You should see me in a crown | ||
I'm gonna run this nothing town | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by | ||
You should see me in a crown | ||
Your silence is my favorite sound | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by one | ||
|
||
Crown | ||
I'm gonna run this nothing town | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by | ||
You should see me in a crown | ||
Your silence is my favorite sound | ||
Watch me make 'em bow | ||
One by one by one | ||
One by one by one | ||
|
||
Don't be cautious, don't be kind | ||
You committed, I'm your crime | ||
Push my button anytime | ||
You got your finger on the trigger, but your trigger finger's mine | ||
|
||
Silver dollar, golden flame | ||
Dirty water, poison rain | ||
Perfect murder, take your aim | ||
I don't belong to anyone, but everybody knows my name | ||
|
||
By the way, you've been uninvited | ||
'Cause all you say are all the same things I did | ||
|
||
Copycat trying to cop my manner | ||
Watch your back when you can't watch mine | ||
Copycat trying to cop my glamour | ||
Why so sad bunny? Can't have mine? | ||
|
||
Call me calloused, call me cold | ||
You're italic, I'm in bold | ||
Call me cocky, watch your tone | ||
You better love me, 'cause you're just a clone | ||
|
||
By the way, you've been uninvited | ||
'Cause all you say are all the same things I did | ||
|
||
Copycat trying to cop my manner | ||
Watch your back when you can't watch mine | ||
Copycat trying to cop my glamour | ||
Why so sad bunny? Can't have mine? | ||
|
||
Mine | ||
I would hate to see you go | ||
Hate to be the one that told you so | ||
You just crossed the line | ||
You've run out of time | ||
I'm so sorry, now you know | ||
Sorry I'm the one that told you so | ||
Sorry, sorry, I'm sorry, sorry... | ||
Psych! | ||
|
||
By the way, you've been uninvited | ||
'Cause all you say are all the same things I did | ||
|
||
Copycat trying to cop my manner | ||
Watch your back when you can't watch mine | ||
Copycat trying to cop my glamour | ||
Why so sad bunny? Can't have mine? | ||
|
||
Hey, leave a message | ||
|
||
Hey, call me back | ||
When you get this | ||
Or when you've got a minute | ||
We really need to talk | ||
Wait, you know what | ||
Maybe just forget it | ||
Cause by the time you get this | ||
Your number might be blocked | ||
|
||
Stay and blah blah blah | ||
You just want what you can't have | ||
No way, I'll call the cops | ||
If you don't stop I'll call your dad | ||
And I hate to do this to you on your birthday | ||
Happy birthday by the way | ||
It's not you it's me and all that other bullshit | ||
You know that's bullshit | ||
Don't you, babe | ||
I'm not your party favor | ||
|
||
Look, now I know we could've done it better | ||
But we can't change the weather | ||
When the weather's come and gone | ||
Books don't make sense if you read them backwards | ||
You'll single out the wrong words | ||
Like you mishear all my songs | ||
|
||
You hear stay and blah blah blah | ||
You just want what you can't have | ||
No way, I'll call the cops | ||
If you don't stop I'll call your dad | ||
And I hate to do this to you on your birthday | ||
Happy birthday by the way | ||
It's not you it's me and all that other bullshit | ||
You know that's bullshit | ||
Don't you, babe | ||
I'm not your party favor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
from graph import Graph, Vertex | ||
import string | ||
import random | ||
|
||
|
||
def get_words_from_text(text_path): | ||
with open(text_path, 'r') as file: | ||
text = file.read() | ||
# text = ' '.join(text.split()) | ||
text = text.lower() | ||
# text = text.translate(str.maketrans('', '', string.punctuation)) | ||
|
||
words = text.split() | ||
|
||
return words | ||
|
||
|
||
def make_graph(words): | ||
g = Graph() | ||
prev_word = None | ||
# for each word | ||
for word in words: | ||
# check that word is in graph, and if not then add it | ||
word_vertex = g.get_vertex(word) | ||
|
||
# if there was a previous word, then add an edge if does not exist | ||
# if exists, increment weight by 1 | ||
if prev_word: # prev word should be a Vertex | ||
# check if edge exists from previous word to current word | ||
prev_word.increment_edge(word_vertex) | ||
|
||
prev_word = word_vertex | ||
|
||
return g | ||
|
||
|
||
def compose(g, words, length=50): | ||
composition = [] | ||
word = g.get_vertex(random.choice(words)) | ||
for _ in range(length): | ||
composition.append(word.value) | ||
word = random.choice(word.probability_map) | ||
|
||
return composition | ||
|
||
|
||
def main(): | ||
words = get_words_from_text('billie.txt') | ||
g = make_graph(words) | ||
g.generate_probability_mappings() | ||
composition = compose(g, words, 100) | ||
print(' '.join(composition)) | ||
|
||
|
||
if __name__ == '__main__': | ||
# print(string.punctuation) | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
class Vertex(object): | ||
def __init__(self, value): | ||
self.value = value | ||
self.adjacent = {} # nodes that it points to | ||
self.probability_map = [] | ||
|
||
def __str__(self): | ||
return self.value + ' '.join([node.value for node in self.adjacent.keys()]) | ||
|
||
def add_edge_to(self, vertex, weight=0): | ||
self.adjacent[vertex] = weight | ||
|
||
def increment_edge(self, vertex): | ||
self.adjacent[vertex] = self.adjacent.get(vertex, 0) + 1 | ||
|
||
def get_adjacent_nodes(self): | ||
return self.adjacent.keys() | ||
|
||
# initializes probability map | ||
def get_probability_map(self): | ||
for (vertex, weight) in self.adjacent.items(): | ||
self.probability_map.extend([vertex for _ in range(weight)]) | ||
|
||
|
||
class Graph(object): | ||
def __init__(self): | ||
self.vertices = {} | ||
|
||
def get_vertex_values(self): | ||
return set(self.vertices.keys()) | ||
|
||
def add_vertex(self, value): | ||
self.vertices[value] = Vertex(value) | ||
|
||
def get_vertex(self, value): | ||
if value not in self.vertices: | ||
self.add_vertex(value) | ||
return self.vertices[value] | ||
|
||
def generate_probability_mappings(self): | ||
for vertex in self.vertices.values(): | ||
vertex.get_probability_map() | ||
|
||
# def add_edge(self, start, end, weight=0): | ||
# # start and end are values of the nodes, not node objects | ||
# self.vertices[start].add_edge_to(self.vertices[end], weight) | ||
# | ||
# def increment_edge(self, start, end): | ||
# self.vertices[start] |
Oops, something went wrong.