@Test public void testSearchRomanticComedy() { System.out.println("search 'romantic comedy'"); String[] terms = {"romantic", "comedy"}; Iterator<Relevance> hits = corpus.search(new BM25(), terms); int n = 0; while (hits.hasNext()) { n++; Relevance hit = hits.next(); System.out.println(hit.text + "\t" + hit.score); } assertEquals(78, n); }
@Override public Iterator<Text> search(String term) { if (invertedFile.containsKey(term)) { ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term)); return hits.iterator(); } else { return Collections.emptyIterator(); } }
SimpleCorpus implements Corpus { @Override public Iterator<Text> search(String term) { if (invertedFile.containsKey(term)) { ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term)); return hits.iterator(); } else { return Collections.emptyIterator(); } } }
SimpleCorpus implements Corpus { @Override public Iterator<Text> search(String term) { if (invertedFile.containsKey(term)) { ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term)); return hits.iterator(); } else { return Collections.emptyIterator(); } } SimpleCorpus();  SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations); }
SimpleCorpus implements Corpus { @Override public Iterator<Text> search(String term) { if (invertedFile.containsKey(term)) { ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term)); return hits.iterator(); } else { return Collections.emptyIterator(); } } SimpleCorpus();  SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations); Text add(Text text); @Override long size(); @Override int getNumDocuments(); @Override int getNumTerms(); @Override long getNumBigrams(); @Override int getAverageDocumentSize(); @Override int getTermFrequency(String term); @Override int getBigramFrequency(Bigram bigram); @Override Iterator<String> getTerms(); @Override Iterator<Bigram> getBigrams(); @Override Iterator<Text> search(String term); @Override Iterator<Relevance> search(RelevanceRanker ranker, String term); @Override Iterator<Relevance> search(RelevanceRanker ranker, String[] terms); }
SimpleCorpus implements Corpus { @Override public Iterator<Text> search(String term) { if (invertedFile.containsKey(term)) { ArrayList<Text> hits = new ArrayList<>(invertedFile.get(term)); return hits.iterator(); } else { return Collections.emptyIterator(); } } SimpleCorpus();  SimpleCorpus(SentenceSplitter splitter, Tokenizer tokenizer, StopWords stopWords, Punctuations punctuations); Text add(Text text); @Override long size(); @Override int getNumDocuments(); @Override int getNumTerms(); @Override long getNumBigrams(); @Override int getAverageDocumentSize(); @Override int getTermFrequency(String term); @Override int getBigramFrequency(Bigram bigram); @Override Iterator<String> getTerms(); @Override Iterator<Bigram> getBigrams(); @Override Iterator<Text> search(String term); @Override Iterator<Relevance> search(RelevanceRanker ranker, String term); @Override Iterator<Relevance> search(RelevanceRanker ranker, String[] terms);  }