Which machine learning algorithm could I use to break up a poem by lines? I want to create a network to predict the break up of poetry lines. The program would receive as input an unbroken poem, and would output the poem broken into lines.
For example, an unbroken poem could be
And then the day came, when the risk to remain tight in a bud was more painful

which should be converted to
And then the day came,
when the risk
to remain tight
in a bud
was more painful
than the risk
it took
to Blossom.

How should I go about this? I have been using classifiers for various tasks, but this seems to be a different type of task.
I'm thinking of it as an array of words (doesn't matter how they're represented for now), which would look like
[6, 32, 60, 203, 40, 50, 60, 230 ...] 

and needs to map into an array representing line breaks
[0, 0, 1, 0, 0, 0, 1, 0, 0, 1 ...]

where 1 (at optimal) means there should be a line break after the word in that index (in this idea, the two arrays are of the same length).
Unfortunately, I couldn't find an algorithm that could train a network of this shape.
What machine learning or deep learning algorithm can be used for this task?
You should try to use an RNN. You feed in letter by letter and have a binary output of linebreak - no linebreak. If you have enough data it might actually work.