duanpiao6679 2013-04-24 04:34
浏览 51
已采纳

从facebook和twitter朋友那里找到相似度得分的算法?

Using PHP I fetched the friends list from facebook and twitter and I stored each list in an associative array. I have both their names and locations. I want to do comparison of both the friends from fb and twitter based on their name and location, and provide with a similarity score.

Like I want to set a threshold of about 0.7, and if the score is more that that for a person, then it means that they represent the same entity. I have used the php function similar_text but it is too basic, it is giving a 50 - 60 % match for almost every friend, as it is just based on the words in the name.

Any suggestions?

  • 写回答

1条回答 默认 最新

  • duanlie2709 2013-04-24 05:07
    关注

    You may want to consider the vector space model: represent each name and location as a dimension in a very high-dimensional space. Represent twitter as one vector, and facebook as another. If, for example, I have a friend named Mike on both facebook and twitter, the "Mike" dimension has a non-zero value in both vectors. By comparing the angle between these two vectors, I can compute as similarity score. A smaller angle indicates a higher degree of similarity. A simple example:

    My twitter friends: Ada Alan Beth Dana Jon

    My facebook friends: Anne Beth Dana Jon

    Space contains dimensions: < Ada, Alan, Anne, Beth, Dana, Jon >

    Twitter vector: t = < 1, 1, 0, 1, 1, 1 >

    Facebook vector: f = < 0, 0, 1, 1, 1, 1 >

    The angle between them is equal to ArcCos( [ f dot t ] / [ | f | * | t | ] )

    See https://en.wikipedia.org/wiki/Vector_space_model

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 51单片机使lcd显示器开机闪烁预设字符闪烁3次需要加什么代码
  • ¥50 C# 使用DEVMOD设置打印机首选项
  • ¥15 麒麟V10 arm安装gdal
  • ¥15 想用@vueuse 把项目动态改成深色主题,localStorge里面的vueuse-color-scheme一开始就给我改成了dark,不知道什么原因(相关搜索:背景颜色)
  • ¥20 OPENVPN连接问题
  • ¥15 flask实现搜索框访问数据库
  • ¥15 mrk3399刷完安卓11后投屏调试只能显示一个设备
  • ¥100 如何用js写一个游戏云存档
  • ¥15 ansys fluent计算闪退
  • ¥15 有关wireshark抓包的问题