lyrics of most pop music contains words that repeat several times

Description
Since the lyrics of most pop music contains words that repeat several times, a simple way to compress a lyric file is to create a map that stores each word once along with the positions of each word in the file.
For example, suppose the lyric consists ofethe lines:
What have I
1 23 <— word position What have I A 56 <— word position What have I done to deserve this 7 8 9 10 11 12 13 <— word position in lyrics in lyrics in lyrics We w ould form a map that maps each unique word to a list of word positions in the lyric. NOTE: The word position for a word at the end of a line is stored as a negative integer rather than a positive integer so you can recreate the lyrics later when you iterate through the words in the map. Sample map for the lyric above (order of words may vary): Word Word Position(s) WHAT 1, A, 7 HAVE 2, 5, 8 I -3, -6, 9 DONE 10 TO 11 DESERVE 12

Leave a Reply

Your email address will not be published.