public static TObjectIntHashMap<LongContainer> getFrequencies(ArrayList<String> out, String fileName) throws IOException {


		String[] array = new String[out.size()];
		out.toArray(array);

	    
		//create multimap with (key,count(key))
	    TObjectIntHashMap<LongContainer> countMap  = new TObjectIntHashMap<LongContainer>();
		for (int i = 0; i <= array.length; i++) {
			String keys ="";
			ArrayList<LongContainer> all = new ArrayList<LongContainer>();
			for (int len = 0; len < (array.length-i < NGRAM_LENGTH ? array.length-i: NGRAM_LENGTH); len++) {
				keys = array[i + len];
			    long[] longKeys = NgramCoder.pack(keys);
			    all.add(new LongContainer(longKeys));
			    
			    long[] ngrams = new long[0];
			    for (LongContainer longNgram: all) {
			    	long[] l = longNgram.getLongArray();
			    	long[] old = ngrams;
			    	ngrams = new long[old.length + l.length];
			    	System.arraycopy(old, 0, ngrams, 0, old.length);
					System.arraycopy(l, 0, ngrams, old.length, l.length);
			    }
				
				if (!countMap.contains(new LongContainer(ngrams))) {
					countMap.put(new LongContainer(ngrams), 1);
				} else {
					int count = countMap.get(new LongContainer(ngrams)) + 1;
					countMap.put(new LongContainer(ngrams), count);
				}

			}
		}
	    
		
		return countMap;
	}