Package ivory.ffg.data

Examples of ivory.ffg.data.DocumentVector


  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
    float[][] fvalues = new float[docids.length][features.length];

    for(int d = 0; d < docids.length; d++) {
      DocumentVector compDoc = documents.get(docids[d]);
      int[] doc = compDoc.decompressDocument();
      int[] hashedTerms = compDoc.transformTerms(qterms);
      computeFeatures(doc, qterms, hashedTerms, features, fvalues[d]);
    }
    return fvalues;
  }
View Full Code Here


  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
    float[][] fvalues = new float[docids.length][features.length];

    for(int d = 0; d < docids.length; d++) {
      DocumentVector compDoc = documents.get(docids[d]);
      int[][] positions = compDoc.decompressPositions(qterms);
      computeFeatures(qterms, positions, compDoc.getDocumentLength(), features, fvalues[d]);
    }
    return fvalues;
  }
View Full Code Here

    intDocVector.readFields(dataIn);
  }

  @Test public void testFeaturesSlidingWindow() throws Exception {
    for(String dvclass: documentVectorClass) {
      DocumentVector dv = DocumentVectorUtility.newInstance(dvclass, intDocVector);

      try {
        int[] transformedDoc = dv.decompressDocument();

        for(Feature f: features.keySet()) {
          f.initialize(new TfScoringFunction());

          for(int[] query: features.get(f).keySet()) {
            int[] transformedTerms = dv.transformTerms(query);
            float fValue = f.
              computeScoreWithSlidingWindow(transformedDoc, query, transformedTerms, null);
            assertEquals(features.get(f).get(query), fValue, 1e-10);
          }
        }
View Full Code Here

    }
  }

  @Test public void testFeaturesWithMiniIndexing() throws Exception {
    for(String dvclass: documentVectorClass) {
      DocumentVector dv = DocumentVectorUtility.newInstance(dvclass, intDocVector);

      try {
        for(Feature f: features.keySet()) {
          f.initialize(new TfScoringFunction());

          for(int[] query: features.get(f).keySet()) {
            int[][] positions = dv.decompressPositions(query);
            float fValue = f.
              computeScoreWithMiniIndexes(positions, query, dv.getDocumentLength(), null);
            assertEquals(features.get(f).get(query), fValue, 1e-10);
          }
        }
      } catch(UnsupportedOperationException e) {
        continue;
View Full Code Here

  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
    float[][] fvalues = new float[docids.length][features.length];

    for(int d = 0; d < docids.length; d++) {
      DocumentVector compDoc = documents.get(docids[d]);
      int[] doc = compDoc.decompressDocument();
      int[] hashedTerms = compDoc.transformTerms(qterms);
      computeFeatures(doc, qterms, hashedTerms, features, fvalues[d]);
    }
    return fvalues;
  }
View Full Code Here

  public float[][] extract(int[] qterms, int[] docids, Feature[] features) throws Exception {
    float[][] fvalues = new float[docids.length][features.length];

    for(int d = 0; d < docids.length; d++) {
      DocumentVector compDoc = documents.get(docids[d]);
      int[][] positions = compDoc.decompressPositions(qterms);
      computeFeatures(qterms, positions, compDoc.getDocumentLength(), features, fvalues[d]);
    }
    return fvalues;
  }
View Full Code Here

TOP

Related Classes of ivory.ffg.data.DocumentVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.