MeteorPhraseTable { public List<ScoredString> lookupParaphrasesFor(String phrase) { ArrayList<ScoredString> phrList = new ArrayList<ScoredString>(); if (!entryPairsAsMap.containsKey(phrase)) { return phrList; } Map<String,Float> mapForLhs = entryPairsAsMap.get(phrase); Iterator<String> itr = mapForLhs.keySet().iterator(); while(itr.hasNext()) { String rhs = itr.next(); Float prob = mapForLhs.get(rhs); ScoredString rhsAndItsProb = new ScoredString(rhs, prob); phrList.add(rhsAndItsProb); } return phrList; } MeteorPhraseTable(String resourcePath); List<ScoredString> lookupParaphrasesFor(String phrase);  }
@Ignore @Test public void test() { BasicConfigurator.resetConfiguration(); BasicConfigurator.configure(); Logger.getRootLogger().setLevel(Level.DEBUG); Logger testlogger = Logger.getLogger(this.getClass().toString()); testlogger.info("This test may take upto 30 seconds..."); MeteorPhraseTable englishTable = null; final long loadStart = System.currentTimeMillis(); try { englishTable = new MeteorPhraseTable("/meteor-1.5/data/paraphrase-en"); } catch (Exception e) { fail(e.getMessage()); } final long loadEnd = System.currentTimeMillis(); final long duration = ( loadEnd - loadStart ) / 1000; testlogger.debug("loading took " + duration + " seconds"); String lhs = "all those who have"; List<ScoredString> rhsAndProbList = englishTable.lookupParaphrasesFor(lhs); assertEquals(rhsAndProbList.size(), 4); for (ScoredString rhsProbTuple : rhsAndProbList) { String rhs = rhsProbTuple.getString(); Double prob = rhsProbTuple.getScore(); testlogger.debug(lhs + " -> " + rhs + " : " + prob.toString()); } String lhs2 = "bikini atoll"; rhsAndProbList = englishTable.lookupParaphrasesFor(lhs2); assertEquals(rhsAndProbList.size(), 0); for (ScoredString rhsProbTuple : rhsAndProbList) { String rhs = rhsProbTuple.getString(); Double prob = rhsProbTuple.getScore(); testlogger.debug(lhs + " -> " + rhs + " : " + prob.toString()); } }