Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Information retrieval systems allow users to enter keywords and retrieve articles that have those keywords associated with them. For example, once a student named
Information retrieval systems allow users to enter keywords and retrieve articles that have those keywords associated with them. For example, once a student named Yi Li wrote a paper called, "Object Class Recognition using Images of Abstract Regions," and included the following keywords: "object recognition', 'abstract regions', 'mixture models', and 'EM algorithm'. If someone does a search for all articles about the EM algorithm, this paper (and many others) will be retrieved. Details The following picture shows the structures with which you will work. Key Word Object Record Object Keyword record 0 1 2 MAX Keywords Array data image search current Count id title author next id title author next id title author next The index is an array Keywords, each element of which is an object of type KevWord. The array has some number MAX_KEYWORD_COUNT of elements (use 500). The variable current Count gives the current number of elements, which is 3 in the picture ('data', 'image', and 'search'). Each KevWord object has two fields: keyword and records. The keyword field contains the keyword and the records field contains a pointer to (eventually) all articles having that keyword. In the picture, the keyword 'data' has an associated pointer to a list of 2 articles. The information about an article is kept in a Record object, which has four parts: id, title, author, and next. We will give you a class called FileData that allows you to open a file, read the information for each article (its id, title, author and keywords), and close the file. You will develop the class Index with the methods to create and populate the index and the class AnswerQueries with the methods to query the index with a given keyword and print the keyword plus the information for each associated article. Index This class creates the index structure. It must include the array Keywords, the constant MAX, and the variable currentCount. In a loop, it should 1. Read the information for the next article from the file. (If the end of file is reached, this part is done.) 2. Create a Record for the article. 3. For each keyword associated with that article: O O O Search for the keyword (by binary search) in Keywords. If it is there, add this Record to the associated list of articles. Available files with the assignment: If it is not there, add the keyword to the array Keywords and make its records pointer point to the new Record. A Data file which contains records to be read into the data structure. Record.java: The "Record" class will be the objects stored in the value for each keyword in the tree. This class also has a "next" pointer which provides the structure for the linked list. Objects of this type will be the value of each node in your search tree. This code should not be modified. Test.java: This code performs reading from the data file as well as allowing test operations of your binary search tree. Performing changes to this file can be done to test particular cases, but this is for your benefit, since it will not be collected. The code provided will print the contents of the tree in inorder, which is alphabetical order. At each node of the tree, it will print the key word and then the titles of all the records in the list that you have created at that node. The test code also performs a few deletions and checks the result to ensure that delete() works correctly.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
It appears youve shared details about an assignment related to building an information retrieval system This system is designed to allow users to ente...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started