• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java NoOutputs类的典型用法和代码示例

java 2次浏览

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

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

示例1: TermsWriter

点赞 3

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
TermsWriter(FieldInfo fieldInfo) {
  this.fieldInfo = fieldInfo;

  noOutputs = NoOutputs.getSingleton();

  // This Builder is just used transiently to fragment
  // terms into "good" blocks; we don't save the
  // resulting FST:
  blockBuilder = new Builder<Object>(FST.INPUT_TYPE.BYTE1,
                                     0, 0, true,
                                     true, Integer.MAX_VALUE,
                                     noOutputs,
                                     new FindBlocks(), false,
                                     PackedInts.COMPACT,
                                     true, 15);

  postingsWriter.setField(fieldInfo);
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:19,
代码来源:BlockTreeTermsWriter.java

示例2: TermsWriter

点赞 3

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
TermsWriter(FieldInfo fieldInfo) {
  this.fieldInfo = fieldInfo;

  noOutputs = NoOutputs.getSingleton();

  // This Builder is just used transiently to fragment
  // terms into "good" blocks; we don't save the
  // resulting FST:
  blockBuilder = new Builder<Object>(FST.INPUT_TYPE.BYTE1,
                                     0, 0, true,
                                     true, Integer.MAX_VALUE,
                                     noOutputs,
                                     new FindBlocks(), false,
                                     PackedInts.COMPACT,
                                     true, 15);

  this.longsSize = postingsWriter.setField(fieldInfo);
}
 

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

示例3: load

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
@Override
public synchronized boolean load(DataInput input) throws IOException {
  count = input.readVLong();
  this.higherWeightsCompletion = new FSTCompletion(new FST<>(
      input, NoOutputs.getSingleton()));
  this.normalCompletion = new FSTCompletion(
      higherWeightsCompletion.getFST(), false, exactMatchFirst);
  return true;
}
 

开发者ID:europeana,
项目名称:search,
代码行数:10,
代码来源:FSTCompletionLookup.java

示例4: load

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
@Override
public synchronized boolean load(InputStream input) throws IOException {
  try {
    this.higherWeightsCompletion = new FSTCompletion(new FST<Object>(
        new InputStreamDataInput(input), NoOutputs.getSingleton()));
    this.normalCompletion = new FSTCompletion(
        higherWeightsCompletion.getFST(), false, exactMatchFirst);
  } finally {
    IOUtils.close(input);
  }
  return true;
}
 

开发者ID:pkarmstr,
项目名称:NYBC,
代码行数:13,
代码来源:FSTCompletionLookup.java

示例5: FstDecompounder

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
public FstDecompounder(InputStream inputStream, String[] glue) throws IOException {
    try {
        this.surfaceForms = new FST<>(new InputStreamDataInput(inputStream), NoOutputs.getSingleton());
    } finally {
        inputStream.close();
    }
    // set up glue morphemes
    this.glueMorphemes = createGlueMorphemes(glue != null && glue.length > 0 ? glue : morphemes);
}
 

开发者ID:jprante,
项目名称:elasticsearch-plugin-bundle,
代码行数:10,
代码来源:FstDecompounder.java

示例6: createGlueMorphemes

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
private FST<Object> createGlueMorphemes(String[] glue) throws IOException {
    for (int i = 0; i < glue.length; i++) {
        glue[i] = new StringBuilder(glue[i]).reverse().toString();
    }
    Arrays.sort(glue);
    final Builder<Object> builder = new Builder<>(INPUT_TYPE.BYTE4, NoOutputs.getSingleton());
    final Object nothing = NoOutputs.getSingleton().getNoOutput();
    IntsRefBuilder intsBuilder = new IntsRefBuilder();
    for (String morpheme : glue) {
        fromUTF16ToUTF32(morpheme, intsBuilder);
        builder.add(intsBuilder.get(), nothing);
    }
    return builder.finish();
}
 

开发者ID:jprante,
项目名称:elasticsearch-plugin-bundle,
代码行数:15,
代码来源:FstDecompounder.java

示例7: load

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
@Override
public synchronized boolean load(DataInput input) throws IOException {
  count = input.readVLong();
  this.higherWeightsCompletion = new FSTCompletion(new FST<Object>(
      input, NoOutputs.getSingleton()));
  this.normalCompletion = new FSTCompletion(
      higherWeightsCompletion.getFST(), false, exactMatchFirst);
  return true;
}
 

开发者ID:yintaoxue,
项目名称:read-open-source-code,
代码行数:10,
代码来源:FSTCompletionLookup.java

示例8: compile

点赞 2

import org.apache.lucene.util.fst.NoOutputs; //导入依赖的package包/类
/**
 *
 * @param inputStream the input stream
 * @param outputStream the output stream
 * @throws IOException if compilation fails
 */
public void compile(InputStream inputStream, OutputStream outputStream) throws IOException {
    final HashSet<BytesRef> words = new HashSet<>();
    BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
    String line;
    String last = null;
    StringBuilder stringBuilder = new StringBuilder();
    while ((line = reader.readLine()) != null) {
        if (line.indexOf('#') >= 0) {
            continue;
        }
        line = pattern.split(line)[0].trim();
        line = line.toLowerCase();
        if (line.equals(last)) {
            continue;
        }
        last = line;
        /*
         * Add the word to the hash set in left-to-right characters order and reversed
         * for easier matching later on.
         */
        stringBuilder.setLength(0);
        stringBuilder.append(line);
        final int len = stringBuilder.length();
        stringBuilder.append('>');
        words.add(new BytesRef(stringBuilder));
        stringBuilder.setLength(len);
        stringBuilder.reverse().append('<');
        words.add(new BytesRef(stringBuilder));
    }
    reader.close();
    final BytesRef [] all = new BytesRef[words.size()];
    words.toArray(all);
    Arrays.sort(all, BytesRef::compareTo);
    final Object nothing = NoOutputs.getSingleton().getNoOutput();
    final Builder<Object> builder = new Builder<>(INPUT_TYPE.BYTE4, NoOutputs.getSingleton());
    final IntsRefBuilder intsRef = new IntsRefBuilder();
    for (BytesRef bytesRef : all) {
        intsRef.clear();
        intsRef.copyUTF8Bytes(bytesRef);
        builder.add(intsRef.get(), nothing);
    }
    final FST<Object> fst = builder.finish();
    try (final OutputStreamDataOutput out = new OutputStreamDataOutput(outputStream)) {
        fst.save(out);
    }
}
 

开发者ID:jprante,
项目名称:elasticsearch-plugin-bundle,
代码行数:53,
代码来源:FstCompiler.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)