In this project, you will be designing and implementing a mini search engine….solved

$20.00

Category:

Description

5/5 - (2 votes)

In this project, you will be designing and implementing a mini search engine. You are probably familiar with Google or Yahoo, which are some of the most popular search engines that you can find on the Web. The task performed by a search engine is, as the name says, to search through a collection of documents. Given a set of texts and a query, the search engine will locate all documents that contain the keywords in the query. The problem may be therefore reduced to a search problem, which can be efficiently solved with the data structures we have studied in this class. Here is a simple example that opens a file, reads a text file and store the information in an array data structure. importjava.io.File; importjava.util.Scanner; importjava.io.FileNotFoundException; //This class demonstrates reading a text file and storing them into an array public class ReadFileIntoArray { public static void main(String[] args) { inti = 0; try { String[] words = new String[5000]; //Assuming the input file has max size of 5000 words Scanner input = new Scanner(System.in); //Scanner object for keyboard input System.out.print( “Enter the filename: ” ); // Prompt the user for a file name String fileName = input.nextLine(); // get a file name from the user //If the full path is not given, then the file must be on the same folder as the source java file. //Otherwise, the user must give the full path File inputFile = new File(fileName ); // create a File object //Another Scanner object for file input Scanner fileInput = new Scanner(inputFile); while (fileInput.hasNext()) //Read from file as long as you have strings { words[i] = fileInput.next(); //Read a single string and store it in the array i++; } //Verify that you have the words stored in the array for (i = 0; i