public NestedHashApproach(File uniFile, File triFile)
            throws IOException, ProcessException
    {
        // Load unigram data.
        Unigram.Data unigramData = Unigram.read(WordrtPreproc.BINARY, new File[] {uniFile});
        idMap = unigramData.unigramIDMap;
        freqs = unigramData.unigramCount;
        cMax = 0;
        for (long freq : freqs) {
            cMax = (freq > cMax ? freq : cMax);
        }
        // Load trigram data.
        BinaryFileFastRecordReader fastReader = new BinaryFileFastRecordReader(triFile);
    	this.rtMap = new TIntObjectHashMap<TIntLongHashMap>();
        try {
            fastReader = new BinaryFileFastRecordReader(triFile);
            MappedByteBuffer readerBuffer = fastReader.getBuffer();
            long recordSize = readerBuffer.getLong();
		    readerBuffer.getInt();  // Omit the total trigram count.
		    readerBuffer.getInt();  // Omit the total unigram count.
			while(true){
				try {
					//get next record length
					recordSize = readerBuffer.getLong();
					//check if EOF is reached
					if(recordSize == 0){
						break;
					}else if(readerBuffer.remaining() < recordSize){
						//check if buffer remaining size is bigger than record length
						//refill buffer and check if buffer can be refill
						if(! fastReader.refillBuffer()){
							break;
						}
						readerBuffer = fastReader.getBuffer();
					}
					//read record
					int w1ID = readerBuffer.getInt();
					int start = readerBuffer.getInt();
					int end = readerBuffer.getInt();
					TIntLongHashMap w3Map = new TIntLongHashMap();
		    		for (int i = start; i < end; i++) {
		    			w3Map.put(readerBuffer.getInt(), (long)readerBuffer.getDouble());
		    		}
		    		// NOTE: Use this data only for testing!
		    		this.rtMap.put(w1ID, w3Map);
				} catch (IOException e) {
				}
			}
        } finally {
            if (fastReader != null)
                fastReader.close();
        }
    }