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

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

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

Operations.concatenate介绍

[英]Returns an automaton that accepts the concatenation of the languages of the given automata.

Complexity: linear in total number of states.
[中]返回一个自动机,该自动机接受给定自动机的语言的串联。
复杂性:状态总数呈线性。

代码示例

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

/**
 * Returns an automaton that accepts the concatenation of the languages of the
 * given automata.
 * <p>
 * Complexity: linear in total number of states.
 */
static public Automaton concatenate(Automaton a1, Automaton a2) {
 return concatenate(Arrays.asList(a1, a2));
}

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

/**
 * Returns an automaton that accepts <code>min</code> or more concatenated
 * repetitions of the language of the given automaton.
 * <p>
 * Complexity: linear in number of states and in <code>min</code>.
 */
static public Automaton repeat(Automaton a, int count) {
 if (count == 0) {
  return repeat(a);
 }
 List<Automaton> as = new ArrayList<>();
 while (count-- > 0) {
  as.add(a);
 }
 as.add(repeat(a));
 return concatenate(as);
}

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

return Operations.concatenate(automata);

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

as.add(a);
b = concatenate(as);

代码示例来源:origin: org.elasticsearch/elasticsearch

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;
}

代码示例来源:origin: org.elasticsearch/elasticsearch

/** Return an {@link Automaton} that matches the given pattern. */
public static Automaton simpleMatchToAutomaton(String pattern) {
  List<Automaton> automata = new ArrayList<>();
  int previous = 0;
  for (int i = pattern.indexOf('*'); i != -1; i = pattern.indexOf('*', i + 1)) {
    automata.add(Automata.makeString(pattern.substring(previous, i)));
    automata.add(Automata.makeAnyString());
    previous = i + 1;
  }
  automata.add(Automata.makeString(pattern.substring(previous)));
  return Operations.concatenate(automata);
}

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

findLeaves(exp2, Kind.REGEXP_CONCATENATION, list, automata,
  automaton_provider, maxDeterminizedStates);
a = Operations.concatenate(list);
a = MinimizationOperations.minimize(a, maxDeterminizedStates);
break;

代码示例来源:origin: org.elasticsearch/elasticsearch

/** Make matches on objects also match dots in field names.
 *  For instance, if the original simple regex is `foo`, this will translate
 *  it into `foo` OR `foo.*`. */
private static Automaton makeMatchDotsInFieldNames(Automaton automaton) {
  return Operations.union(
      automaton,
      Operations.concatenate(Arrays.asList(automaton, Automata.makeChar('.'), Automata.makeAnyString())));
}

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

/**
 * Returns an automaton that accepts the concatenation of the languages of the
 * given automata.
 * <p>
 * Complexity: linear in total number of states.
 */
static public Automaton concatenate(Automaton a1, Automaton a2) {
 return concatenate(Arrays.asList(a1, a2));
}

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

/**
 * Returns an automaton that accepts the concatenation of the languages of the
 * given automata.
 * <p>
 * Complexity: linear in total number of states.
 */
static public Automaton concatenate(Automaton a1, Automaton a2) {
 return concatenate(Arrays.asList(a1, a2));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

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;
}

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

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;
}

代码示例来源:origin: apache/servicemix-bundles

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;
}

代码示例来源:origin: org.codelibs/elasticsearch-querybuilders

/** Return an {Automaton} that matches the given pattern. */
public static Automaton simpleMatchToAutomaton(String pattern) {
  List<Automaton> automata = new ArrayList<>();
  int previous = 0;
  for (int i = pattern.indexOf('*'); i != -1; i = pattern.indexOf('*', i + 1)) {
    automata.add(Automata.makeString(pattern.substring(previous, i)));
    automata.add(Automata.makeAnyString());
    previous = i + 1;
  }
  automata.add(Automata.makeString(pattern.substring(previous)));
  return Operations.concatenate(automata);
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/** Return an {@link Automaton} that matches the given pattern. */
public static Automaton simpleMatchToAutomaton(String pattern) {
  List<Automaton> automata = new ArrayList<>();
  int previous = 0;
  for (int i = pattern.indexOf('*'); i != -1; i = pattern.indexOf('*', i + 1)) {
    automata.add(Automata.makeString(pattern.substring(previous, i)));
    automata.add(Automata.makeAnyString());
    previous = i + 1;
  }
  automata.add(Automata.makeString(pattern.substring(previous)));
  return Operations.concatenate(automata);
}

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

/** Return an {@link Automaton} that matches the given pattern. */
public static Automaton simpleMatchToAutomaton(String pattern) {
  List<Automaton> automata = new ArrayList<>();
  int previous = 0;
  for (int i = pattern.indexOf('*'); i != -1; i = pattern.indexOf('*', i + 1)) {
    automata.add(Automata.makeString(pattern.substring(previous, i)));
    automata.add(Automata.makeAnyString());
    previous = i + 1;
  }
  automata.add(Automata.makeString(pattern.substring(previous)));
  return Operations.concatenate(automata);
}

代码示例来源:origin: org.codelibs/elasticsearch-querybuilders

/** Make matches on objects also match dots in field names.
 *  For instance, if the original simple regex is `foo`, this will translate
 *  it into `foo` OR `foo.*`. */
private static Automaton makeMatchDotsInFieldNames(Automaton automaton) {
  return Operations.union(
      automaton,
      Operations.concatenate(Arrays.asList(automaton, Automata.makeChar('.'), Automata.makeAnyString())));
}

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

/** Make matches on objects also match dots in field names.
 *  For instance, if the original simple regex is `foo`, this will translate
 *  it into `foo` OR `foo.*`. */
private static Automaton makeMatchDotsInFieldNames(Automaton automaton) {
  return Operations.union(
      automaton,
      Operations.concatenate(Arrays.asList(automaton, Automata.makeChar('.'), Automata.makeAnyString())));
}

代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch

/** Make matches on objects also match dots in field names.
 *  For instance, if the original simple regex is `foo`, this will translate
 *  it into `foo` OR `foo.*`. */
private static Automaton makeMatchDotsInFieldNames(Automaton automaton) {
  return Operations.union(
      automaton,
      Operations.concatenate(Arrays.asList(automaton, Automata.makeChar('.'), Automata.makeAnyString())));
}

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

protected void flattenPrefixQuery(BytesRef bytes, float boost, Object sourceOverride,
    Callback callback) {
  // Should be safe not to copy this because it is fixed...
  if (!sentAutomata.add(bytes)) {
    return;
  }
  Object source = sourceOverride == null ? bytes : sourceOverride;
  Automaton automaton = Automata.makeString(bytes.utf8ToString());
  automaton = Operations.concatenate(automaton, Automata.makeAnyString());
  callback.flattened(automaton, boost, source.hashCode());
}

相关文章