Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write in python.We will compute the PageRank of the articles of the Hawaiian wikipedia, which is available at haw.wikipedia.org. Additional information of the Hawaiian wiki
Write in python.We will compute the PageRank of the articles of the Hawaiian wikipedia, which is available at
haw.wikipedia.org. Additional information of the Hawaiian wiki
can be found here.
Hints: If you don't speak Hawaiian, you might want to learn the wiki logic from the English wikipedia, and translate your findings. Also, caching is
recommended.
a Use the special AllPages page and understand its logic to retrieve the url of all articles in the Hawaiian wikipedia. Make sure to skip redirections.
How many articles did you find? I found a bit more than
# a
import requests
import requestscache
import lxmlhtml as
import re
b i Write a function that scans an article given by its url and retrieves all links to other articles in the Hawaiian wikipedia. Avoid links to special pages, images
or the ones that point to another website. Only count the proper article for links that point to a specific section. Use regular expressions to manage these
cases. ii Make sure to match redirections to their correct destiation article. To this end, find how wikipedia treats redirections and retrieve the true article.
Help: Try searching for uc davis' on
enwikipedia.org' To this end, I used the collection or article urls obtained in a which I stored in a dict object to allow for
fast lookups. Then, for each new found link I checked whether that link appeared in the dict. If not, It might be a redirection and receive special attention.
iii Request all articles and obtain all links to other articles.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started