cordjostler: 2019 (Default)
2020-04-23 11:34 am

lyric generator

I finally found a Fiverr dev willing to take on my little lyric generator project. It's been interesting playing product owner on a teeny tiny scale. His first pass only took him a couple of hours and was pretty cool, but it had a couple defects and one of the completion criteria was completely misinterpreted, but I figure in all, that's pretty good for the couple paragraphs and sharpie wireframes I gave him.
Here's an example of some of the things that come out based on a corpus of lyrics from the band hum:

my eye to see far to spare and she miss the train.
differ from her dream with absent eye.
upright let me to come back now.
do care what they choos.
dream with seven nine and think about the end.

I guess the biggest issue I have is that he used the NLTK routine for "stemming" the words, hence some of them missing their suffixes. If this were intended to be generating grammar from scratch, that would matter, but I'm just going off of probability, so it doesn't. He said he'll pull it out in the next rev, and I think the usefulness of output will go up a lot.

I only briefly looked over the code. It's not how I would have done it / want it to be in some ways, but I guess in terms of utility, it still gets me farther than I was. For example, he's just storing the words linearly in the order they are imported. I'm not sure how this affects the probability component since words have multiple instances. though maybe he's taking that into account when he retrieves the word rather than when he puts it in. It also looks like he's using a graph database for something?  know they are trendy, but seems weird.. Maybe it's just easier to work with than other methods like my stupid hacky arrays.

The sentences don't make a lot of sense, but that is as expected. This concept is super basic, and the output intended to be more inspirational than usable verbatim. and hell, most song lyrics don't make a lot of sense anyway.
cordjostler: 2019 (Default)
2019-09-20 10:21 am
Entry tags:

generative poetry/lyrics

I've fiddled with python/language processing stuff the last few evenings. I still don't know what I'm doing. I started out trying to do a really basic thing. I was going to parse sentences and words, store them in a database and store the ID of words that follow them. I guess the idea is kind of like the iphone predictive text feature. 

I didn't get far. I started parsing sentences by punctuation and words by spaces.. but then found the NLTK tokenizing stuff, and it was just easier.. mostly.. I ran into the problem of trying to store stuff.. I wanted to iteratively read it into a variable at first, as a step before putting it in SQLite or whatever python can do natively... and, I ran into the thing where I don't understand the way python does (or doesn't do) 2D arrays. This was compounded by my lack of understanding of how to do an iterative loop when the iterator is from the data structure. ie: "data" is a list of sentences. "sentence" seems to be individual elements of that list.. but if I do "for sentence.." and use sentence as an index for a variable, I get told I can't use a string as an index. 

I felt like I was doing something for a minute though. not that I really was, I just felt almost competent. lol

while looking up info on NLTK, I found an old post on reddit by a person who wrote something similar to what I want to do.. a poetry remixer is how they describe it. It's waaaaay more advanced than what I envisioned.. but, it doesn't seem to really work right. they shared the distro, and it doesn't seem to have been worked since december. When I ran it, there's a GUI, and it runs showing the background process in console, but it's not doing what the gui says it should be doing. It's fun to watch it though. it seems to be processing a bunch of source texts.. the bible, nietzsche, etc.. then it puts words together based on a rhyme scheme and I think some loose grammar rules. It's kind of like it's thinking. I can only get it to spit out two lines at a time.. and it takes about 5 minutes to run. so far they are all pretty old timey sounding. Anyway. I'm trying to walk through the code, but it's way over my head; spread out over a bunch of files, and not documented at all beyond "this cleans up some things". lol. I reached out to the person.. hopefully they are still around.