Examples of like()


Examples of org.apache.lucene.queries.mlt.MoreLikeThis.like()

        }
        if (sb.length() > 0) sb.append(" ");
        sb.append(s);
      }
      try {
        similar = (BooleanQuery)mlt.like("field", new StringReader(sb.toString()));
      } catch (Exception e) {
        e.printStackTrace();
        errorMsg("FAILED: " + e.getMessage());
        return;
      }
View Full Code Here

Examples of org.apache.lucene.queries.mlt.MoreLikeThis.like()

        errorMsg("FAILED: " + e.getMessage());
        return;
      }
    } else {
      try {
        similar = (BooleanQuery)mlt.like(id);
      } catch (Exception e) {
        e.printStackTrace();
        errorMsg("FAILED: " + e.getMessage());
        return;
      }
View Full Code Here

Examples of org.apache.lucene.search.similar.MoreLikeThis.like()

    moreLikeThis.setMinTermFreq(1);
    moreLikeThis.setMinDocFreq(1);
   
    //<start id="lucene.examples.mlt.query"/>
    Reader reader = new FileReader(inputPath); //<co id="mlt.query"/>
    Query query = moreLikeThis.like(reader);

    TopDocs results
      = indexSearcher.search(query, maxResults); //<co id="mlt.search"/>
   
    HashMap<String, CategoryHits> categoryHash
View Full Code Here

Examples of org.apache.lucene.search.similar.MoreLikeThis.like()

    if (minDocFreq >= 0) {
      mlt.setMinDocFreq(minDocFreq);
    }
    mlt.setMaxQueryTerms(maxQueryTerms);
    mlt.setStopWords(stopWords);
    BooleanQuery bq = (BooleanQuery) mlt.like(new StringReader(likeText), fieldName);
    BooleanClause[] clauses = bq.getClauses();
    // make at least half the terms match
    bq.setMinimumNumberShouldMatch((int) (clauses.length * percentTermsToMatch));
    return bq;
  }
View Full Code Here

Examples of org.apache.lucene.search.similar.MoreLikeThis.like()

        mlt.setMinWordLen(minWordLen);
        mlt.setMaxWordLen(maxWordLen);
        mlt.setStopWords(stopWords);
        mlt.setBoost(boostTerms);
        mlt.setBoostFactor(boostTermsFactor);
        BooleanQuery bq = (BooleanQuery) mlt.like(new FastStringReader(likeText));
        BooleanClause[] clauses = bq.getClauses();

        bq.setMinimumNumberShouldMatch((int) (clauses.length * percentTermsToMatch));
        return bq;
    }
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.like()

  }

  public void testRmultinom1() {
    double[] b = {0.4, 0.6};
    Vector v = new DenseVector(b);
    Vector t = v.like();
    for (int i = 1; i <= 100; i++) {
      Vector multinom = UncommonDistributions.rMultinom(100, v);
      t = t.plus(multinom);
    }
    System.out.println("sum(rMultinom(" + 100 + ", [0.4, 0.6]))/100="
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.like()

  }

  public void testRmultinom2() {
    double[] b = {0.1, 0.2, 0.7};
    Vector v = new DenseVector(b);
    Vector t = v.like();
    for (int i = 1; i <= 100; i++) {
      Vector multinom = UncommonDistributions.rMultinom(100, v);
      t = t.plus(multinom);
    }
    System.out.println("sum(rMultinom(" + 100 + ", [ 0.1, 0.2, 0.7 ]))/100="
View Full Code Here

Examples of org.apache.mahout.math.DenseVector.like()

  @Test
  public void testRmultinom1() {
    double[] b = {0.4, 0.6};
    Vector v = new DenseVector(b);
    Vector t = v.like();
    for (int i = 1; i <= 100; i++) {
      Vector multinom = UncommonDistributions.rMultinom(100, v);
      t = t.plus(multinom);
    }
    System.out.println("sum(rMultinom(" + 100 + ", [0.4, 0.6]))/100="
View Full Code Here

Examples of org.apache.mahout.math.Vector.like()

  @Override
  public Model<VectorWritable>[] sampleFromPrior(int howMany) {
    Model<VectorWritable>[] result = new NormalModel[howMany];
    for (int i = 0; i < howMany; i++) {
      Vector prototype = getModelPrototype().get();
      result[i] = new NormalModel(prototype.like(), 1);
    }
    return result;
  }
 
  @Override
View Full Code Here

Examples of org.apache.mahout.math.Vector.like()

  @Override
  public Model<VectorWritable>[] sampleFromPrior(int howMany) {
    Model<VectorWritable>[] result = new L1Model[howMany];
    for (int i = 0; i < howMany; i++) {
      Vector prototype = getModelPrototype().get();
      result[i] = new L1Model(prototype.like());
    }
    return result;
  }
 
  @Override
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.