當前位置: 首頁>>代碼示例>>Java>>正文


Java BinaryVectorUtils類代碼示例

本文整理匯總了Java中pitt.search.semanticvectors.vectors.BinaryVectorUtils的典型用法代碼示例。如果您正苦於以下問題:Java BinaryVectorUtils類的具體用法?Java BinaryVectorUtils怎麽用?Java BinaryVectorUtils使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BinaryVectorUtils類屬於pitt.search.semanticvectors.vectors包,在下文中一共展示了BinaryVectorUtils類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: VectorSearcherSubspaceSim

import pitt.search.semanticvectors.vectors.BinaryVectorUtils; //導入依賴的package包/類
/**
 * @param queryVecStore Vector store to use for query generation.
 * @param searchVecStore The vector store to search.
 * @param luceneUtils LuceneUtils object to use for query weighting. (May be null.)
 * @param queryTerms Terms that will be parsed and used to generate a query subspace.
 */
public VectorSearcherSubspaceSim(VectorStore queryVecStore,
    VectorStore searchVecStore,
    LuceneUtils luceneUtils,
    FlagConfig flagConfig,
    String[] queryTerms)
        throws ZeroVectorException {
  super(queryVecStore, searchVecStore, luceneUtils, flagConfig);
  this.disjunctSpace = new ArrayList<Vector>();
  this.vectorType = flagConfig.vectortype();
  
  for (int i = 0; i < queryTerms.length; ++i) {
    System.out.println("\t" + queryTerms[i]);
    // There may be compound disjuncts, e.g., "A NOT B" as a single argument.
    String[] tmpTerms = queryTerms[i].split("\\s");
    Vector tmpVector = CompoundVectorBuilder.getQueryVector(
        queryVecStore, luceneUtils, flagConfig, tmpTerms);
    if (tmpVector != null) {
      this.disjunctSpace.add(tmpVector);
    }
  }
  if (this.disjunctSpace.size() == 0) {
    throw new ZeroVectorException("No nonzero input vectors ... no results.");
  }
  if (!vectorType.equals(VectorType.BINARY))
    VectorUtils.orthogonalizeVectors(this.disjunctSpace);
  else BinaryVectorUtils.orthogonalizeVectors(this.disjunctSpace);
}
 
開發者ID:semanticvectors,項目名稱:semanticvectors,代碼行數:34,代碼來源:VectorSearcher.java

示例2: getScore

import pitt.search.semanticvectors.vectors.BinaryVectorUtils; //導入依賴的package包/類
/**
 * Scoring works by taking scalar product with disjunctSpace
 * (which must by now be represented using an orthogonal basis).
 * @param testVector Vector being tested.
 */
@Override
public double getScore(Vector testVector) {
  if (!vectorType.equals(VectorType.BINARY))
    return VectorUtils.compareWithProjection(testVector, disjunctSpace);
  else return BinaryVectorUtils.compareWithProjection(testVector, disjunctSpace);
}
 
開發者ID:semanticvectors,項目名稱:semanticvectors,代碼行數:12,代碼來源:VectorSearcher.java

示例3: VectorSearcherSubspaceSim

import pitt.search.semanticvectors.vectors.BinaryVectorUtils; //導入依賴的package包/類
/**
 * @param queryVecStore Vector store to use for query generation.
 * @param searchVecStore The vector store to search.
 * @param luceneUtils LuceneUtils object to use for query weighting. (May be null.)
 * @param queryTerms Terms that will be parsed and used to generate a query subspace.
 */
public VectorSearcherSubspaceSim(VectorStore queryVecStore,
    VectorStore searchVecStore,
    LuceneUtils luceneUtils,
    FlagConfig flagConfig,
    String[] queryTerms)
        throws ZeroVectorException {
  super(queryVecStore, searchVecStore, luceneUtils, flagConfig);
  this.disjunctSpace = new ArrayList<Vector>();

  for (int i = 0; i < queryTerms.length; ++i) {
    System.out.println("\t" + queryTerms[i]);
    // There may be compound disjuncts, e.g., "A NOT B" as a single argument.
    String[] tmpTerms = queryTerms[i].split("\\s");
    Vector tmpVector = CompoundVectorBuilder.getQueryVector(
        queryVecStore, luceneUtils, flagConfig, tmpTerms);
    if (tmpVector != null) {
      this.disjunctSpace.add(tmpVector);
    }
  }
  if (this.disjunctSpace.size() == 0) {
    throw new ZeroVectorException("No nonzero input vectors ... no results.");
  }
  if (!vectorType.equals(VectorType.BINARY))
    VectorUtils.orthogonalizeVectors(this.disjunctSpace);
  else BinaryVectorUtils.orthogonalizeVectors(this.disjunctSpace);
}
 
開發者ID:tuxdna,項目名稱:semanticvectors-googlecode,代碼行數:33,代碼來源:VectorSearcher.java


注:本文中的pitt.search.semanticvectors.vectors.BinaryVectorUtils類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。