Search This Blog

Wednesday, October 25, 2017

Simple linking analysis program

I do SEO project and I want what are the most links to be on first page, the wording to be above the link, or the major keywords in wording. So I have all programmed scripts necessary except for counting repetitive or lines with certain keywords. So one my famoust pymotw blogs for quality codes gave me answer.

Counter
A Counter is a container that keeps track of how many times equivalent values are added. It can be used to implement the same algorithms for which bag or multiset data structures are commonly used in other languages.

This library provides Ranking iterator to assign rank to each values and various strategies for assigning rankings.
https://pypi.python.org/pypi/ranking

In most cases, enumerate a Python standard function is a best tool to make a ranking. But how about tie scores? You may end up with giving different rank for tie scores. And I’m quite sure that will make you and your users dissatisfied. Solution? You are on the right page.
http://pythonhosted.org/ranking/

Strategies to assign ranks

Ranking follows the strategy function when it assigns ranks to tie scores. Also this module provides most common 5
strategies:

ranking.COMPETITION()
ranking.MODIFIED_COMPETITION()
ranking.DENSE()
ranking.ORDINAL()
ranking.FRACTIONAL()

You can also implement your own strategy function. A strategy function has parameters start, a rank of the first
tie score; length, a length of tie scores. Then it returns length + 1 for each scores for tie scores and the next rank.

So with python after you scrap data you can merged files with first page links of each link seen specific keyword (TOP 10 of each link seen on TOP 10 position); and the the second, the third and also TOP 30 of TOP 10 all together.

I also found interesting codes

Counter 1.0.0 counter package defines the "counter.Counter" class similar to bags or multisets in other languages.Counter package defines the counter.Counter class similar to bags or multisets in other languages. This package is created from Raymond Hettinger recipe: http://code.activestate.com/recipes/576611/
COUNTER CLASS (PYTHON RECIPE) Bag/multiset class for convenient tallying of hashable objects. This code can be helpful  for iterating trough text. Repeatitive reading is needed. 

Below Beginning Programming with Python For Dummies, lovely series for beginners, how to create and use dicts in python (similar to lists). 
http://www.dummies.com/programming/python/how-to-create-and-use-a-dictionary-in-python/



No comments:

Post a Comment

Note: Only a member of this blog may post a comment.