Now we will continue with our running example, the search engine. What we want to do here is to try to predict whether a URL comes from the first page of the search engine results or not. So, it is time to use the material we have covered so far in this chapter.
In Chapter 2, Data Processing Toolbox, we created the following object to store the information about pages:
public class RankedPage {
private String url;
private int position;
private int page;
private int titleLength;
private int bodyContentLength;
private boolean queryInTitle;
private int numberOfHeaders;
private int numberOfLinks;
}
First, we can start by adding a few methods to this object, as follows:
- isHttps: This should tell us if the URL is HTTPS and can be implemented with url.startsWith("https://")
- isComDomain: This should tells us if the URL belongs to the COM...