Exemplo n.º 1
0
 @Before
 public void setUp() throws Exception {
   classUnderTest = new BM25();
   engine = IndriSearchEngine.getInstance(documentIndexDir);
   String[] rules = new String[] {"method:dir", "mu:1000"};
   retrivedDocumentId = engine.runQuery(1, rules, "nobel prize");
   query = new Query("1", "nobel prize");
   windowList = getWindowSegments(retrivedDocumentId.get(0), 1000);
   passLM_List = engine.calcPassagesLM(windowList, true, query);
   passagesInColl = getNumberOfPassages(1000);
 }
Exemplo n.º 2
0
  protected List<Integer> getDFpass(Query query, String windowSize) throws Exception {

    List<Integer> dfList = new ArrayList<Integer>();
    for (String qTerm : query.getQueryTerms()) {
      int df =
          engine.runPassageQuery(String.format(PASSAGE_RETRIEVAL, windowSize, windowSize, qTerm));
      dfList.add(df);
    }
    return dfList;
  }
Exemplo n.º 3
0
  private List<WindowBoundary> getWindowSegments(RetrivalResult res, int segSize) throws Exception {

    List<WindowBoundary> windowList;
    FixedWindowStrategy windowSegments = new FixedWindowStrategy(segSize);
    int[] docsID = new int[1];
    docsID[0] = res.getIndriDocId();
    ParsedDocument pDoc;
    pDoc = engine.documentPositions(docsID);
    windowList =
        windowSegments.getWindows(
            pDoc, res.getDocumentId(), res.getIndriDocId(), -3.61494, res.getEndPosition());

    return windowList;
  }