How do you implement related tag features used at Stackoverflow.com?

How do you implement the functionality of related tags that are used on many sites, such as our stackoverflow.com and http://tagexplorer.sandbox.yahoo.com/ .

+6
algorithm
source share
5 answers

I assume this is a correlation between the tags that are most often used together.

For example:

  • Question. Tag tagged tag2, tag2
  • Question B with tags tag1, tag3
  • Question C with tags tag1, tag2

Then itโ€™s natural to assume that tag2 is โ€œassociatedโ€ with tag1.

I would say that the best place to study would be the O'Reilly Intelligence Collective Book .

+10
source share

A couple of ways come to mind. You can simply run a quick query to select related tag names:

SELECT * FROM tags WHERE tag_name LIKE '%$current_tag%' 

Another way would be to set up a tag table to have a relationship field, possibly related identifiers separated by commas, but this seems hellish to maintain.

I am sure that someone will come up with a better answer, so I am also very interested.

+1
source share

Hmm, I'm not very good at math :-), but it looks like you are looking for correlation between two tags. My first instinct would be to set the expected value to 50% (expecting each tag to appear in 50% of the articles - this may not be the case), calculate the correlation coefficient of the tags in pairs and decide that if the correlation is higher than a certain value (which you must determine experimenting), they are interconnected.

Alternatively, you can get it with a simple measure, for example (the number of articles that they are displayed together) / (total number of articles where at least one tag appears).

0
source share

Maybe so keeps track of how many timestamps are combined

  • I insert Q1 with tags A + B, so the ratio isWeight (A, B) = 1

  • I am inserting Q2 with tags A + B, so the relationWeight (A, B) = 2

  • Now I delete Q1 and Q2. I should know the "weight ratio" to disassociate tags when the ratio is Weight = 0

0
source share

Using:

 (DataAccessDataContext db = new DataAccessDataContext()) { Repeater1.DataSource = from rt in db.RelatedTags where st.ITEMID == itemid select new TagView() { ID = rt.Tag.ID, NAME = rt.Tag.NAME }; Repeater1.DataBind(); } ///:) 
-one
source share

All Articles