/** * Constructs a <code>AbstractLSI</code> object. */ public AbstractLSI(File UtFile, File SFile, File rowFile, File colFile, File dfFile, int dim, boolean rescaleIdf, boolean normalize) throws IOException { init(UtFile, SFile, rowFile, colFile, dfFile, dim, rescaleIdf, normalize); } // end constructor
private void createIdf(Vocabulary voc, int l) { long begin = System.currentTimeMillis(); logger.info("creating idf vector..."); Iidf = new float[voc.entrySet().size()]; //logger.debug("Iidf.size: " + Iidf.length); // iterates over the types Iterator it = voc.entrySet().iterator(); while (it.hasNext()) { Map.Entry me = (Map.Entry) it.next(); String term = (String) me.getKey(); Vocabulary.TermFrequency tf = (Vocabulary.TermFrequency) me.getValue(); int index = termIndex.get(term); Iidf[index] = (float) log2((double) l / tf.get()); //logger.info(index + ": " + l + "/"+ tf.get() + " = " + Iidf[index]); } // end while //for (int i=0;i<Iidf.length;i++) // logger.info(i + " " + Iidf[i]); long end = System.currentTimeMillis(); logger.info("took " + (end - begin) + " ms"); } // end createIdf
/** * Constructs a <code>AbstractLSI</code> object. */ public AbstractLSI(String root, int dim, boolean rescaleIdf, boolean normalize) throws IOException { //logger.info("reading ls model..."); this.dim = dim; File Ut = new File(root + "-Ut"); File Sk = new File(root + "-S"); File r = new File(root + "-row"); File c = new File(root + "-col"); File df = new File(root + "-df"); init(Ut, Sk, r, c, df, dim, rescaleIdf, normalize); } // end loadLSM