public void constructInvertedIndexFromFile(String indexDirectory)
	{
		try 
        {
			if (!indexDirectory.substring(indexDirectory.length() - 1).equals("/"))
			{
				indexDirectory = indexDirectory+"/";
			}
            FileReader fr = new FileReader(indexDirectory+indexFileName);
            
            try 
            {
                Scanner scan = new Scanner(fr);
				
                int lineNumber = 0; //for debug
        
                while (scan.hasNextLine()) 
                {
                    lineNumber++; //for debug
                    String line = scan.nextLine();    // Read one line of the text file into a string
                    String[] parts = line.trim().split(",");  // Split the line by space into a String array
					if (parts.length > 0)
					{
						String token = parts[0];
						// Take last part off, its the IDF 
						String idfStr = parts[parts.length - 1];
						double idf = Double.parseDouble(idfStr);
						termIDFs.put(token, idf);
						
						// now get all the doc,term-frequency pairs
						// NOTE!! the for loop variable increments by 2 each iteration
						HashMap<String, Integer> docTFs = new HashMap<String, Integer>();
						for (int i = 1; i < parts.length - 1; i += 2)
						{
							String docName = parts[i];
							int termFreq = Integer.parseInt(parts[i+1]);
							docTFs.put(docName,termFreq);
							
							//build up non-duplicate set of corpus doc names
							corpusDocs.add(docName);
							
							//add to document vector norm calculation
							double tfIDFSquared = (termFreq*idf)*(termFreq*idf);
							if (docVectorNormsSquared.containsKey(parts[i]))
							{
								docVectorNormsSquared.put(parts[i], docVectorNormsSquared.get(parts[i]) + tfIDFSquared);
							} else {
								docVectorNormsSquared.put(parts[i], tfIDFSquared);
							}
						}
						invertedIndexTFs.put(token, docTFs);
					}
                }
				
				//Print vocab size
				//System.out.println("Size of vocabulary: "+ invertedIndexTFs.size());
				//System.out.println("Number of docs: "+ corpusDocs.size());
            }
            finally
            {
               fr.close();
            }
            
        } 
        catch (FileNotFoundException e) 
        {
            System.out.print("File not found\n");
        }
        catch (IOException e)
        {
            System.out.print("Unexpected I/O exception\n");
        }
	}