Page "binary" "search" "tree" ---------------------------------- 1 8 0 10 2 3 8 4 3 6 3 3Page 2 has the highest rating with 15, page 3 has the second highest rating with 12, and page 1 has the lowest rating with 0.
java ProcessQueries urlListFile ignoreFileThe urlListFile should contain a list of URLs, one per line. The ignoreFile should contain words to ignore as you count word frequencies in the html files (just as in the last program).
In order to process queries from a user, you'll need to create a new class that joins together a URL string with a binary search tree (holding TokenFrequency objects) representing that web page's content. Call this class URLContent. Your program should create a list of URLContent objects, one for each URL that appears in the urlListFile. (You might find a Vector a handy structure for holding this list.)
Once you have processed all the URLs in the input file (you should gracefully handle invalid URLs), your program should enter a loop as shown below, which prompts the user to enter a search query (or -1 to quit), and then lists all URL's that match the query (relevance rating > 0) in order from the best match first to the worst match last. Include each result URL's rating. URLs of web pages with ratings of 0 should not appear in the result list.
Enter a query or -1 to quit. Search for: programming Relevance URL --------- ---- 10 http://cs.roanoke.edu/~bloss/cpsc150syl.html 7 http://cs.roanoke.edu/~bloss/cs310syl01.html 7 http://cs.roanoke.edu/~bloss/cs101syl.html Search for: computer science Relevance URL --------- ---- 26 http://cs.roanoke.edu/~bloss/cs101syl.html 12 http://cs.roanoke.edu/~bloss/cpsc150syl.htmlTo find the results of the query in order, you will process the binary search trees in the list of URLContent objects, create priority queue elements for the URLContent objects whose trees give relevance ratings > 0, and add them to a priority queue for the search. Then use the priority queue to print out the matching urls in order. Remember that in a priority queue low values equate with high priority.
You should be able to use your BST, HeapPriorityQueue and related classes without modification. The programs that you wrote to test them will not be used directly, but you may need to incorporate some of the code in those programs.