org.apache.lucene.util.automaton.Operations.reverse()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(119)

本文整理了Java中org.apache.lucene.util.automaton.Operations.reverse()方法的一些代码示例,展示了Operations.reverse()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Operations.reverse()方法的具体详情如下:
包路径:org.apache.lucene.util.automaton.Operations
类名称:Operations
方法名:reverse

Operations.reverse介绍

[英]Returns an automaton accepting the reverse language.
[中]返回接受反向语言的自动机。

代码示例

代码示例来源:origin: org.apache.lucene/lucene-core

/** Returns an automaton accepting the reverse language. */
public static Automaton reverse(Automaton a) {
 return reverse(a, null);
}

代码示例来源:origin: org.apache.lucene/lucene-core

/**
 * Returns the longest BytesRef that is a suffix of all accepted strings.
 * Worst case complexity: exponential in number of states (this calls
 * determinize).
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 * @return common suffix, which can be an empty (length 0) BytesRef (never null)
 */
public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
 // reverse the language of the automaton, then reverse its common prefix.
 Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
 BytesRef ref = getCommonPrefixBytesRef(r);
 reverseBytes(ref);
 return ref;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/**
 * Returns the longest BytesRef that is a suffix of all accepted strings.
 * Worst case complexity: exponential in number of states (this calls
 * determinize).
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 * @return common suffix, which can be an empty (length 0) BytesRef (never null)
 */
public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
 // reverse the language of the automaton, then reverse its common prefix.
 Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
 BytesRef ref = getCommonPrefixBytesRef(r);
 reverseBytes(ref);
 return ref;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/** Returns an automaton accepting the reverse language. */
public static Automaton reverse(Automaton a) {
 return reverse(a, null);
}

代码示例来源:origin: harbby/presto-connectors

/**
 * Returns the longest BytesRef that is a suffix of all accepted strings.
 * Worst case complexity: exponential in number of states (this calls
 * determinize).
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 * @return common suffix, which can be an empty (length 0) BytesRef (never null)
 */
public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
 // reverse the language of the automaton, then reverse its common prefix.
 Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
 BytesRef ref = getCommonPrefixBytesRef(r);
 reverseBytes(ref);
 return ref;
}

代码示例来源:origin: org.infinispan/infinispan-embedded-query

/** Returns an automaton accepting the reverse language. */
public static Automaton reverse(Automaton a) {
 return reverse(a, null);
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.lucene

/**
 * Returns the longest BytesRef that is a suffix of all accepted strings.
 * Worst case complexity: exponential in number of states (this calls
 * determinize).
 * @param maxDeterminizedStates maximum number of states determinizing the
 *  automaton can result in.  Set higher to allow more complex queries and
 *  lower to prevent memory exhaustion.
 * @return common suffix, which can be an empty (length 0) BytesRef (never null)
 */
public static BytesRef getCommonSuffixBytesRef(Automaton a, int maxDeterminizedStates) {
 // reverse the language of the automaton, then reverse its common prefix.
 Automaton r = Operations.determinize(reverse(a), maxDeterminizedStates);
 BytesRef ref = getCommonPrefixBytesRef(r);
 reverseBytes(ref);
 return ref;
}

代码示例来源:origin: harbby/presto-connectors

/** Returns an automaton accepting the reverse language. */
public static Automaton reverse(Automaton a) {
 return reverse(a, null);
}

代码示例来源:origin: wikimedia/search-highlighter

private Factory(String regexString, int maxDeterminizedStates) {
  Automaton automaton = new RegExp(regexString).toAutomaton(maxDeterminizedStates);
  forward = new OffsetReturningRunAutomaton(automaton, false);
  if (hasLeadingWildcard(automaton)) {
    Automaton reversed = Operations.determinize(Operations.reverse(
        new RegExp("(" + regexString + ").*").toAutomaton(maxDeterminizedStates)), maxDeterminizedStates);
    reverse = new AcceptReturningReverseRunAutomaton(reversed);
  } else {
    reverse = null;
  }
}

相关文章