Twitter链接分析器

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Twitter链接分析器相关的知识,希望对你有一定的参考价值。

  1. public static const homeLink:String = "http://twitter.com";
  2. public static const timelineURIPattern:String = homeLink + "/statuses/user_timeline/{userName}.xml?count={count}&page={page}";
  3. public static const userHomeURIPattern:String = homeLink + "/{userName}";
  4.  
  5.  
  6. public static const linkPattern:RegExp = /https?://([-w.]+)+(/([w/_.]*(?S+)?(#S+)?)?)?/g;
  7. public static const linkReplace:String = "<a href='$&' target='_blank'>$&</a>";
  8. public static const userPattern:RegExp = /@(w+)/g;
  9. public static const userReplace:String = "@<a href='"+ homeLink + "/$1' target='_blank'>$1</a>";
  10.  
  11. public static const tagLink:String = "http://search.twitter.com/search?q=%23";
  12. public static const tagPattern:RegExp = /(s+)#(w+)/g;
  13. public static const tagReplace:String = "$1<a href='"+tagLink+"$2' target='_blank'>#$2</a>";
  14. public static const tagPattern2:RegExp = /^#(w+)/;
  15. public static const tagReplace2:String = "<a href='"+tagLink+"$1' target='_blank'>#$1</a>";
  16.  
  17.  
  18. public static function replaceAll(text:String):String
  19. {
  20. text = text.replace(linkPattern,linkReplace);
  21. text = text.replace(userPattern,userReplace);
  22. text = text.replace(tagPattern,tagReplace);
  23. text = text.replace(tagPattern2,tagReplace2);
  24. return text;
  25. }
  26.  

以上是关于Twitter链接分析器的主要内容,如果未能解决你的问题,请参考以下文章

使用文本挖掘技术分析Twitter用户对电影Rangoon的评价

Storm入门Twitter Storm源代码分析之CoordinatedBolt

用R对Twitter用户的编程语言语义分析

Twitter发布新的大数据实时分析系统Heron

Twitter账户活动情况分析工具 – Simple Twitter Profile Analyzer

Android漏洞分析twitter资料