reading a file of set of keyword documents used to search in a library computer system
<p><strong>Description of Scenario for project</strong>: To search and articles in a library computer system one uses keywords in combination with Boolean operators such as 'and'(&amp;) and 'or(). For example, if you are going to search for articles and books dealin with uses of nanotechnology and bridge construction, the query would be Nanotechnology &amp; bridge construction. In order to retrive the books and articlkes properly, every document is represented using a set of keywords that represent the content of the document. </p>

<p>Assume that each document (books, articles, etc.) is represented by a document number which is unique. You will be provided with a set of documents represented by their numbers and keywords that are contained in that document as given below. </p>

<pre><code>887 5 
nanotechnology 
bridge construction
carbon fiber 
digital signal processing 
wireless
</code></pre>

<p>The number 887 above corresponds to the document number and 5 is the number of keywords that are given for the document. Each keyword will be on a separate line. The input for your project will contain a set of document numbers and keywords for each document. The first line of the input will contain an integer that corresponds to the number of document records to process.</p>

<p>An Inverted List data structure is where for each keyword we store a set of document numbers that contain the keyword. For example, for the keyword carbon fiber we will have the following:</p>

<blockquote>
  <p>bridge construction 887, 117, 665, 900
  carbon fiber 887, 1098, 654, 665, 117</p>
</blockquote>

<p>The documents numbered 887, 1098, 654, 665, and 117 all will contain the keyword carbon fiber and the keyword bridge construction is found in documents numbered 887, 117, 665 and 900. </p>

<p><strong>There are two main aspects to this project</strong>: </p>

<ol>
<li>I am required to read a file (using standard input) that contains the document information and build the inverted list data structure</li>
<li>to apply Boolean queries to the Inverted List data structure.</li>
</ol>

<p>The Boolean queries are processed as illustrated in the following example. To obtain the documents containing the keywords bridge construction &amp; carbon fiber we perform a set intersection operation and get the documents 887, 117, and 665. The Boolean query bridge construction | carbon fiber will result in a set union operation and the documents for this query are 887, 1098, 654, 665, and 900.</p>

<p>OK SO MY QUESTION IS:</p>

<p><strong>How do I read the document since on my first class is a setClass that stores a set of Document numbers?</strong> </p>

<p>My problem is that all documents are all in one text file for example:</p>

<pre><code>25                                                      //first document number 
329 7                                                   //second document number 
ARAMA
ROUTING ALGORITHM
AD-HOC
CSMA
MAC LAYER
JARA
MANET
107 4                                                            //third document number 
ANALYSIS
CROSS-LAYER
GEOGRAPHIC FORWARDING
WIRELESS SENSOR NETWORKS
</code></pre>

<p><strong>So how can I read the document numbers since they all have different amount of keywords right after another?</strong> </p>
