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; }
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]; }