Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 346605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:11:34+00:00 2026-05-12T11:11:34+00:00

I just started working on a website that will help people understand what rappers

  • 0

I just started working on a website that will help people understand what rappers are talking about. Users will see the lyrics to a rap song and they’ll be able to click certain lyrics to see an explanation. Here’s a screenshot (you can also check out the site itself here):

alt text http://img146.imageshack.us/img146/6882/clocal.png

(Original lyrics censored; click here to see them)

Anyway, my question is how to model these annotations in my application. Right now, I’m storing the lyrics and annotations as one big blob of HTML in this format:

<div class="lyrics">
  With the goons I spy
  <a href="#note1">Stay in tune with ma</a>
  <a href="#note2">She like damn
  This the realest since 'Kumbaya'</a>
  Kumbayay Killa Cam my lord 
</div>

<div class="annotations">
  <div id="note1">
"Ma" refers to ladies, generally, and specifically also the woman singing the hook;  "Stay in tune" is a musical metaphor: he literally stays in tune with the singer and also in the sense that he has game.
  </div>
  <div id="note2">
Kumbaya is a campfire singalong.
  </div>
</div>

and then processing it with this method for output:

class Song < ActiveRecord::Base
  include ActionView::Helpers

  def annotated_lyrics
    lyrics = read_attribute('annotated_lyrics')
    return if lyrics.blank?

    require 'hpricot'
    doc = Hpricot lyrics

    doc.at('.lyrics').inner_html = doc.at('.lyrics').inner_html.strip
    doc.search("a[@href^='#note']").set('class', 'tooltip').each do |t|
      t.inner_html = t.inner_html.strip
    end
    doc.search("div[@id^='note']").set('class', 'annotation').each do |a|
      a.inner_html = auto_link(a.inner_html.strip, :all, :target => '_blank')
    end
    simple_format doc.html.strip
  end
end

and the rest I do with jQuery and the fantastic qTip plugin.

This works fine for display, but since my application doesn’t know about the relationship between annotations and lyrics, it will be hard to, say, add an interface for updating an individual annotation inline (or at all, really).

On the other hand, I don’t really know the best way to represent this in ActiveRecord. I suppose a song could “have_many” annotations, but how would I represent which lyrics were annotated? I could store the start and end word index, but this seems painful and sensitive to minor changes in the lyrics.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:11:34+00:00Added an answer on May 12, 2026 at 11:11 am

    What about presenting the lyrics like this (with thanks to the People’s Champ)?

    Well it's that [grain grippa][1] from Houston, Tex
    That bar sippa, that bar no plex
    I'm straight up outta that [Swishahouse][2]
    Where G. Dash write all the checks
    So [check the neck, check the wrist][3]
    I'm balla status from head to toe
    
    [1]Referring to the wood grain steering wheel common to luxury cars
    [2]Swisha House is the record label Paul Wall records for
    [3]"Look at my watch and necklace because they are expensive"
    

    Just an idea, I was inspired by the markup used to add comments on this site.

    So, for the database, create Lyric, LyricLine and Annotation tables. Annotations have LyricLineIds, StartChar and EndChar values and a Meaning or Description field. LyricLines are the text of each line, related to the Lyric entity by LyricIds. Lyrics store song info, language info, whatever.

    This format should be pretty easy to generate off of the database and has the benefit of being more “human readable” than XML and editable in-place, so you can test it a lot easier before you have to develop a whole UI.

    I have this question favorited, and look forward to watching the site progress. Interesting work!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 334k
  • Answers 334k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This is what end up working on two different your… May 14, 2026 at 3:29 am
  • Editorial Team
    Editorial Team added an answer For now, you don't, since you can't run any apps… May 14, 2026 at 3:29 am
  • Editorial Team
    Editorial Team added an answer BindingOperations.SetBinding() May 14, 2026 at 3:29 am

Related Questions

Hey guys, hope this isn't too much of a n00b question I'm mainly a
I want to get started using Boost. I'm programming a C++ program in Visual
EDIT by OP: My question presupposed that PowerShell was the best tool for this
I've written an application in Microsoft Visual C# 2008 Express Edition. The Windows XP

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.