Clean Room Implementation of Google Page Rank Algorithm Sala limpa implementação do Google Page Rank algoritmo
Finally a clean-room implementation of Google’s Page Rank Algorithm in Java, reverse-engineered from their numerous commentary on Page Rank (or is it Pigeon Rank?). Finalmente um limpa-sala de execução do Google Page Rank Algoritmo em Java, engenharia de inversão de seus inúmeros comentários sobre Page Rank (ou será Pigeon Rank?).
public static int getPageRank(url) { // start off with a random low PR int pageRank = rand.getInt(0, 3); if ( isHostedOn('google.com', url) ) { pageRank++; } else if ( isHostedOn('microsoft.com', url) ) { pageRank--; } // Support valid pages if (isValidPage(url) ) { pageRank += 1; } tag_value['b'] = 1; tag_value['h2'] = 2; tag_value['h1'] = 3; tag_value['strong'] = -1; // W3C sux!public static int getPageRank (url) (/ / inicie com uma baixa aleatória PR int PageRank rand.getInt = (0, 3); se (isHostedOn ( 'google.com', url)) (PageRank + +;) senão Se (isHostedOn ( "microsoft.com", url)) (PageRank -;) / / Apoio páginas válidas se (isValidPage (url)) (PageRank + = 1;) tag_value [ 'b'] = 1; tag_value [ 'h2'] = 2; tag_value [ 'h1'] = 3; tag_value [ 'forte'] = -1; / / W3C sux!pageRank = calculateTagsPR(tag_value, pagerank); // Sergey said good news sites have // lots of nested tables tablesOnPage = getTagCount(’table’); if (tablesOnPage >= 50) { pageRank += 2; } if (pageRank >= 5) { pageRank = 4; // helps selling AdWords } if (linksFrom(’mattcutts.com’, url) >= 4) { // I link to “clean” sites only // ?PageRank calculateTagsPR = (tag_value, pagerank), / / Sergey disse ter boas notícias sites / / lotes de tabelas aninhadas tablesOnPage = getTagCount ( 'mesa'); se (tablesOnPage> = 50) (PageRank + = 2;) if (PageRank> = 5) (PageRank = 4; / / ajuda a vender o AdWords) if (linksFrom ( 'mattcutts.com ", url)> = 4) (/ / I link para" limpar "somente sites / /?Matt, Feb 2006 pagerank += 2; } pagerank += countBacklinks(url) / 10000; blacklist1 = getList(’c:\chinese-government-censored.txt’); blacklist2 = getList(’c:\larry-page-hatelist.txt’); if ( inArray(blacklist1, url) || inArray(blacklist2, url) ) { pageRank = 0; } d = dashesInUrl(url); pageRank = (d >= 3) ?Matt, fevereiro 2006 pagerank + = 2;) pagerank + = countBacklinks (URL) / 10000; blacklist1 = getList ( 'c: \ pelo governo chinês-censored.txt'); blacklist2 = getList ( 'c: \ Larry-page - hatelist.txt '); se (inArray (blacklist1, url) | | inArray (blacklist2, url)) (PageRank = 0;) d = dashesInUrl (url); PageRank = (d> = 3)?pageRank -1 : pageRank + 1; if (inString(url, “how to build a bomb”)) { // added on request.PageRank -1: PageRank + 1; se (inString (url, "como construir uma bomba")) (/ / adicionado ao pedido.2004-12-01.2004-12-01.recipient = “peter@homelandsecurity.gov”; subject = “You might wanna check this…”; sendMailTo(recipient, subject, url); // page might still be relevant pageRank++; } if (month() == “June” || month() == “October”) { // makes people talk about // PR updates, good publicity pagerank -= randomNumber(1,3); } if (checkIdenticalPageAndLinkColor) { // spammer!!receptor = "peter@homelandsecurity.gov"; assunto = "Você pode querer marcar essa…"; sendMailTo (destinatário, assunto, url); / / página pode ainda ser relevante PageRank + +;) if (mês () == "Jun" | | Mês () == "Outubro") (/ / faz as pessoas falam sobre / / PR atualizações, a boa publicidade pagerank -= randomNumber (1,3);) if (checkIdenticalPageAndLinkColor) (/ / spammer!Googleaxe it!!Googleaxe-lo!pagerank = 0; } if (url == “http://www.nytimes.com”) { // just testing, pls remove tomorrow // ?pagerank = 0;) if (url == "http://www.nytimes.com") (/ / apenas testes, pls remover amanhã / /?Frank, June 2003 pagerank = 10; } //Don’t show PR above 10 if(pagerank > 10) pagerank = 10; return pagerank; }Frank, junho 2003 pagerank = 10;) / / Não mostrar PR se acima de 10 (pagerank> 10) pagerank = 10; retorno pagerank;)
Modified (to Java and added normalization etc.) from idea and original code by Modificada (Java e acrescentou a normalização etc) a partir de idéia original e por código Jack Tang Jack Tang .
Filed under Arquivado em Google , De Headline News Headline News , De How To How To , De Humor , De Tech Note Nota Tech , De Web , De Web Services Web Services | |
| |
RSS 2.0 RSS 2,0 | |
Trackback this Article | este artigo |
Email this Article E-mail este artigo
You may also like to read Você pode também gosta de ler |




