当前位置: 首页>>代码示例>>Java>>正文


Java Operations.determinize方法代码示例

本文整理汇总了Java中org.apache.lucene.util.automaton.Operations.determinize方法的典型用法代码示例。如果您正苦于以下问题:Java Operations.determinize方法的具体用法?Java Operations.determinize怎么用?Java Operations.determinize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.lucene.util.automaton.Operations的用法示例。


在下文中一共展示了Operations.determinize方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: toLookupAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
final Automaton toLookupAutomaton(final CharSequence key) throws IOException {
    // TODO: is there a Reader from a CharSequence?
    // Turn tokenstream into automaton:
    Automaton automaton = null;

    try (TokenStream ts = queryAnalyzer.tokenStream("", key.toString())) {
        automaton = getTokenStreamToAutomaton().toAutomaton(ts);
    }

    automaton = replaceSep(automaton);

    // TODO: we can optimize this somewhat by determinizing
    // while we convert

    // This automaton should not blow up during determinize:
    automaton = Operations.determinize(automaton, Integer.MAX_VALUE);
    return automaton;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:19,代码来源:XAnalyzingSuggester.java

示例2: toAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
/**
 * Create a automaton for a given context query this automaton will be used
 * to find the matching paths with the fst
 *
 * @param preserveSep set an additional char (<code>XAnalyzingSuggester.SEP_LABEL</code>) between each context query
 * @param queries list of {@link ContextQuery} defining the lookup context
 *
 * @return Automaton matching the given Query
 */
public static Automaton toAutomaton(boolean preserveSep, Iterable<ContextQuery> queries) {
    Automaton a = Automata.makeEmptyString();

    Automaton gap = Automata.makeChar(ContextMapping.SEPARATOR);
    if (preserveSep) {
        // if separators are preserved the fst contains a SEP_LABEL
        // behind each gap. To have a matching automaton, we need to
        // include the SEP_LABEL in the query as well
        gap = Operations.concatenate(gap, Automata.makeChar(XAnalyzingSuggester.SEP_LABEL));
    }

    for (ContextQuery query : queries) {
        a = Operations.concatenate(Arrays.asList(query.toAutomaton(), gap, a));
    }

    // TODO: should we limit this?  Do any of our ContextQuery impls really create exponential regexps?  GeoQuery looks safe (union
    // of strings).
    return Operations.determinize(a, Integer.MAX_VALUE);
}
 
开发者ID:baidu,项目名称:Elasticsearch,代码行数:29,代码来源:ContextMapping.java

示例3: toLookupAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
final Automaton toLookupAutomaton(final CharSequence key) throws IOException {
  // TODO: is there a Reader from a CharSequence?
  // Turn tokenstream into automaton:
  Automaton automaton = null;
  TokenStream ts = queryAnalyzer.tokenStream("", key.toString());
  try {
      automaton = getTokenStreamToAutomaton().toAutomaton(ts);
  } finally {
    IOUtils.closeWhileHandlingException(ts);
  }

  automaton = replaceSep(automaton);

  // TODO: we can optimize this somewhat by determinizing
  // while we convert
  automaton = Operations.determinize(automaton, DEFAULT_MAX_DETERMINIZED_STATES);
  return automaton;
}
 
开发者ID:europeana,项目名称:search,代码行数:19,代码来源:AnalyzingSuggester.java

示例4: convertAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
@Override
protected Automaton convertAutomaton(Automaton a) {
  if (unicodeAware) {
    // FLORIAN EDIT: get converted Automaton from superclass
    Automaton utf8automaton = new UTF32ToUTF8().convert(super.convertAutomaton(a));
    // This automaton should not blow up during determinize:
    utf8automaton = Operations.determinize(utf8automaton, Integer.MAX_VALUE);
    return utf8automaton;
  } else {
    return super.convertAutomaton(a);
  }
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:XFuzzySuggester.java

示例5: convertAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
protected Automaton convertAutomaton(Automaton a) {
  if (queryPrefix != null) {
    a = Operations.concatenate(Arrays.asList(queryPrefix, a));
    // This automaton should not blow up during determinize:
    a = Operations.determinize(a, Integer.MAX_VALUE);
  }
  return a;
}
 
开发者ID:justor,项目名称:elasticsearch_my,代码行数:9,代码来源:XAnalyzingSuggester.java

示例6: convertAutomaton

import org.apache.lucene.util.automaton.Operations; //导入方法依赖的package包/类
@Override
protected Automaton convertAutomaton(Automaton a) {
  if (unicodeAware) {
    Automaton utf8automaton = new UTF32ToUTF8().convert(a);
    utf8automaton = Operations.determinize(utf8automaton, DEFAULT_MAX_DETERMINIZED_STATES);
    return utf8automaton;
  } else {
    return a;
  }
}
 
开发者ID:europeana,项目名称:search,代码行数:11,代码来源:FuzzySuggester.java


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