• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PositiveIntOutputs类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.lucene.util.fst.PositiveIntOutputs的典型用法代码示例。如果您正苦于以下问题:Java PositiveIntOutputs类的具体用法?Java PositiveIntOutputs怎么用?Java PositiveIntOutputs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PositiveIntOutputs类属于org.apache.lucene.util.fst包,在下文中一共展示了PositiveIntOutputs类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<>(INPUT_TYPE.BYTE1, outputs);
  IntsRefBuilder scratch = new IntsRefBuilder();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:MemoryDocValuesConsumer.java


示例2: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(DataInput input) throws IOException {
  CodecUtil.checkHeader(input, CODEC_NAME, VERSION_START, VERSION_START);
  count = input.readVLong();
  byte separatorOrig = input.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = input.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = input.readVLong();

  fst = new FST<>(input, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:FreeTextSuggester.java


示例3: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  InputStream is = null;
  FST<Long> fst = null;
  boolean success = false;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
    success = true;
  } finally {
    if (success) {
      IOUtils.close(is);
    } else {
      IOUtils.closeWhileHandlingException(is);
    }
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:europeana,项目名称:search,代码行数:21,代码来源:TokenInfoDictionary.java


示例4: build

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public void build(TermFreqIterator iterator) throws IOException {
  BytesRef scratch = new BytesRef();
  TermFreqIterator iter = new WFSTTermFreqIteratorWrapper(iterator);
  IntsRef scratchInts = new IntsRef();
  BytesRef previous = null;
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
  Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
  while ((scratch = iter.next()) != null) {
    long cost = iter.weight();
    
    if (previous == null) {
      previous = new BytesRef();
    } else if (scratch.equals(previous)) {
      continue; // for duplicate suggestions, the best weight is actually
                // added
    }
    Util.toIntsRef(scratch, scratchInts);
    builder.add(scratchInts, cost);
    previous.copyBytes(scratch);
  }
  fst = builder.finish();
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:24,代码来源:WFSTCompletionLookup.java


示例5: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton(true));
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:18,代码来源:TokenInfoDictionary.java


示例6: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
  Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs);
  IntsRef scratch = new IntsRef();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:19,代码来源:Lucene42DocValuesConsumer.java


示例7: writeFST

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void writeFST(FieldInfo field, Iterable<BytesRef> values) throws IOException {
  meta.writeVInt(field.number);
  meta.writeByte(FST);
  meta.writeLong(data.getFilePointer());
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<Long>(INPUT_TYPE.BYTE1, outputs);
  IntsRef scratch = new IntsRef();
  long ord = 0;
  for (BytesRef v : values) {
    builder.add(Util.toIntsRef(v, scratch), ord);
    ord++;
  }
  FST<Long> fst = builder.finish();
  if (fst != null) {
    fst.save(data);
  }
  meta.writeVLong(ord);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:MemoryDocValuesConsumer.java


示例8: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(DataInput input) throws IOException {
  CodecUtil.checkHeader(input, CODEC_NAME, VERSION_START, VERSION_START);
  count = input.readVLong();
  byte separatorOrig = input.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = input.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = input.readVLong();

  fst = new FST<Long>(input, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:19,代码来源:FreeTextSuggester.java


示例9: TokenInfoDictionary

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private TokenInfoDictionary() throws IOException {
  super();
  IOException priorE = null;
  InputStream is = null;
  FST<Long> fst = null;
  try {
    is = getResource(FST_FILENAME_SUFFIX);
    is = new BufferedInputStream(is);
    fst = new FST<Long>(new InputStreamDataInput(is), PositiveIntOutputs.getSingleton());
  } catch (IOException ioe) {
    priorE = ioe;
  } finally {
    IOUtils.closeWhileHandlingException(priorE, is);
  }
  // TODO: some way to configure?
  this.fst = new TokenInfoFST(fst, true);
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:18,代码来源:TokenInfoDictionary.java


示例10: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput in = new InputStreamDataInput(input);
  CodecUtil.checkHeader(in, CODEC_NAME, VERSION_START, VERSION_START);
  byte separatorOrig = in.readByte();
  if (separatorOrig != separator) {
    throw new IllegalStateException("separator=" + separator + " is incorrect: original model was built with separator=" + separatorOrig);
  }
  int gramsOrig = in.readVInt();
  if (gramsOrig != grams) {
    throw new IllegalStateException("grams=" + grams + " is incorrect: original model was built with grams=" + gramsOrig);
  }
  totTokens = in.readVLong();

  fst = new FST<Long>(in, PositiveIntOutputs.getSingleton());

  return true;
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:19,代码来源:FreeTextSuggester.java


示例11: build

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public void build(InputIterator iterator) throws IOException {
  if (iterator.hasPayloads()) {
    throw new IllegalArgumentException("this suggester doesn't support payloads");
  }
  BytesRef scratch = new BytesRef();
  InputIterator iter = new WFSTInputIterator(iterator);
  IntsRef scratchInts = new IntsRef();
  BytesRef previous = null;
  PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
  Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
  while ((scratch = iter.next()) != null) {
    long cost = iter.weight();
    
    if (previous == null) {
      previous = new BytesRef();
    } else if (scratch.equals(previous)) {
      continue; // for duplicate suggestions, the best weight is actually
                // added
    }
    Util.toIntsRef(scratch, scratchInts);
    builder.add(scratchInts, cost);
    previous.copyBytes(scratch);
  }
  fst = builder.finish();
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:27,代码来源:WFSTCompletionLookup.java


示例12: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(
        PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:14,代码来源:XAnalyzingSuggester.java


示例13: XBuilder

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
public XBuilder(int maxSurfaceFormsPerAnalyzedForm, boolean hasPayloads, int payloadSep) {
    this.payloadSep = payloadSep;
    this.outputs = new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton());
    this.builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
    this.maxSurfaceFormsPerAnalyzedForm = maxSurfaceFormsPerAnalyzedForm;
    this.hasPayloads = hasPayloads;
    surfaceFormsAndPayload = new SurfaceFormAndPayload[maxSurfaceFormsPerAnalyzedForm];

}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:10,代码来源:XAnalyzingSuggester.java


示例14: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(InputStream input) throws IOException {
  DataInput dataIn = new InputStreamDataInput(input);
  try {
    this.fst = new FST<>(dataIn, new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
    maxAnalyzedPathsForOneInput = dataIn.readVInt();
    hasPayloads = dataIn.readByte() == 1;
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:13,代码来源:XAnalyzingSuggester.java


示例15: TermsWriter

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
TermsWriter(FieldInfo fieldInfo) {
  this.numTerms = 0;
  this.fieldInfo = fieldInfo;
  this.longsSize = postingsWriter.setField(fieldInfo);
  this.outputs = PositiveIntOutputs.getSingleton();
  this.builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);

  this.lastBlockStatsFP = 0;
  this.lastBlockMetaLongsFP = 0;
  this.lastBlockMetaBytesFP = 0;
  this.lastBlockLongs = new long[longsSize];

  this.lastLongs = new long[longsSize];
  this.lastMetaBytesFP = 0;
}
 
开发者ID:europeana,项目名称:search,代码行数:16,代码来源:FSTOrdTermsWriter.java


示例16: FSTFieldWriter

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
public FSTFieldWriter(FieldInfo fieldInfo, long termsFilePointer) throws IOException {
  this.fieldInfo = fieldInfo;
  fstOutputs = PositiveIntOutputs.getSingleton();
  fstBuilder = new Builder<>(FST.INPUT_TYPE.BYTE1, fstOutputs);
  indexStart = out.getFilePointer();
  ////System.out.println("VGW: field=" + fieldInfo.name);

  // Always put empty string in
  fstBuilder.add(new IntsRef(), termsFilePointer);
  startTermsFilePointer = termsFilePointer;
}
 
开发者ID:europeana,项目名称:search,代码行数:12,代码来源:VariableGapTermsIndexWriter.java


示例17: loadTermsIndex

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void loadTermsIndex() throws IOException {
  if (fst == null) {
    IndexInput clone = in.clone();
    clone.seek(indexStart);
    fst = new FST<>(clone, fstOutputs);
    clone.close();

    /*
    final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
    Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
    Util.toDot(fst, w, false, false);
    System.out.println("FST INDEX: SAVED to " + dotFileName);
    w.close();
    */

    if (indexDivisor > 1) {
      // subsample
      final IntsRefBuilder scratchIntsRef = new IntsRefBuilder();
      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton();
      final Builder<Long> builder = new Builder<>(FST.INPUT_TYPE.BYTE1, outputs);
      final BytesRefFSTEnum<Long> fstEnum = new BytesRefFSTEnum<>(fst);
      BytesRefFSTEnum.InputOutput<Long> result;
      int count = indexDivisor;
      while((result = fstEnum.next()) != null) {
        if (count == indexDivisor) {
          builder.add(Util.toIntsRef(result.input, scratchIntsRef), result.output);
          count = 0;
        }
        count++;
      }
      fst = builder.finish();
    }
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:35,代码来源:VariableGapTermsIndexReader.java


示例18: load

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
@Override
public boolean load(DataInput input) throws IOException {
  count = input.readVLong();
  this.fst = new FST<>(input, new PairOutputs<>(PositiveIntOutputs.getSingleton(), ByteSequenceOutputs.getSingleton()));
  maxAnalyzedPathsForOneInput = input.readVInt();
  hasPayloads = input.readByte() == 1;
  return true;
}
 
开发者ID:europeana,项目名称:search,代码行数:9,代码来源:AnalyzingSuggester.java


示例19: FSTFieldWriter

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
public FSTFieldWriter(FieldInfo fieldInfo, long termsFilePointer) throws IOException {
  this.fieldInfo = fieldInfo;
  fstOutputs = PositiveIntOutputs.getSingleton(true);
  fstBuilder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, fstOutputs);
  indexStart = out.getFilePointer();
  ////System.out.println("VGW: field=" + fieldInfo.name);

  // Always put empty string in
  fstBuilder.add(new IntsRef(), termsFilePointer);
  startTermsFilePointer = termsFilePointer;
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:12,代码来源:VariableGapTermsIndexWriter.java


示例20: loadTermsIndex

import org.apache.lucene.util.fst.PositiveIntOutputs; //导入依赖的package包/类
private void loadTermsIndex() throws IOException {
  if (fst == null) {
    IndexInput clone = in.clone();
    clone.seek(indexStart);
    fst = new FST<Long>(clone, fstOutputs);
    clone.close();

    /*
    final String dotFileName = segment + "_" + fieldInfo.name + ".dot";
    Writer w = new OutputStreamWriter(new FileOutputStream(dotFileName));
    Util.toDot(fst, w, false, false);
    System.out.println("FST INDEX: SAVED to " + dotFileName);
    w.close();
    */

    if (indexDivisor > 1) {
      // subsample
      final IntsRef scratchIntsRef = new IntsRef();
      final PositiveIntOutputs outputs = PositiveIntOutputs.getSingleton(true);
      final Builder<Long> builder = new Builder<Long>(FST.INPUT_TYPE.BYTE1, outputs);
      final BytesRefFSTEnum<Long> fstEnum = new BytesRefFSTEnum<Long>(fst);
      BytesRefFSTEnum.InputOutput<Long> result;
      int count = indexDivisor;
      while((result = fstEnum.next()) != null) {
        if (count == indexDivisor) {
          builder.add(Util.toIntsRef(result.input, scratchIntsRef), result.output);
          count = 0;
        }
        count++;
      }
      fst = builder.finish();
    }
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:35,代码来源:VariableGapTermsIndexReader.java



注:本文中的org.apache.lucene.util.fst.PositiveIntOutputs类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RubyNil类代码示例发布时间:2022-05-22
下一篇:
Java AssetLocator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap