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

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

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

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

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

  1. /**
  2. * Returns an automaton that accepts <code>min</code> or more concatenated
  3. * repetitions of the language of the given automaton.
  4. * <p>
  5. * Complexity: linear in number of states and in <code>min</code>.
  6. */
  7. static public Automaton repeat(Automaton a, int count) {
  8. if (count == 0) {
  9. return repeat(a);
  10. }
  11. List<Automaton> as = new ArrayList<>();
  12. while (count-- > 0) {
  13. as.add(a);
  14. }
  15. as.add(repeat(a));
  16. return concatenate(as);
  17. }

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

  1. return Operations.concatenate(automata);

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

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

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

  1. protected Automaton convertAutomaton(Automaton a) {
  2. if (queryPrefix != null) {
  3. a = Operations.concatenate(Arrays.asList(queryPrefix, a));
  4. // This automaton should not blow up during determinize:
  5. a = Operations.determinize(a, Integer.MAX_VALUE);
  6. }
  7. return a;
  8. }

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

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

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

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

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

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

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

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

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

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

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

  1. protected Automaton convertAutomaton(Automaton a) {
  2. if (queryPrefix != null) {
  3. a = Operations.concatenate(Arrays.asList(queryPrefix, a));
  4. // This automaton should not blow up during determinize:
  5. a = Operations.determinize(a, Integer.MAX_VALUE);
  6. }
  7. return a;
  8. }

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

  1. protected Automaton convertAutomaton(Automaton a) {
  2. if (queryPrefix != null) {
  3. a = Operations.concatenate(Arrays.asList(queryPrefix, a));
  4. // This automaton should not blow up during determinize:
  5. a = Operations.determinize(a, Integer.MAX_VALUE);
  6. }
  7. return a;
  8. }

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

  1. protected Automaton convertAutomaton(Automaton a) {
  2. if (queryPrefix != null) {
  3. a = Operations.concatenate(Arrays.asList(queryPrefix, a));
  4. // This automaton should not blow up during determinize:
  5. a = Operations.determinize(a, Integer.MAX_VALUE);
  6. }
  7. return a;
  8. }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章