public PairOfIntLong getStats(String term) { int df = -1; long cf = -1; PairOfIntLong p = new PairOfIntLong(); if (frequentTermsDfs != null) { try { df = frequentTermsDfs.get(term); LOGGER.info("[cached] df of " + term + ": " + df); if (frequentTermsCfs != null) { try { cf = frequentTermsCfs.get(term); LOGGER.info("[cached] cf of " + term + ": " + cf); p.set(df, cf); return p; } catch (NoSuchElementException e) { } } } catch (NoSuchElementException e) { } } int index = prefixSet.getId(term); LOGGER.info("index of " + term + ": " + index); if (index < 0) return null; p.set(dfs[index], cfs[index]); return p; }
private void loadFrequentDfMap(int n) { if (frequentTermsDfs != null) return; frequentTermsDfs = new HMapKI<String>(); if (dfs.length < n) n = dfs.length; for (int id = 1; id <= n; id++) { frequentTermsDfs.put(prefixSet.getTerm(idToTerm[id - 1]), dfs[idToTerm[id - 1]]); } // return frequentTermsMap; }
public int getDF(String term) { // if(dfs == null) // throw new RuntimeException("DF-Stats must be loaded first!"); if (frequentTermsDfs != null) { try { int df = frequentTermsDfs.get(term); LOGGER.info("[cached] df of " + term + ": " + df); return df; } catch (NoSuchElementException e) { } } int index = prefixSet.getId(term); LOGGER.info("index of " + term + ": " + index); if (index < 0) return -1; return dfs[index]; }