Trending algorithm

前端 未结 1 344
挽巷
挽巷 2021-02-02 03:59

I\'m working on a micro-forum of sorts, whereby a quick (close to tweet-size) topic message is posted by a special user, which subscribers can respond to with like-sized message

1条回答
  •  有刺的猬
    2021-02-02 04:30

    Intuition says that a solution to this problem doesn't need a lot of statistics, by ranking the topics based on some simple measures may already provide you with an interesting selection of "trending topics."

    One way is to order the topics by number comments generated in the last hour/day/week... and to select the top ones.

    Another way is to count the number of comments for each of the topics and divide this by the "age" of the topic. New topics that immediately generate comments will be considered trending, while older topics with many comments will be less trending as they grow older.

    These implementations can easily be created in Ruby/Rails and can even be done in an SQL query, provided that the tables contain publish dates and numbers of comments.

    0 讨论(0)
提交回复
热议问题