@@ -0,0 +1,1267 @@
+package com.cu.bigdata.moviereview.BuildVector;%0A%0Aimport java.io.BufferedReader;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.FileReader;%0Aimport java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport org.apache.mahout.math.RandomAccessSparseVector;%0Aimport org.apache.mahout.math.Vector;%0A%0Aimport com.cu.bigdata.moviereview.DataInstance;%0A%0Apublic class FeatureDictBuilder %7B%0A%09public FeatureDictBuilder() %7B%0A%09%09// TODO Auto-generated constructor stub%0A%09%7D%0A%09%0A%09public Map%3CString, Integer%3E buildDict(String filePath)%7B%0A%09%09Map%3CString, Integer%3E dict = new HashMap%3CString, Integer%3E();%0A%09%09%0A%09%09BufferedReader br = null;%0A%09%09String line = %22%22;%0A%09%09String cvsSplitBy = %22,%22;%0A%09%09int idxCounter = 0;%0A%09%09try %7B%0A%09%09%09br = new BufferedReader(new FileReader(filePath));%0A%09%09%09while ((line = br.readLine()) != null) %7B%0A%09%09%09    // use comma as separator%0A%09%09%09%09String%5B%5D splitedline = line.split(cvsSplitBy);%0A%09%09%09%09for(String s:splitedline)%7B%0A%09%09%09%09%09if(dict.get(s)==null)%7B%0A%09%09%09%09%09%09dict.put(s, idxCounter++);%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D catch (FileNotFoundException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D catch (IOException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D finally %7B%0A%09%09%09if (br != null) %7B%0A%09%09%09%09try %7B%0A%09%09%09%09%09br.close();%0A%09%09%09%09%7D catch (IOException e) %7B%0A%09%09%09%09%09e.printStackTrace();%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09return dict;%0A%09%7D%0A%7D%0A

add fieature dict builder