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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. private Factory(String regexString, int maxDeterminizedStates) {
  2. Automaton automaton = new RegExp(regexString).toAutomaton(maxDeterminizedStates);
  3. forward = new OffsetReturningRunAutomaton(automaton, false);
  4. if (hasLeadingWildcard(automaton)) {
  5. Automaton reversed = Operations.determinize(Operations.reverse(
  6. new RegExp("(" + regexString + ").*").toAutomaton(maxDeterminizedStates)), maxDeterminizedStates);
  7. reverse = new AcceptReturningReverseRunAutomaton(reversed);
  8. } else {
  9. reverse = null;
  10. }
  11. }

相关文章