26
Chapter 4 Result and Discussion
4.1 Implementation of Extended Weighted Tree Similarity
Extended weighted tree similarity has been implemented to this recommender system and the user interface has been
designed to support it. The design of the user interface has been explained in chapter 3 and the implementation of it will be
explained in the next sub chapters but before it is explained, how the system run will be discussed first.
4.1.1 Crawling the Web
After the user input the criteria in to system and press search button, what the system do is crawling the web. The site
that is crawled by the system is Tabloid Pulsa’s site because the site provides information about mobile phone. Code 4.1 shows
the code of the crawling that it started with startup url setting, download the page and save the XML tree in the vector. Code 4.2
is show the conversion of web page to XML tree.
Code 4.1
Crawler Controller
27 public class crawlercontroller{
. . . . . . 46
Sring starturl = http:tabloidpulsa.co.idspesifikasi
. . . . . . 194
Private String downloadstringURL url{ 195
try { 196 BufferedReader reader =
197 new BufferedReadernew InputStreamReader 198 pageUrl.openStream;
. . . . . . 214
} . . . . . .
282 public Vector crawl throws Exception {
383 }
384 }
27
Code 4.2 XML tree generation from website
As has been discussed in chapter 2, the crawler system that is used in this system is combination of Depth and Breadth
First Systems. The Breadth First system is used to list all links in the web page but if the system find the link that contains mobile
phone information, the system will look deeper in that link first to find the link of mobile phone’s image before continue to the next
link.
4.1.2 User Interface 4.1.1 Main Form
Main form is form for users to decide the weight of Harga Price, Vendor and Fitur Feature. If the users decide the weight
of one or more criteria, the system will show the sub form depend of the choices. Figure 4.1 show the main form of the
recommender system.
26 public class xmltreewebsiteController {
27 public static Document buildxmltreeString pagecontent
throws ParserConfigurationException { 28
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance;
29 DocumentBuilder docBuilder =
docFactory.newDocumentBuilder; 30
Document doc = docBuilder.newDocument; . . . . . .
166 return doc; }}
28
Figure 4.1 Main Form
4.1.2 Price Form