/** * Enter an interactive user-query loop, accepting queries and showing the retrieved documents in * ranked order. */ public void processQueries() { System.out.println("Now able to process queries. When done, enter an empty query to exit."); // Loop indefinitely answering queries do { // Get a query from the console String query = UserInput.prompt("\nEnter query: "); // If query is empty then exit the interactive loop if (query.equals("")) break; HashMapVector queryVector; // If there is a space in the query, then the user is searching for a bigram // therefore, make a bigram hashmapvector if (query.contains(" ")) queryVector = (new TextStringDocument(query, stem)).hashMapBigramVector(); // Otherwise, queryVector is a normal hashmapvector else queryVector = (new TextStringDocument(query, stem)).hashMapVector(); Retrieval[] retrievals = retrieve(queryVector); presentRetrievals(queryVector, retrievals); } while (true); }